A web application allows users to upload profile pictures. The backend process first checks if the uploaded file has a valid image extension (e.g., .jpg, .png) and then, in a separate step, moves the file from a temporary directory to a permanent, web-accessible directory. A security analyst discovers that an attacker can replace the benign file in the temporary directory with a malicious script between the validation and move operations. Which vulnerability is exploited in this scenario?
This scenario describes a Time-of-check, time-of-use (TOCTOU) vulnerability. The application checks a resource's property (the file extension) at one point in time but uses the resource (moves the file) at a later point. An attacker exploits the time gap to change the resource, creating a race condition that bypasses the initial security check. CSRF involves tricking a user into submitting an unintended request. Insecure deserialization vulnerabilities occur when processing untrusted serialized data. SSRF involves forcing the server to make requests to other systems.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a TOCTOU flaw?
Open an interactive chat with Bash
What are race conditions in software security?
Open an interactive chat with Bash
How can applications prevent TOCTOU vulnerabilities?