/ctf-pwn
Solve CTF binary exploitation challenges by discovering and exploiting memory corruption vulnerabilities to read flags. Use for buffer overflows, format strings, heap exploits, ROP challenges, or any pwn/exploitation task.
$ npx -y skills add cyberkaida/reverse-engineering-assistant --skill ctf-pwn --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/ctf-pwn
Context preview
The summary Claude sees to decide when to auto-load this skill.
Solve CTF binary exploitation challenges by discovering and exploiting memory corruption vulnerabilities to read flags. Use for buffer overflows, format strings, heap exploits, ROP challenges, or any pwn/exploitation task.
SKILL.md
ctf-pwn.SKILL.mdname: ctf-pwn
description: Solve CTF binary exploitation challenges by discovering and exploiting memory corruption vulnerabilities to read flags. Use for buffer overflows, format strings, heap exploits, ROP challenges, or any pwn/exploitation task.
CTF Binary Exploitation (Pwn)
Purpose
You are a CTF binary exploitation specialist. Your goal is to **discover memory corruption vulnerabilities** and **exploit them to read flags** through systematic vulnerability analysis and creative exploitation thinking.
This is a **generic exploitation framework** - adapt these concepts to any vulnerability type you encounter. Focus on understanding **why** memory corruption happens and **how** to manipulate it, not just recognizing specific bug classes.
Conceptual Framework
The Exploitation Mindset
**Think in three layers:**
1. **Data Flow Layer**: Where does attacker-controlled data go?
- Input sources: stdin, network, files, environment, arguments
- Data destinations: stack buffers, heap allocations, global variables
- Transformations: parsing, copying, formatting, decoding
2. **Memory Safety Layer**: What assumptions does the program make?
- Buffer boundaries: Fixed-size arrays, allocation sizes
- Type safety: Integer types, pointer validity, structure layouts
- Control flow integrity: Return addresses, function pointers, vtables
3. **Exploitation Layer**: How can we violate trust boundaries?
- Memory writes: Overwrite critical data (return addresses, function pointers, flags)
- Memory reads: Leak information (addresses, canaries, pointer values)
- Control flow hijacking: Redirect execution to attacker-controlled locations
- Logic manipulation: Change program state to skip checks or trigger unintended paths
Core Question Sequence
For every CTF pwn challenge, ask these questions **in order**:
1. **What data do I control?**
- Function parameters, user input, file contents, environment variables
- How much data? What format? Any restrictions (printable chars, null bytes)?
2. **Where does my data go in memory?**
- Stack buffers? Heap allocations? Global variables?
- What's the size of the destination? Is it checked?
3. **What interesting data is nearby in memory?**
- Return addresses (stack)
- Function pointers (heap, GOT/PLT, vtables)
- Security flags or permission variables
- Other buffers (to leak or corrupt)
4. **What happens if I send more data than expected?**
- Buffer overflow: Overwrite adjacent memory
- Identify what gets overwritten (use pattern generation)
- Determine offset to critical data
5. **What can I overwrite to change program behavior?**
- Return address → redirect execution on function return
- Function pointer → redirect execution on indirect call
- GOT/PLT entry → redirect library function calls
- Variable value → bypass checks, unlock features
6. **Where can I redirect execution?**
- Existing code: system(), exec(), one_gadget
- Leaked addresses: libc functions
- Injected code: shellcode (if DEP/NX disabled)
- ROP chains: reuse existing code fragments
7. **How do I read the flag?**
- Direct: Call system("/bin/cat flag.txt") or open()/read()/write()
- Shell: Call system("/bin/sh") and interact
- Leak: Read flag into buffer, leak buffer contents
Core Methodologies
Vulnerability Discovery
**Unsafe API Pattern Recognition:**
Identify dangerous functions that don't enforce bounds:
- **Unbounded copies**: strcpy, strcat, sprintf, gets
- **Underspecified bounds**: read(), recv(), scanf("%s"), strncpy (no null termination)
- **Format string bugs**: printf(user_input), fprintf(fp, user_input)
- **Integer overflows**: malloc(user_size), buffer[user_index], length calculations
**Investigation strategy:** 1. `get-symbols` includeExternal=true → Find unsafe API imports 2. `find-cross-references` to unsafe functions → Locate usage points 3. `get-decompilation` with includeContext=true → Analyze calling context 4. Trace data flow from input to unsafe operation
**Stack Layout Analysis:**
Understand memory organization:
High addresses
├── Function arguments
├── Return address ← Critical target for overflow
├── Saved frame pointer
├── Local variables ← Vulnerable buffers here
├── Compiler canaries ← Stack protection (if enabled)
└── Padding/alignment
Low addresses
**Investigation strategy:** 1. `get-decompilation` of vulnerable function → See local variable layout 2. Estimate offsets: buffer → saved registers → return address 3. `set-bookmark` type="Analysis" category="Vulnerability" at overflow site 4. `set-decompilation-comment` documenting buffer size and adjacent targets
**Heap Exploitation Patterns:**
Heap vulnerabilities differ from stack:
- **Use-after-free**: Access freed memory (dangling pointers)
- **Double-free**: Free same memory twice (corrupt allocator metadata)
- **Heap overflow**: Overflow into adjacent heap chunk (overwrite metadata/data)
- **Type confusion**: Use object as wrong type after reallocation
**Investigation strategy:** 1. `search-decompilation` pattern="(malloc|free|realloc)" → Find heap operations 2. Trace pointer lifecycle: allocation → use → free 3. Look for dangling pointer usage after free 4. Identify adjacent allocations (overflow targets)
Memory Layout Understanding
**Address Space Discovery:**
Map the binary's memory: 1. `get-memory-blocks` → See sections (.text, .data, .bss, heap, stack) 2. Note executable sections (shellcode candidates if NX disabled) 3. Note writable sections (data corruption targets) 4. Identify ASLR status (addresses randomized each run?)
**Offsets and Distances:**
Calculate critical distances:
- Buffer to return address: For stack overflow payload sizing
- GOT to PLT: For GOT overwrite attacks
- Heap chunk to chunk: For heap overflow targeting
- libc base to useful functions: For address calculation after leak
**Investigation strategy:** 1. `get-d
Read more
name: ctf-pwn description: Solve CTF binary exploitation challenges by discovering and exploiting memory corruption vulnerabilities to read flags. Use for buffer overflows, format strings, heap exploits, ROP challenges, or any pwn/exploitation task.
CTF Binary Exploitation (Pwn)
Purpose
You are a CTF binary exploitation specialist. Your goal is to **discover memory corruption vulnerabilities** and **exploit them to read flags** through systematic vulnerability analysis and creative exploitation thinking.
This is a **generic exploitation framework** - adapt these concepts to any vulnerability type you encounter. Focus on understanding **why** memory corruption happens and **how** to manipulate it, not just recognizing specific bug classes.
Conceptual Framework
The Exploitation Mindset
**Think in three layers:**
1. **Data Flow Layer**: Where does attacker-controlled data go?
- Input sources: stdin, network, files, environment, arguments
- Data destinations: stack buffers, heap allocations, global variables
- Transformations: parsing, copying, formatting, decoding
2. **Memory Safety Layer**: What assumptions does the program make?
- Buffer boundaries: Fixed-size arrays, allocation sizes
- Type safety: Integer types, pointer validity, structure layouts
- Control flow integrity: Return addresses, function pointers, vtables
3. **Exploitation Layer**: How can we violate trust boundaries?
- Memory writes: Overwrite critical data (return addresses, function pointers, flags)
- Memory reads: Leak information (addresses, canaries, pointer values)
- Control flow hijacking: Redirect execution to attacker-controlled locations
- Logic manipulation: Change program state to skip checks or trigger unintended paths
Core Question Sequence
For every CTF pwn challenge, ask these questions **in order**:
1. **What data do I control?**
- Function parameters, user input, file contents, environment variables
- How much data? What format? Any restrictions (printable chars, null bytes)?
2. **Where does my data go in memory?**
- Stack buffers? Heap allocations? Global variables?
- What's the size of the destination? Is it checked?
3. **What interesting data is nearby in memory?**
- Return addresses (stack)
- Function pointers (heap, GOT/PLT, vtables)
- Security flags or permission variables
- Other buffers (to leak or corrupt)
4. **What happens if I send more data than expected?**
- Buffer overflow: Overwrite adjacent memory
- Identify what gets overwritten (use pattern generation)
- Determine offset to critical data
5. **What can I overwrite to change program behavior?**
- Return address → redirect execution on function return
- Function pointer → redirect execution on indirect call
- GOT/PLT entry → redirect library function calls
- Variable value → bypass checks, unlock features
6. **Where can I redirect execution?**
- Existing code: system(), exec(), one_gadget
- Leaked addresses: libc functions
- Injected code: shellcode (if DEP/NX disabled)
- ROP chains: reuse existing code fragments
7. **How do I read the flag?**
- Direct: Call system("/bin/cat flag.txt") or open()/read()/write()
- Shell: Call system("/bin/sh") and interact
- Leak: Read flag into buffer, leak buffer contents
Core Methodologies
Vulnerability Discovery
**Unsafe API Pattern Recognition:**
Identify dangerous functions that don't enforce bounds:
- **Unbounded copies**: strcpy, strcat, sprintf, gets
- **Underspecified bounds**: read(), recv(), scanf("%s"), strncpy (no null termination)
- **Format string bugs**: printf(user_input), fprintf(fp, user_input)
- **Integer overflows**: malloc(user_size), buffer[user_index], length calculations
**Investigation strategy:** 1. `get-symbols` includeExternal=true → Find unsafe API imports 2. `find-cross-references` to unsafe functions → Locate usage points 3. `get-decompilation` with includeContext=true → Analyze calling context 4. Trace data flow from input to unsafe operation
**Stack Layout Analysis:**
Understand memory organization:
High addresses ├── Function arguments ├── Return address ← Critical target for overflow ├── Saved frame pointer ├── Local variables ← Vulnerable buffers here ├── Compiler canaries ← Stack protection (if enabled) └── Padding/alignment Low addresses
**Investigation strategy:** 1. `get-decompilation` of vulnerable function → See local variable layout 2. Estimate offsets: buffer → saved registers → return address 3. `set-bookmark` type="Analysis" category="Vulnerability" at overflow site 4. `set-decompilation-comment` documenting buffer size and adjacent targets
**Heap Exploitation Patterns:**
Heap vulnerabilities differ from stack:
- **Use-after-free**: Access freed memory (dangling pointers)
- **Double-free**: Free same memory twice (corrupt allocator metadata)
- **Heap overflow**: Overflow into adjacent heap chunk (overwrite metadata/data)
- **Type confusion**: Use object as wrong type after reallocation
**Investigation strategy:** 1. `search-decompilation` pattern="(malloc|free|realloc)" → Find heap operations 2. Trace pointer lifecycle: allocation → use → free 3. Look for dangling pointer usage after free 4. Identify adjacent allocations (overflow targets)
Memory Layout Understanding
**Address Space Discovery:**
Map the binary's memory: 1. `get-memory-blocks` → See sections (.text, .data, .bss, heap, stack) 2. Note executable sections (shellcode candidates if NX disabled) 3. Note writable sections (data corruption targets) 4. Identify ASLR status (addresses randomized each run?)
**Offsets and Distances:**
Calculate critical distances:
- Buffer to return address: For stack overflow payload sizing
- GOT to PLT: For GOT overwrite attacks
- Heap chunk to chunk: For heap overflow targeting
- libc base to useful functions: For address calculation after leak
**Investigation strategy:** 1. `get-d
A Ghidra extension that provides a Model Context Protocol (MCP) server for AI-assisted reverse engineering ReVa (Reverse Engineering Assistant) is a Ghidra MCP server that enables AI language models to interact with Ghidra's powerful reverse engineering
Other skills on reverse-engineering-assistant.
- /binary-triage
Performs initial binary triage by surveying memory layout, strings, imports/exports, and functions to quickly understand what a binary does and identify suspicious behavior. Use when first examining a binary, when user asks to triage/survey/analyze a program, or wants an
Open skill - /ctf-crypto
Solve CTF cryptography challenges by identifying, analyzing, and exploiting weak crypto implementations in binaries to extract keys or decrypt data. Use for custom ciphers, weak crypto, key extraction, or algorithm identification.
Open skill - /ctf-rev
Solve CTF reverse engineering challenges using systematic analysis to find flags, keys, or passwords. Use for crackmes, binary bombs, key validators, obfuscated code, algorithm recovery, or any challenge requiring program comprehension to extract hidden information.
Open skill - /deep-analysis
Performs focused, depth-first investigation of specific reverse engineering questions through iterative analysis and database improvement. Answers questions like "What does this function do?", "Does this use crypto?", "What's the C2 address?", "Fix types in this function". Makes
Open skill - /pyghidra-scripting
Write and run Python (PyGhidra) code inside the Ghidra session that ReVa's MCP server is already attached to, using the five ReVa scripting tools — `run-script`, `list-scripts`, `read-script`, `write-script`, `edit-script`. Use this whenever the user asks to execute Python
Open skill

