LLM Skills
~/catalogue/workflows automatisés//SKILL

Code d'attaque

/SKILL

Guide de référence pour le développement de shellcode destiné aux opérations de sécurité offensive. À utiliser pour écrire du shellcode x86/x64 personnalisé, implémenter du code indépendant de la

SnailSploitSnailSploit
2.8k
8 mai 2026
MIT License
// contenu du skill

name: offensive-shellcode

description: "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."


Shellcode Development Workflow

  1. Define concept and target platform (x86/x64, Windows/Linux/macOS)
  2. Write assembly using position-independent techniques
  3. Extract binary and test in controlled environment
  4. Apply null byte avoidance and optimizations
  5. Encode/encrypt to evade static detection
  6. Package with loader and choose delivery method

Basic Concepts

Execution Pattern (Allocate-Write-Execute)

Avoid direct PAGE_EXECUTE_READWRITE — prefer:

  1. Allocate with PAGE_READWRITE
  2. Write shellcode to allocated region
  3. Call VirtualProtect to switch to PAGE_EXECUTE_READ
c
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

MethodPlatformNotes
Call/PopWindowsPush next addr, pop into register
FPU stateWindowsfstenv saves instruction pointer
SEHWindowsException handler stores EIP
GOTLinuxGlobal Offset Table
VDSOLinuxKernel-provided shared object

Windows API Resolution (PEB Walk)

Identifying kernel32.dll without imports:

  1. Get PEB via gs:[0x60] (x64) or fs:[0x30] (x86)
  2. Walk PEB->Ldr.InMemoryOrderModuleList — order: exe → ntdll → kernel32
  3. Hash-compare module names to locate kernel32
  4. Parse the Export Address Table (EAT)
  5. Find GetProcAddress by name hash, then resolve LoadLibraryA
  6. Use LoadLibraryA to load WS2_32.dll, resolve Winsock functions

WinDbg helpers for debugging PEB walk:

bash
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 — allocate RW
  • ZwCreateSection + NtMapViewOfSection — alternative approach
  • After writing: VirtualProtectEx to switch to RX

Other options: code caves, stack/heap (with DEP disabled)

Write Phase

  • WriteProcessMemory / NtWriteVirtualMemory
  • memcpy to 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:

TechniqueNotes
CreateRemoteThread / ZwCreateThreadExLoud, heavily monitored
NtSetContextThreadHijack suspended thread
NtQueueApcThreadExAPC injection
API trampolinesOverwrite function prologue
ThreadlessInjectNo new threads created

Indirect execution resources:


PE-to-Shellcode Conversion

ToolPurpose
DonutEXE/DLL → shellcode
sRDIDLL → position-independent shellcode
Pe2shcPE → shellcode
AmberReflective PE packer

Open-source loaders:


Shellcode Storage & Hiding

LocationRiskNotes
Hardcoded in .textMediumRequires recompile; stored RW/RO
PE Resources (RCDATA)HighMost scanned by AV
Extra PE sectionMedium
// source originale publique
SnailSploit/Claude-Red
/Skills/infrastructure/offensive-shellcode/SKILL.md
Licence : MIT License
Projet indépendant, non affilié à Anthropic. Ce skill reste la propriété de son auteur original.
// installer ce skill
Collez cette commande dans votre terminal à la racine de votre projet :
mkdir -p .claude/commands && curl -o ".claude/commands/SKILL.md" "https://raw.githubusercontent.com/SnailSploit/Claude-Red/main/Skills/infrastructure/offensive-shellcode/SKILL.md"
Ensuite dans Claude Code, tapez /SKILL pour l'activer.
open_in_newVoir la source originale
// sauvegarder
Sauvegarde disponible après connexion.
loginSe connecter pour sauvegarder
// informations
CréateurSnailSploit
Étoiles 2.8k
LicenceMIT License
Mis à jour8 mai 2026
Format.md
AccèsGratuit
// similaires

Skills Workflows automatisés

Voir toutarrow_forward