Exploitation binaire (Pwn)

VérifiéPrudence

Résolvez des défis CTF d'exploitation binaire (pwn) : buffer overflows, format strings, chaînes ROP, exploitation de heap et shellcoding.

Spar Skills Guide Bot
SecuriteAvancé
26/07/2026
Claude CodeCursorCodex
#ctf#binary-exploitation#pwntools#rop#shellcode

Recommandé pour

Synthèse automatique

Guide l'analyse et l'exploitation de binaires de CTF (pwn) : débordements de tampon, format strings, chaînes ROP et heap exploitation, en s'appuyant sur checksec et pwntools.

Points forts

  • Fournit un script checksec qui renvoie du JSON avec les protections, les vecteurs d'attaque viables et une stratégie d'exploitation suggérée
  • Donne des patrons de payload pwntools prêts à adapter selon la combinaison de protections (canary, NX, PIE)
  • Inclut une checklist d'exploitation ordonnée et un script de vérification de l'outillage requis
  • Décrit une répartition en trois rôles (analyste statique, analyste dynamique, développeur d'exploit) avec un ordonnancement des dépendances

Limites

  • Dépend d'outils externes à installer (pwntools, ROPgadget, one_gadget, gdb, checksec) et ne les fournit pas
  • Les extraits de code sont des modèles : offsets, adresses et gadgets doivent être calculés pour chaque binaire
  • Ne couvre pas l'ingénierie inverse statique seule, explicitement renvoyée vers une autre compétence
  • Malgré la mention des binaires PE, le contenu reste centré sur les ELF et l'écosystème Linux
Quand l'utiliser

À utiliser lorsqu'un challenge CTF fournit un binaire à exploiter, éventuellement accompagné d'un service distant à atteindre via nc.

Quand l'éviter

À éviter pour de la rétro-ingénierie pure ou de l'analyse de malware sans objectif d'exploitation, ou lorsque l'outillage pwn n'est pas installé.

Analyse de sécurité

Prudence
Score qualité86/100

The skill is explicitly scoped to CTF binary exploitation and contains no destructive, exfiltration, obfuscated, or safety-disabling instructions. However, it relies on bash, local binaries, exploit development, and remote connections, so it falls under caution as a powerful dual-use toolkit rather than clearly safe.

Points d'attention
  • •Uses powerful execution and exploitation tools (bash, pwntools, gdb, ROPgadget, one_gadget, checksec) and references bundled shell scripts whose contents are not shown in the provided SKILL.md.
  • •Includes sending exploit payloads to remote services via pwntools/netcat, which is dual-use and could be misapplied outside CTF targets.
  • •Does not declare allowed-tools, yet instructs the agent to run shell scripts and Python exploit code.
Comment cette analyse est faite

Exemples

Exploit a remote pwn challenge
I have a CTF pwn challenge: ./vuln is running at nc chall.ctf.io 1337. Run checksec on it, pick the right strategy, and write a pwntools exploit that gets a shell.
Find the offset and build a ROP chain
The binary crashes after a long input. Help me find the exact offset to the return address with a cyclic pattern and build a ret2libc ROP chain for system('/bin/sh').
Format string leak to defeat PIE
This binary has printf(buf) and PIE is enabled. Write a pwntools script that leaks the canary and a code address through the format string, then computes the base to finish the exploit.

name: pwn description: >- Solve CTF binary exploitation (pwn) challenges: buffer overflows, format strings, ROP chains, heap exploitation, and shellcoding. Use when given ELF/PE binaries with a remote service to exploit. Triggers: "buffer overflow", "format string", "ROP", "shellcode", "checksec", "NX", "canary", "PIE", "GOT overwrite", "ret2libc", pwntools scripts, .elf files, nc/netcat connection targets. Tools: checksec, ROPgadget, pwntools, gdb, one_gadget. NOT for static reverse engineering (use reverse).

CTF Pwn

Analyze and exploit binary exploitation challenges.

When to Use

Use this command for challenges involving:

  • ELF binaries
  • Buffer overflows
  • Format string vulnerabilities
  • ROP chains
  • Heap exploitation

Bundled Scripts

  • check-tools.sh — Verify required pwn tools are installed
  • run-checksec.sh — Check binary protections (CANARY, NX, PIE, RELRO). Outputs JSON with protection status, attack vectors, and suggested exploitation strategy.

Instructions

  1. First check tool availability: bash scripts/check-tools.sh

  2. Start with checksec to understand binary protections:

    bash scripts/run-checksec.sh $ARGUMENTS
    

    The JSON output includes:

    • protections: status of each protection (enabled/disabled/partial)
    • attack_vectors: viable exploitation approaches
    • suggestions[0]: recommended exploitation STRATEGY based on protections

    Example: if stack_canary=disabled and nx=disabled, the strategy is "Classic buffer overflow with shellcode injection".

  3. Based on checksec JSON, proceed with exploitation:

    No Canary + No NX (shellcode):

    from pwn import *
    p = process('./binary')
    shellcode = asm(shellcraft.sh())
    payload = shellcode + b'A' * (offset - len(shellcode)) + p64(buf_addr)
    p.sendline(payload)
    p.interactive()
    

    No Canary + NX + No PIE (ROP):

    ROPgadget --binary ./binary --re "pop rdi"
    
    payload = b'A' * offset + p64(pop_rdi) + p64(bin_sh) + p64(system)
    

    PIE enabled (need leak):

    • Leak address via format string or partial overwrite
    • Calculate base address
    • Build ROP chain with calculated addresses
  4. Find offset to return address:

    from pwn import *
    print(cyclic(200))
    # After crash: cyclic_find(0x61616161)
    

Exploitation Checklist

  1. Run binary, understand behavior
  2. run-checksec.sh → read JSON attack_vectors
  3. Find vulnerability (overflow, format string)
  4. Find offset to control
  5. Build exploit (shellcode or ROP)
  6. Test locally, then remote

Team Roles

When using /ctf-kit:team-solve with a pwn challenge, the lead spawns 3 specialists.

Exploit-dev requires plan approval before connecting to remote targets.

| Role | Teammate Name | Focus | Tools | First Action | |------|--------------|-------|-------|--------------| | Static Analyst | binary-analyst | checksec, disassembly, vulnerability identification, function mapping, string cross-refs | checksec, radare2, scripts/run-checksec.sh | Run checksec, disassemble main + interesting functions, identify vuln class | | Exploit Developer | exploit-dev | Payload crafting, ROP chain building, shellcode, format string exploitation, ret2libc/ret2csu | pwntools, ROPgadget, one_gadget | Build exploit based on static analysis, find gadgets, calculate offsets | | Dynamic Analyst | dynamic-analyst | GDB debugging, offset finding, leak discovery, heap state inspection, ASLR/PIE bypass | gdb, pwntools, ltrace, strace | Run binary with cyclic pattern, find crash offset, identify leakable addresses |

Workflow coordination

The pwn team has a natural dependency chain:

  1. Static analyst runs first → identifies protections and vulnerability type
  2. Dynamic analyst runs in parallel → finds offsets and leaks
  3. Exploit developer waits for both → builds the final exploit

When to broadcast

  • Static: "Binary has no canary + no PIE, vuln in read() at offset 0x40" — exploit dev starts building
  • Dynamic: "Crash at offset 72, libc leak via puts@GOT" — exploit dev uses these values
  • Exploit dev: "Exploit works locally, switching to remote" — lead reviews plan before remote connection
  • Any: "Got shell / found flag" — immediate broadcast, all stop

Example Usage

/ctf-kit:pwn ./challenge
/ctf-kit:pwn ./binary

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/binary-exploitation-pwn-ms1aw4ne' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/binary-exploitation-pwn-ms1aw4ne/download' --output '.skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md.part' && mv '.skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md.part' '.skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md' && test -s '.skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/pwn' && cp -R '.skill-downloads/binary-exploitation-pwn-ms1aw4ne' '.claude/skills/pwn'

Cursor
test -f '.skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md' && test -s '.skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/pwn' && cp -R '.skill-downloads/binary-exploitation-pwn-ms1aw4ne' '.cursor/skills/pwn'

Codex
test -f '.skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md' && test -s '.skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/pwn' && cp -R '.skill-downloads/binary-exploitation-pwn-ms1aw4ne' '.agents/skills/pwn'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/binary-exploitation-pwn-ms1aw4ne'

openskills read 'binary-exploitation-pwn-ms1aw4ne'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires