Logo di Detecting Race Conditions

Detecting Race Conditions

Organizzazione
UnboundCompute
detecting-race-conditions

Individua bug di concorrenza e di tipo time-of-check/time-of-use (TOCTOU): stato condiviso non sincronizzato, sequenze check-then-act e violazioni di atomicità. Ragiona su quale stato è condiviso, su quali operazioni possono intercalarsi e su dove si apre una finestra tra un controllo e il suo utilizzo. Usa questa skill su un target sorgente autorizzato quando il rischio riguarda l’ordine delle operazioni, non un singolo valore contaminato; è utile per revisionare codice multithread, cache e contatori condivisi, controlli sul filesystem o sequenze «verifica e poi agisci» (controlli del saldo, autenticazione seguita dall’uso, protezioni contro i duplicati). Verifica ogni caso come prova di intercalazione e produce i risultati secondo lo schema condiviso.

Panoramica

Pubblicato daUnboundCompute
Repositorysecurity-agent-skills
Nome della skilldetecting-race-conditions
Stelle
27
Fork
8
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da UnboundCompute su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Detecting Race Conditions in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/UnboundCompute/security-agent-skills/tree/main/skills/detecting-race-conditions
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/UnboundCompute/security-agent-skills.git /tmp/security-agent-skills
mkdir -p .claude/skills
cp -r /tmp/security-agent-skills/skills/detecting-race-conditions .claude/skills/detecting-race-conditions
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Detecting Race Conditions in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Detecting Race Conditions non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Detecting Race Conditions non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Detecting race conditions

Race bugs don't live in one line - they live in the gap between two operations that another actor can slip through. There's no tainted value to trace and no single sink to grep; you find them by asking what state is shared, what runs concurrently, and where a window opens between deciding something and acting on it. This skill covers the recurring shapes and how to confirm a real window.

When to use

  • Multithreaded / async / multiprocess code, or a shared resource (DB row, cache, counter, file, in-memory map) touched by concurrent requests.
  • A "check then act" sequence where the check's truth can expire before the act: balance/quota checks, auth-then-use, uniqueness/dedup guards, file existence checks, one-time tokens.

Scope check

Authorized source only. If you can't name the authorization, stop.

The shapes and how to confirm each

Confirmation of a race is an interleaving witness: two concrete operation orders where one is safe and the other, achievable by an attacker, is not.

  1. TOCTOU (time-of-check to time-of-use). State is validated, then used, and it can change in between. Classic filesystem form: access(path) / stat(path) then open(path) - a symlink swap in the window redirects the open. General form: any check(x); … ; use(x) where x (or what it names) is mutable by another actor in the gap. Confirm: identify the shared thing, show a writer that can change it between check and use.

  2. Check-then-act on shared state without atomicity. "If not exists, create"; "if balance ≥ n, deduct n"; "if not already redeemed, redeem." Two requests both pass the check before either acts → double-spend, duplicate creation, coupon reuse. Confirm: two concurrent runs both read the pre-act value; neither the read+act is atomic (no transaction, lock, SELECT … FOR UPDATE, compare- and-swap, or unique constraint).

  3. Unsynchronized shared mutable state. A field/map/counter read and written by multiple threads with no lock/atomic. Confirm: two threads reach the same memory, at least one writes, no happens-before relationship (no shared lock, no atomic, no ownership handoff) orders them.

  4. Atomicity violation across a compound update. Several fields that must move together are updated without a single critical section, so a concurrent reader sees a torn, inconsistent state. Confirm: a reader path observes the fields mid-update.

  5. Lock misuse. Right idea, wrong execution: the lock is taken after the shared access, a different lock guards read vs write, the lock is released early, or the critical section doesn't cover the whole check-then-act. Confirm: the guarded region doesn't actually span both the decision and the action.

Where to look

Shared sinks are the anchors: process-global/static mutable state, singleton caches, ORM objects reused across requests, filesystem paths derived from a check, and any DB write preceded by an application-level read that decides it. For each, ask: who else touches this concurrently, and is the decision+action atomic?

Worked example

Double-spend via check-then-act. redeem(code): row = db.get(code); if row.used: reject; … ; row.used = True; db.save(row). Two requests with the same code both read used == False before either saves. Witness: interleave R1.read, R2.read, R1.save, R2.save → both succeed. No transaction, no SELECT … FOR UPDATE, no unique/CAS on used. Confirmed atomicity/check-then-act race, severity high, impact = coupon/token reused N times. Remediation: atomic conditional update (UPDATE … SET used=true WHERE code=? AND used=false) and act on affected-row-count.

Rationalizations to reject

  • "It's guarded by a check right above." → A check above the act is exactly the TOCTOU shape unless the check+act is atomic. The gap is the bug.
  • "There's a lock in the function." → Does the critical section span both the decision and the action, on every path, with the same lock as the writer?
  • "Requests are basically serial in practice." → "Basically" is the window. Assume concurrent unless the runtime guarantees otherwise.
  • "The DB will sort it out." → Only with a transaction at the right isolation, a constraint, or a conditional update. A plain read-then-write won't.

Executing this in practice

You need to identify shared state and the concurrent entry points that reach it, then read the ordering around each access. A code property graph helps you find every reader/writer of a shared object and every path into a check-then-act; a concurrency-aware analyzer or a targeted stress/PoC harness corroborates a real window. State each finding as an interleaving witness and emit per the finding schema, with the two operation orders in evidence and reachable = conditional on the interleaving.

Related

  • auditing-guard-gaps - when only some paths take the lock/transaction.
  • hunting-bugs-with-a-code-graph - the master loop that routes these here.
  • FINDING-SCHEMA.md.

Domande frequenti

Cosa fa la skill IA Detecting Race Conditions?

Individua bug di concorrenza e di tipo time-of-check/time-of-use (TOCTOU): stato condiviso non sincronizzato, sequenze check-then-act e violazioni di atomicità. Ragiona su quale stato è condiviso, su quali operazioni possono intercalarsi e su dove si apre una finestra tra un controllo e il suo utilizzo. Usa questa skill su un target sorgente autorizzato quando il rischio riguarda l’ordine delle operazioni, non un singolo valore contaminato; è utile per revisionare codice multithread, cache e contatori condivisi, controlli sul filesystem o sequenze «verifica e poi agisci» (controlli del sald...

Perché usare Detecting Race Conditions su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Detecting Race Conditions è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Detecting Race Conditions in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/UnboundCompute/security-agent-skills/tree/main/skills/detecting-race-conditions. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Detecting Race Conditions?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Detecting Race Conditions?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Detecting Race Conditions: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Detecting Race Conditions è gratuita?

Sì. È pubblicata su GitHub da UnboundCompute con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇