521 字
3 分钟
DLL Proxy Project Explained: High-Compatibility version.dll Hijacking and a Stealthy Payload Launcher
CAUTION

This project may involve sensitive fields such as security research and penetration testing. Please ensure it is used in a legally authorized environment. Unauthorized use may violate laws and regulations.

Project Overview#

Project link

This project uses C to develop a highly compatible DLL Proxy for hijacking version.dll. The core goals are:

  • Seamless forwarding: All standard version.dll API calls are transparently forwarded to the system’s original DLL.
  • Stealthy triggering: On DLL load, an asynchronous thread is started to decrypt and execute a hidden payload (e.g. launching the system calculator).

Supported platforms are Windows 7/8/10/11 x64, balancing compatibility, stealth, and file size. Suitable for security research, penetration testing, and similar scenarios.

Directory structure#

.
├── .gitignore
├── build.bat
├── LICENSE
├── README.md
├── .github/
│ └── workflows/
│ ├── build.yml
│ └── copilot-setup-steps.yml
└── src/
├── proxy.c
├── version.rc
└── vm_engine.h
  • proxy.c: Main proxy logic, implementing API forwarding and payload launch
  • vm_engine.h: Virtual machine engine, used to dynamically generate/restore encrypted command strings
  • version.rc: Resource script that disguises the DLL version information
  • build.bat: Local build script
  • build.yml: GitHub Actions automated build and packaging
  • README.md: Detailed design documentation

Core features and implementation details#

1. Absolute-path API forwarding#

Using #pragma comment(linker, "/export:..."), all 17 standard version.dll export functions are forwarded to the original DLL in the system directory.
Absolute paths are used to avoid being hijacked again, improving compatibility and stability.

2. String obfuscation and dynamic restoration#

Avoid storing the “calc.exe” string in plaintext, so it cannot be directly discovered with tools like strings during adversarial analysis. Commands are dynamically generated via a custom virtual machine (see vm_engine.h).
The bytecode restores the target command at runtime, preventing static analysis from directly discovering sensitive strings.

3. Asynchronous payload launch#

During the DLL_PROCESS_ATTACH phase of DllMain, a new thread is immediately started with CreateThread to avoid Loader Lock and main-thread blocking.
The new thread calls CreateProcessW to launch the calculator, with the command line restored by the virtual machine.
After the command is used, SecureWipe and SecureZeroMemory are called to immediately clear memory, preventing sensitive data residue.

4. Resource disguise and size control#

version.rc mimics the resource description of Microsoft’s official version.dll to improve disguise.
Build parameters are optimized: debug symbols are disabled and linker optimization is enabled to keep the DLL under 50KB.

Build and automation#

Local build#

Run build.bat directly:

Terminal window
rc.exe /v src/version.rc
cl.exe /c /O1 /GL /GS- /MT src/proxy.c /Fo:proxy.obj
link.exe /DLL /OUT:version.dll /ENTRY:DllMain /NODEFAULTLIB /SUBSYSTEM:WINDOWS ^
/LTCG /OPT:REF /OPT:ICF ^
proxy.obj src/version.res kernel32.lib user32.lib

CI/CD automation#

build.yml supports automatic building, packaging, and Release publishing on the main branch and Tags.
It automatically strips symbols, packages the zip, and uploads the Release.

Key code snippets#

API forwarding declaration:

#pragma comment(linker, "/export:GetFileVersionInfoA=C:\\Windows\\System32\\version.GetFileVersionInfoA,@1")
// ...其余16个API同理...

Virtual machine dynamically restores the command:

static void ExecuteVM(WCHAR* output) {
// ...虚拟机解释字节码,动态生成 "calc.exe" ...
}

Asynchronous payload launch and memory wipe:

DWORD WINAPI ExecutePayload(LPVOID lpParam) {
WCHAR command[64];
ExecuteVM(command);
// ...CreateProcessW 启动 calc.exe...
SecureWipe(command, sizeof(command));
return 0;
}

Summary#

Using DLL Proxy technology, this project achieves seamless forwarding to the system’s version.dll and integrates a stealthy payload launch mechanism. The design balances compatibility, stealth, and security, and is suitable for security research, red team testing, and similar scenarios. For detailed design and implementation details, please refer to README.md and the source code comments.

DLL Proxy Project Explained: High-Compatibility version.dll Hijacking and a Stealthy Payload Launcher
https://tski.uk/blog/en/dll-proxy/
作者
Tokisaki Galaxy
发布于
2026-02-15
许可协议
CC BY