TechKnowSurge
CompTIA Security+ 2.3
InteractiveSecurityFree

What Did the Race Leave?

Two servers read a stock count of 40 at once; one sells 3, the other 5, and each writes its own answer back. What does the system show? Work out what each race condition left behind.

⚑ Complete this interactive to capture a CTF flag worth 5 points.

About this interactive

What you are doing: working out what a race condition left behind, as a number. A race condition happens when more than one task uses the same value at once, or when a value changes between the time it is checked and the time it is used. Lesson pshk-10-0040 shows both, and each leaves a result you can calculate. Lost update. Two tasks read the same value, each changes its own copy, and each writes its copy back. The last write wins, and the other task's change disappears. A score of 70 read by two tasks, one adding 10 and one adding 20, ends at 80 or 90, never the 100 it should. Check, then use. A value is checked, and only later used or updated. Every check that runs in between sees the same old value, so each one is approved. Two requests for $70 against a $100 balance both pass their check and leave −$40. The window. The time from the check to the use is the time-of-check to time-of-use (TOCTOU) window. It is the use time minus the check time, and anything that delays the use, a pause, a slow call, a session that stays signed in, makes it longer. For each case, ask which value each task read, which write lands last, and what was checked before anything was recorded.

What you'll learn

Aligned to

CompTIA Security+
2.3 Explain various types of vulnerabilities.

Key terms

Race Condition
A software vulnerability that occurs when a system's behavior depends on the timing or sequence of events — an attacker who can manipulate the window between a time-of-check and a time-of-use can alter the outcome in their favor.
Time of Check to Time of Use
TOCTOU
Time of Check to Time of Use is a race condition vulnerability where a resource's state is verified at one moment but changes before it is actually used, allowing attackers to substitute malicious content in the intervening window.

Topics

Race Condition Time Of Check To Time Of Use Interactive Calculation

About TechKnowSurge

TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.

Explore free tools and programs →