1- # 🤖 rust-SHELLCODE 🤖
2-
1+ # 🤖 rust-shellcode 🤖
32This project provides the underlying support for bypass av of offensive activities.
43The available Shellcode loaders include:
54* [ asm] ( #asm )
65* [ create_fiber] ( #create_fiber )
6+ * [ create_process] ( #create_process )
77* [ create_remote_thread] ( #create_remote_thread )
88* [ create_remote_thread_native] ( #create_remote_thread_native )
99* [ create_thread] ( #create_thread )
@@ -15,7 +15,6 @@ The available Shellcode loaders include:
1515* [ rtl_create_user_thread] ( #rtl_create_user_thread )
1616
1717## Build
18-
1918This is a rust project, you need install [ rust] ( https://www.rust-lang.org/ ) first.
2019Then, you can build with follow command:
2120
@@ -26,20 +25,17 @@ cargo build --release
2625Binarys in ` target/release `
2726
2827## How to use
29-
3028This project is just a basic demo, you need to choose the right loading method,
3129encrypt the SHELLCODE, download the SHELLCODE from the internet,
3230or use it with ETW patch, unhooking, etc.
3331
3432## asm
35-
3633SHELLCODE execute locally.
37341 . link SHELLCODE to .text section
38352 . inline asm using asm! macro
39363 . call SHELLCODE
4037
4138## create_fiber
42-
4339SHELLCODE execute locally.
44401 . convert current thread to fiber using ` ConvertThreadToFiber `
45412 . alloc memory using ` VirtualAlloc `
@@ -48,8 +44,24 @@ SHELLCODE execute locally.
48445 . jump SHELLCODE using ` SwitchToFiber `
49456 . jump back
5046
51- ## create_remote_thread
47+ ## create_process
48+ SHELLCODE execute locally.
49+ 1 . create a process in ` CREATE_SUSPENDED ` state using ` CreateProcessA `
50+ 2 . alloc remote memory using ` VirtualAllocEx `
51+ 3 . copy SHELLCODE to allocated memory using ` WriteProcessMemory `
52+ 4 . change memory permission to executable using ` VirtualProtectEx `
53+ 5 . get ` PROCESS_BASIC_INFORMATION ` using ` NtQueryInformationProcess `
54+ 6 . get ` PEB ` using ` ReadProcessMemory `
55+ 7 . get ` IMAGE_DOS_HEADER ` using ` ReadProcessMemory `
56+ 8 . get ` IMAGE_FILE_HEADER ` using ` ReadProcessMemory `
57+ 9 . determine ` IMAGE_FILE_HEADER.Machine ` is x86 or x64
58+ 10 . get ` [IMAGE_OPTIONAL_HEADER32|IMAGE_OPTIONAL_HEADER64] ` using ` ReadProcessMemory `
59+ 11 . let ` entrypoint ` = ` ImageBaseAddress ` + ` [IMAGE_OPTIONAL_HEADER32|IMAGE_OPTIONAL_HEADER64].AddressOfEntryPoint `
60+ 12 . write a piece of assembly code to the ` entrypoint ` to jump to the SHELLCODE using ` WriteProcessMemory `
61+ 13 . resume process's thread using ` ResumeThread `
62+ 14 . close opened handle using ` CloseHandle `
5263
64+ ## create_remote_thread
5365SHELLCODE execute remotely.
5466inject ` explorer.exe ` by default.
55671 . get pid by process name using crate ` sysinfo `
@@ -61,14 +73,12 @@ inject `explorer.exe` by default.
61737 . close opened handle using ` CloseHandle `
6274
6375## create_remote_thread_native
64-
6576SHELLCODE execute remotely.
6677inject ` explorer.exe ` by default.
6778this is same with [ create_remote_thread] ( #create_remote_thread ) , but without crate ` windows-sys `
6879using crate ` libloading ` get functions from dlls.
6980
7081## create_thread
71-
7282SHELLCODE execute locally.
73831 . alloc remote memory using ` VirtualAlloc `
74842 . copy SHELLCODE to allocated memory using ` std::ptr::copy `
@@ -77,13 +87,11 @@ SHELLCODE execute locally.
77875 . waiting thread exit using ` WaitForSingleObject `
7888
7989## create_thread_native
80-
8190SHELLCODE execute locally.
8291this is same with [ create_thread] ( #create_thread ) , but without crate ` windows-sys `
8392using crate ` libloading ` get functions from dlls.
8493
8594## early_bird
86-
8795SHELLCODE execute remotely.
8896create and inject ` svchost.exe ` by default.
89971 . create a process using ` CreateProcessA `
@@ -95,7 +103,6 @@ create and inject `svchost.exe` by default.
951037 . close opened handle using ` CloseHandle `
96104
97105## etwp_create_etw_thread
98-
99106SHELLCODE execute locally.
1001071 . get ` EtwpCreateEtwThread ` funtion from ` ntdll ` using ` LoadLibraryA ` and ` GetProcAddress `
1011082 . alloc remote memory using ` VirtualAlloc `
@@ -105,7 +112,6 @@ SHELLCODE execute locally.
1051126 . waiting thread exit using ` WaitForSingleObject `
106113
107114## memmap2_transmute
108-
109115SHELLCODE execute locally.
1101161 . alloc memory using crate ` memmap2 `
1111172 . copy SHELLCODE using ` copy_from_slice ` function from ` MmapMut ` struct
@@ -114,7 +120,6 @@ SHELLCODE execute locally.
1141205 . execute fn
115121
116122## nt_queue_apc_thread_ex_local
117-
118123SHELLCODE execute locally.
1191241 . get ` NtQueueApcThreadEx ` funtion from ` ntdll ` using ` LoadLibraryA ` and ` GetProcAddress `
1201252 . alloc remote memory using ` VirtualAlloc `
@@ -124,7 +129,6 @@ SHELLCODE execute locally.
1241296 . execute SHELLCODE using ` NtQueueApcThreadEx `
125130
126131## rtl_create_user_thread
127-
128132SHELLCODE execute remotely.
129133inject ` explorer.exe ` by default.
1301341 . get ` RtlCreateUserThread ` funtion from ` ntdll ` using ` LoadLibraryA ` and ` GetProcAddress `
0 commit comments