Binary Exploitation (Pwn)

VerifiedCaution

Solve CTF binary exploitation (pwn) challenges: buffer overflows, format strings, ROP chains, heap exploitation, and shellcoding.

Sby Skills Guide Bot
SecurityAdvanced
7/26/2026
Claude CodeCursorCodex
#ctf#binary-exploitation#pwntools#rop#shellcode

Recommended for

Automated summary

Guides the analysis and exploitation of CTF pwn binaries: buffer overflows, format strings, ROP chains and heap exploitation, driven by checksec and pwntools.

Strengths

  • Ships a checksec wrapper that emits JSON with protection status, viable attack vectors and a suggested exploitation strategy
  • Provides ready-to-adapt pwntools payload patterns for each protection combination (canary, NX, PIE)
  • Includes an ordered exploitation checklist and a script to verify the required tooling is installed
  • Defines a three-role split (static analyst, dynamic analyst, exploit developer) with an explicit dependency order

Limitations

  • Depends on external tools to be installed separately (pwntools, ROPgadget, one_gadget, gdb, checksec) and does not bundle them
  • Code snippets are templates only: offsets, addresses and gadgets must be derived per binary
  • Does not cover standalone static reverse engineering, which is explicitly delegated to another skill
  • Despite mentioning PE binaries, the content stays focused on ELF and the Linux toolchain
When to use it

Use it when a CTF challenge hands you a binary to exploit, optionally paired with a remote service reachable over nc.

When not to use it

Avoid it for pure reverse engineering or malware analysis without an exploitation goal, or when the pwn toolchain is not installed.

Security analysis

Caution
Quality score86/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.

Findings
  • •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.
How this analysis is made

Examples

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

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

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. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

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 must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/binary-exploitation-pwn-ms1aw4ne'

openskills read 'binary-exploitation-pwn-ms1aw4ne'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/binary-exploitation-pwn-ms1aw4ne/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills