This project provides the underlying support for bypass av of offensive activities.
The available Shellcode loaders include:
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 using CreateProcessA
- alloc remote memory using VirtualAllocEx
- copy SHELLCODE to allocated memory using WriteProcessMemory
- change memory permission to executable using VirtualProtectEx
- get PROCESS_BASIC_INFORMATION using NtQueryInformationProcess
- get PEB using ReadProcessMemory
- get IMAGE_DOS_HEADER using ReadProcessMemory
- get IMAGE_FILE_HEADER using ReadProcessMemory
- determine IMAGE_FILE_HEADER.Machine is x86 or x64
- get [IMAGE_OPTIONAL_HEADER32|IMAGE_OPTIONAL_HEADER64] using ReadProcessMemory
- let entrypoint = ImageBaseAddress + [IMAGE_OPTIONAL_HEADER32|IMAGE_OPTIONAL_HEADER64].AddressOfEntryPoint
- write a piece of assembly code to the entrypoint to jump to the SHELLCODE using WriteProcessMemory
- 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
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.
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 from ntdll using LoadLibraryA and GetProcAddress
- 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 from MmapMut struct
- change memory permission to executable using make_exec funtion from MmapMut 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 using GetProcAddress with GetModuleHandleA
- 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
nt_queue_apc_thread_ex_local
SHELLCODE execute locally.
- get NtQueueApcThreadEx function from ntdll using LoadLibraryA and GetProcAddress
- 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 from ntdll using LoadLibraryA and GetProcAddress
- 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