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/offset_finder.py
View on GitHub#!/usr/bin/env python3
"""
offset_finder.py - Auto-discover the saved-RIP offset of a stack buffer overflow.
Sends a De Bruijn (cyclic) pattern to a local process or remote service, catches the
crash, reads the faulting return address from the core dump (local) or from a supplied
RSP/RIP value, and reports the exact offset to RIP and (if PIE/canary) what was clobbered.
Usage:
python3 offset_finder.py ./target # local process, auto core analysis
python3 offset_finder.py ./target --length 400 # bigger pattern
python3 offset_finder.py --remote host:1337 --send-after '> ' # remote, manual fault
python3 offset_finder.py --value 0x6161616c6161616b # offset from a known qword
Dependencies: pwntools (pip install pwntools)
Notes: enable cores locally with `ulimit -c unlimited` and a sane core_pattern.
"""
import argparse
import sys
try:
from pwn import context, process, remote, cyclic, cyclic_find, ELF, log, core, p64, u64
except ImportError:
sys.exit("[!] pwntools required: pip install pwntools")
def offset_from_value(val, length):
pat = cyclic(length, n=8) # 8-byte stride for amd64
try:
off = cyclic_find(val, n=8)
except Exception:
off = cyclic_find(val & 0xffffffff, n=4)
if off < 0:
log.failure(f"value {hex(val)} not found in pattern of length {length}")
return None
log.success(f"offset to controlled value = {off}")
return off
def local_core(binary, length):
context.binary = ELF(binary)
context.arch = context.binary.arch
pat = cyclic(length, n=8)
io = process(binary)
io.sendline(pat)
io.wait()
c = io.corefile
fault_pc = c.pc
fault_sp = c.sp
log.info(f"crash: pc={hex(fault_pc)} sp={hex(fault_sp)}")
# Prefer the value sitting at RSP (the consumed saved-RIP slot) for the offset.
sp_val = u64(c.read(fault_sp, 8))
off = cyclic_find(sp_val & 0xffffffffffff, n=8)
if off < 0:
off = cyclic_find(fault_pc & 0xffffffff, n=8)
if off >= 0:
log.success(f"saved-RIP offset = {off}")
log.info(f" payload layout: b'A'*{off} + p64(return_target)")
else:
log.warning("could not auto-resolve; inspect core manually (pc/sp above)")
return off
def remote_manual(target, length, send_after):
host, port = target.split(":")
pat = cyclic(length, n=8)
io = remote(host, int(port))
if send_after:
io.recvuntil(send_after.encode())
io.sendline(pat)
log.info("pattern sent. Capture the faulting RIP/RSP from the debugger on the target,")
log.info("then re-run with --value 0x<qword> to compute the offset.")
try:
log.info("service response: " + repr(io.recvrepeat(timeout=2)))
except Exception:
pass
io.close()
def main():
ap = argparse.ArgumentParser(description="Auto stack-overflow offset finder")
ap.add_argument("binary", nargs="?", help="local target binary")
ap.add_argument("--length", type=int, default=200, help="cyclic pattern length")
ap.add_argument("--remote", help="host:port for a remote service")
ap.add_argument("--send-after", help="recvuntil this string before sending")
ap.add_argument("--value", help="known faulting qword (hex) to resolve offset")
args = ap.parse_args()
if args.value:
offset_from_value(int(args.value, 0), max(args.length, 4096))
elif args.remote:
remote_manual(args.remote, args.length, args.send_after)
elif args.binary:
local_core(args.binary, args.length)
else:
ap.error("provide a binary, --remote, or --value")
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 |