Skip to content

ljagiello/ctf-skills / ctf-pwn

ctf-pwn

Flagged

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.

FileKindSize
SKILL.mdskill md20.4 KB
advanced-exploits-2.mdmarkdown30.4 KB
advanced-exploits-3.mdmarkdown32.5 KB
advanced-exploits-4.mdmarkdown30.5 KB
advanced-exploits-5.mdmarkdown6.1 KB
advanced-exploits.mdmarkdown35.0 KB
advanced.mdmarkdown14.3 KB
attack-playbook.mdmarkdown5.6 KB
field-notes.mdmarkdown25.7 KB
format-string.mdmarkdown32.3 KB
heap-fsop.mdmarkdown14.8 KB
heap-techniques-2.mdmarkdown19.8 KB
heap-techniques.mdmarkdown37.2 KB
kernel-bypass.mdmarkdown19.6 KB
kernel-techniques.mdmarkdown18.6 KB
kernel.mdmarkdown32.0 KB
overflow-basics.mdmarkdown26.2 KB
pwnable-tw/3x17.mdmarkdown11.3 KB
pwnable-tw/README.mdmarkdown54.0 KB
pwnable-tw/alive_note.mdmarkdown13.9 KB
pwnable-tw/applestore.mdmarkdown14.0 KB
pwnable-tw/babyallocator.mdmarkdown14.8 KB
pwnable-tw/babystack.mdmarkdown15.0 KB
pwnable-tw/bash.mdmarkdown10.3 KB
pwnable-tw/bash_revenge.mdmarkdown14.2 KB
pwnable-tw/bookwriter.mdmarkdown12.7 KB
pwnable-tw/bounty_program_a.mdmarkdown14.1 KB
pwnable-tw/bounty_program_b.mdmarkdown13.5 KB
pwnable-tw/break_out.mdmarkdown14.1 KB
pwnable-tw/calc.mdmarkdown13.2 KB
pwnable-tw/caov.mdmarkdown13.4 KB
pwnable-tw/criticalheap.mdmarkdown14.0 KB
pwnable-tw/criticalheap_pp.mdmarkdown13.3 KB
pwnable-tw/de_aslr.mdmarkdown14.8 KB
pwnable-tw/death_note.mdmarkdown13.7 KB
pwnable-tw/digimon.mdmarkdown14.5 KB
pwnable-tw/dubblesort.mdmarkdown11.5 KB
pwnable-tw/food_store.mdmarkdown12.8 KB
pwnable-tw/ghost_party.mdmarkdown13.2 KB
pwnable-tw/hacknote.mdmarkdown12.4 KB
pwnable-tw/heap_paradise.mdmarkdown12.4 KB
pwnable-tw/hitcon_ftp.mdmarkdown13.7 KB
pwnable-tw/kidding.mdmarkdown13.3 KB
pwnable-tw/mno2.mdmarkdown12.5 KB
pwnable-tw/omegago.mdmarkdown13.6 KB
pwnable-tw/orw.mdmarkdown11.8 KB
pwnable-tw/printable.mdmarkdown13.7 KB
pwnable-tw/re_alloc.mdmarkdown11.6 KB
pwnable-tw/re_alloc_revenge.mdmarkdown11.5 KB
pwnable-tw/seccomptools.mdmarkdown12.3 KB
pwnable-tw/secret_garden.mdmarkdown13.9 KB
pwnable-tw/secret_of_my_heart.mdmarkdown12.6 KB
pwnable-tw/seethefile.mdmarkdown12.4 KB
pwnable-tw/silver_bullet.mdmarkdown14.0 KB
pwnable-tw/spirited_away.mdmarkdown11.9 KB
pwnable-tw/starbound.mdmarkdown13.3 KB
pwnable-tw/start.mdmarkdown10.7 KB
pwnable-tw/stupid_boss.mdmarkdown13.4 KB
pwnable-tw/tcache_tear.mdmarkdown12.5 KB
pwnable-tw/unexploitable.mdmarkdown14.4 KB
pwnable-tw/wannaheap.mdmarkdown12.9 KB
rop-advanced.mdmarkdown32.3 KB
rop-and-shellcode.mdmarkdown28.1 KB
sandbox-escape.mdmarkdown15.1 KB
scripts/fmtstr_payload_suite.pyexecutablescript3.1 KB
scripts/ret2libc_two_stage.pyexecutablescript2.5 KB
scripts/seccomp_orw_generator.pyexecutablescript3.2 KB
scripts/shellcraft_asm.pyexecutablescript2.7 KB
scripts/srop_execve.pyexecutablescript2.7 KB
static-signals.mdmarkdown2.2 KB
tools-mcp.mdmarkdown11.8 KB

pwnable-tw/README.md

View on GitHub
# pwnable.tw Challenge Directory

Canonical directory of all 43 binary exploitation challenge writeups from `pwnable.tw`. Each row details the target environment, protections, taxonomy tags, observed diagnostic triggers, root cause defects, multiple concrete exploitation chains, and key exploitation symbols/gadgets.

| Challenge | Points | Arch | Libc | Protections | Tags | Observed Clues & Triggers | Root Cause Defects | Exploitation Chains & Keywords |
|---|---|---|---|---|---|---|---|---|
| [`orw`](orw.md) | 100 | i386 | static | Partial RELRO, Canary, NX disabled, No PIE | `shellcode`, `seccomp-bypass` | i386 ELF; RWX BSS buffer executes user shellcode; seccomp filter restricts syscalls to open, read, write. | Program reads 200 bytes from stdin directly into an executable BSS buffer (`shellcode` at `0x0804a060`) and executes it as a function pointer (`((void(*)())shellcode)();`). A seccomp BPF filter (`PR_SET_SECCOMP`) blocks `execve` (11) and socket syscalls, whitelisting only `sys_open` (5), `sys_read` (3), `sys_write` (4), and `sys_exit` (1). | • **Path A (Direct ORW Assembly):** Push `/home/orw/flag` onto stack; invoke `sys_open(esp, O_RDONLY=0, 0)` returning fd 3; invoke `sys_read(3, esp, 0x30)` reading flag into stack buffer; invoke `sys_write(1, esp, 0x30)` printing flag to stdout.<br>• **Path B (x32 / Syscall Alternatives):** Bypasses via alternate syscall offsets or seccomp boundary conditions.<br><br>**Keywords:** `seccomp BPF`, `PR_SET_SECCOMP`, `sys_open` (5), `sys_read` (3), `sys_write` (4), RWX BSS, `/home/orw/flag`, `int 0x80`, shellcode injection |
| [`start`](start.md) | 100 | i386 | static | No RELRO, No Canary, NX disabled, No PIE | `stack-buffer-overflow`, `information-leak`, `shellcode` | Minimal 32-bit ELF in raw x86 assembly (no libc); reads 60 bytes into 20-byte stack buffer. | Handwritten assembly routine (`_start` at `0x08048060`) allocates 20 bytes on stack (`esp-0x14`), executes `sys_write(1, msg, 0x38)` then `sys_read(0, esp, 0x3c)`. Reading 60 bytes into a 20-byte buffer allows a 40-byte stack buffer overflow directly overwriting the saved return address. Stack memory is marked RWX (no NX, no canary). | • **Path A (ESP Leak + Ret-to-Stack Shellcode):** Overwrite return address with `0x08048087` (`mov ecx, esp; mov dl, 0x14; mov bl, 1; mov al, 4; int 0x80`) to leak current ESP pointer via `sys_write`; payload 2 sends 20 bytes padding + `leaked_esp + 20` + 23-byte `/bin/sh` shellcode.<br>• **Path B (Shellcode Before Return):** Place shellcode in the buffer before the return address and jump backwards using negative offset gadgets.<br><br>**Keywords:** `_start`, raw x86 assembly, `sys_write`, `sys_read`, stack leak, ESP relative offset, RWX stack, shellcode injection, `int 0x80` |
| [`3x17`](3x17.md) | 150 | x86-64 | static | Partial RELRO, No Canary, NX, No PIE | `arbitrary-write`, `fini-array-overwrite`, `rop`, `static-binary` | Static stripped x86-64 ELF; prompts for address and 24 data bytes once, then exits; no leak, no canary. | `main` (0x401B6D) parses an address as decimal via `strtoul`, reads exactly 24 bytes of data, and performs `memcpy(addr, buf, 24)`. A global byte guard at `0x4B9330` prevents re-entering `main`. However, `.fini_array` at `0x4B40F0` is writable (Partial RELRO, no PIE) and is executed in reverse order by `__libc_csu_fini` upon process exit. | • **Path A (.fini_array Loop + ROP at .fini_array+0x10):** Overwrite `.fini_array[0] = __libc_csu_fini` (0x402960) and `.fini_array[1] = main` (0x401B6D). When `__libc_csu_fini` runs, it calls `main` (granting an extra 24-byte write) then `__libc_csu_fini` (looping exit handlers infinitely). Use subsequent writes to write a static ROP chain at `.fini_array+0x10`. Finally overwrite `.fini_array[0] = leave; ret` (0x401C4B). Because `__libc_csu_fini` leaves `rbp = 0x4B40F0`, `leave; ret` pivots RSP to `0x4B40F8`, executing static `execve("/bin/sh", 0, 0)` ROP chain.<br>• **Path B (Data Segment ROPgadget Auto-Chain):** Write ROP chain into BSS data segment and pivot stack via `pop rsp`.<br><br>**Keywords:** `strtoul`, `memcpy`, `.fini_array` (`0x4B40F0`), `__libc_csu_fini` (`0x402960`), guard (`0x4B9330`), `leave; ret` pivot, static ROP, `execve` |
| [`calc`](calc.md) | 150 | i386 | static | Partial RELRO, Canary, NX, No PIE | `integer-underflow`, `stack-buffer-overflow`, `rop`, `static-binary` | Static 32-bit ELF; math expression parser with operand/operator stacks; zero token bug. | Expression parser maintains operand stack `numbers[100]` on stack with index `count`. When encountering operators with empty tokens or zero, the parser decrements or increments `count` without pushing an operand. Supplying expressions like `+360` accesses `numbers[360]`, indexing out-of-bounds directly into `calc`'s saved return address and stack frame. | • **Path A (Arbitrary Stack R/W to Static ROP Chain):** Querying `+<index>` reads 4-byte stack integer at `numbers[<index>]`; sending `+<index>+<diff>` or `+<index>-<diff>` overwrites `numbers[<index>]` with arbitrary 32-bit values. Overwrite saved return address at index 361 and subsequent stack slots with ROP gadgets: `pop eax; ret` (0x0805c34b), 11 (sys_execve), `pop edx; ret` (0), `pop ecx; pop ebx; ret` (0, BSS address of "/bin/sh"), `int 0x80`. Send empty line `\n` to return from `calc` and trigger shell.<br>• **Path B (mprotect RWX Shellcode):** Write ROP chain to call `mprotect()` on stack/BSS, pivot to shellcode.<br><br>**Keywords:** expression parser, token index underflow, operand pool, index 361, arbitrary stack AAR/AAW, static ROP, `sys_execve`, `int 0x80` |
| [`hacknote`](hacknote.md) | 150 | i386 | glibc-2.23 | Partial RELRO, Canary, NX, No PIE | `use-after-free`, `got-overwrite`, `ret2libc` | i386 glibc 2.23; note system with 8-byte metadata chunk holding function pointer and data pointer. | Notes are represented by 8-byte metadata chunks: `[print_func_ptr (4 bytes) | content_ptr (4 bytes)]`. `delete_note` calls `free(note->content)` and `free(note)`, but does NOT set the global pointer in `note_list[i]` to NULL, creating a classic Use-After-Free (UAF). | • **Path A (Fastbin UAF Reclamation + Function Pointer Overwrite):** Allocate note 0 and note 1 with size > 8. Delete note 0 then note 1 (8-byte note structs placed in 0x10 fastbin freelist). Allocate note 2 with content size 8: allocator reuses note 0's metadata chunk for note 2's content. Write `puts@plt` and `puts@got` into content; call `print_note(0)` to trigger `print_func_ptr(content_ptr)`, leaking libc base. Delete note 2, reallocate note 3 with size 8 containing `system` address and string `";sh\0"`. Call `print_note(0)` to invoke `system("...;sh")`.<br>• **Path B (Direct Argument Pointer):** Overwrite function pointer with `system` and content pointer pointing to `"sh"`.<br><br>**Keywords:** Use-After-Free (UAF), fastbin 0x10, note metadata struct, function pointer overwrite, `puts@plt`, `puts@got`, `system`, `";sh"` |
| [`bash`](bash.md) | 200 | x86-64 | glibc-2.23 | Partial RELRO, Canary, NX, No PIE | `logic-flaw`, `race-condition`, `command-injection` | Restricted interactive bash 4.3.0; `chmod o-x` on binaries; flag service on 127.0.0.1:1337. | Low-privilege interactive bash 4.3.0 environment where `/bin/*`, `/sbin/*`, `/usr/bin/*` have `chmod o-x` (only `cat` and `ls` retain `o+x`). Flag at `/flag` is root-owned 400; root xinetd listens on `127.0.0.1:1337`. Custom bash lacks `/dev/tcp`. W1 (Unintended): `/lib64/ld-linux-x86-64.so.2` retains world-execute (`o+x`). W2 (Intended): CVE-2016-9401 in bash `popd` builtin where negative offsets trigger uncontrolled `free()`. W3: `/proc/self/mem` is writable. | • **Path A (ld.so Loader Bypass + System Bash /dev/tcp):** Use loader to execute the system `/bin/bash` (which has net redirections): `/lib64/ld-linux-x86-64.so.2 /bin/bash -c "cat < /dev/tcp/127.0.0.1/1337"`.<br>• **Path B (ld.so + Perl/Python/Awk Sockets):** Run perl or python via loader: `/lib64/ld-linux-x86-64.so.2 /usr/bin/perl -e 'use IO::Socket; $s=IO::Socket::INET->new("127.0.0.1:1337"); print <$s>;'`.<br>• **Path C (Intended CVE-2016-9401 In-Process Free):** Exploit `popd` UAF to corrupt bash internal heap and call libc `socket()`/`connect()` in-process without spawning binaries.<br>• **Path D (/proc/self/mem Code Overwrite):** Open `/proc/self/mem` (`exec 3>/proc/self/mem`), use loader-launched `dd` to overwrite `echo` builtin code with shellcode, execute `echo`.<br><br>**Keywords:** `ld-linux-x86-64.so.2`, loader execution bypass, `CVE-2016-9401`, `popd` UAF, `/dev/tcp`, `/proc/self/mem`, xinetd port 1337, socket connect |
| [`criticalheap`](criticalheap.md) | 200 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, No PIE | `type-confusion`, `arbitrary-write`, `shellcode` | x86-64 glibc 2.23; system vs normal heap objects; `TZ` read via `localtime`; safe format read. | Heap structures support 3 types: Normal (content buffer), System (stores `name`, `value` pointers), and Secret. `delete_heap` frees memory without clearing pointers, causing type confusion and UAF. Furthermore, `play_system` uses FORTIFY-safe `__printf_chk`, but `localtime()` evaluates user-controlled `TZ` environment variable, copying file content into heap memory. Additionally, `set_content` with `realpath(buf, buf)` can overflow small heap chunks. | • **Path A (TZ Environment File Read + Decoy Flag Leak):** Set `TZ` environment variable to `/home/criticalheap/flag` via system heap item; calling `localtime()` causes glibc to read the file into heap memory. Use format string or heap show to read the flag.<br>• **Path B (Realpath Heap Overflow + Shellcode RWX Page):** Realloc `name` buffer, trigger `realpath` off-heap buffer overflow, corrupt chunk metadata to gain arbitrary write into an mmapped RWX page or overwrite `__malloc_hook`.<br><br>**Keywords:** `TZ` environment variable, `localtime()`, `__printf_chk` format read, type confusion, UAF, `realpath(buf, buf)` overflow, RWX page, glibc 2.23 |
| [`re_alloc`](re_alloc.md) | 200 | x86-64 | glibc-2.29 | Partial RELRO, Canary, NX, No PIE | `use-after-free`, `tcache-poisoning`, `got-overwrite` | x86-64 glibc 2.29; wrapper around `realloc()`; two allocation slots; Partial RELRO. | Target allows allocating, reallocating, and freeing 2 heap buffers. In `reallocate()`, calling `realloc(ptr, 0)` invokes `free(ptr)` under glibc 2.29, but the program does NOT clear the pointer if return is NULL, leaving a dangling pointer in the slot array. Partial RELRO allows GOT overwrites. | • **Path A (Tcache Poisoning → atoll@GOT Overwrite to printf then system):** `realloc(A, 0)` frees chunk A into tcache; `reallocate(A, 0x20, &atoll@got)` overwrites tcache `next` pointer with `atoll@GOT`. Allocate chunks to receive `atoll@GOT` chunk. Overwrite `atoll@GOT` with `printf@plt`. Input `%p` format strings to leak libc base. Re-poison tcache to overwrite `atoll@GOT` with `system`. Input `"/bin/sh"` to trigger `system("/bin/sh")`.<br>• **Path B (Realloc GOT to printf + ROP):** Overwrite `realloc@GOT` with `printf` to achieve stack leak and ROP.<br>• **Path C (Tcache Poison to __malloc_hook):** Overwrite `__malloc_hook` with one_gadget.<br><br>**Keywords:** `realloc(ptr, 0)` as free, glibc 2.29 tcache, tcache poisoning, `atoll@GOT`, `printf@plt` format leak, `system`, Partial RELRO |
| [`silver_bullet`](silver_bullet.md) | 200 | i386 | glibc-2.23 | Partial RELRO, No Canary, NX, No PIE | `off-by-one`, `stack-buffer-overflow`, `ret2libc` | i386 glibc 2.23; bullet power accumulation using `strncat`; buffer adjacent to length integer. | `create_bullet` reads up to 48 bytes into a 48-byte stack buffer and writes length into an integer `power` immediately following the buffer. `power_up` uses `strncat(buf, desc, 48 - power)`: `strncat` appends user data and ALWAYS writes a terminating NUL byte past the appended string. If `power` is 47, reading 1 byte appends 1 byte + 1 NUL byte, writing `\x00` into `power` (`power = 0`). | • **Path A (strncat Length Reset + ret2plt Leak + ret2libc):** Create bullet with 47 bytes (`power = 47`). Call `power_up` with 1 byte: `strncat` writes 1 byte + null terminator, resetting `power` to 0 while buffer now has 48 bytes. Call `power_up` a second time with 48 bytes: `48 - power = 48` bytes read, overflowing past saved EBP and return address. Overwrite return address with `puts@plt`, `main`, and `puts@got` argument. Beat the werewolf, trigger function return to leak libc base. Second iteration repeats overflow to call `system("/bin/sh")`.<br>• **Path B (Stack Pivot to BSS):** Pivot ESP into BSS buffer containing ROP chain.<br><br>**Keywords:** `strncat` off-by-null, length counter reset, stack buffer overflow, `puts@plt`, `puts@got`, ret2libc, `system("/bin/sh")` |
| [`starbound`](starbound.md) | 200 | i386 | glibc-2.23 | Partial RELRO, No Canary, NX, No PIE | `integer-overflow`, `stack-pivoting`, `rop` | i386 glibc 2.23; game settings menu; menu option read into signed integer; negative index in jump table. | Game configuration menu reads user selection via `read()` and converts to integer with `strtol()`. Menu jump table `funcs[]` stores function pointers. The option index is signed: passing negative values (e.g. `-33`) indexes backwards out-of-bounds relative to the table into user-controlled memory (like the name buffer in BSS/stack). | • **Path A (Negative Index Stack Pivot to User ROP Chain):** Provide negative index `-33` to index into player name buffer. Name buffer contains address of a stack pivot gadget (`add esp, 0x1c; ret` or `xchg esp, eax`). Pivot stack onto user-controlled ROP payload. ROP chain calls `puts@plt(puts@got)` to leak libc, then loops to `main` to execute `system("/bin/sh")`.<br>• **Path B (do_bye Format String Gadget):** Call `do_bye` gadget with controlled stack to trigger `printf` format string leak.<br>• **Path C (Direct ORW ROP):** Statically resolve or construct ROP chain without libc.<br><br>**Keywords:** signed integer underflow, negative jump table index, `strtol()`, stack pivot (`xchg esp, eax`), `puts@plt`, `puts@got`, ret2libc |
| [`tcache_tear`](tcache_tear.md) | 200 | x86-64 | glibc-2.27 | Full RELRO, Canary, NX, No PIE | `double-free`, `tcache-poisoning`, `arbitrary-write` | x86-64 glibc 2.27; allows 8 allocations and 8 frees; free does not check if already freed. | glibc 2.27 initial implementation of tcache lacked double-free checks (the `tcache_entry.key` check was introduced in glibc 2.29). `free()` in the binary frees user chunk pointers without clearing them or checking if already freed, allowing immediate tcache double-free. | • **Path A (Tcache Poison → Fake Unsorted Chunk in BSS → stdout Leak → __free_hook):** Allocate chunk A (size 0x50), free A twice (`free(A); free(A)`). Tcache is poisoned: write target address into A's `fd`. First target: forge a fake 0x500 chunk in BSS (set valid `prev_size`, `size = 0x501`, and forge next chunk size to satisfy chunk boundaries). Free the fake BSS chunk into unsorted bin; unsorted bin link writes `main_arena + 96` into BSS. Read BSS name buffer to leak libc base. Second target: poison tcache to overwrite `__free_hook` with `system`. Allocate chunk containing `"/bin/sh"`, call `free()` to get shell.<br>• **Path B (_IO_2_1_stdout_ FSOP Leak):** Poison tcache to overwrite `_IO_2_1_stdout_` flags and write buffer pointers to leak libc.<br><br>**Keywords:** glibc 2.27 tcache, double-free, tcache poisoning, fake unsorted chunk in BSS, `main_arena` leak, `__free_hook`, `system("/bin/sh")` |
| [`babystack`](babystack.md) | 250 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, PIE | `information-leak`, `brute-force-oracle`, `stack-buffer-overflow`, `rop` | x86-64; password check uses `strncmp` with attacker length; `strcpy` into shared frame. | Password check function reads up to 127 bytes, then uses `strncmp(input, password, strlen(input))` to verify password. Because `strlen(input)` determines comparison length, passing `\x00` (length 0) causes `strncmp` to return 0 (login succeeds immediately!). Furthermore, testing 1 byte at a time reveals whether the byte matches password or canary. Copy command uses `strcpy` to copy user buffer into stack buffer, allowing unbounded buffer overflow because source buffer can be larger than destination. | • **Path A (strncmp Byte-by-Byte Oracle + Shared Frame strcpy Overflow to ROP):** 1) Brute-force 16-byte random password byte-by-byte using `strncmp` oracle (256 attempts per byte). 2) Log in, leak stack/libc pointers left in uninitialized stack frame. 3) Brute-force 16-byte custom canary using same oracle. 4) Use `strcpy` overflow to overwrite saved RIP while preserving canary and password values, executing ROP chain (`pop rdi; ret` -> `/bin/sh` -> `system`).<br><br>**Keywords:** `strncmp` length oracle, byte-by-byte brute force, uninitialized stack leak, `strcpy` buffer overflow, custom canary preservation, ret2libc ROP |
| [`applestore`](applestore.md) | 300 | i386 | glibc-2.23 | Partial RELRO, Canary, NX, No PIE | `stack-pivoting`, `type-confusion`, `arbitrary-write`, `got-overwrite` | i386; checkout cart inserts stack-allocated iPhone 8 node; delete item unlinks node. | Shopping cart application maintains items in a doubly linked list (`struct item { char *name; int price; struct item *next; struct item *prev; }`). Checkout option offers special "iPhone 8" item ($7174) if cart total matches. The iPhone 8 item struct is allocated on the local stack frame of `checkout()`, NOT on the heap! When `checkout()` returns, this stack node remains linked in the global heap cart list. Deleting the item calls an unsafe doubly-linked list unlink: `node->next->prev = node->prev; node->prev->next = node->next`. | • **Path A (Stack Node Unlink + EBP Pivot to GOT Hijack):** Use `cart` command to print items; uninitialized pointers in stack item leak stack and libc addresses. Select `delete` on the stack item: control its `next` and `prev` pointers to trigger an arbitrary 4-byte write (`prev+12 = next; next+8 = prev`). Overwrite saved EBP of `delete()` with stack buffer containing fake stack frame. When `delete()` executes `leave; ret`, EBP pivots to user stack buffer, redirecting execution to `read@plt` or `my_read` to overwrite `atoi@GOT` with `system`, then enter `"/bin/sh"`.<br>• **Path B (Direct GOT Overwrite via Unlink):** Craft `next` and `prev` to write function pointer into GOT directly.<br><br>**Keywords:** stack node in heap linked list, unsafe unlink primitive, stack leak, libc leak, EBP pivot (`leave; ret`), `atoi@GOT`, `system("/bin/sh")` |
| [`death_note`](death_note.md) | 300 | i386 | static | Partial RELRO, Canary, NX, No PIE | `out-of-bounds-write`, `alpha-shellcode`, `got-overwrite` | Static 32-bit ELF; note contents restricted to printable ASCII (0x20-0x7e); negative index. | Note manager stores notes in array `notes[10]`. In `add_note` and `delete_note`, note index is signed and lacks lower-bound check: negative index (e.g. `-19`) accesses Global Offset Table (`GOT`). Content filter permits ONLY printable ASCII characters (`0x20 <= byte <= 0x7e`). Heap is mapped with `READ_IMPLIES_EXEC` (RWX heap). | • **Path A (Negative Index GOT Overwrite + Printable Self-Modifying Shellcode):** Negative index writes note heap address into `free@GOT` or `puts@GOT`. Note content must be 100% printable ASCII. Use printable instructions (`push`, `pop`, `xor`, `sub`) to construct registers. To generate non-printable `int 0x80` (`\xcd\x80`), use printable `xor [ecx+offset], reg` or `sub [ecx+offset], reg` arithmetic against printable memory bytes to dynamically self-modify code. Calling `delete_note` executes `free@GOT`, jumping to printable shellcode which unpacks `int 0x80` and invokes `execve("/bin/sh", 0, 0)`.<br><br>**Keywords:** negative array index, GOT overwrite, printable ASCII shellcode, self-modifying code, `READ_IMPLIES_EXEC`, `xor` arithmetic decoding, `int 0x80` |
| [`dubblesort`](dubblesort.md) | 300 | i386 | glibc-2.23 | Full RELRO, Canary, NX, PIE | `canary-bypass`, `stack-buffer-overflow`, `ret2libc` | i386 glibc 2.23; bubble sorts integer array; `scanf("%u")` in loop; stack canary present. | Reads user name into stack buffer without NUL-terminator, leaking libc via `printf`. Next, asks how many numbers to sort and reads integers into stack array using `scanf("%u", &arr[i])`. Canary is present. Vulnerability: `scanf("%u")` fails when reading non-digit characters (like `+` or `-`), leaving the array slot unmodified without advancing or crashing. | • **Path A (scanf Non-Numeric Canary Skip + Bubble Sort ret2libc):** Read name to leak libc base from uninitialized stack memory. Specify 35 numbers to sort (overwriting stack up to return address). For slots 0–23: input numbers smaller than canary. For slot 24 (canary location): send `+` or `-`: `scanf` skips writing, leaving the canary completely intact! For slots 25–34: send libc addresses (`system`, dummy return, `/bin/sh`). Bubble sort arranges numbers in non-decreasing order; as long as input numbers <= canary <= libc addresses, array order is preserved and return address executes `system("/bin/sh")`.<br><br>**Keywords:** uninitialized stack leak, `scanf("%u")` skip trick, canary bypass without overwrite, bubble sort payload ordering, ret2libc, Full RELRO |
| [`kidding`](kidding.md) | 300 | i386 | static | Partial RELRO, No Canary, NX, No PIE | `stack-buffer-overflow`, `rop`, `seccomp-bypass`, `reverse-shell` | Static 32-bit ELF; stdin/stdout/stderr closed (`close(0)`, `close(1)`, `close(2)`); stack overflow. | Binary calls `close(0)`, `close(1)`, `close(2)` (closing stdin, stdout, and stderr), then reads input into stack buffer via `sys_read(0, buf, 0x100)`. Stack buffer overflow directly overwrites return address. | • **Path A (ROP Reverse Shell via sys_socketcall):** Construct static ROP chain using `int 0x80` gadgets to invoke `sys_socketcall`: create AF_INET socket (`socket(AF_INET, SOCK_STREAM, 0)` -> fd 0), connect to remote listener IP/port (`connect(0, &sockaddr, 16)`), then `dup2(0, 0)`, `dup2(0, 1)`, `dup2(0, 2)` and `execve("/bin/sh", 0, 0)`.<br>• **Path B (_dl_make_stack_executable + Reverse Shellcode):** Call internal libc `_dl_make_stack_executable` or `mprotect` to make stack executable, jump to reverse shellcode.<br><br>**Keywords:** closed standard streams (`close(0/1/2)`), static ROP, `sys_socketcall`, reverse shell connect-back, `_dl_make_stack_executable`, `mprotect`, `int 0x80` |
| [`mno2`](mno2.md) | 300 | i386 | static | Partial RELRO, No Canary, NX, No PIE | `alpha-shellcode`, `seccomp-bypass` | Static 32-bit ELF; shellcode into fixed RWX BSS; alphanumeric and seccomp filters. | Reads shellcode into fixed RWX BSS buffer (`0x0804a060`). Content filter enforces strict alphanumeric ASCII check (`isupper() || islower() || isdigit()`). Seccomp sandbox allows only `open`, `read`, `write`, `exit`. | • **Path A (Alphanumeric Self-Modifying ORW Shellcode):** Use alphanumeric instructions (`push`, `pop`, `xor`, `sub`, `inc`, `dec`) to build register values. Dynamically patch memory to create `int 0x80` instructions. Execute ORW chain: `open("/home/mno2/flag", 0)` -> `read(fd, bss, 0x50)` -> `write(1, bss, 0x50)`.<br><br>**Keywords:** alphanumeric shellcode, seccomp sandbox, self-modifying code, RWX BSS, `int 0x80` memory patching, open-read-write |
| [`spirited_away`](spirited_away.md) | 300 | i386 | glibc-2.23 | Partial RELRO, Canary, NX, No PIE | `house-of-spirit`, `stack-buffer-overflow`, `ret2libc` | i386 glibc 2.23; feedback survey; `sprintf` length truncation overwriting name pointer. | Feedback survey reads `name`, `age`, `reason`, and `comment`. V1: `sprintf(buf, "%d %s %s...", ...)` overflow corrupts adjacent `name_comment_len` variable when `cnt` reaches 100, expanding allowable comment length to 0x6e. V2: `printf("%s", reason)` leaks stack address (`saved_ebp`) and libc pointer (`_IO_2_1_stdout_`). V3: Local pointer `name_ptr` on stack holds `malloc(0x3c)` buffer; comment overflow overwrites `name_ptr`. | • **Path A (House of Spirit on Stack Fake Chunk → ret2libc):** Iteration 1: Leak stack (`saved_ebp`) and libc (`_IO_2_1_stdout_`) via `reason` format print. Iterations 2–100: Send empty comments until loop counter increments `cnt` to 100, changing `name_comment_len` to 0x6e. Iteration 101: Forge a fake 0x40 fastbin chunk on stack within `reason` buffer; use oversized comment read to overwrite `name_ptr` with address of fake stack chunk. Program calls `free(name_ptr)`, inserting stack chunk into fastbin list! Next iteration `malloc(0x3c)` returns the stack fake chunk; input overwrites saved return address with `system("/bin/sh")`.<br><br>**Keywords:** `sprintf` length corruption, House of Spirit, fake fastbin chunk on stack, `name_ptr` overwrite, `_IO_2_1_stdout_` leak, ret2libc |
| [`alive_note`](alive_note.md) | 350 | i386 | glibc-2.23 | Partial RELRO, Canary, NX disabled, No PIE | `heap-buffer-overflow`, `alpha-shellcode`, `got-overwrite` | i386; notes limited to alphanumeric ASCII; negative index in note array reaching GOT. | Stores notes on heap (mapped RWX under Linux 32-bit). Only allows 8 bytes of data per note, and content must be strictly alphanumeric ASCII. Index check allows negative numbers, enabling writes relative to GOT. | • **Path A (Chained 3-byte Alphanumeric Jump Shellcode to Read Stager):** Negative index writes note address into `free@GOT`. Because each note only holds 8 bytes (and 4 bytes are chunk metadata), each note stores a 3-byte alphanumeric payload + a 2-byte short jump (`\x75\xXX` or `push reg; pop reg`) jumping to the next note chunk on the heap. Chain multiple note chunks together to form a stager that patches `int 0x80` and calls `read(0, esp, 0x100)` to execute unconstrained shellcode.<br>• **Path B (popad Frame Construction):** Use `popad` to load registers from memory.<br><br>**Keywords:** negative index GOT overwrite, 8-byte notes, alphanumeric shellcode, jump chaining across heap chunks, `free@GOT`, RWX heap, `read` stager |
| [`break_out`](break_out.md) | 350 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, PIE | `use-after-free`, `information-leak`, `fastbin-dup` | x86-64 glibc 2.23; prisoner note system; `punish` frees note but leaves pointer/size. | Prisoner cell note application. `punish` command frees the prisoner note chunk, but fails to clear `prisoner->note_ptr` or `prisoner->note_size`, causing Use-After-Free (UAF). Additionally, prisoner structs form a linked list where `next` pointers can be manipulated. | • **Path A (UAF Heap/Libc Leak + Fastbin Dup to __malloc_hook):** Allocate notes. Call `punish` to free note into fastbin/unsorted bin. Call `list` to print note content, leaking heap and libc base. Allocate reallocated chunk overlapping prisoner struct, corrupting fastbin `fd` pointer to point near `__malloc_hook` (using `0x7f` size field). Allocate twice to receive chunk over `__malloc_hook`, overwrite with one_gadget.<br>• **Path B (/proc/self/maps Leak + FSOP):** Read `/proc/self/maps` whitelist to leak bases, trigger FSOP on stdout.<br><br>**Keywords:** Use-After-Free, dangling pointer, fastbin duplication, `__malloc_hook` overwrite, one_gadget, `/proc/self/maps` leak |
| [`caov`](caov.md) | 350 | x86-64 | glibc-2.23 | Full RELRO, No Canary, NX, No PIE | `use-after-free`, `type-confusion`, `fastbin-dup` | x86-64 C++ glibc 2.23; `Data` class `operator=` returns object by value instead of reference. | C++ key-value database. Class `Data` implements copy assignment operator `Data& operator=(Data rhs)` with parameter passed by value (or returning by value) instead of by reference (`const Data&`). When assignment executes, a temporary object is constructed; upon returning, the temporary's destructor runs and `free()`s the live heap buffer, causing a double-free / UAF. | • **Path A (By-Value Assignment Temporary Destructor Double Free → Fastbin Dup to Fake Vtable):** Trigger copy assignment to free active `Data.value` buffer. Reallocate to leak heap and libc pointers. Exploit double-free to perform fastbin duplication into BSS `Data` object memory. Overwrite object virtual method table pointer to point to fake vtable containing `system`, trigger virtual method call with `"/bin/sh"` argument.<br>• **Path B (Stack-Reuse / Uninitialized Destructor via set_name):** Exploit uninitialized stack memory to corrupt object pointers.<br><br>**Keywords:** C++ `operator=`, temporary object destructor, double free, fastbin duplication, fake vtable hijack, BSS object corruption |
| [`heap_paradise`](heap_paradise.md) | 350 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, PIE | `off-by-null`, `fastbin-dup`, `io-file-exploit` | x86-64 glibc 2.23; allocations up to 0x78 (fastbin only); no view/show function; 1-byte null overflow. | Fastbin-only heap manager (allocates up to size 0x78). Has `allocate` and `free`, but NO `show`/`view` function. `allocate` allows single-byte off-by-null overflow into adjacent chunk's size field. | • **Path A (Off-by-Null Fastbin Consolidation + stdout FSOP Leak + __malloc_hook):** Allocate chunks A, B, C. Free A. Allocate chunk before B with off-by-null to shrink B's size header or clear prev_inuse. Trigger fastbin overlap so chunk C is freed while still referenced. Overwrite fastbin `fd` with 2-byte partial overwrite pointing to `_IO_2_1_stdout_` (targeting `\x25` or `0x7f` fake fastbin size). Allocate over stdout, overwrite `_IO_write_base` low byte to leak libc. Poison fastbin to allocate over `__malloc_hook`, write one_gadget.<br><br>**Keywords:** glibc 2.23, no-leak heap challenge, off-by-null, 2-byte partial overwrite, `_IO_2_1_stdout_` FSOP leak, fastbin dup, `__malloc_hook`, one_gadget |
| [`re_alloc_revenge`](re_alloc_revenge.md) | 350 | x86-64 | glibc-2.29 | Full RELRO, Canary, NX, PIE | `use-after-free`, `double-free`, `tcache-poisoning`, `io-file-exploit` | x86-64 glibc 2.29 Full RELRO; only two allocation slots; `realloc(ptr, 0)` bug retained. | Hardened version of `re_alloc` with Full RELRO and PIE enabled, retaining `realloc(ptr, 0)` UAF defect with only 2 allocation slots. | • **Path A (Tcache Poisoning → stdout Partial Overwrite → __free_hook):** Use `realloc(ptr, 0)` to free chunks into tcache without clearing pointers. Manipulate tcache count and forge large chunk size (e.g. 0x420) to bypass tcache into unsorted bin. Partial overwrite unsorted bin `fd` (2 bytes) to point to `_IO_2_1_stdout_`. Modify stdout buffer pointers to trigger libc leak upon next output. Poison tcache to overwrite `__free_hook` with one_gadget or `system`.<br>• **Path B (Tcache perthread_struct Poisoning):** Overwrite tcache control structures directly.<br><br>**Keywords:** glibc 2.29, Full RELRO, PIE, `realloc(ptr, 0)` UAF, unsorted bin placement, `_IO_2_1_stdout_` partial overwrite, `__free_hook`, one_gadget |
| [`secret_garden`](secret_garden.md) | 350 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, PIE | `double-free`, `fastbin-dup`, `one-gadget` | x86-64 glibc 2.23; flower management; `remove` frees flower name without clearing pointer. | Flower garden management. `remove_flower` frees flower name buffer (`free(flower->name)`), but sets flag `flower->deleted = 1` without clearing `flower->name`. Calling `remove_flower` again on same index checks `deleted`, but creating/cleaning allows double-free on name chunk into fastbin list. | • **Path A (Unsorted Bin Leak + Fastbin Dup to __malloc_hook):** Allocate 2 large flowers, free first into unsorted bin; printing flower name leaks `main_arena` libc address. Allocate two 0x70 fastbin chunks, perform double free (`free(A); free(B); free(A)`). Allocate to write fake chunk address `__malloc_hook - 0x23` (using `0x7f` size field). Allocate chunks from fastbin until receiving chunk over `__malloc_hook`; overwrite `__malloc_hook` with one_gadget, trigger `malloc()` to spawn shell.<br>• **Path B (Unsorted Bin Attack to global_max_fast):** Overwrite `global_max_fast` to turn all chunks into fastbins.<br><br>**Keywords:** fastbin double-free, unsorted bin leak, fastbin dup, `__malloc_hook - 0x23`, one_gadget, `global_max_fast` |
| [`ghost_party`](ghost_party.md) | 400 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, PIE | `type-confusion`, `use-after-free`, `vtable-hijack` | x86-64 C++ glibc 2.23; 8 derived classes of varying sizes; slot array reuse. | C++ game party manager with 8 derived classes (`Vampire`, `Alan`, `Devil`, `Zombie`, `Werewolf`, etc.) of varying sizes. V1: `Vampire` class is missing a copy constructor, causing shallow pointer copy and double-free / UAF. V2: Type confusion: program stores polymorphic objects in a fixed array and allows reusing freed slots with different derived classes without checking object type tags. | • **Path A (Derived Class Type Confusion + Vtable Hijack to system):** Trigger Vampire shallow copy double free to leak heap and libc pointers. Reallocate a different derived class (e.g. `Werewolf`) into the freed slot of another class. The mismatched struct offsets cause function pointer / vtable pointer fields to overlap user string data. Overwrite virtual table pointer with address of fake vtable in heap/BSS pointing to `system`, trigger virtual method call with `"/bin/sh"` string.<br>• **Path B (Alan Missing Destructor UAF):** Exploit `lightsaber` pointer UAF in `Alan`.<br><br>**Keywords:** C++ polymorphic classes, missing copy constructor, derived class type confusion, fake vtable, virtual method table hijack, `system("/bin/sh")` |
| [`printable`](printable.md) | 400 | x86-64 | glibc-2.23 | Full RELRO, No Canary, NX, No PIE | `format-string`, `fini-array-overwrite`, `stack-pivoting` | x86-64 glibc 2.23; single `printf(buf)` call; stdout is closed (`close(1)`); immediate exit. | Program reads format string into buffer, calls `printf(buf)`, and exits immediately. Standard output is closed (`close(1)`). | • **Path A (Blind Format String on stderr + .fini_array Loop + Stack Pivot ROP):** 1) Target `stderr` (which remains open, fd 2) using format string `%*c%n` writes. 2) Overwrite `_dl_fini` destructor or `.fini_array` entries to prevent immediate exit and re-execute `main`. 3) Overwrite `stdout` file descriptor or redirect `stderr` to achieve output leak. 4) Pivot stack to BSS and execute ROP chain to call `execve("/bin/sh", 0, 0)`.<br>• **Path B (Sequential Format String Retargeting Stack):** Loop through stack pointer chains without positional specifiers.<br><br>**Keywords:** blind format string, closed stdout (`close(1)`), `stderr` exploitation, `.fini_array` loop, `_dl_fini` hijack, stack pivot, ROP |
| [`secret_of_my_heart`](secret_of_my_heart.md) | 400 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, PIE | `off-by-null`, `heap-consolidation`, `fastbin-dup` | x86-64 glibc 2.23; secret note creation; reads `size` bytes then appends null byte. | Secret note manager allows adding, showing, and deleting notes. In `add_secret`, `read_input` reads `size` bytes and appends a single null byte at `buf[size]`: this is a classic off-by-null (poison null byte) vulnerability overwriting the adjacent chunk's `prev_inuse` bit and the low byte of `prev_size`. | • **Path A (Poison Null Byte Backward Heap Consolidation → Chunk Overlap → __malloc_hook):** Allocate chunk A (0x18), chunk B (0x100), chunk C (0xf0). Forge fake `prev_size` inside B. Free B. Write into A with off-by-null to clear C's `prev_inuse` bit and point `prev_size` to fake chunk. Free C: allocator triggers backward consolidation of C across live chunk B into fake chunk in B! Allocate chunk from consolidated unsorted bin to overlap active chunk. Leak libc via unsorted bin pointer. Perform fastbin duplication on overlapped chunk to allocate over `__malloc_hook`, overwrite with one_gadget.<br>• **Path B (House of Orange / FSOP):** Corrupt `_IO_list_all` directly.<br><br>**Keywords:** off-by-null, poison null byte, backward heap consolidation, `prev_inuse`, `prev_size`, chunk overlap, fastbin dup, `__malloc_hook`, one_gadget |
| [`seethefile`](seethefile.md) | 400 | i386 | glibc-2.23 | Partial RELRO, Canary, NX, No PIE | `io-file-exploit`, `vtable-hijack`, `arbitrary-write` | i386 glibc 2.23; file viewing utility; uses `fopen`, `fread`, `fclose`; Partial RELRO. | File viewing utility wraps `fopen`, `fread`, `fclose`. Reading `/proc/self/maps` reveals memory mappings (libc base, heap base, stack). BSS buffer overflow in exit routine allows overwriting global `FILE *fp` pointer with arbitrary address. | • **Path A (/proc/self/maps Leak + BSS Fake _IO_FILE vtable Hijack on fclose):** Read `/proc/self/maps` via file viewer to leak libc base address. In exit command, overflow BSS buffer to overwrite global file pointer `fp` to point to a fake `_IO_FILE` structure constructed in BSS (`0x0804b280`). In the fake FILE struct, point `vtable` pointer to a fake vtable where `__finish` or `__close` points to `system`. When `fclose(fp)` executes, it calls `fp->vtable->__finish(fp)`, invoking `system("/bin/sh")`.<br>• **Path B (Redirect __close instead of __finish):** Alternative FILE vtable slot targeting.<br><br>**Keywords:** `/proc/self/maps` leak, `FILE *` pointer overwrite, fake `_IO_FILE`, `_IO_file_jumps`, `fclose()` vtable hijack, `system("/bin/sh")` |
| [`wannaheap`](wannaheap.md) | 400 | x86-64 | glibc-2.24 | Full RELRO, Canary, NX, PIE | `off-by-null`, `heap-consolidation`, `arbitrary-write` | x86-64 glibc 2.24; binary treap implementation; off-by-null byte in key insertion; Full RELRO. | Binary treap implementation in glibc 2.24. Off-by-null byte during key insertion allows clearing `prev_inuse` bit of adjacent heap chunks. glibc 2.24 introduced vtable validation on `_IO_FILE` jump tables. | • **Path A (Off-by-Null Treap Consolidation + glibc 2.24 _IO_str_jumps FSOP / setcontext):** Exploit off-by-null to trigger backward consolidation across active treap nodes, gaining arbitrary write primitive. Bypass glibc 2.24 vtable validation by targeting `_IO_str_jumps` (valid libc vtable) or overwriting `__free_hook` / `_dl_open_hook`. Use `setcontext+53` gadget to pivot RSP into an open-read-write (ORW) ROP chain to extract the flag under seccomp.<br>• **Path B (_dl_open_hook via Unsorted Bin Attack):** Overwrite dynamic linker hooks.<br><br>**Keywords:** glibc 2.24, binary treap, off-by-null, backward consolidation, `_IO_str_jumps` vtable bypass, `_dl_open_hook`, `setcontext+53`, ORW ROP |
| [`babyallocator`](babyallocator.md) | 500 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, No PIE | `stack-exhaustion`, `heap-overlap`, `arbitrary-write` | x86-64 `-fsplit-stack` binary; recursion and `alloca`; `scanf` parsing. | Program is compiled with `-fsplit-stack` (GCC split stacks). Deep recursion uses `alloca()` to allocate dynamic stack frames. In split-stack binaries, when stack segment limit is exceeded, `__morestack` allocates a new stack segment via `mmap`. Memory allocation mismatch between split-stack management and `scanf` input buffers allows stack segment to overlap heap buffers. | • **Path A (Split-Stack Segment Heap Overlap → TLS Destructor / Return Overwrite):** Exhaust split-stack segments through controlled recursive allocations so dynamic stack frame overlaps mmapped heap memory. Modify saved return address or hijack TLS destructors (`__call_tls_dtors`) to execute ROP chain or stdout FSOP.<br>• **Path B (Stack-to-Heap Overwrite on _IO_2_1_stdin_):** Corrupt stdin FILE structure pointers.<br><br>**Keywords:** `-fsplit-stack`, split-stack segment exhaustion, `alloca()`, `__morestack`, heap-stack overlap, TLS destructor hijack, ROP |
| [`bash_revenge`](bash_revenge.md) | 500 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, PIE | `logic-flaw`, `file-descriptor-leak`, `command-injection` | Chroot sandbox with only custom bash binary; no external tools or `/dev/tcp`; flag on localhost:1337. | Chroot-jailed bash 4.3.0 without tools, `/dev/tcp`, or filesystem writes. Flag at `/flag` is root 400; root xinetd on `127.0.0.1:1337`. V1: CVE-2016-9401 in `popd +-N` out-of-range negative index executes `free(*(void**)(8*N))` on uninitialized pushd list, allowing arbitrary free of fixed BSS memory. V2: `localbuf[128]` at `0x6b7c40` holds raw input with NUL bytes. V3: Custom bash allocator (`union mhead`, magic `0x5555`). | • **Path A (localbuf Fake Chunk → SHELL_VAR Reclaim → Raw Socket Shellcode):** Forge valid bash allocator chunk in `localbuf[128]`. Free it via `popd +-(offset/8)`. Assign variables (`A=B`) to reclaim forged chunk as `SHELL_VAR` struct (`0x30`). Overwrite `SHELL_VAR.value` with `read@got` and read `$VAR` to leak libc. Overwrite `dynamic_value` with `setcontext+53` or `gets`. Trigger variable evaluation to pivot execution into ROP/shellcode that connects raw socket to `127.0.0.1:1337` and reads the flag.<br>• **Path B (Stdout Buffer Fake Chunk):** Forge chunk in stdout buffer via `printf` / `echo -ne`.<br>• **Path C (Bash Array / JOB Structure Hijack):** Reclaim as background JOB structure for `j_cleanup` RIP hijack.<br><br>**Keywords:** `CVE-2016-9401`, `popd`, custom bash malloc, `localbuf` (`0x6b7c40`), `SHELL_VAR`, `setcontext+53`, raw socket shellcode, chroot escape |
| [`bookwriter`](bookwriter.md) | 500 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, No PIE | `out-of-bounds-write`, `information-leak`, `house-of-orange`, `io-file-exploit` | x86-64 glibc 2.23; book editor; no `free()` exists; `strlen` used for edit size. | Book editor. V1: `edit_page` computes edit length via `strlen(page[idx])`, allowing writes past original allocation if string was expanded. V2: Author name read does not NUL-terminate, leaking heap pointer. V3: No `free()` function exists anywhere in the binary. | • **Path A (House of Orange → _IO_flush_all_lockp FSOP):** 1) Leak heap address via author name print. 2) Use `edit` length overflow to corrupt top chunk size header (e.g. set to `0xfa1`, page-aligned with prev_inuse set). 3) Allocate chunk larger than `0xfa0`: `sysmalloc` fails top chunk extension, freeing old top chunk into unsorted bin! 4) Allocate from unsorted bin, leaking `main_arena` libc pointer. 5) Forge fake `_IO_FILE` structure inside unsorted chunk: set `_mode <= 0`, `_IO_write_ptr > _IO_write_base`, forge fake vtable with `__overflow = system`, set file name/start to `"/bin/sh"`. 6) Trigger `malloc()` to abort, executing `_IO_flush_all_lockp` which calls `vtable->__overflow(fp)` -> `system("/bin/sh")`.<br>• **Path B (Unsorted Bin Attack to _IO_list_all):** Classic unsorted bin attack targeting `_IO_list_all`.<br><br>**Keywords:** House of Orange, top chunk size corruption, `sysmalloc` abort, unsorted bin leak, fake `_IO_FILE`, `_IO_flush_all_lockp`, vtable hijack, `system("/bin/sh")` |
| [`bounty_program_a`](bounty_program_a.md) | 500 | x86-64 | glibc-2.27 | Full RELRO, Canary, NX, PIE | `heap-buffer-overflow`, `tcache-poisoning`, `arbitrary-write` | x86-64 glibc 2.27; report comment parsing calls `calloc(1, -1)` on error; strtok state kept. | Bug bounty report manager under glibc 2.27. In `add_type`, allocating invalid size calls `calloc(1, -1)` which returns NULL on integer overflow, but the pointer error check fails to clear state, leaving a dangling pointer. Furthermore, `strtok(NULL, ...)` tokenizer state persists across commands, writing NUL bytes into heap chunk headers. | • **Path A (calloc(-1) UAF + strtok NUL Overwrite → Tcache Poisoning to __free_hook):** Exploit dangling pointer from failed allocation and `strtok` NUL injection to corrupt heap chunk boundaries and overlap active chunks. Leak libc via unsorted bin. Corrupt tcache `next` pointer to point to `__free_hook`, allocate chunk over `__free_hook`, write `system` or `one_gadget`, call `free()` to execute shell.<br>• **Path B (MD5 Contact Oracle):** Leak heap pointers using contact validation oracle.<br><br>**Keywords:** glibc 2.27, `calloc(1, -1)` integer overflow, `strtok` state persistence, heap chunk overlap, tcache poisoning, `__free_hook`, `system` |
| [`bounty_program_b`](bounty_program_b.md) | 500 | x86-64 | glibc-2.27 | Full RELRO, Canary, NX, PIE | `heap-buffer-overflow`, `unsorted-bin-attack`, `tcache-poisoning` | Hardened glibc 2.27; failed `calloc(1, -1)` + delimiter bug under FORTIFY_SOURCE. | Hardened successor to `bounty_program_a` compiled with `FORTIFY_SOURCE`. Fixes straightforward leaks while retaining `calloc(1, -1)` and `strtok` state retention defects. | • **Path A (Hardened Heap Overlap + Unsorted Bin Attack to __free_hook):** Construct complex heap layout to survive FORTIFY_SOURCE checks. Overlap heap chunks, perform unsorted bin attack to leak libc and corrupt allocator metadata, poison tcache to allocate over `__free_hook` and execute shell / ORW payload.<br>• **Path B (Fake Report Struct Reuse):** Reallocate fake report headers to bypass field assertions.<br><br>**Keywords:** glibc 2.27, FORTIFY_SOURCE, `calloc(1, -1)`, `strtok` delimiter corruption, unsorted bin attack, tcache poisoning, `__free_hook` |
| [`de_aslr`](de_aslr.md) | 500 | x86-64 | glibc-2.23 | Full RELRO, No Canary, NX, No PIE | `ret2dlresolve`, `rop`, `information-leak` | x86-64 glibc 2.23 Full RELRO; only `gets()` available; no output functions (no puts/printf/write). | Minimal binary with Full RELRO. Only function called is `gets(buf)` into a 16-byte stack buffer. Absolutely NO output functions exist (no `puts`, `printf`, `write`, `read`). | • **Path A (64-bit ret2dlresolve / Dynamic Linker Resolver Hijack):** Stack buffer overflow via `gets()`. Because Full RELRO is enabled, `.rela.plt` is read-only, but `_dl_runtime_resolve_sse` can be invoked with forged `Elf64_Rela` and `Elf64_Sym` structures placed in BSS. Forge relocation entry pointing to string `"system"`, trigger dynamic linker resolution to resolve and execute `system("/bin/sh")`.<br>• **Path B (Arithmetic Gadget Transform of gets into execve):** Pivot GOT to use arithmetic gadgets (`add [rdi], al` or similar) to transform resolved `gets` function pointer into `execve`, then call it.<br><br>**Keywords:** unbounded `gets()`, no leak / no output functions, Full RELRO, 64-bit ret2dlresolve, `_dl_runtime_resolve`, forged Elf64_Rela/Sym, GOT transformation |
| [`food_store`](food_store.md) | 500 | x86-64 | glibc-2.24 | Full RELRO, Canary, NX, PIE | `heap-buffer-overflow`, `unsorted-bin-attack`, `house-of-orange` | x86-64 glibc 2.24; recipe book manager; heap buffer overflow during recipe name/cook parsing. | Recipe manager under glibc 2.24. Heap buffer overflow during recipe ingredient and cooking instruction parsing. glibc 2.24 introduced vtable validation checks on `_IO_FILE` pointer jump tables. | • **Path A (House of Orange + glibc 2.24 _IO_str_jumps FSOP Bypass):** Overwrite top chunk size to trigger House of Orange and place unsorted chunk into arena. Forge fake `_IO_FILE` structure inside unsorted chunk. Because arbitrary vtables are blocked in glibc 2.24, point `vtable` to `_IO_str_jumps` (which is a valid glibc vtable), setting `_IO_str_overflow` fields to redirect execution to `system("/bin/sh")`.<br>• **Path B (Unsorted Bin Attack to mp_):** Attack memory parameter structures to alter allocation behavior.<br><br>**Keywords:** glibc 2.24, House of Orange, top chunk corruption, `_IO_FILE`, vtable validation bypass, `_IO_str_jumps`, `_IO_str_overflow`, `system("/bin/sh")` |
| [`hitcon_ftp`](hitcon_ftp.md) | 500 | x86-64 | glibc-2.27 | Full RELRO, Canary, NX, PIE | `heap-buffer-overflow`, `seccomp-bypass`, `rop` | x86-64 glibc 2.27; custom FTP server with msgpack packet serialization; seccomp filter active. | Custom FTP service communicating via msgpack packet serialization. Packet deserialization routine has integer/length calculation defects in `check_crc32` and `msgpack_object_print_buffer`, corrupting heap metadata. Strict seccomp sandbox allows only open, read, write. | • **Path A (Msgpack Heap Corruption → Seccomp ORW ROP Chain):** Exploit msgpack deserialization heap corruption to leak libc and stack addresses. Overwrite execution control pointer under seccomp sandbox to construct an open-read-write (ORW) ROP chain to read `/home/hitcon_ftp/flag` and write back to client socket.<br>• **Path B (Type Confusion in OACK Options):** Arbitrary memory disclosure via option parsing.<br><br>**Keywords:** msgpack deserialization, heap corruption, seccomp sandbox, open-read-write (ORW) ROP chain, `check_crc32` |
| [`seccomptools`](seccomptools.md) | 500 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, PIE | `arbitrary-write`, `seccomp-bypass`, `timing-side-channel` | x86-64 glibc 2.23; seccomp rule manager and disassembler; strict BPF filter limits syscalls. | Web/CLI seccomp inspection tool. Allows adding, inspecting, and executing BPF filter rules. Heap write primitive in rule management allows overwriting `__free_hook`. Strict seccomp policy terminates process on blocked syscalls. | • **Path A (BPF Filter Timing Side-Channel Oracle via __free_hook):** Overwrite `__free_hook` with address inside the seccomp rule evaluation engine. Construct a BPF filter that compares flag bytes against a guess; if match, enter an infinite loop or delay; if mismatch, exit immediately. Measure response latency (timing side-channel) to recover the entire flag byte-by-byte.<br>• **Path B (FSOP via BSS stream Overwrite):** Overwrite file stream pointer in BSS to trigger FSOP.<br><br>**Keywords:** BPF filter engine, timing side-channel oracle, `__free_hook` overwrite, seccomp execution timing, byte-by-byte memory disclosure |
| [`stupid_boss`](stupid_boss.md) | 500 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, PIE | `use-after-free`, `type-confusion`, `got-overwrite` | x86-64 glibc 2.23; employee management; employee deletion frees object without clearing global reference. | Employee management system with object hierarchy. `fire_employee` frees the employee object but leaves the pointer in the active company roster array, causing Use-After-Free (UAF). Additionally, `scanf` reads into uninitialized stack variables, leaking memory. | • **Path A (scanf Stack Leak + UAF Function Pointer Overwrite to system):** Use `scanf` uninitialized stack leak to recover libc base. Allocate note/task into freed employee object memory, overwriting the object's function pointer with `system` and the data field with `"/bin/sh"`. Call employee action to invoke `system("/bin/sh")`.<br>• **Path B (Type Confusion to __free_hook):** Exploit UAF to corrupt tcache/fastbin and write `__free_hook`.<br><br>**Keywords:** Use-After-Free, uninitialized stack leak, employee object structure, function pointer overwrite, `system("/bin/sh")` |
| [`unexploitable`](unexploitable.md) | 500 | x86-64 | glibc-2.23 | Partial RELRO, No Canary, NX, No PIE | `stack-buffer-overflow`, `srop`, `stack-pivoting` | x86-64 glibc 2.23; reads into small buffer; no output functions exist in binary; Partial RELRO. | Stripped minimal binary. Calls `sleep(3)` then `read(0, buf, 0x100)` into a 16-byte stack buffer. Absolutely NO output functions (no `puts`, `printf`, `write`). Partial RELRO with writable GOT. | • **Path A (ret2csu + SROP via read Return Value RAX=15):** 1) Stack buffer overflow into `ret2csu` gadgets (`__libc_csu_init`). 2) Use `ret2csu` to call `read(0, buf, 15)`: sending exactly 15 bytes causes `read()` to return 15, setting `RAX = 15` (the syscall number for `rt_sigreturn`). 3) Invoke `syscall` gadget: kernel restores a complete `sigcontext` frame forged on the stack, setting `RAX = 59` (`execve`), `RDI = &"/bin/sh"`, `RSI = 0`, `RDX = 0`, and `RIP = syscall`.<br>• **Path B (GOT Low-Byte Overwrite to Adjacent syscall):** Overwrite low byte of `read@got` to point to a `syscall; ret` gadget inside libc, then chain `execve`.<br><br>**Keywords:** no output functions, stack buffer overflow, `ret2csu`, Sigreturn-Oriented Programming (SROP), `read()` return value RAX=15, `rt_sigreturn`, `execve("/bin/sh")` |
| [`criticalheap_pp`](criticalheap_pp.md) | 600 | x86-64 | glibc-2.23 | Full RELRO, Canary, NX, No PIE | `type-confusion`, `use-after-free`, `arbitrary-write` | Hardened successor; real flag requires shell; `PWD=.` causes `realpath` heap overflow. | Hardened successor to `criticalheap`. Polymorphic C++ class destruction without virtual destructors leads to dangling pointer reuse and type confusion. Setting `PWD=.` causes `realpath(path, path)` to perform an off-heap buffer overflow on small heap allocations. | • **Path A (Realpath Heap Overflow → Fastbin Corruption to __malloc_hook):** Trigger `realpath` heap overflow to corrupt adjacent chunk metadata. Trigger fastbin corruption or unsafe unlink to allocate a chunk over `__malloc_hook`. Overwrite `__malloc_hook` with one_gadget to spawn a shell.<br>• **Path B (setenv/realloc Environment Controlled Alloc/Free):** Manipulate environment allocations to groom heap layout.<br><br>**Keywords:** polymorphic C++ destructor bug, `PWD=.`, `realpath` heap buffer overflow, fastbin corruption, unsafe unlink, `__malloc_hook`, one_gadget |
| [`digimon`](digimon.md) | 600 | x86-64 | glibc-2.23 | Partial RELRO, Canary, NX, PIE | `use-after-free`, `race-condition`, `vtable-hijack` | x86-64 C++ glibc 2.23; multi-threaded battle arena; task queue parser lacks NUL terminator. | Multi-threaded Digimon battle game. Battle threads run asynchronously. `read_line` misses NUL-termination, and `strtok` overwrites adjacent stack variables in the task parser. A race condition between concurrent battle threads frees Digimon partner structures while still referenced in the task queue, causing a Use-After-Free (UAF). | • **Path A (Thread Race Condition UAF + Vtable Pointer Overwrite to system):** Win race condition between battle thread and task queue to access freed Partner structure. Reclaim freed chunk with controlled task data, overwriting Digimon virtual method table pointer with a fake vtable pointing to `system`. Trigger action to invoke `system("/bin/sh")`.<br>• **Path B (Toolmon scanf Uninitialized Leak):** Leak stack/heap addresses via uninitialized input variables.<br><br>**Keywords:** multi-threading race condition, `strtok` stack overwrite, Use-After-Free, C++ virtual method table overwrite, `system("/bin/sh")` |
| [`omegago`](omegago.md) | 600 | x86-64 | glibc-2.23 | Partial RELRO, No Canary, NX, No PIE | `type-confusion`, `out-of-bounds-write`, `got-overwrite` | x86-64 glibc 2.23; Go board game logic; 19x19 board coordinate encoding. | 19x19 Go board game. Coordinate conversion logic has signed integer arithmetic and boundary flaws: out-of-bounds coordinate values bypass validation, allowing out-of-bounds array reads and writes relative to the board history array. Partial RELRO allows GOT overwrites. | • **Path A (Out-of-Bounds Coordinate GOT Overwrite to system):** Provide out-of-bounds board coordinates to index into the Global Offset Table (`GOT`). Overwrite GOT entry of a frequently called function (such as `puts@GOT` or `strlen@GOT`) with `system`. Input `"/bin/sh"` string to trigger shell.<br>• **Path B (House of Spirit via Board State):** Use board state to forge fake fastbin chunks and allocate arbitrary pointers.<br><br>**Keywords:** Go board coordinate confusion, out-of-bounds array indexing, GOT overwrite, `puts@GOT`, `system("/bin/sh")`, Partial RELRO |
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 196kUpdated Claude CodeCodexVerifiedInstall