Join our Newsletter — 33% off our NHI Course
Threats, Abuse & Incident Response

CWE-362

← Back to Glossary
By NHI Mgmt Group Updated November 25, 2026 Domain: Threats, Abuse & Incident Response

CWE-362 is a weakness class for race conditions caused by improper synchronisation of concurrent operations. It applies when two or more threads, processes or requests access shared state without correct locking, ordering or atomic controls, allowing inconsistent results, privilege misuse or corruption.

What CWE-362 Means in Practice

CWE-362 describes a concurrency weakness, not a single bug pattern. It appears when multiple execution paths touch the same shared state without reliable synchronisation, so the program can observe stale, partial, or out-of-order updates. The result may be inconsistent business logic, broken invariants, privilege mistakes, or corrupted data structures.

Race conditions are dangerous because the failure often depends on timing, load, and interleaving rather than a single malformed input. That makes them hard to reproduce in testing and easy to overlook in code review, especially when the affected code looks correct in isolation.

How Improper Synchronisation Creates the Weakness

The core issue is missing or weak coordination around a shared resource. If two threads, workers, or requests can read and modify the same object, record, file, or counter at the same time, a check may occur against one state while the action is applied to another. This is the classic time-of-check, time-of-use pattern, but the broader weakness also covers lost updates, double execution, and ordering bugs.

Not every concurrent program is vulnerable. The weakness emerges when the implementation depends on an assumption that state will not change between related operations, yet no atomic operation, lock, transaction boundary, or other concurrency control actually enforces that assumption.

Where It Commonly Shows Up

CWE-362 often appears in workflows that create, update, or consume shared state under pressure: access checks, counters, queues, session handling, temporary files, payment or inventory logic, and state machines. In security-sensitive code, the same flaw can turn a harmless ordering bug into a privilege escalation, duplicate action, or policy bypass.

Distributed systems can also surface similar problems when coordination is split across services or when application code assumes that a database write, cache update, and in-memory decision will stay aligned. The weakness is therefore not limited to multithreaded code in the narrow sense, it is any place where correctness depends on serialising access to shared state.

Detection and Hardening Approaches

Good detection starts with identifying where shared state exists and which operations must be atomic. Review the code paths that read, check, and then act on the same resource, then ask whether a competing request could interleave between those steps. Static analysis, targeted concurrency tests, and stress testing under load can help expose timing-sensitive defects, but they rarely replace design-level review.

Mitigation usually comes from making the critical sequence indivisible or by removing the race window altogether. That can mean locking, transactional updates, compare-and-swap style patterns, uniqueness constraints, idempotency controls, or restructuring the workflow so that repeated or reordered execution cannot create an unsafe outcome. The most reliable fix is usually the one that preserves the business invariant even when the system is under contention.

Risk and Threat Considerations

Race conditions matter because attackers often look for timing gaps that let them duplicate an action, bypass a control, or corrupt a shared resource before the system reconciles its state. Even when exploitation is difficult, the same weakness can produce intermittent failures that are expensive to diagnose and can undermine trust in security-sensitive workflows.

Failure mechanism: Two or more operations overlap on shared state, and a check, update, or permission decision is made on data that changes before the action completes.

Impact: The system may overgrant access, process the same request twice, lose or corrupt data, or violate ordering assumptions that other controls depend on.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

CIS Controls v8, OWASP ASVS and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
CIS Controls v8CIS-16 — Application Software SecurityRace conditions are application software weaknesses that require secure design and testing controls.
Recommendation — Review shared-state code paths for concurrency defects and verify fixes with secure testing.
OWASP ASVSV15 — Secure Coding and ArchitectureASVS covers secure design choices that prevent concurrency flaws and unsafe state transitions.
Recommendation — Design critical workflows so state changes are atomic and cannot be reordered into an unsafe outcome.
NIST SP 800-53 Rev 5SI-10 — Information Input ValidationRace-prone workflows often fail when state assumptions are not validated at the point of use.
Recommendation — Validate state at the moment of action and do not rely on earlier checks remaining true.

Practitioner Guidance

What to watch for: Focus on code paths where a validation step and a state-changing step are separated, especially if the resource can be touched by concurrent requests, retries, background jobs, or multiple threads. Those are the places where “it works in testing” most often hides a real race.

Governance implication: Treat race-prone logic as a design issue, not just a defect-fix issue. Ownership should sit with the team that controls the invariant, because the right remedy is often architectural, for example moving the safety boundary into a transaction, a lock, or a storage-level constraint.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org