offensive-toctou

Featured

Time-of-Check / Time-of-Use (TOCTOU) race condition exploitation methodology across binary, kernel, filesystem, web, and container layers. Covers symbolic-link races (open/access/stat split), file-descriptor races, fopen/realpath traversal races, /proc and procfs races, FUSE-backed slow-fs races to widen the window, ptrace and signal races, kernel double-fetch / userspace pointer races, container/runc/symlink escape primitives, kubernetes admission/authz TOCTOU, web auth-vs-authz TOCTOU, JWT-claim TOCTOU at gateway vs service, payment/idempotency races, and modern race-amplification techniques (single-packet attack, slow loris, FUSE pause, cgroup freeze, scheduler shaping). Use when you've identified a 'check then act' pattern in code, when fuzzing for race conditions, or when exploiting concurrency bugs in privileged binaries / kernel / orchestrators.

Data & Documents 719 stars 91 forks Updated 1 months ago MIT

Install

View on GitHub

Quality Score: 87/100

Stars 20%
95
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# TOCTOU — Time-of-Check / Time-of-Use Exploitation A TOCTOU bug exists wherever code checks a property (file owner, path target, token validity, balance) and then acts on it as if the property still holds. Between check and use is a window — your job is to widen it and swap the underlying object. ## Quick Workflow 1. Identify the **check** (syscall, function, validation step) and the **use** (the privileged action) 2. Confirm the check and use don't operate on the same kernel object (FD, inode, atomic snapshot) 3. Build a primitive that swaps the object between check and use (symlink, mount, mv, parallel request) 4. **Widen the window** with FUSE, slow filesystems, scheduler tricks, or single-packet HTTP/2 5. Run a tight loop and confirm the post-use state corresponds to the swapped target --- ## The Core Pattern ```c // Vulnerable if (access(path, W_OK) == 0) { // check — resolves "path" now fd = open(path, O_WRONLY); // use — re-resolves "path" later write(fd, attacker_data, n); } ``` Between `access` and `open`, an attacker replaces `path` with a symlink to `/etc/shadow`. The check sees an attacker-owned file; the use opens shadow as root. The fix is always: **operate on the kernel object, not the path.** Use `O_NOFOLLOW`, `openat` with `AT_SYMLINK_NOFOLLOW`, `fstat` on the FD, etc. --- ## Filesystem TOCTOU ### Symlink Swap (Classic) ```bash # Setup target — privileged binary that writes to user-supplied path after access() check victim --o...

Details

Author
0xwilliamortiz
Repository
0xwilliamortiz/claude-red
Created
1 months ago
Last Updated
1 months ago
Language
JavaScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Data & Documents Featured

offensive-toctou

Time-of-Check / Time-of-Use (TOCTOU) race condition exploitation methodology across binary, kernel, filesystem, web, and container layers. Covers symbolic-link races (open/access/stat split), file-descriptor races, fopen/realpath traversal races, /proc and procfs races, FUSE-backed slow-fs races to widen the window, ptrace and signal races, kernel double-fetch / userspace pointer races, container/runc/symlink escape primitives, kubernetes admission/authz TOCTOU, web auth-vs-authz TOCTOU, JWT-claim TOCTOU at gateway vs service, payment/idempotency races, and modern race-amplification techniques (single-packet attack, slow loris, FUSE pause, cgroup freeze, scheduler shaping). Use when you've identified a 'check then act' pattern in code, when fuzzing for race conditions, or when exploiting concurrency bugs in privileged binaries / kernel / orchestrators.

6,950 Updated 6 days ago
SnailSploit
Data & Documents Listed

security-race-and-toctou

Design controlled concurrency tests for authorization reuse, check/use identity changes, and non-atomic state transitions. Use for one-use grants, filesystem snapshots, competing reservations, or cancellation races. Not a broad penetration test or kernel exploitation workflow.

0 Updated 1 weeks ago
dills122
AI & Automation Listed

detecting-race-conditions

Find concurrency and time-of-check/time-of-use bugs - TOCTOU, unsynchronized shared state, check-then-act, and atomicity violations - by reasoning about what state is shared, what can interleave, and where a window opens between a check and its use. Use on an authorized source target when the risk is ordering, not a single tainted value; when reviewing multithreaded code, shared caches/counters, filesystem checks, or "verify then act" sequences (balance checks, auth-then-use, dedup guards). Confirms each as an interleaving witness and emits the shared finding schema.

5 Updated 2 weeks ago
UnboundCompute