How Cal.com Rebuilt AppSec After Going Closed Source
How Cal.com consolidated noisy security tooling into one continuous, context-aware pull request security program with Gecko.
Gecko Security

Your SAST tool can read a balance check. It can read the debit that follows. What it can't read is what happens when two requests hit that sequence at the same millisecond, both pass the check, and both execute against funds that only existed once. That's race condition territory, and it sits in the same vulnerability class as IDOR and broken access control at the top of the OWASP list. The reason pattern-based tools miss it isn't a gap in rules. It's a gap in what static analysis can reason about.
TLDR:
A race condition occurs when two or more operations execute concurrently and the final outcome depends on the precise sequence or timing of those operations. When that sequence is unpredictable, an attacker who can influence timing can force outcomes the application never intended.
The classic example is a check-then-act pattern: an application verifies a condition, then acts on it, assuming the state hasn't changed between those two steps. Under concurrent load, that assumption breaks. Another request can slip in between the check and the act, leaving the system in a state no single code path was designed to produce.
Race conditions become business logic vulnerabilities when the window between check and act exposes object references or bypasses authorization logic. A user who triggers two simultaneous requests can sometimes act on a resource they were denied access to a fraction of a second earlier.
The broken authentication category has a related problem: session state and token validation logic often assume sequential execution. Under concurrent requests, that assumption fails in ways that let one session bleed into another.
Three conditions have to be true for a race condition to be exploitable:
A race condition occurs when two or more operations compete to read and modify shared state, and the final outcome depends on the precise timing of their execution. The window of vulnerability is often measured in milliseconds, but that's enough.
The classic pattern looks like this: a system checks whether an action is permitted, then performs it. Between the check and the action, another request slips through. Both pass the check. Both execute. The state has been read twice before either write completes.
Security engineers call this the time-of-check to time-of-use (TOCTOU) problem. The gap between verification and execution is where the broken access control lives. Consider a wallet balance check before a withdrawal: if two concurrent withdrawal requests both read the same starting balance before either commits a deduction, both succeed against funds that only existed once.
The race condition meaning here goes beyond concurrency bugs. In a security context, the consequence is authorization bypass, double-spending, or privilege escalation depending on what shared state is being manipulated.
Three conditions have to hold for a race condition to be exploitable:
HTTP/2 single-packet attacks collapse timing uncertainty almost entirely. An attacker doesn't need precise coordination across the network; they pack concurrent requests into one TCP segment and let the server's own thread scheduler create the race.
A race condition vulnerability is a specific subclass of broken access control where the window between checking a permission and acting on it becomes an attack surface.
The classic pattern: a server checks whether a user has funds, then processes a withdrawal. If two requests arrive simultaneously, both pass the check before either depletion is recorded. Both withdrawals execute. The race condition meaning here is precise: two threads racing to read-then-write shared state, with neither seeing the other's changes.
TOCTOU flaws sit at the intersection of timing, concurrency, and access control logic. No static analysis tool catches them by reading source alone.
Time-of-check to time-of-use (TOCTOU) flaws, limit bypass attacks, and concurrent session exploits each represent a distinct way that race conditions surface in web applications. Understanding how they differ matters because the fix for one rarely maps cleanly onto the other two.
A TOCTOU race occurs when an application checks a condition, then acts on it after a window of time during which that condition can change. The check and the use are two separate operations, and an attacker exploits the gap between them.
A classic example: a payment system checks whether a user has sufficient funds, then processes the transfer in a separate database transaction. If two requests arrive simultaneously, both checks pass before either deduction commits. The user spends the same balance twice.
Rate limits, coupon codes, referral bonuses, and one-time-use tokens all rely on a read-modify-write pattern: read the current state, decide if the action is allowed, write the new state. When that pattern is not atomic, sending parallel requests lets each thread read the same pre-update state before any write completes.
used: false before any of them writes used: true.These races appear in workflows that span multiple steps, such as account upgrades, role assignments, or checkout flows. An attacker starts a privileged action under one state, then changes their account state mid-flight before the server completes the operation.
| Race Type | Where It Appears | What the Attacker Controls |
|---|---|---|
| TOCTOU | Fund transfers, inventory checks | Timing between check and write |
| Limit bypass | Coupons, rate limits, one-time tokens | Parallel request volume |
| Concurrent session | Role changes, checkout, account upgrade | State mutation mid-request |
The race condition meaning in each case is the same at the structural level: the application assumes sequential execution and a consistent world-state across multiple operations, but neither assumption holds under concurrent load. SAST tools that scan code in isolation see the individual operations as correct. The vulnerability only exists in the interaction between them.
Race conditions let attackers exploit the window between a security check and the action that follows it. A check-then-act sequence that looks safe in isolation becomes a vulnerability the moment two requests run concurrently: the check passes for both, but only one outcome was authorized.
The consequences scale with what the guarded resource controls. Duplicate financial transactions, bypassed rate limits, and privilege escalation through concurrent role assignments all follow the same structural pattern.
OWASP ranks broken access control as the number one vulnerability class, appearing in 100% of tested applications across a dataset of roughly 500,000 apps. Race conditions are one of several mechanisms that produce broken access control findings, alongside IDOR and authentication flaws, which is why the full vulnerability class resists any single detection approach.
Race conditions don't land neatly in a single OWASP category. Under the OWASP 2025 Top 10, the default classification for most race conditions is A08 Software and Data Integrity Failures, though time-of-check/time-of-use (TOCTOU) flaws that bypass authentication gates often get pulled into A07 Identification and Authentication Failures instead. The classification depends on what the race corrupts.
Broken access control sits at A01, the top spot, appearing in 100% of roughly 500,000 applications tested. broken access control patterns fall squarely within that category since they expose object references without authorization enforcement.
Race conditions sit at the intersection of timing, state, and trust assumptions, exposing a category of flaw that no pattern-based scanner can find by reading code alone.
A race condition occurs when two or more operations compete to read and modify shared state, and the outcome depends on the order of execution. In security terms, the window between a check and the corresponding action is where the vulnerability lives. An attacker who can send concurrent requests can win that window reliably enough to exploit it.
The classic framing treats race conditions as a concurrency bug. The more accurate framing is that they are a broken access control and business logic failure. Consider a withdrawal endpoint that checks a user's balance, then processes the transfer. The check is correct. The transfer logic is correct. The vulnerability exists in the assumption that those two operations will always run sequentially for a single user. When an attacker fires ten simultaneous requests, that assumption breaks.
The code does exactly what it was written to do. No input is malformed. No injection is happening. The flaw is in the design assumption about ordering and atomicity, not in any line of code a SAST rule could flag.
This is what puts race conditions squarely in the same category as IDOR vulnerabilities and broken authentication: the bug is a correctness failure against a specification that exists outside the code itself.
A static tool reading the withdrawal handler sees a balance check followed by a debit. It has no way to know that concurrent execution is possible, that the database transaction boundary doesn't cover both operations, or that the deployment runs behind a load balancer where requests from the same user can hit different application instances simultaneously. That infrastructure context is invisible to any tool that only reads source files.
Race condition meaning, in practice, is inseparable from deployment context. The same code is safe behind a properly configured queue and exploitable without one.
Race conditions are hard to detect because the flaw lives in the interaction between concurrent execution paths. Each individual operation is correct in isolation, and static tools see it that way: the balance check passes, the debit follows, no rule fires. The vulnerability only exists when two of those sequences run simultaneously, and that interaction is invisible to any tool reading source files one at a time.
Heisenbugs make this worse. Add logging or a profiler between the check and the act, and the timing changes enough that the race disappears. The observation suppresses the bug, which is why race conditions are notoriously hard to reproduce in instrumented environments.
DAST faces a structural constraint: it fires requests sequentially by default, and even parallel probes rarely achieve the sub-millisecond timing precision needed to land inside a race window reliably. Most race conditions pass through runtime scans without triggering.
Manual testers use two techniques to surface them:
Race conditions stem from timing gaps between a check and the action that follows it. Closing those gaps requires changes at the architectural level, beyond code review alone.
Atomic transactions and row-level locking are the most reliable defenses. When a balance check and a debit happen inside a single serializable transaction, no concurrent request can interleave between them. Optimistic locking adds a version column to each record: before committing, the write verifies the version hasn't changed since the read. If it has, the transaction fails and retries.
Idempotency keys force duplicate requests to return the cached result of the first successful operation instead of executing again. This is especially relevant for payment endpoints, where a network retry can trigger a second charge.
Pattern-based scanners check code structure, not execution timing. A race condition between a permission check and a file operation looks syntactically correct. No rule fires. The vulnerability only appears when two requests run simultaneously against a shared resource, a condition no static analysis pass can reproduce.
Race conditions sit in an interesting position within the broken access control vulnerability class. A static analyzer can read your mutex placement, your lock acquisition order, your semaphore initialization. What it cannot read is time.
Gecko reasons over a compiler-accurate semantic graph that preserves inter-procedural relationships across service boundaries, extending well beyond a single file. When two concurrent requests hit the same endpoint, the vulnerability lives in the sequence of operations across those requests and in the shared state between them. No pattern in the source code uniquely identifies that condition. The bug exists in runtime behavior, in the gap between what the code does individually and what it does simultaneously.
The structural constraint is straightforward: SAST tools match patterns against code structure. Race conditions are not structural patterns. They are temporal relationships between execution paths that only materialize under concurrent load.
Consider a wallet debit endpoint that checks balance, then deducts. The check and the deduct are both correctly written. The lock between them is the missing context, and whether that lock is required depends on whether the endpoint is called from a concurrent context, which service calls it, what the transaction isolation level is, and what state those concurrent calls share. None of that lives in the file.
Gecko traces call chains across service boundaries and folds in deployment context to reason about where concurrent execution is actually possible, bringing race condition detection into the same framework that handles IDOR vulnerability patterns and broken authentication flows. Every finding includes the vulnerable path alongside a working proof-of-concept that confirms the condition is exploitable in your specific environment, not theoretically possible in the abstract code.
Every race condition vulnerability comes back to the same broken assumption: that the world stays consistent between a check and the action that follows it. Under concurrent load, that assumption fails, and the consequences range from duplicate transactions to full authorization bypass depending on what shared state is involved. Fixing the code is only part of the answer; you also need to know which endpoints in your deployment are actually reachable concurrently. If you want to map that out, the Gecko team is available to talk.
A race condition is a timing exploit where concurrent requests slip into the window between a permission check and the action that follows it, while an IDOR vulnerability exposes object references without verifying ownership. The two overlap when a race condition bypasses an authorization check, turning a concurrency bug into a broken access control finding.
No. Pattern-based SAST tools read code structure one file at a time and see each operation as syntactically correct in isolation. Race conditions only exist in the temporal relationship between concurrent execution paths, which no static analysis pass can reproduce. The vulnerability lives in runtime behavior and deployment context, not in any line of code a rule can flag.
Wrap the balance check and the debit inside a single serializable database transaction, or add optimistic locking with a version column that fails the commit if state changed since the read. For endpoints where atomic transactions aren't available at the storage layer, idempotency keys or a queue-based write serializer removes the concurrent execution window entirely.
DAST fires requests sequentially by default, and even parallel probes rarely hit the sub-millisecond timing precision needed to land inside a race window consistently. Most race conditions pass through runtime scans without triggering, which is why manual testers use HTTP/2 single-packet attacks and parallel flooding tools to collapse the timing gap that standard scanners never close.
They are related but distinct. Broken access control is the broader OWASP category, appearing in 100% of roughly 500,000 tested applications, that covers any failure to enforce what authenticated users are permitted to do. Race conditions are one mechanism that produces broken access control findings, alongside IDOR and authentication flaws, by exploiting the timing gap between a check and its corresponding action instead of bypassing authorization logic directly.
Gecko Security
The latest news, technologies, and resources from our team.
How Cal.com consolidated noisy security tooling into one continuous, context-aware pull request security program with Gecko.
Gecko Security
See what actually changed in the OWASP Top 10 for 2026, from merged SSRF and XXE categories to new supply chain risks and scanner coverage gaps.
Jeevan Jutla
Gecko Security uncovered CVE-2026-21894 in August 2026, an n8n authorization bypass with CVSS 8.8. See why static tools missed it and how to remediate it.
Jeevan Jutla
Security misconfiguration is OWASP A05 for a reason. Learn how deployment context determines exploitability and how to fix gaps in August 2026.
Jeevan Jutla
How do modern AppSec vendors actually compare? This July 2026 capability map covers SAST, DAST, SCA, business logic flaws, and cross-service
Gecko Security
Break down your AppSec stack: what SAST, DAST, SCA, IAST, and pen testing each see — and what they miss. Updated July 2026 by Gecko Security.
Gecko Security
Occasional updates, new content, and insights. No spam; unsubscribe anytime.