- Windows 64bit only;
- core source code from this brilliant repo Cracked5pider/ShellcodeTemplate;
- add Visual Studio Code tasks to build & extract shellcode;
- add example to use the shellcode;
- using MSVC toolset instead of GNU;
- GNU toolset, please see MinGW;
- Python, require the latest version;
- please also install pip module of
pefile
:pip install pefile
;
- please also install pip module of
- Visual Studio, C/C++ dev environment required;
- NASM, chose the latest version to download;
- First, find out what library and what function you need to use;
- For example, you want to call
system()
in the target process:- add lib
msvcrt
module instruct INSTANCE
; - add function
system
instruct Win32
, both structs are defined in filecore.h
; - load the
msvcrt
withinstance.Win32.LoadLibraryA(GET_SYMBOL("msvcrt"))
function; - get the address of the target function
system
withLdrFunction(instance.Modules.msvcrt, 0xcff4a7ca)
function; - finnally, call the
system("start notepad.exe")
withinstance.Win32.system(GET_SYMBOL("start notepad.exe"))
function, please see fileentry.c
for more details;
- add lib
- For example, you want to call
- Calculate the function hash by using
hasher.exe "system" "LoadLibraryA" // result: // [+] Hashed SYSTEM ==> 0xcff4a7ca // [+] Hashed LOADLIBRARYA ==> 0xb7072fdb
- use the
build hasher.exe
task to build thehasher.exe
application;
- use the
- Get the shellcode by using
build PE
task;- the shellcode will be saved in
out\shellcode.bin
file;
- the shellcode will be saved in
- Test the shellcode
- check the
examples
folder for shellcode injection examples;
- check the