Tooluck logoTooluck
SKILL.md

offensive-toctou

Agent skill fromSnailSploit/Claude-Red

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.

How to install offensive-toctou

install offensive-toctou
# install the Claude-Red pack with the skills CLI
npx skills add SnailSploit/Claude-Red

# or add only this skill to Claude Code: copy the folder

Skills/exploit-dev/offensive-toctou/

# into

~/.claude/skills/offensive-toctou/ (all projects)

.claude/skills/offensive-toctou/ (one project)

Skills/exploit-dev/offensive-toctou/SKILL.md

MITFull file
1# TOCTOU — Time-of-Check / Time-of-Use Exploitation
2
3A 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.
4
5## Quick Workflow
6
71. Identify the **check** (syscall, function, validation step) and the **use** (the privileged action)
82. Confirm the check and use don't operate on the same kernel object (FD, inode, atomic snapshot)
93. Build a primitive that swaps the object between check and use (symlink, mount, mv, parallel request)
104. **Widen the window** with FUSE, slow filesystems, scheduler tricks, or single-packet HTTP/2
115. Run a tight loop and confirm the post-use state corresponds to the swapped target
12
13---
14
15## The Core Pattern
16
17```c
18// Vulnerable
19if (access(path, W_OK) == 0) { // check — resolves "path" now
20 fd = open(path, O_WRONLY); // use — re-resolves "path" later
21 write(fd, attacker_data, n);
22}
23```
24
25Between `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.
26
27The fix is always: **operate on the kernel object, not the path.** Use `O_NOFOLLOW`, `openat` with `AT_SYMLINK_NOFOLLOW`, `fstat` on the FD, etc.
28
29---
30
31## Filesystem TOCTOU
32
33### Symlink Swap (Classic)
34
35```bash
36# Setup target — privileged binary that writes to user-supplied path after access() check
37…

Excerpt shown under the repository's MIT license.

More skills in Claude-Red

Keep exploring

Similar skill repositories

thedotmack /

claude-mem
116k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

CCCXGHGM+135 skills

cathrynlavery /

diagram-design
66k

Editorial diagram design for Claude Code, Codex, GitHub Copilot, Cursor, Factory Droid, Qoder, and Pi. 45 diagram types. Self-contained HTML + SVG. No shadows. No Mermaid slop.

CCCXCUGH1 skill

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates