PatchWerk is a proof-of-concept (PoC) tool designed to clean NTDLL syscall stubs by patching syscall hooks without requiring a handle to the NTDLL library.
This innovative approach enables user-land hook evasion, allowing red teamers and security researchers to bypass detection mechanisms employed by Endpoint Detection and Response (EDR) systems.
Developed as a Cobalt Strike Beacon Object File (BOF), PatchWerk simplifies the process of unhooking system calls while maintaining stealth.
PatchWerk identifies all Nt* system call stubs within the NTDLL library and overwrites them with clean stubs.
This ensures that NTAPI calls originate from NTDLL, avoiding suspicious patterns in call stacks that EDR solutions monitor.
Unlike traditional unhooking methods, PatchWerk avoids mapping ntdll.dll from disk or opening handles to remote processes, reducing the risk of detection.
Key features include:
NtOpenProcess, NtWriteVirtualMemory, and NtProtectVirtualMemory.GetModuleHandle and GetProcAddress functions (written in C and assembly) to evade hooks on kernel32.dll.NtOpenProcess by using hProc = (HANDLE)-1.PatchWerk can be executed with or without specifying a process ID (PID). When a PID is provided, it patches the NTDLL syscall stubs of the specified remote process. Without a PID, it defaults to patching the current process.
Example usage:
textbeacon> patchwerk 6115
[*] Patchwerk (Bobby Cooke|@0xBoku|github.com/boku7}
[+] host called home, sent 4937
[+] received output:
Patching NTDLL System Call Stubs in Process: 6115 (PID) PatchWerk represents a significant advancement in evading user-mode hooks and maintaining operational security during red team engagements.
By leveraging direct syscalls and innovative patching techniques, it provides an effective method for bypassing modern EDR solutions.
Journalists use OSINT to verify public information before publishing. In 2026, misinformation, AI-generated images, fake…
DockerĀ is an open-source platform that lets you package and run applications inside containers. Each container…
PostgreSQL (often called Postgres) is an open-source relational database system. It supports advanced features like JSON…
Xrdp is an open-source server that lets you connect to your Ubuntu machine from another computer…
Apache Tomcat is an open-source web server and Java servlet container. It is one of the…
Keeping your Ubuntu system updated is one of the best ways to protect it. Security…