# Sh kb race conditions

> Sh kb race conditions is an open-source agent skill for security. Guides an agent to hunt race conditions and TOCTOU flaws in code and apps. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/dmdhrumilmistry/indra/tree/main/plugins/indra/skills/sh-kb-race-conditions
- **Repository:** https://github.com/dmdhrumilmistry/indra
- **GitHub stars:** 44
- **License:** MIT
- **Skill name:** sh-kb-race-conditions
- **Collection:** https://github.com/dmdhrumilmistry/indra
- **Categories:** [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-12-03

## About

This knowledge base equips an agent to find concurrency bugs where a check and the action that depends on it are not atomic, so parallel requests can slip past limits. It covers double-spend, quota and attempt-counter bypass, reuse of single-use tokens, and filesystem time-of-check to time-of-use issues. It sets out patterns to grep for, such as read-then-write sequences and missing row locks or unique constraints, and lists the guards that make a path safe.

The skill walks the agent through a detection routine: map state-changing operations on shared resources, check whether each check-and-act is atomic, consider whether the endpoint is reachable concurrently and whether the guard holds across replicas, and confirm the ordering of irreversible side effects. It also suggests variant hunting across sibling paths and helper callers, and includes false-positive filters for atomic updates, constraints and serialized queues.

For evidence, it describes how to build a proof of concept with many simultaneous requests, including single-packet and last-byte synchronization techniques over HTTP/2 and HTTP/1.1. It also includes defender-oriented detection signals and mitigation guidance. It assumes a codebase or application to review and an agent able to read source and send HTTP requests.

## When your agent uses it

> Knowledge base for finding race conditions and TOCTOU flaws - concurrent requests exploiting non-atomic check-then-act logic (double-spend, limit bypass, single-use token reuse, balance manipulation, file TOCTOU). Use when hunting concurrency/business-logic race bugs. CWE-362/367/366, OWASP A04:2021-Insecure Design.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/dmdhrumilmistry/indra/tree/HEAD/plugins/indra/skills/sh-kb-race-conditions)
- [License: MIT](https://github.com/dmdhrumilmistry/indra/tree/HEAD/plugins/indra/skills/sh-kb-race-conditions)

## Features

- **Check-then-act detection:** Explains how to spot read-modify-write sequences on balances, coupons, tokens and counters that lack atomic guards.
- **Filesystem TOCTOU coverage:** Covers races between existence checks and file opens, symlink swaps and predictable temporary names.
- **Database guard recognition:** Lists locking, constraint and atomic-update idioms across common frameworks and databases to tell safe code from racy code.
- **Concurrent exploit technique:** Describes synchronized parallel request methods to widen narrow race windows during proof-of-concept testing.
- **False-positive filters:** Gives criteria for dismissing findings where updates are atomic, constrained or serialized.
- **Defender detection signals:** Outlines log patterns and behavioral alerts that reveal repeated use of single-use objects.

## Good for

- Check whether a coupon or gift card can be redeemed twice by parallel requests
- Find withdrawal or transfer endpoints that can overdraw an account
- Test whether login or OTP attempt limits can be bypassed with concurrent attempts
- Review file handling code for exists-then-open time-of-check to time-of-use bugs
- Audit password reset and magic-link tokens for reuse under concurrency

## Install

### Claude Code

This skill ships in the `indra` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add dmdhrumilmistry/indra
/plugin install indra@indra
```

Or copy only this skill to `~/.claude/skills/sh-kb-race-conditions`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/dmdhrumilmistry/indra.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/sh-kb-race-conditions &&
cp -R "$tmp/plugins/indra/skills/sh-kb-race-conditions" ~/.claude/skills/sh-kb-race-conditions &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/sh-kb-race-conditions` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/sh-kb-race-conditions` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/dmdhrumilmistry/indra.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/sh-kb-race-conditions &&
cp -R "$tmp/plugins/indra/skills/sh-kb-race-conditions" ~/.agents/skills/sh-kb-race-conditions &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/sh-kb-race-conditions` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/sh-kb-race-conditions` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/dmdhrumilmistry/indra.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/sh-kb-race-conditions &&
cp -R "$tmp/plugins/indra/skills/sh-kb-race-conditions" ~/.cursor/skills/sh-kb-race-conditions &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/sh-kb-race-conditions` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/dmdhrumilmistry/indra.git --path plugins/indra/skills/sh-kb-race-conditions
```

Or copy the folder to `~/.gemini/skills/sh-kb-race-conditions` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/sh-kb-race-conditions`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/dmdhrumilmistry/indra.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/sh-kb-race-conditions &&
cp -R "$tmp/plugins/indra/skills/sh-kb-race-conditions" ~/.copilot/skills/sh-kb-race-conditions &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/sh-kb-race-conditions` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/dmdhrumilmistry/indra.git
```

Then copy `indra/plugins/indra/skills/sh-kb-race-conditions` into your agent's skills folder as `sh-kb-race-conditions`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does Sh kb race conditions change in the agent's behavior?

It adds a structured approach for hunting race conditions and TOCTOU flaws, including patterns to grep for, a detection recipe, false-positive filters and guidance for building concurrent proofs of concept.

### Does Sh kb race conditions include scripts or tools?

No scripts are included. It mentions tools such as Burp Repeater and Turbo Intruder as options for sending parallel requests.

### What kinds of race bugs does Sh kb race conditions cover?

Double-spend, limit and quota bypass, single-use token reuse, balance manipulation, uniqueness checks without constraints, idempotency gaps and filesystem TOCTOU.

### Is Sh kb race conditions only for offensive testing?

No. It includes detection signals for defenders and mitigation guidance such as atomic updates, constraints, row locking and exclusive file creation.

### How do I install Sh kb race conditions in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/sh-kb-race-conditions to use it in all your projects, or to .claude/skills/sh-kb-race-conditions in one project. Or install the indra plugin, which includes it: /plugin marketplace add dmdhrumilmistry/indra, then /plugin install indra@indra.

### Does Sh kb race conditions run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Sh kb race conditions?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Sh kb race conditions?

The closest alternatives to Sh kb race conditions are Sh kb business logic, Web app logic, Sh kb access control, Sh kb crypto and Sh kb path traversal.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Sh kb business logic](https://ai-powered.com/skills/sh-kb-business-logic): Sh kb business logic is an open-source agent skill for security.
- [Web app logic](https://ai-powered.com/skills/web-app-logic): Web app logic is an open-source agent skill for security.
- [Sh kb access control](https://ai-powered.com/skills/sh-kb-access-control): Sh kb access control is an open-source agent skill for security.
- [Sh kb crypto](https://ai-powered.com/skills/sh-kb-crypto): Sh kb crypto is an open-source agent skill for finance and payments.
- [Sh kb path traversal](https://ai-powered.com/skills/sh-kb-path-traversal): Sh kb path traversal is an open-source agent skill for security.
- [Sh kb deserialization](https://ai-powered.com/skills/sh-kb-deserialization): Sh kb deserialization is an open-source agent skill for security.
- [Sh kb csrf](https://ai-powered.com/skills/sh-kb-csrf): Sh kb csrf is an open-source agent skill for security.
- [Sh kb auth](https://ai-powered.com/skills/sh-kb-auth): Sh kb auth is an open-source agent skill for security.

---
Source: https://ai-powered.com/skills/sh-kb-race-conditions
