ctf-pwn by ljagiello/ctf-skills
npx skills add https://github.com/ljagiello/ctf-skills --skill ctf-pwn二进制漏洞利用(pwn)CTF 挑战的快速参考。每种技术在此处都有一行描述;完整细节请参阅支持文件。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
__call_tls_dtorspthread -> 竞争条件usleep()/sleep() -> 时间窗口bash -c '{ echo "cmd1"; echo "cmd2"; sleep 1; } | nc host port'
gets(),scanf("%s"),strcpy()printf(user_input)| 保护机制 | 状态 | 影响 |
|---|---|---|
| PIE | 禁用 | 所有地址(GOT,PLT,函数)固定 - 直接覆盖有效 |
| RELRO | 部分 | GOT 可写 - GOT 覆盖攻击可能 |
| RELRO | 完全 | GOT 只读 - 需要替代目标(hooks,vtables,返回地址) |
| NX | 启用 | 无法在栈/堆上执行 shellcode - 使用 ROP 或 ret2win |
| 金丝雀 | 存在 | 栈粉碎被检测 - 需要泄露或避免栈溢出(使用堆) |
快速决策树:
__free_hook,__malloc_hook(glibc < 2.34),或返回地址cyclic 200 然后 cyclic -l <value>checksec --file=binary带魔法值的 ret2win: 溢出 -> ret(对齐)-> pop rdi; ret -> 魔法值 -> win()。完整利用代码见 overflow-basics.md。
栈对齐: 现代 glibc 需要 16 字节对齐;movaps 中的 SIGSEGV = 添加额外的 ret gadget。见 overflow-basics.md。
偏移计算: 缓冲区在 rbp - N,返回地址在 rbp + 8,总计 = N + 8。见 overflow-basics.md。
输入过滤: memmem() 检查会阻止某些字节序列;确保 payload 不包含被禁止的字符串。见 overflow-basics.md。
查找 gadget: ROPgadget --binary binary | grep "pop rdi",或使用 pwntools ROP(),它也能在 CMP 立即数中找到隐藏 gadget。见 overflow-basics.md。
模式: 对包含数据缓冲区和指针的结构体进行菜单创建/修改/删除。通过名称字段溢出到指针字段,填入 GOT 地址,然后通过修改写入 win 地址。完整利用和 GOT 目标选择表见 overflow-basics.md。
模式: scanf("%d") 没有符号检查;负数量 * 价格 = 负总额,绕过余额检查。见 overflow-basics.md。
模式: 溢出缓冲区与金丝雀之间的 valid 标志。使用 ./ 作为无操作路径填充以实现精确长度。完整利用链见 overflow-basics.md 和 advanced.md。
模式: 相邻的全局变量;通过额外的 CSV 分隔符溢出改变文件名指针。完整利用见 overflow-basics.md 和 advanced.md。
通过 puts@PLT(puts@GOT) 泄露 libc,返回到漏洞函数,第二阶段使用 system("/bin/sh")。完整的两阶段 ret2libc 模式、泄露解析和返回目标选择见 rop-and-shellcode.md。
原始系统调用 ROP: 当 system()/execve() 崩溃(CET/IBT)时,使用来自 libc 的 pop rax; ret + syscall; ret。见 rop-and-shellcode.md。
ret2csu: __libc_csu_init gadget 控制 rdx,rsi,edi 并调用任何 GOT 函数 — 无需 libc gadget 的通用 3 参数调用。见 rop-and-shellcode.md。
坏字符 XOR 绕过: 在写入 .data 之前用密钥 XOR payload 数据,然后用 ROP gadget 在原地 XOR 回来。避免空字节、换行符和其他过滤字符。见 rop-and-shellcode.md。
异类 gadget(BEXTR/XLAT/STOSB/PEXT): 当标准的 mov 写 gadget 不可用时,链接晦涩的 x86 指令进行逐字节内存写入。见 rop-and-shellcode.md。
栈转移(xchg rax,esp): 当溢出空间太小无法容纳完整 ROP 链时,将栈指针交换到攻击者控制的堆/缓冲区。需要 pop rax; ret 先加载转移地址。见 rop-and-shellcode.md。
rdx 控制: 在 puts() 之后,rdx 被破坏为 1。使用来自 libc 的 pop rdx; pop rbx; ret,或重新进入二进制的读取设置 + 栈转移。见 rop-and-shellcode.md。
Shell 交互: 在 execve 之后,sleep(1) 然后 sendline(b'cat /flag*')。见 rop-and-shellcode.md。
模式: 静态链接的二进制文件,函数极少且没有有用的 ROP gadget。Linux 内核将 vDSO 映射到每个进程中,其中包含可用的 gadget。从栈上的 AT_SYSINFO_EHDR(auxv 类型 0x21)泄露 vDSO 基址,转储 vDSO,提取用于 execve 的 gadget。vDSO 是内核特定的 — 始终转储远程副本。见 rop-advanced.md。
模式: 菜单创建/删除/查看,其中 free() 没有将指针置 NULL。创建 -> 泄露 -> 释放 -> 分配相同大小的对象以覆盖函数指针 -> 触发回调。关键:两个结构体必须大小相同才能被 tcache 重用。完整利用代码见 advanced.md。
当 seccomp 阻止 open()/read() 时的替代系统调用:openat() (257),openat2() (437,常被遗漏!),sendfile() (40),readv()/writev(),mmap() (9,将 flag 文件映射到内存而不是读取),pread64() (17)。
检查规则: seccomp-tools dump ./binary
快速参考见 rop-advanced.md,条件缓冲区地址限制、无重定位的 shellcode、scmp_arg_cmp 结构布局见 advanced.md。
模式: 二进制反转输入缓冲区。预反转 shellcode,使用部分 6 字节 RIP 覆盖,蹦床 jmp short 到 NOP 滑板。见 rop-advanced.md。
可写的 .fini_array + 任意写 -> 用 win/shellcode 地址覆盖。即使在完全 RELRO 下也有效。实现见 rop-advanced.md。
模式: 清理器在匹配到禁止字符后跳过下一个字符;双写字符以绕过(例如,....//....//etc//passwd)。如果二进制有 flag 文件描述符打开,也可以尝试 /proc/self/fd/3。见 advanced.md。
modprobe_path 覆盖(smallkirby/kernelpwn): 用恶意脚本路径覆盖 modprobe_path,然后 execve 一个前 4 字节不可打印的二进制文件。内核以 root 身份运行该脚本。需要 AAW;被 CONFIG_STATIC_USERMODEHELPER 阻止。见 kernel.md。
tty_struct kROP(smallkirby/kernelpwn): open("/dev/ptmx") 在 kmalloc-1024 中分配 tty_struct。用伪造的 vtable 覆盖 ops → ioctl() 劫持 RIP。通过 leave gadget 栈转移在 tty_struct 自身内构建两阶段 kROP。见 kernel.md。
userfaultfd 竞争稳定化(smallkirby/kernelpwn): 向 uffd 注册 mmap 区域。内核缺页阻塞线程 → 确定性的堆操作竞争窗口。见 kernel.md。
堆喷结构: tty_struct(kmalloc-1024,内核基址泄露),tty_file_private(kmalloc-32,内核堆泄露),poll_list(可变,通过链表任意释放),user_key_payload(可变,add_key() 控制的数据),seq_operations(kmalloc-32,内核基址泄露)。见 kernel.md。
ret2usr(hxp CTF 2020): 当 SMEP/SMAP 禁用时,从用户态函数直接调用 prepare_kernel_cred(0) → commit_creds(),然后 swapgs; iretq 以 root 身份返回。见 kernel.md。
内核 ROP 链(hxp CTF 2020): 启用 SMEP 时,构建 ROP:pop rdi; ret → 0 → prepare_kernel_cred → mov rdi, rax → commit_creds → swapgs → iretq → 用户态。见 kernel.md。
KPTI 绕过方法(hxp CTF 2020): 四种方法:swapgs_restore_regs_and_return_to_usermode + 22 蹦床,SIGSEGV 信号处理程序,通过 ROP 的 modprobe_path 覆盖,通过 ROP 的 core_pattern 管道。见 kernel.md。
FGKASLR 绕过(hxp CTF 2020): 早期的 .text 节 gadget 不受影响。通过多阶段利用中的 __ksymtab 相对偏移解析随机化的函数。见 kernel.md。
配置侦察: 检查 QEMU 脚本中的 SMEP/SMAP/KASLR/KPTI。通过 readelf -S vmlinux 节数量(30 vs 36000+)检测 FGKASLR。通过 grep modprobe_path /proc/kallsyms 检查 CONFIG_KALLSYMS_ALL。见 kernel.md。
通过易受攻击的 lseek 实现 OOB,使用 fork() 进行堆整理,SUID 利用。检查 CONFIG_SLAB_FREELIST_RANDOM 和 CONFIG_SLAB_MERGE_DEFAULT。见 advanced.md。
竞争窗口扩展(DiceCTF 2026): MADV_DONTNEED + mprotect() 循环强制在内核操作触及用户态内存期间重复缺页,将竞争窗口从亚毫秒级扩展到数十秒。见 kernel-techniques.md。
通过 CPU 分裂的跨缓存攻击(DiceCTF 2026): 在 CPU 0 上分配,从 CPU 1 释放 — 对象通过部分链表溢出从专用 SLUB 缓存逃逸到伙伴分配器。见 kernel-techniques.md。
PTE 重叠文件写(DiceCTF 2026): 将释放的页面回收为 PTE 页面,重叠匿名映射和文件支持映射 → 通过匿名侧写入在物理页面级别修改文件内容。见 kernel-techniques.md。
模式: 自定义 slab 分配器 + io_uring 工作线程。FLUSH 释放对象(UAF),通过 slab 回退实现类型混淆,在重用内存中构造 IORING_OP_OPENAT SQE。io_uring 信任来自用户态共享内存的 SQE 内容。见 advanced-exploits-2.md。
模式: 输入验证为 int32(>= 0),转换为 int16_t 进行边界检查。值 65534 通过 int32 检查,作为 int16_t 变为 -2 → OOB 数组访问。在容器化 ORW 链中使用 xchg rdi, rax; cld; ret gadget 动态捕获文件描述符。见 advanced-exploits-2.md。
%p.%p.%p.%p.%p.%p | 泄露特定:%7$p%n(4 字节),%hn(2 字节),%hhn(1 字节),%lln(8 字节完整 64 位)GOT 覆盖模式、盲打、过滤器绕过、金丝雀+PIE 泄露、__free_hook 覆盖和参数重定向见 format-string.md。
何时使用: GOT 地址包含坏字节(例如 0x0a)。修补 .rela.plt 符号索引 + .dynsym st_value 以将函数解析重定向到 win()。绕过所有 GOT 字节限制。完整技术和代码见 format-string.md。
__free_hook/__malloc_hook 被移除时,通过 _IO_wfile_jumps 进行 FSOP(文件流导向编程)。伪造 FILE,设置 _flags = " sh",vtable 链 → system(fp)。对于 SUID 二进制文件:使用 setcontext() 变体进行栈转移 → setuid(0) → system()(当 uid != euid 时 dash 会丢弃权限)。见 advanced.md。ptr ^ (chunk_addr >> 12)。strings libc.so.6 | grep GLIBCHouse of Orange: 损坏 top chunk 大小 → 大 malloc 强制 sysmalloc → 旧的 top 块被释放而不调用 free()。与 FSOP 链接。见 advanced.md。
House of Spirit: 在目标区域伪造假块,free() 它,重新分配以获得写访问权限。需要有效的大小 + 下一个块大小。见 advanced.md。
House of Lore: 损坏 smallbin bk → 链接假块 → 第二次 malloc 返回攻击者控制的地址。见 advanced.md。
ret2dlresolve: 伪造 Elf64_Sym/Rela 以解析任意 libc 函数而无需泄露。Ret2dlresolvePayload(elf, symbol="system", args=["/bin/sh"])。需要部分 RELRO。见 advanced.md。
tcache stashing unlink(glibc 2.29+): 在 tcache stashing 期间损坏 smallbin 块的 bk → 任意地址链接到 tcache → 写原语。见 advanced.md。
House of Apple 2 FSOP 链(+ setcontext SUID 变体)、House of Orange/Spirit/Lore、ret2dlresolve、tcache stashing unlink、自定义分配器利用(nginx 池)、通过进制转换实现堆重叠、树数据结构栈分配不足、通过 openat/mmap/write 和 mov rsp, rdx 栈转移实现 FSOP + seccomp 绕过见 advanced.md。
用于 tcache 投毒的 GF(2) 高斯消元: 当确定性 XOR 密码作为副作用损坏堆元数据时,将损坏建模为 GF(2) 上的线性代数。找到其组合 XOR 将 tcache fd 从当前值转换到目标地址的密码种子子集。见 advanced-exploits-2.md。
模式: 指令编码中的差一错误 -> 错位的机器码。将 shellcode 嵌入为减法操作的操作数字节,与 2 字节 jmp 指令链接。见 advanced.md。
BF JIT 不平衡括号: 不平衡的 ] 从栈中弹出磁带地址(RWX)→ 用 +/- 将 shellcode 写入磁带,触发 ] 跳转到它。见 advanced.md。
模式: 解释器设置错误的类型标签 → 结构体字段被重新解释。一个变体中未使用的填充字节在另一个变体中成为活动指针/数据。标志字节作为类型值触发 UNKNOWN_DATA 转储。见 advanced.md。
模式: 数组索引 0 映射到 entries[-1],与结构体元数据(大小字段)重叠。损坏的大小 → OOB 读取泄露金丝雀/libc,然后 OOB 写入放置 ROP 链。见 advanced.md。
模式: win() 检查 if (attempts++ > 0) — 需要两次调用。栈上放置两个返回地址:p64(win) + p64(win)。见 advanced.md。
模式: 二进制提供显式的读/写原语。通过 GOT 读取泄露 libc,用 system 覆盖 strtoll@GOT,下一次调用变为 system(user_input)。选择 GOT 目标时,该函数应将用户控制的字符串作为第一个参数。见 advanced-exploits-3.md。
模式: 具有只读原语和 memcpy(stack_buf, user_addr, user_len) 的二进制文件。通过 GOT 泄露 libc,通过 __environ 泄露栈,在输入缓冲区中植入 ROP 地址,溢出 memcpy 将它们复制到返回地址上,发送 EOF 触发返回。见 advanced-exploits-3.md。
模式: JIT 编译器将条件跳转偏移截断为 uint16,当代码超过 64KB 时导致错位。将 2 字节 shellcode 片段嵌入 add 立即数中,用 jmp $+3 链接执行。见 advanced-exploits-3.md。
Quick reference for binary exploitation (pwn) CTF challenges. Each technique has a one-liner here; see supporting files for full details.
__call_tls_dtors, custom shadow stack pointer overflow bypass, signed int overflow negative OOB heap write, XSS-to-binary pwn bridge, Windows SEH overwrite + pushad VirtualAlloc ROP, SeDebugPrivilege → SYSTEMpthread -> race conditionsusleep()/sleep() -> timing windowsbash -c '{ echo "cmd1"; echo "cmd2"; sleep 1; } | nc host port'
gets(), scanf("%s"), strcpy()printf(user_input)| Protection | Status | Implication |
|---|---|---|
| PIE | Disabled | All addresses (GOT, PLT, functions) are fixed - direct overwrites work |
| RELRO | Partial | GOT is writable - GOT overwrite attacks possible |
| RELRO | Full | GOT is read-only - need alternative targets (hooks, vtables, return addr) |
| NX | Enabled | Can't execute shellcode on stack/heap - use ROP or ret2win |
| Canary | Present | Stack smash detected - need leak or avoid stack overflow (use heap) |
Quick decision tree:
__free_hook, __malloc_hook (glibc < 2.34), or return addressescyclic 200 then cyclic -l <value>checksec --file=binaryret2win with magic value: Overflow -> ret (alignment) -> pop rdi; ret -> magic -> win(). See overflow-basics.md for full exploit code.
Stack alignment: Modern glibc needs 16-byte alignment; SIGSEGV in movaps = add extra ret gadget. See overflow-basics.md.
Offset calculation: Buffer at rbp - N, return at rbp + 8, total = N + 8. See overflow-basics.md.
Input filtering: memmem() checks block certain byte sequences; assert payload doesn't contain banned strings. See overflow-basics.md.
Finding gadgets: ROPgadget --binary binary | grep "pop rdi", or use pwntools ROP() which also finds hidden gadgets in CMP immediates. See overflow-basics.md.
Pattern: Menu create/modify/delete on structs with data buffer + pointer. Overflow name into pointer field with GOT address, then write win address via modify. See overflow-basics.md for full exploit and GOT target selection table.
Pattern: scanf("%d") without sign check; negative quantity * price = negative total, bypasses balance check. See overflow-basics.md.
Pattern: Overflow valid flag between buffer and canary. Use ./ as no-op path padding for precise length. See overflow-basics.md and advanced.md for full exploit chain.
Pattern: Adjacent global variables; overflow via extra CSV delimiters changes filename pointer. See overflow-basics.md and advanced.md for full exploit.
Leak libc via puts@PLT(puts@GOT), return to vuln, stage 2 with system("/bin/sh"). See rop-and-shellcode.md for full two-stage ret2libc pattern, leak parsing, and return target selection.
Raw syscall ROP: When system()/execve() crash (CET/IBT), use pop rax; ret + syscall; ret from libc. See rop-and-shellcode.md.
ret2csu: __libc_csu_init gadgets control rdx, rsi, edi and call any GOT function — universal 3-argument call without libc gadgets. See rop-and-shellcode.md.
Bad char XOR bypass: XOR payload data with key before writing to .data, then XOR back in place with ROP gadgets. Avoids null bytes, newlines, and other filtered characters. See rop-and-shellcode.md.
Exotic gadgets (BEXTR/XLAT/STOSB/PEXT): When standard mov write gadgets are unavailable, chain obscure x86 instructions for byte-by-byte memory writes. See rop-and-shellcode.md.
Stack pivot (xchg rax,esp): Swap stack pointer to attacker-controlled heap/buffer when overflow is too small for full ROP chain. Requires pop rax; ret to load pivot address first. See rop-and-shellcode.md.
rdx control: After puts(), rdx is clobbered to 1. Use pop rdx; pop rbx; ret from libc, or re-enter binary's read setup + stack pivot. See rop-and-shellcode.md.
Shell interaction: After execve, sleep(1) then sendline(b'cat /flag*'). See rop-and-shellcode.md.
Pattern: Statically-linked binary with minimal functions and no useful ROP gadgets. The Linux kernel maps a vDSO into every process, containing usable gadgets. Leak vDSO base from AT_SYSINFO_EHDR (auxv type 0x21) on the stack, dump the vDSO, extract gadgets for execve. vDSO is kernel-specific — always dump the remote copy. See rop-advanced.md.
Pattern: Menu create/delete/view where free() doesn't NULL pointer. Create -> leak -> free -> allocate same-size object to overwrite function pointer -> trigger callback. Key: both structs must be same size for tcache reuse. See advanced.md for full exploit code.
Alternative syscalls when seccomp blocks open()/read(): openat() (257), openat2() (437, often missed!), sendfile() (40), readv()/writev(), mmap() (9, map flag file into memory instead of read), pread64() (17).
Check rules: seccomp-tools dump ./binary
See rop-advanced.md for quick reference and advanced.md for conditional buffer address restrictions, shellcode without relocations, scmp_arg_cmp struct layout.
Pattern: Binary reverses input buffer. Pre-reverse shellcode, use partial 6-byte RIP overwrite, trampoline jmp short to NOP sled. See rop-advanced.md.
Writable .fini_array + arbitrary write -> overwrite with win/shellcode address. Works even with Full RELRO. See rop-advanced.md for implementation.
Pattern: Sanitizer skips char after banned char match; double chars to bypass (e.g., ....//....//etc//passwd). Also try /proc/self/fd/3 if binary has flag fd open. See advanced.md.
modprobe_path overwrite (smallkirby/kernelpwn): Overwrite modprobe_path with evil script path, then execve a binary with non-printable first 4 bytes. Kernel runs the script as root. Requires AAW; blocked by CONFIG_STATIC_USERMODEHELPER. See kernel.md.
tty_struct kROP (smallkirby/kernelpwn): open("/dev/ptmx") allocates tty_struct in kmalloc-1024. Overwrite ops with fake vtable → ioctl() hijacks RIP. Build two-phase kROP within tty_struct itself via leave gadget stack pivot. See kernel.md.
userfaultfd race stabilization (smallkirby/kernelpwn): Register mmap'd region with uffd. Kernel page fault blocks the thread → deterministic race window for heap manipulation. See kernel.md.
Heap spray structures: tty_struct (kmalloc-1024, kbase leak), tty_file_private (kmalloc-32, kheap leak), poll_list (variable, arbitrary free via linked list), user_key_payload (variable, add_key() controlled data), seq_operations (kmalloc-32, kbase leak). See kernel.md.
ret2usr (hxp CTF 2020): When SMEP/SMAP are disabled, call prepare_kernel_cred(0) → commit_creds() directly from userland function, then swapgs; iretq to return as root. See kernel.md.
Kernel ROP chain (hxp CTF 2020): With SMEP, build ROP: pop rdi; ret → 0 → prepare_kernel_cred → mov rdi, rax → commit_creds → swapgs → iretq → userland. See kernel.md.
KPTI bypass methods (hxp CTF 2020): Four approaches: swapgs_restore_regs_and_return_to_usermode + 22 trampoline, SIGSEGV signal handler, modprobe_path overwrite via ROP, core_pattern pipe via ROP. See kernel.md.
FGKASLR bypass (hxp CTF 2020): Early .text section gadgets are unaffected. Resolve randomized functions via __ksymtab relative offsets in multi-stage exploit. See kernel.md.
Config recon: Check QEMU script for SMEP/SMAP/KASLR/KPTI. Detect FGKASLR via readelf -S vmlinux section count (30 vs 36000+). Check CONFIG_KALLSYMS_ALL via grep modprobe_path /proc/kallsyms. See kernel.md.
OOB via vulnerable lseek, heap grooming with fork(), SUID exploits. Check CONFIG_SLAB_FREELIST_RANDOM and CONFIG_SLAB_MERGE_DEFAULT. See advanced.md.
Race window extension (DiceCTF 2026): MADV_DONTNEED + mprotect() loop forces repeated page faults during kernel operations touching userland memory, extending race windows from sub-ms to tens of seconds. See kernel-techniques.md.
Cross-cache via CPU split (DiceCTF 2026): Allocate on CPU 0, free from CPU 1 — objects escape dedicated SLUB caches via partial list overflow → buddy allocator. See kernel-techniques.md.
PTE overlap file write (DiceCTF 2026): Reclaim freed page as PTE page, overlap anonymous + file-backed mappings → write through anonymous side modifies file content at physical page level. See kernel-techniques.md.
Pattern: Custom slab allocator + io_uring worker thread. FLUSH frees objects (UAF), type confusion via slab fallback, craft IORING_OP_OPENAT SQE in reused memory. io_uring trusts SQE contents from userland shared memory. See advanced-exploits-2.md.
Pattern: Input validated as int32 (>= 0), cast to int16_t for bounds check. Value 65534 passes int32 check, becomes -2 as int16_t → OOB array access. Use xchg rdi, rax; cld; ret gadget for dynamic fd capture in containerized ORW chains. See advanced-exploits-2.md.
%p.%p.%p.%p.%p.%p | Leak specific: %7$p%n (4-byte), %hn (2-byte), %hhn (1-byte), %lln (8-byte full 64-bit)See format-string.md for GOT overwrite patterns, blind pwn, filter bypass, canary+PIE leak, __free_hook overwrite, and argument retargeting.
When to use: GOT addresses contain bad bytes (e.g., 0x0a). Patch .rela.plt symbol index + .dynsym st_value to redirect function resolution to win(). Bypasses all GOT byte restrictions. See format-string.md for full technique and code.
_IO_wfile_jumps when __free_hook/__malloc_hook removed. Fake FILE with _flags = " sh", vtable chain → system(fp). For SUID binaries: use setcontext() variant to stack pivot → setuid(0) → system() (dash drops privs when uid != euid). See advanced.md.House of Orange: Corrupt top chunk size → large malloc forces sysmalloc → old top freed without calling free(). Chain with FSOP. See advanced.md.
House of Spirit: Forge fake chunk in target area, free() it, reallocate to get write access. Requires valid size + next chunk size. See advanced.md.
House of Lore: Corrupt smallbin bk → link fake chunk → second malloc returns attacker-controlled address. See advanced.md.
ret2dlresolve: Forge Elf64_Sym/Rela to resolve arbitrary libc function without leak. Ret2dlresolvePayload(elf, symbol="system", args=["/bin/sh"]). Requires Partial RELRO. See advanced.md.
tcache stashing unlink (glibc 2.29+): Corrupt smallbin chunk's bk during tcache stashing → arbitrary address linked into tcache → write primitive. See advanced.md.
See advanced.md for House of Apple 2 FSOP chain (+ setcontext SUID variant), House of Orange/Spirit/Lore, ret2dlresolve, tcache stashing unlink, custom allocator exploitation (nginx pools), heap overlap via base conversion, tree data structure stack underallocation, FSOP + seccomp bypass via openat/mmap/write with mov rsp, rdx stack pivot.
GF(2) Gaussian elimination for tcache poisoning: When a deterministic XOR cipher corrupts heap metadata as a side effect, model the corruption as linear algebra over GF(2). Find a subset of cipher seeds whose combined XOR transforms tcache fd from current value to target address. See advanced-exploits-2.md.
Pattern: Off-by-one in instruction encoding -> misaligned machine code. Embed shellcode as operand bytes of subtraction operations, chain with 2-byte jmp instructions. See advanced.md.
BF JIT unbalanced bracket: Unbalanced ] pops tape address (RWX) from stack → write shellcode to tape with +/-, trigger ] to jump to it. See advanced.md.
Pattern: Interpreter sets wrong type tag → struct fields reinterpreted. Unused padding bytes in one variant become active pointers/data in another. Flag bytes as type value trigger UNKNOWN_DATA dump. See advanced.md.
Pattern: Array index 0 maps to entries[-1], overlapping struct metadata (size field). Corrupted size → OOB read leaks canary/libc, then OOB write places ROP chain. See advanced.md.
Pattern: win() checks if (attempts++ > 0) — needs two calls. Stack two return addresses: p64(win) + p64(win). See advanced.md.
Pattern: Binary provides explicit read/write primitives. Leak libc via GOT read, overwrite strtoll@GOT with system, next call becomes system(user_input). Choose GOT targets where the function takes a user-controlled string as first arg. See advanced-exploits-3.md.
Pattern: Binary with read-only primitive and memcpy(stack_buf, user_addr, user_len). Leak libc via GOT, leak stack via __environ, plant ROP addresses in input buffer, overflow memcpy to copy them over return address, send EOF to trigger return. See advanced-exploits-3.md.
Pattern: JIT compiler truncates conditional jump offset to uint16, causing misalignment when code exceeds 64KB. Embed 2-byte shellcode fragments in add immediates, thread with jmp $+3 to chain execution. See advanced-exploits-3.md.
Pattern: Custom DNS server doesn't track decompressed name length. Compression pointer chains revisit data, overflowing stack buffer. Split ROP chain across multiple DNS question entries. See advanced-exploits-3.md.
Pattern: Signing scheme hashes section headers/content but not program headers. Append shellcode, modify LOAD segment's p_offset to point to appended data — signature still valid, loader executes attacker code. See advanced-exploits-3.md.
Pattern: Level editor parses signed integer coordinates but bounds-checks via unsigned comparison — negative coordinates pass the check and write block IDs (arbitrary bytes) before the level array, enabling stack return address overwrite. Leak stack address via hidden developer mode, encode shellcode as block IDs. See advanced-exploits-3.md.
Pattern: Service reads secret into memfd_create() FD without MFD_CLOEXEC, then calls system() for user commands — child inherits the FD. Bypass strstr() keyword filters with shell quote splitting (p'r'oc instead of proc) to read /proc/self/fd/N. See advanced-exploits-3.md.
Pattern: Metadata parser's to_int32 converts unsigned values >= 0x80000000 to negative signed integers. Used as array index/offset, this causes OOB memory access. Iterate byte-by-byte to leak flag from memory. See advanced-exploits-3.md.
Pattern: Binary with only read() primitive — no write, no win function. Leak libc via GOT, then "import" arbitrary byte values onto the stack by reading from libc offsets whose content matches desired ROP gadget addresses. Read primitive doubles as write primitive. See advanced-exploits-3.md.
Pattern: Brainfuck/Pikalang interpreter with unbounded tape = arbitrary read/write relative to buffer base. Move pointer to GOT, overwrite byte-by-byte with system(). See advanced.md.
Pattern: Many AAAA records overflow stack buffer in DNS response parser. Set up DNS server with excessive records, overwrite return address. See advanced.md.
Pattern: Binary with AddressSanitizer has format string + OOB write. ASAN may use "fake stack" (50% chance). Leak PIE, detect real vs fake stack, calculate OOB write offset to overwrite return address. See advanced.md.
Pattern (Encodinator): Base85-encoded input in RWX memory passed to printf(). Write shellcode to RWX region, overwrite .fini_array[0] via format string %hn writes. Use convergence loop for base85 argument numbering. See advanced.md.
Pattern: Buffer overflow must preserve known canary value. Write exact canary bytes at correct offset: b'A' * 64 + b'BIRD' + b'X'. See advanced.md.
Pattern (Hashchain): Brute-force MD5 preimages with eb 0c prefix (jmp +12) to skip middle bytes; bytes 14-15 become 2-byte i386 instructions. Build syscall chains from gadgets like 31c0 (xor eax), cd80 (int 0x80). See advanced.md for C code and v2 technique.
AST bypass via f-strings, audit hook bypass with b'flag.txt' (bytes vs str), MRO-based __builtins__ recovery. See sandbox-escape.md.
Pattern: Custom VM with NEWBUF/SLICE/GC opcodes. Slicing creates shared slab reference; dropping+GC'ing slice frees slab while parent still holds it. Allocate function object to reuse slab, leak code pointer via UAF read, overwrite with win() address. See advanced.md.
Pattern: Mark-compact GC follows null references to heap address 0, creating fake object. During compaction, memmove cascades corruption through adjacent object headers → OOB access → libc leak → FSOP. See advanced.md.
Pattern: String processing function with user-controlled stride skips past null terminator, leaking stack canary and return address one byte at a time. Then overflow with leaked values. See overflow-basics.md.
Pattern: When payload must be valid UTF-8 (Rust binaries, JSON parsers), use SROP — only 3 gadgets needed. Multi-byte UTF-8 sequences spanning register field boundaries "fix" high bytes. See rop-advanced.md.
Pattern: Custom VM with OOB read/write in syscalls. Leak PIE via XOR-encoded function pointer, overflow to rewrite pointer with win() ^ KEY. See sandbox-escape.md.
Look for cuse_lowlevel_main() / fuse_main(), backdoor write handlers with command parsing. Exploit to chmod /etc/passwd then modify for root access. See sandbox-escape.md.
Find writable paths via character devices, target /etc/passwd or /etc/sudoers, modify permissions then content. See sandbox-escape.md.
exec<&3;sh>&3 for fd redirection, $0 instead of sh, ls -la /proc/self/fd to find correct fd. See sandbox-escape.md.
Pattern: Small overflow (only RBP + RIP). Overwrite RBP → BSS address, RIP → leave; ret gadget. leave sets RSP = RBP (BSS). Second stage at BSS calls fgets(BSS+offset, large_size, stdin) to load full ROP chain. See rop-advanced.md.
Pattern: Seccomp blocks 64-bit syscalls (open, execve). Use retf gadget to load CS=0x23 (IA-32e compatibility mode). In 32-bit mode, int 0x80 uses different syscall numbers (open=5, read=3, write=4) not covered by the filter. Requires mprotect to make BSS executable for 32-bit shellcode. See rop-advanced.md.
Pattern: No libc leak available. Chain multiple fgets(addr, 7, stdin) calls via ROP to construct fake stdout FILE struct on BSS. Set _IO_write_base to GOT entry, call fflush(stdout) → leaks GOT content → libc base. The 7-byte writes avoid null byte corruption since libc pointer MSBs are already \x00. See advanced-exploits-2.md.
Pattern: Size field stored as signed char, cast to unsigned char for use. size = -112 → (unsigned char)(-112) = 144, overflowing a 127-byte buffer by 17 bytes. Combine with XOR keystream brute-force for byte-precise writes, forge chunk sizes for unsorted bin promotion (libc leak), FSOP stdout for TLS leak, and TLS destructor (__call_tls_dtors) overwrite for RCE. See advanced-exploits-2.md.
__call_tls_dtorsPattern: Alternative to House of Apple 2 on glibc 2.34+. Forge __tls_dtor_list entries with pointer-guard-mangled function pointers: encoded = rol(target ^ pointer_guard, 0x11). Requires leaking pointer guard from TLS segment (via FSOP stdout redirection). Each node calls PTR_DEMANGLE(func)(obj) on exit. See advanced-exploits-2.md.
Pattern (Canvas of Fear): Index formula y * width + x in signed 32-bit int overflows to negative value, passing bounds check and writing backward into heap metadata. Use to corrupt adjacent chunk sizes/pointers, leak libc via unsorted bin, redirect a data pointer to environ for stack leak, then write ROP chain to main's return address. When binary is behind a web API, chain XSS → Fetch API → heap exploit, and inject \n in API parameters for command stacking via sendline().
See advanced-exploits-2.md for full exploit chain, XSS bridge pattern, and RGB pixel write primitive.
Pattern (Revenant): Userland shadow stack in .bss with unbounded pointer. Recurse to advance shadow_stack_ptr past the array into user-controlled memory (e.g., username buffer), write win() there, then overflow the hardware stack return address to match. Both checks pass.
# Iterate (target_addr - shadow_stack_base) // 8 times to overflow pointer
for i in range(512):
io.sendlineafter(b"Survivor name:\n", fit(exe.symbols["win"]))
io.sendlineafter(b"[0] Flee", b"4") # recurse
See advanced-exploits-2.md for full exploit and .bss layout analysis.
Format string leak defeats ASLR. SEH (Structured Exception Handler) overwrite with stack pivot to ROP chain. pushad builds VirtualAlloc call frame for DEP (Data Execution Prevention) bypass. Detached process launcher for shell stability on thread-based servers. See advanced-exploits-2.md.
SeDebugPrivilege + Meterpreter migrate -N winlogon.exe → SYSTEM. See advanced-exploits-2.md.
checksec, one_gadget, ropper, ROPgadget, seccomp-tools dump, strings libc | grep GLIBC. See rop-advanced.md for full command list and pwntools template.
Weekly Installs
616
Repository
GitHub Stars
629
First Seen
Feb 1, 2026
Security Audits
Gen Agent Trust HubPassSocketFailSnykFail
Installed on
codex604
opencode603
github-copilot590
gemini-cli589
amp588
kimi-cli587
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
103,800 周安装
ptr ^ (chunk_addr >> 12).strings libc.so.6 | grep GLIBC