SiteShadow
Back to vulnerability library

CWE-362 Race Condition (TOCTOU)

What this means

SiteShadow flagged a check‑then‑use pattern where state can change between two operations (classic TOCTOU). Example: "check file exists" then "open file", or "check permission" then "perform action".

Why it matters

Attackers can change state between a check and the action.

Safer examples

1) Use atomic operations

Use OS/library calls that combine the check and the use (platform dependent).

2) Prefer handles over paths

Operate on file descriptors/handles rather than re-resolving attacker-controlled paths.

3) Avoid world-writable directories for sensitive operations

Use application-owned directories with strict permissions and safe temp helpers.

How SiteShadow detects it (high level)

References

---

← Back to Vulnerability Library

Request access View coverage