- 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
msvcrtmodule instruct INSTANCE; - add function
systeminstruct Win32, both structs are defined in filecore.h; - load the
msvcrtwithinstance.Win32.LoadLibraryA(GET_SYMBOL("msvcrt"))function; - get the address of the target function
systemwithLdrFunction(instance.Modules.msvcrt, 0xcff4a7ca)function; - finnally, call the
system("start notepad.exe")withinstance.Win32.system(GET_SYMBOL("start notepad.exe"))function, please see fileentry.cfor 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.exetask to build thehasher.exeapplication;
- use the
- Get the shellcode by using
build PEtask;- the shellcode will be saved in
out\shellcode.binfile;
- the shellcode will be saved in
- Test the shellcode
- check the
examplesfolder for shellcode injection examples;
- check the