Index of every page on this site: llms.txt
All skills
ljagiello avatar

/ctf-pwn

@20d182d
by Lukasz Jagielloljagiello/ctf-skills3.8k stars
447
Run it yourself

Provides binary exploitation techniques for CTF challenges. Use when you already have a vulnerable native target or service and need to turn memory corruption or low-level primitives into code execution or privilege escalation, such as buffer overflows, format strings, heap bugs, ROP, ret2libc, shellcode, kernel exploitation, seccomp bypass, sandbox escape, or Windows/Linux exploit chains. Do not use it when the main blocker is understanding what the binary does; use reverse engineering first. Do not use it for pure web bugs, disk or packet forensics, or standalone crypto/math challenges.

Use this Skill: https://skilld.dev/gh/ljagiello/ctf-skills/ctf-pwn

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

attack-playbook.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Linux Userland Attack Playbook

Use this as the workflow view for a Linux/glibc target. It answers what to look for and which primitive to pursue; use the linked technique notes for full payloads, version-specific bypasses, and CTF writeups.

Recon

Enumerate input and privilege boundaries before choosing an exploit path:

  • Arguments and environment: argv, getopt(), getenv(), LD_PRELOAD, PATH.
  • Files: attacker-selected fopen()/read() paths and configuration files such as /etc/program.conf or ~/.config/....
  • Standard input: read() and fgets() loops.
  • Network sockets: accept(), recv(), and recvfrom().
  • IPC: D-Bus, Unix-domain sockets, and shared memory.
  • Privilege boundary: SUID/SGID state and whether the process changes UID/EUID.
  • Event paths: signal handlers (SIGUSR*, SIGALRM, ...) and any signal-unsafe code.
  • Pseudo-filesystem interfaces: values read from /proc or /sys.

Record which entry point reaches dangerous allocations, copies, format sinks, dereferences, or privileged operations. A bug that is hard to reach is usually worse than a stronger primitive that is unreachable.

Static signals from ELF metadata, libc build, and protection tooling can rank candidate primitives, but they do not prove exploitability by themselves. When the request asks for exploitability or security impact, read static-signals.md before choosing a route.

Leak Selection

Identify the smallest leak that defeats the mitigations actually enabled by the target:

Secret Useful sources
libc unsorted/small/large-bin fd/bk, stack return paths, writable function pointers, heap/stack residue, FILE structures
heap tcache/fastbin/largebin metadata, stack residue, TLS
stack uninitialized stack, saved frames, libc __environ
canary uninitialized/overread stack, TLS
binary stack residue and function/data pointers with binary offsets
memory map file-read primitive against /proc/self/maps

Common ways to obtain a leak:

  • Read an uninitialized heap or stack allocation.
  • Use a format-string bug.
  • Turn FILE corruption into an arbitrary read.
  • Turn an overflow or arbitrary allocation into an overread.
  • Combine a write primitive with an object that later prints or copies from it.

For libc identification, use the database linked from format-string.md. For full format-string mechanics, see format-string.md.

Control-Flow and Write Targets

Choose the target after checking binary protections, libc version, and the strength of the write primitive:

Write target Typical condition
return address controllable stack write or overflow
binary GOT Partial RELRO
libc GOT version-dependent; verify against the target libc
malloc/free/realloc hooks glibc < 2.34
FILE vtable older glibc; modern targets usually require a validated-vtable bypass
FILE wide vtable viable on modern glibc
binary function pointer / fini_array binary-specific writable target
l_addr plus a function pointer binary-specific base/pointer combination

Payload selection:

  • ROP when gadget addresses and stack control are available.
  • SROP when a sigreturn trigger can replace many gadget requirements.
  • One gadget when its register/stack constraints can be met.
  • system("/bin/sh") when /bin/sh can be placed in rdi and stack alignment is preserved.

Version-specific modern-libc chains: nobodyisnobody/docs and n132/Libc-GOT-Hijacking.

Route To A Technique

Situation Canonical deep dive
Input reaches printf/sprintf/syslog as a format format-string.md
Corruption reaches _IO_FILE, especially on Full RELRO heap-fsop.md
Bug is tcache/fastbin/unsorted/largebin or allocator metadata heap-techniques.md
Need stack pivot, ret2libc, syscall ROP, or shellcode rop-and-shellcode.md
Need SROP, modern ROP, vDSO, or seccomp evasion rop-advanced.md
Need exact stack/canary behavior or partial overflows overflow-basics.md

Payload Checklist

  • Stack pivot: use controlled rbp plus leave, or mov rsp, <reg>; pivot to input, BSS, heap, or residual stack only after proving read/write/execute expectations.
  • ROP: preserve 16-byte stack alignment; use ret as padding, setcontext for broad register control, and existing vtable/function pointers when useful.
  • Shellcode: prefer existing RWX when present; otherwise mprotect/mmap through ROP. For filters, consider null-free, alphanumeric, staged, self-modifying, and carefully encoded ModR/M forms.
  • Partial overwrite: overwrite only trailing bytes when the nearby code/data differs by known low bits; account for brute-force probability.
  • Seccomp: enumerate allowed syscalls, look for equivalent calls, and use ORW when execution is blocked. See advanced.md.
  • TLS: corruption can expose the canary, tcache state, stack guard, or destructor pointers; see the allocator notes in heap-techniques.md.
  • Environment variables: check whether they alter libc/application behavior, disable or shape caching behavior, fill payloads, or make layout predictable.
  • Blind brute force: use distinguishable crash/hang/output timing when no direct oracle exists; budget attempts before choosing another primitive.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

2 alerts26d5 checks · Risk SAFE
  • Gen Agent Trust Hub26d

    This skill is an extensive reference library and toolset for binary exploitation in CTF (Capture The Flag) competitions. It provides detailed documentation, scripts, and techniques for a wide range of vulnerabilities, including heap corruption, stack overflows, and kernel exploits. All recommended tool installations and script operations are standard for security research and are appropriately scoped to its educational purpose.

  • Socket26d

    26 alerts: gptSecurity, gptAnomaly, gptMalware

  • Snyk26d

    Risk: LOW · No issues

  • Runlayer8mo

    7/7 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 20d182d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 4 weeks ago
metadata
{
  "user-invocable": "false",
  "author": "Lukasz Jagiello"
}
All 1 allowed tools
Bash Read Write Edit Glob Grep Task WebFetch WebSearch
Other metadata
compatibility
Requires filesystem-based agent (Claude Code or similar) with bash, Python 3, and internet access for tool installation.
  • binary-exploitation
  • ctf
  • rop
  • shellcode
  • heap
  • pwn
  • gdb
  • pwntools
  • kernel
  • seccomp

README badge

README badge for ljagiello/ctf-skills/ctf-pwn

Provides binary exploitation techniques for CTF challenges targeting memory corruption and low-level primitives like buffer overflows, format strings, heap bugs, ROP chains, and kernel exploits. Includes detailed references for ret2libc, ret2csu, SROP, seccomp bypass, heap techniques (House of Apple, tcache poisoning), FILE structure exploitation, and Windows/Linux privilege escalation — but assumes the vulnerable binary is already identified and does not cover reverse engineering or standalone crypto challenges.

Generated from the current SKILL.md.

Does this skill cover heap exploitation?
Yes. The skill includes techniques for House of Apple 2, House of Einherjar, tcache poisoning, FILE structure exploitation, and UAF attacks across glibc and custom allocators.
What platforms and architectures does this support?
Linux (x86, x86_64, ARM) and Windows (SEH-based exploits). macOS is supported for development tools but target exploitation assumes Linux or Windows binaries.
Does this cover kernel exploitation?
Yes. The skill includes kernel ROP, tty_struct heap spray, KASLR/KPTI/SMEP bypass, modprobe_path overwrite, and privilege escalation via ret2usr and kernel memory corruption.
When should I use this skill instead of reverse engineering?
Use this skill when you already understand what the binary does and need to convert a known vulnerability (buffer overflow, format string, UAF, etc.) into code execution. Switch to reverse engineering first if the main blocker is understanding the binary's purpose or control flow.
Does this skill handle web bugs or cryptographic challenges?
No. The skill excludes pure web bugs, disk/packet forensics, and standalone crypto/math challenges. Use ctf-web or ctf-crypto for those domains instead.

Generated from the current SKILL.md. These answers refresh after source changes.