typetechniqueconfidencehighcreated2026-07-05updated2026-07-05payloadstagingencryptionxorpereflective-loading

XOR-Encrypted PE Payload Staging

A multi-stage payload delivery pattern where a secondary PE is written to disk encrypted with a repeating XOR key, then read back and decrypted in-memory by a shellcode loader before execution.

Pattern Definition

  1. Encryption at rest: The secondary PE is XOR-encrypted with a short fixed key and embedded in the loader script.
  2. Disk staging: The encrypted blob is written to a file in %TEMP% (e.g. Sancha).
  3. In-memory decryption: The shellcode reads the file, decrypts with repeating XOR, and verifies the PE header (MZ / PE\x00\x00).
  4. Reflective execution: The decrypted PE is mapped into memory and executed without writing a plaintext executable to disk.

Detection / Fingerprint

  • %TEMP% files with high entropy (>7.8) and no recognizable header.
  • The decryption key is hardcoded in the loader; common keys are 8–16 bytes of mixed alphanumeric characters.
  • The loader opens the temp file with GENERIC_READ, allocates RWX memory, then transfers control.

Implementation (observed in 70848598)

// fcn.000022e0 in shellcode
for (i = 0; i < len; i++) {
    buf[i] ^= key[i % key_len];   // key = "51AHC0R0YXO" (11 bytes)
}

The decrypted payload is a 288 KB PE32 compiled Apr 2017, fully static, single .text section. ^[decrypted_zyvp.bin]

Defensive Countermeasures

  • Monitor for high-entropy files written to %TEMP% followed by CreateFileWReadFileVirtualAlloc with PAGE_EXECUTE_READWRITE.
  • Memory-based YARA: scan RWX allocations for PE headers.

Pages Where Observed