NetPatcher modifies managed .NET assemblies by inserting a payload at the beginning of the program entry point. The original entry-point code remains in place and runs after the payload unless the payload terminates the process or throws an exception.
The interactive patcher can:
- Launch
calc.exe. - Display a Windows message box.
- Download a file with
WebClientand execute it. - Generate code that loads a DLL into a selected interactive process using Win32 remote-thread APIs.
For repeatable operation, provide a target directly:
NetPatcher.exe --target "C:\path\to\assembly.dll"
Without --target, NetPatcher scans common installation and user-profile
directories, lists managed assemblies with entry points, and lets the user
choose one interactively.
NetPatcher supports managed .NET assemblies that:
- contain a valid entry point;
- can be read and written by dnlib; and
- target .NET Framework or modern .NET runtimes.
Supported input forms include:
- .NET Framework assemblies, including applications targeting versions such as 4.0 through 4.8;
- modern .NET assemblies targeting installed runtimes such as .NET 5, 7, 8, and 9;
- framework-dependent .NET apphosts, when their companion managed DLL and runtime sidecar files are present; and
- self-contained .NET apphosts, when the complete runtime layout is present.
For apphosts, the native launcher is copied and the companion managed DLL is
patched. The associated .runtimeconfig.json, .deps.json, and self-contained
runtime files are copied to the patched output layout.
The following are not supported:
- native C/C++ executables;
- NativeAOT binaries;
- true single-file bundles without an external companion assembly;
- assemblies without an entry point;
- assemblies that dnlib cannot parse or rewrite; and
- heavily obfuscated assemblies whose metadata or control flow cannot be safely modified.
The DLL payload generates remote-process injection code and requires suitable Windows permissions, matching process architecture, and a valid DLL path. NetPatcher does not execute that injection against arbitrary system processes automatically.
The patched managed assembly is written to the current directory with
_patched appended to its filename. When an apphost is supplied, the patched
launcher and required sidecars are written with the same suffix.
The project targets Windows and builds for .NET 8 and .NET Framework 4.8:
dotnet build NetPatcher.csproj --configuration Release
The project uses dnlib for .NET metadata and IL manipulation.