offensive-shellcode
What it does
This skill is a reference for writing low-level shellcode for x86 and x64 systems, covering position-independent code and loaders. It is for security researchers and exploit developers working on authorized projects.
When to use it
- βWhen you are doing authorized exploit development research on x86 or x64 systems.
- βWhen you need to understand position-independent code for a security research project.
- βWhen you are studying how loaders and staged payloads work for a defensive analysis.
Skill link
https://github.com/SnailSploit/Claude-Red/blob/main/Skills/infrastructure/offensive-shellcode/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βFor our authorized security research lab, explain position-independent code on x64 Windows.β
5 new skills a week. 1 minute to read.
How it works
The skill outlines a workflow from defining the target platform to writing and testing position-independent assembly in a controlled environment. It also covers the basic concepts of memory handling on Windows.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Shellcode Development Workflow
- Define concept and target platform (x86/x64, Windows/Linux/macOS)
- Write assembly using position-independent techniques
- Extract binary and test in controlled environment
- Apply null byte avoidance and optimizations
- Encode/encrypt to evade static detection
- Package with loader and choose delivery method
Basic Concepts
Execution Pattern (Allocate-Write-Execute)
Avoid direct PAGE_EXECUTE_READWRITE β prefer:
- Allocate with
PAGE_READWRITE - Write shellcode to allocated region
- Call
VirtualProtectto switch toPAGE_EXECUTE_READ
char *dest = VirtualAlloc(NULL, 0x1234, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
memcpy(dest, shellcode, 0x1234);
VirtualProtect(dest, 0x1234, PAGE_EXECUTE_READ, &old);
((void(*)())dest)();
Position-Independent Code (PIC) Techniques
| Method | Platform | Notes |
|---|---|---|
| Call/Pop | Windows | Push next addr, pop into register |
| FPU state | Windows | fstenv saves instruction pointer |
| SEH | Windows | Exception handler stores EIP |
| GOT | Linux | Global Offset Table |
| VDSO | Linux | Kernel-provided shared object |
Windows API Resolution (PEB Walk)
Identifying kernel32.dll without imports:
- Get
PEBviags:[0x60](x64) orfs:[0x30](x86) - Walk
PEB->Ldr.InMemoryOrderModuleListβ order: exe β ntdll β kernel32 - Hash-compare module names to locate
kernel32 - Parse the Export Address Table (EAT)
- Find
GetProcAddressby name hash, then resolveLoadLibraryA - Use
LoadLibraryAto loadWS2_32.dll, resolve Winsock functions
WinDbg helpers for debugging PEB walk:
dt nt!_TEB -y ProcessEnvironmentBlock @$teb
dt nt!_PEB -y Ldr <peb_addr>
dt -r _PEB_LDR_DATA <ldr_addr>
dt _LDR_DATA_TABLE_ENTRY (<init_flink_addr> - 0x10)
lm m kernel32 # verify base address
r @r8 # check register
Shellcode Loaders
Loader Responsibilities
- Environment verification / keying (sandbox detection)
- Shellcode decryption
- Safe memory allocation and injection
- Ends its duties after injecting
Recommended languages: Zig (small, no runtime), Rust (secure), Nim, Go (watch for runtime signatures)
Allocation Phase
Avoid RWX allocations β use two-step:
VirtualAllocEx/NtAllocateVirtualMemoryβ allocateRWZwCreateSection+NtMapViewOfSectionβ alternative approach- After writing:
VirtualProtectExto switch toRX
Other options: code caves, stack/heap (with DEP disabled)
Write Phase
WriteProcessMemory/NtWriteVirtualMemorymemcpyto mapped section
Evasion tips:
- Prepend shellcode with dummy opcodes
- Split into chunks, write in randomized order
- Add delays between writes
Execute Phase
Most scrutinized step β EDR checks thread start address against image-backed memory:
| Technique | Notes |
|---|---|
CreateRemoteThread / ZwCreateThreadEx |
Loud, heavily monitored |
NtSetContextThread |
Hijack suspended thread |
NtQueueApcThreadEx |
APC injection |
| API trampolines | Overwrite function prologue |
| ThreadlessInject | No new threads created |
Indirect execution resources:
PE-to-Shellcode Conversion
| Tool | Purpose |
|---|---|
| Donut | EXE/DLL β shellcode |
| sRDI | DLL β position-independent shellcode |
| Pe2shc | PE β shellcode |
| Amber | Reflective PE packer |
Open-source loaders:
- ScareCrow
- NimPackt-v1
- NullGate β indirect syscalls + junk-write sequencing
- DripLoader β chunked RW writes + direct syscalls + JMP trampoline
- ProtectMyTooling β chain multiple protections
- Direct-syscall helpers: SysWhispers3, FreshyCalls (now baseline requirements)
Shellcode Storage & Hiding
| Location | Risk | Notes |
|---|---|---|
Hardcoded in .text |
Medium | Requires recompile; stored RW/RO |
PE Resources (RCDATA) |
High | Most sc |
FAQ
What platforms does it cover?
It covers Windows, Linux and macOS on x86 and x64.
Is this for use in a lab?
The skill assumes testing in a controlled environment, under authorization.
Does it cover converting files?
Yes. It also covers converting PE files to shellcode for research.
Details
Original description by the author
Shellcode development reference for offensive security engagements. Use when writing custom x86/x64 shellcode, implementing position-independent code (PIC), building shellcode loaders, evading AV/EDR detection, or converting PE files to shellcode. Covers null byte avoidance, API hashing, encoder/decoder patterns, staged vs stageless payloads, Windows PEB traversal, and cross-platform shellcode techniques.
repo: SnailSploit/Claude-Red
Popularity
- GitHub stars
- 10k
- Ranking position
- #11960
- License
- MIT
- Updated
- 10/12/2026
Comments
- β¦
More skills from this repository
offensive-active-directory
10kHelps your agent plan an authorized Active Directory security test, from mapping the network to finding attack paths to Domain Admin.
offensive-netexec
10kHelps your agent use the NetExec (nxc) tool for authorized network testing, covering protocols, authentication and credential checks.
offensive-api-abuse
10kHelps your agent plan authorized API security tests that look for business logic abuse, GraphQL risks and race conditions.
offensive-api-security
10kHelps your agent run authorized security tests on REST, gRPC and WebSocket APIs, based on the OWASP API Top 10.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.