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/safe_linking.py
View on GitHub#!/usr/bin/env python3
"""
safe_linking.py - glibc 2.32+ safe-linking encode/decode helper for tcache/fastbin fd.
Safe-linking stores a chunk's forward pointer as:
mangled = (chunk_addr >> 12) ^ next_ptr
To poison a freed chunk's fd so the next allocation lands at `target`, write
`encode(chunk_addr, target)` into the chunk's fd field. Decoding recovers the real
pointer from a leaked mangled value (and can recover the heap base from a leaked fd).
Also enforces the 2.32 alignment check: returned chunks must be 16-byte aligned.
Usage:
python3 safe_linking.py encode --chunk 0x555555559290 --target 0x7ffff7fae6a0
python3 safe_linking.py decode --mangled 0x555500055ad8 --chunk 0x555555559290
python3 safe_linking.py heapbase --mangled 0x55500005589 # recover heap base from a leaked fd
python3 safe_linking.py --import # use the encode()/decode() functions from your own exploit
Dependencies: none (pure Python 3).
"""
import argparse
import sys
def encode(chunk_addr: int, target: int) -> int:
"""Value to write into chunk.fd so malloc returns `target` next."""
if target & 0xf:
sys.stderr.write(f"[!] target {hex(target)} not 16-byte aligned -> 2.32 abort\n")
return (chunk_addr >> 12) ^ target
def decode(mangled: int, chunk_addr: int) -> int:
"""Recover the real next pointer from a mangled fd whose chunk addr is known."""
return (chunk_addr >> 12) ^ mangled
def recover_heap_base(leaked_fd: int) -> int:
"""A leaked *head* tcache fd (last chunk, next_ptr==0) equals (chunk_addr >> 12).
Reverse the >>12 to recover the heap page base (low 12 bits are 0)."""
return leaked_fd << 12
def main():
ap = argparse.ArgumentParser(description="glibc safe-linking helper")
sub = ap.add_subparsers(dest="cmd")
e = sub.add_parser("encode")
e.add_argument("--chunk", required=True)
e.add_argument("--target", required=True)
d = sub.add_parser("decode")
d.add_argument("--mangled", required=True)
d.add_argument("--chunk", required=True)
h = sub.add_parser("heapbase")
h.add_argument("--mangled", required=True)
args = ap.parse_args()
if args.cmd == "encode":
v = encode(int(args.chunk, 0), int(args.target, 0))
print(f"write into fd: {hex(v)}")
elif args.cmd == "decode":
v = decode(int(args.mangled, 0), int(args.chunk, 0))
print(f"real next ptr: {hex(v)}")
elif args.cmd == "heapbase":
print(f"heap base ~= {hex(recover_heap_base(int(args.mangled, 0)))}")
else:
ap.print_help()
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 |