Guides

DLL Output

Generate a DLL instead of an EXE, and proxy a legitimate DLL's exports.

DLL Output

PayloadFactory can emit a DLL instead of a standalone EXE, which is useful for DLL side-loading / search-order hijacking.

Generate a DLL

python main.py current_thread -s sc.bin --dll -o payload.dll

With --dll, the compiler is invoked with -shared and the output extension is rewritten from .exe to .dll. The stub gains a DllMain entry point (loaded from the dllMain template).

Proxy a legitimate DLL (--dll-proxy)

--dll-proxy takes a path to a legitimate DLL and auto-generates a .def file that forwards all of its exports to your payload. This makes the generated DLL a drop-in replacement for that DLL — a classic search-order-hijacking primitive (technique credit: tothi, dll-hijack-by-proxying).

python main.py current_thread -s sc.bin --dll --dll-proxy /tmp/libfoo.dll -o payload.dll

At build time PayloadFactory parses the reference DLL with pefile, enumerates its exports, and writes EXPORTS name=payload.name @ordinal lines to a temporary .def that is passed to the compiler. Using --dll-proxy implicitly enables --dll.

Note: DLL output and proxying are Windows-target features.

Copyright © 2026