Academy
TermTechnique

Stub

The small startup code in a file produced by a crypter that decrypts the embedded payload in memory and runs it.

Flow

  1. 1Runs
  2. 2Checks the environment
  3. 3Decrypts the payload
  4. 4Starts the payload
Related families
PureLogs
MITRE ATT&CK
T1140 · Deobfuscate/Decode Files or Information
Sources
6 sources
01

Overview

The stub is the only visible part of the encrypted file. Its job is to decrypt the embedded data, check for an analysis environment if needed and launch the actual payload. MITRE ATT&CK

Antivirus signatures are mostly written for the stub; this is why crypter sellers change it often. MITRE ATT&CK

02

How it works

  1. 1

    Runs

    The user opens the file; the first code to run is the stub.

  2. 2

    Checks the environment

    It may stop if a virtual machine or analysis tool is present. MITRE ATT&CK

  3. 3

    Decrypts the payload

    It decrypts the embedded data into memory. MITRE ATT&CK

  4. 4

    Starts the payload

    It runs the payload in its own process or inside another process. MITRE ATT&CK

03

Real-world examples

PureLogs: payload with a PNG header

PureLogs profile

Swiss Post Cybersecurity documented that in the PureLogs chain the payload was carried inside a PNG-looking file and the loader unpacked it in memory. Swiss Post Cybersecurity

04

How to detect it

  • Processes that write executable code into their own memory region and jump to it shortly afterwards. MITRE ATT&CK
05

What to do

  • Keep endpoint rules that monitor and block memory injection enabled. MITRE ATT&CK
06

MITRE ATT&CK

07

Related families and terms

08

Sources

  1. 1Deobfuscate/Decode Files or Information (T1140) · MITRE ATT&CK
  2. 2Software Packing (T1027.002) · MITRE ATT&CK
  3. 3System Checks (T1497.001) · MITRE ATT&CK
  4. 4Process Injection (T1055) · MITRE ATT&CK
  5. 5PureLogs infostealer analysis: don't judge a PNG by its header · Swiss Post Cybersecurity
  6. 6Behavior Prevention on Endpoint (M1040) · MITRE ATT&CK
From the Essential plan

Infostealer Detection

See your firm's attack surface on one screen: how many findings, at which severity, on which domain.