How hasherezade/thread_namecalling works
Project type and purpose
• This is a native C++ security research/demo project implementing a remote shellcode injection technique using the Windows Thread Description API.
• It comprises three modules:
• thread_namecaller: the attacker/“injector” CLI tool that pushes shellcode via SetThreadDescription and executes it via APC.
• dll_inj: a variant injector that writes a DLL path into the target with the same method.
• thread_receive: a demo “victim” process that sets up various Windows mitigation policies.
File structure
• Top-level CMakeLists.txt: orchestrates building all three subprojects.
• Three subdirectories, each with its own CMakeLists.txt and main.cpp:
• thread_namecaller/ – CLI injector + rop_api.h + embedded shellcode.
• dll_inj/ – CLI injector for DLL injection.
• thread_receive/ – demo target process.
• Common files (common.cpp/h) and wrappers (ntdll_wrappers.cpp/h) implement shared helper functions and undocumented ntdll calls.
README for additional insights
• Describes the high-level injection workflow:
1) Pass shellcode or DLL path via SetThreadDescription to the remote thread.
2) Use QueueUserAPC to call GetThreadDescription in target context (copies buffer).
3) Change page protections to RX and queue another APC to execute the code.
• Defines dependencies: Windows 10+ (Thread Description APIs), ntdll undocumentation, CMake build.
a. Main components
• Attacker Tool(s): thread_namecaller & dll_inj CLIs
• Victim Process: thread_receive (with various mitigation flags)
• Windows OS Kernel & ntdll APIs
• Shared Code/Helpers: common, ntdll_wrappers
b. Component relationships & interactions
• Attacker CLI invokes SetThreadDescription(hThread, shellcode_buffer) → Windows API writes into remote thread’s description.
• Attacker uses QueueUserAPC → schedules a remote call to GetThreadDescription in the target.
• Target’s working set receives the shellcode in a user-mode buffer.
• Attacker invokes VirtualProtectEx or uses NtProtectVirtualMemory → changes buffer pages to executable.
• Attacker queues a final APC to start execution of shellcode/DLL main in target.
c. Architectural patterns & design principles
• Modular CLI tools share common helper libraries (common.cpp/h, ntdll_wrappers).
• Clear separation between injector functionality and target demo.
• Use of native Windows APIs and undocumented wrappers.
d. Key technologies & libraries
• CMake for cross-project build orchestration
• Win32 APIs: SetThreadDescription, GetThreadDescription, QueueUserAPC, VirtualProtectEx
• ntdll wrappers for lower-level memory and thread manipulation