This project provides the underlying support for bypass av of offensive activities.
The available Shellcode loaders include:
- asm
- create_fiber
- create_process
- create_remote_thread
- create_remote_thread_native
- create_thread
- create_thread_native
- early_bird
- etwp_create_etw_thread
- memmap2_transmute
- module_stomping
- nt_queue_apc_thread_ex_local
- rtl_create_user_thread
This is a rust project, you need install rust first.
Then, you can build with follow command:
cargo build --release
Binarys in target/release
This project is just a basic demo, you need to choose the right loading method, encrypt the SHELLCODE, download the SHELLCODE from the internet, or use it with ETW patch, unhooking, etc.
SHELLCODE execute locally.
- link SHELLCODE to .text section
- inline asm using asm! macro
- call SHELLCODE
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
SHELLCODE execute locally.
- create a process in
CREATE_SUSPENDED
state usingCreateProcessA
- alloc remote memory using
VirtualAllocEx
- copy SHELLCODE to allocated memory using
WriteProcessMemory
- change memory permission to executable using
VirtualProtectEx
- get
PROCESS_BASIC_INFORMATION
usingNtQueryInformationProcess
- get
PEB
usingReadProcessMemory
- get
IMAGE_DOS_HEADER
usingReadProcessMemory
- get
IMAGE_FILE_HEADER
usingReadProcessMemory
- determine
IMAGE_FILE_HEADER.Machine
is x86 or x64 - get
[IMAGE_OPTIONAL_HEADER32|IMAGE_OPTIONAL_HEADER64]
usingReadProcessMemory
- let
entrypoint
=ImageBaseAddress
+[IMAGE_OPTIONAL_HEADER32|IMAGE_OPTIONAL_HEADER64].AddressOfEntryPoint
- write a piece of assembly code to the
entrypoint
to jump to the SHELLCODE usingWriteProcessMemory
- resume process's thread using
ResumeThread
- close opened handle using
CloseHandle
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
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.
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
SHELLCODE execute locally.
this is same with create_thread, but without crate windows-sys
using crate libloading
get functions from dlls.
SHELLCODE execute remotely.
create and inject svchost.exe
by default.
- create a process using
CreateProcessA
- alloc remote memory using
VirtualAllocEx
- copy SHELLCODE to allocated memory using
WriteProcessMemory
- change memory permission to executable using
VirtualProtectEx
- execute process using
QueueUserAPC
- resume process's thread using
ResumeThread
- close opened handle using
CloseHandle
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
SHELLCODE execute locally.
- alloc memory using crate
memmap2
- copy SHELLCODE using
copy_from_slice
function fromMmapMut
struct - change memory permission to executable using
make_exec
funtion fromMmapMut
struct - convert memory pointer to fn type using
transmute
- execute fn
SHELLCODE execute remotely.
inject notepad.exe
by default.
- get pid by process name using crate
sysinfo
- get handle using
OpenProcess
- alloc remote memory using
VirtualAllocEx
- copy dll path to allocated memory using
WriteProcessMemory
- get
LoadLibraryA
addr usingGetProcAddress
withGetModuleHandleA
- load dll using
CreateRemoteThread
- wait created remote thread using
WaitForSingleObject
- get modules using
EnumProcessModules
- get module name using
GetModuleBaseNameA
- alloc memory using
HeapAlloc
- get entry_point using
ReadProcessMemory
- copy SHELLCODE to dll entry_point using
WriteProcessMemory
- execute SHELLCODE using
CreateRemoteThread
- close opened handle using
CloseHandle
SHELLCODE execute locally.
- get
NtQueueApcThreadEx
function 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
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