I made a repository of Windows Shellcode runners: rust-shellcode.
Here are some introductions:
rust-shellcode
- asm
- create_fiber
- create_remote_thread
- create_remote_thread_native
- create_thread
- create_thread_native
- etwp_create_etw_thread
- nt_queue_apc_thread_ex_local
- rtl_create_user_thread
asm
shellcode execute locally.
- link shellcode to .text section
- inline asm using asm! macro
- call shellcode
create_fiber
shellcode execute locally.
- convert current thread to fiber using
ConvertThreadToFiber
- alloc memory using
VirtualAlloc
- copy shellcode to allocated memory using
std::ptr::copy
- create a fiber using
CreateFiber
- jump shellcode using
SwitchToFiber
- jump back
create_remote_thread
shellcode execute remotely.
inject explorer.exe
by default.
- get pid by process name using crate
sysinfo
- get handle using
OpenProcess
- alloc remote memory using
VirtualAllocEx
- copy shellcode to allocated memory using
WriteProcessMemory
- change memory permission to executable using
VirtualProtectEx
- execute shellcode using
CreateRemoteThread
- close opened handle using
CloseHandle
create_remote_thread_native
shellcode execute remotely.
inject explorer.exe
by default.
this is same with create_remote_thread, but without crate windows-sys
using crate libloading
get functions from dlls.
create_thread
shellcode execute locally.
- alloc remote memory using
VirtualAlloc
- copy shellcode to allocated memory using
std::ptr::copy
- change memory permission to executable using
VirtualProtect
- execute shellcode using
CreateThread
- waiting thread exit using
WaitForSingleObject
create_thread_native
shellcode execute locally.
this is same with create_thread, but without crate windows-sys
using crate libloading
get functions from dlls.
etwp_create_etw_thread
shellcode execute locally.
- get
EtwpCreateEtwThread
funtion fromntdll
usingLoadLibraryA
andGetProcAddress
- alloc remote memory using
VirtualAlloc
- copy shellcode to allocated memory using
std::ptr::copy
- change memory permission to executable using
VirtualProtect
- execute shellcode using
EtwpCreateEtwThread
- waiting thread exit using
WaitForSingleObject
nt_queue_apc_thread_ex_local
shellcode execute locally.
- get
NtQueueApcThreadEx
funtion fromntdll
usingLoadLibraryA
andGetProcAddress
- alloc remote memory using
VirtualAlloc
- copy shellcode to allocated memory using
std::ptr::copy
- change memory permission to executable using
VirtualProtect
- get current thread handle using
GetCurrentThread
- execute shellcode using
NtQueueApcThreadEx
rtl_create_user_thread
shellcode execute remotely.
inject explorer.exe
by default.
- get
RtlCreateUserThread
funtion fromntdll
usingLoadLibraryA
andGetProcAddress
- get pid by process name using crate
sysinfo
- get handle using
OpenProcess
- alloc remote memory using
VirtualAllocEx
- copy shellcode to allocated memory using
WriteProcessMemory
- change memory permission to executable using
VirtualProtectEx
- execute shellcode using
RtlCreateUserThread
- close opened handle using
CloseHandle