Prerequisites
Before building Stardust, ensure you have the following tools installed on your Linux system:Stardust uses Clang as the compiler with MinGW targets, not GCC directly. This provides better C++20 support and more consistent code generation.
Building Stardust
Build in Release Mode
Compile the shellcode for both x64 and x86 architectures:Expected output:
The “section below image base” warnings are expected and indicate successful PIC generation. This is intentional behavior.
Testing with Stomper
Stardust includes a test harness called stomper that executes shellcode by injecting it into a legitimate Windows DLL’s code section.Transfer Files to Windows
Copy the following to a Windows test machine:
bin/stardust.x64.bin(orstardust.x86.bin)test/stomper.x64.exe(orstomper.x86.exe)
Observe the Result
Press Enter, and you should see a MessageBox appear with:
- Title: “caption”
- Message: “Hello world”
- Resolved
ntdll.dllandkernel32.dllfrom the PEB - Loaded
user32.dllviaLoadLibraryA - Resolved
MessageBoxAfrom the export table - Executed the API call
Debug Build (Optional)
For troubleshooting or development, build in debug mode to enableDbgPrint output:
- Include
DbgPrintcalls for runtime diagnostics - Are larger (~1.2KB vs ~750 bytes for x64)
- Require DebugView to see output
- Run DebugView as Administrator on Windows
- Enable Capture Kernel and Capture Win32
- Execute stomper with the debug shellcode
Next Steps
Customize Your Shellcode
Modify
src/main.cc to implement custom payload logicAdd New APIs
Learn how to extend the API resolution system
Understand the Build System
Deep dive into compiler flags and optimizations
Explore Examples
See advanced shellcode implementations
Troubleshooting
MessageBox doesn't appear
MessageBox doesn't appear
Possible causes:
- Antivirus interference: Disable Windows Defender or whitelist the directory
- Wrong architecture: Ensure x64 stomper is used with x64 shellcode (same for x86)
- Missing DLL:
chakra.dllmight not exist on your Windows version. Editstomper.ccto use a different DLL likekernel32.dll
test/stomper.cc
Build errors with undefined references
Build errors with undefined references
Error:Cause: Missing linking flags or incorrect toolchain.Solution:Ensure Clang is installed and the Makefile uses the correct target:
Makefile
Stomper crashes immediately
Stomper crashes immediately
Cause: Corrupted shellcode or incorrect section extraction.Debug steps:
-
Verify
.binfile sizes are reasonable (500-1500 bytes) -
Check hex dump for obvious corruption:
-
Rebuild with
make clean && make
