Skip to content

grisuno/netsh_helper_dll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸ“œ Netsh Helper DLL Payload Loader

image

A simple, stealthy DLL that executes arbitrary shellcode when loaded by netsh.exe via the add helper command.

This project leverages the legitimate "Netsh Helper DLL" functionality in Windows to execute malicious code (shellcode) within the context of the trusted netsh.exe process. Ideal for evasion and lateral movement in Windows environments.

βš™οΈ How It Works

Mandatory Entry Point: The Windows netsh.exe utility requires helper DLLs to export a specific function called InitHelperDll (officially documented by Microsoft here ). Automatic Loading: When you run netsh add helper <path_to_dll>, netsh.exe loads the DLL and immediately calls its InitHelperDll function. Payload Execution: Inside InitHelperDll, this code: Allocates executable memory using VirtualAlloc. Copies an embedded shellcode buffer into this memory. Executes the shellcode synchronously in the main thread of the netsh.exe process.

Captura de pantalla_20250921_232519 image

πŸ› οΈ Compilation

Requires the MinGW-w64 compiler for Windows (x64 target).

x86_64-w64-mingw32-gcc -shared -o helper.dll main.c -lkernel32 -luser32
Note: You must replace the buf[] array in main.c with your actual shellcode (e.g., generated by msfvenom). 
image

πŸš€ Usage

Upload the compiled DLL (helper.dll) to the target machine. Execute the following command in a terminal with sufficient privileges (CMD, PowerShell, Evil-WinRM):

netsh add helper C:\Full\Path\helper.dll

Your shellcode will execute immediately! If your shellcode is a reverse shell, you should receive a connection on your listener. The netsh add helper ... command will block/hang if the shellcode does not return (expected behavior for persistent shells).

πŸ” Why Use This?

Legitimate Mechanism: Exploits a documented, legitimate Windows feature (netsh helper). No New Processes: Executes within the trusted netsh.exe process, avoiding suspicious process creation. Evasion: Can bypass security controls monitoring for new process creation or injection into critical system processes. Simple & Effective: Straightforward loading and execution mechanism.

⚠️ Important Considerations

Architecture: Ensure you compile the DLL for the same architecture (x64) as the target system and its netsh.exe. Synchronous Execution: The shellcode runs synchronously. This means the netsh add helper command will not return control until the shellcode finishes or the process is killed. This is intentional to ensure the shellcode has time to execute fully. Shellcode Replacement: The example shellcode ("\d34d\beef") is invalid. You must replace it with your real payload.

πŸ“„ License GPLv3

This code is public domain. Use it responsibly and only in authorized environments.

πŸ“š References

πŸŽ“ Educational Purpose

This project is intended to:

  • Help red teams understand modern C2 evasion techniques.
  • Assist blue teams in developing better detection logic.
  • Promote research into secure software design and defensive hardening.
  • Demonstrate the importance of runtime analysis over static signatures.

⚠️ DISCLAIMER - NO WARRANTY OR LIABILITY

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

πŸ”— Links

jimeng-2025-06-29-179-Cyberpunk-style logo for 'LazyOwn RedTeam', hacking_pen-testing tool  Colors_

Python Shell Script Flask License: GPL v3

ko-fi

About

This project leverages the legitimate "Netsh Helper DLL" functionality in Windows to execute malicious code (shellcode) within the context of the trusted netsh.exe process. Ideal for evasion and lateral movement in Windows environments.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Generated from grisuno/template