Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated
A race condition is a flaw in which several requests that arrive almost together are processed with no handling of order, so an action meant to pass once passes many times. It affects sites with a check-then-update step: coupons, points, balances, stock, booking slots and one-time passcodes. List the one-time actions on your site, and ask your agency what the build does when the same action arrives twice at once.
Operating screens one at a time rarely reproduces it, and it sometimes surfaces only after years of running.
Check this first: sites that should be reviewed
Look at how simultaneous requests are handled if your site has any of these.
- You have once-per-person or once-only schemes such as coupons, points or campaign bonuses.
- Features count down a number: balance, stock, booking slots, capacity.
- You issue one-time codes, such as one-time passcodes or password reset links.
- Payment or transfer completion arrives as a notice from an outside service.
- A feature exports members' data in bulk, such as a booking list or invoices.
- You built or modified a feature yourself, with no design or test record for "two arrive together".
Why does a once-only action pass more than once?
A race condition is when several processes handle the same data almost simultaneously, and the order decides the result. MITRE's CWE-362 describes a shared resource that should be used exclusively but leaves a gap in which other processes can change it. The type where the state changes between check and use is CWE-367 (TOCTOU, time of check to time of use).
Take a coupon. The site first checks that it is unused, then marks it used. If another request completes its check between those two steps, both judge it "unused" and proceed. OWASP's testing guide points to financial transactions, one-time tokens and allocation of limited resources as the places to watch.
What damage can it cause?
- A one-time coupon or points are used repeatedly, and the operator loses money.
- Numbers contradict: a balance goes negative, more is sold than is in stock, bookings exceed capacity.
- A token or code meant for one use creates several logged-in states.
- Another user's information mixes into a different user's export or download.
How it differs from similar flaws
Business logic flaws are a loose-ended family of loopholes in how a business flow is designed, and race conditions are the ones rooted in timing and order. Missing rate limits mean no counting or stopping of floods from one party, but two nearly simultaneous requests are enough here, so cutting counts does not cure it. Session management flaws concern how login state is kept.
Cases from IPA and a developer
Few operators state publicly that a race condition caused a coupon or points problem. We take two public sources whose content we could open: a case IPA organised, and an official advisory from a developer.
IPA's lessons: other customers' data mixed by simultaneous requests
IPA's lessons-learned collection for highly reliable information systems (IT service edition) describes an event company, name withheld. It took customers' event bookings online through several agencies and handled them centrally in one management system. One day an agent at agency A downloaded the list of bookers for an event whose booking had closed, and it held people who were not that agent's customers. Around the same time an agent at agency B noticed the same, and IPA says the mixed data included personal information.
IPA gives the direct cause as a fault in the list download. The system wrote data to a temporary file before sending it to the requesting agency. It used one temporary file without exclusive control (a way to stop simultaneous use), so the booker data of two agencies that asked almost together went into the same file and was sent to both.
The company stopped the download feature and investigated, and found no sign of earlier occurrences. After a fix it resumed the feature three days after the incident. The system had run for over five years with no problem before.
IPA's analysis says the designer, used to the OS and middleware handling contention, did not realise it had to be built in. The design guidelines had no item on exclusive control, and tests were made from the design documents alone. Years after the first release, personal information fields were added to the list without enough impact checking. IPA says exclusive control is one pillar of security and that systems with personal information need especially careful design.
Spring Security: one token, several logged-in states
On 21 April 2026 the developer of the Java framework Spring Security published an advisory for CVE-2026-22751, rated Medium. In apps that set up one-time token login with the database component JdbcOneTimeTokenService, a race arises between check and use. According to the advisory, when a valid token is used by several requests at once, the one-use token is accepted repeatedly and several authenticated states result.
The standard in-memory component handles simultaneous use and is not affected. The affected versions are 7.0.0 to 7.0.4, 6.5.0 to 6.5.9 and 6.4.0 to 6.4.15. The fixes are 7.0.5 and 6.5.10, and 6.4.16 is for paid-support customers. The developer asks for an update to the matching fixed version and says no other workaround is needed.
It shows that race conditions occur in authentication components too, so part of the defence is to keep updating the parts you use. We explain updates on the page about unpatched software.
How can you check your own site?
You can start without specialist knowledge, only on a site you manage and in a way that does not disturb operations.
- List the "passes only once" actions. Candidates are coupons, point use, sign-up bonuses, purchases of stocked items, booking slots, transfers and withdrawals, one-time passcodes, reset links and data exports.
- Ask your agency about the design. Do check and update form one process? Is the one-time mark protected by a database constraint? What happens to the second of two simultaneous identical actions? A vague answer shows where to look first.
- Look for double traces in data. OWASP lists several success responses for a one-time action, a balance that goes negative after simultaneous withdrawals, allocation beyond capacity, and duplicate emails or invoices. Look in your sales, stock and points ledgers for records of one item in the same second.
- Read the admin screens of payment and booking services. See whether double charges, double bookings or refunds cluster on one feature.
- Check that logs are kept. See whether you could later trace many requests by one user for one item at very short intervals.
We advise against sending many simultaneous requests to a live site to test, because it can cause real double processing or double charges. Testing belongs in a test environment with test accounts, run by your agency or an assessor.
This covers only the features you checked and is no guarantee for the whole site. If you are unsure, contact us to talk through the next step.
How to prevent race conditions
Developers and operators have different tasks, so we start with developers.
For developers
The top priority is to make check and update one unit that no other request can enter. The points below come from OWASP's testing guide and cheat sheet and MITRE's CWE.
- Inside a database transaction (a bundled process), take a row lock (such as SELECT ... FOR UPDATE) so later requests wait.
- Do "reduce only if the balance suffices" in one update statement, and treat zero updated rows as failure.
- Give once-only actions a unique database constraint, such as per user and coupon, so duplicates are refused.
- Optimistic locking, which compares a version number on update, or a stronger isolation level, are also options.
- For payments and outside services, add an idempotency key so a request sent twice counts once.
- Handle a one-time token as one operation that fetches it and invalidates it at the same moment.
- Do not assume "the check is fast, so it is fine". Tools that send simultaneous requests can hit even a short gap.
- Add simultaneous-request tests to automated tests, checking that a balance cannot go negative and a coupon is used once. IPA says long load tests in a simulated environment make occurrence more likely.
For site owners
- Ask your agency for a list of one-time actions and an account of what happens when requests arrive together.
- When you order development or changes, write "what happens when two arrive at once" in the specification and make its test an acceptance condition (the IPA lesson).
- Keep authentication and payment components updated, and ask whether your agency follows the developer's advisories.
- When a change to a feature with personal information only adds a field, still ask for the related processing to be reviewed.
- Decide in advance who takes double-charge or double-grant enquiries and how the feature is stopped.
What can you do yourself, and when should you call an expert?
You can list the one-time actions, question your agency, read sales and stock data and prepare an enquiry desk. How well the build resists simultaneous requests cannot be told by hearing a design explained.
An assessment is worth it if any of these applies:
- You built or heavily changed coupon, points, booking or payment features.
- A feature exports members' personal or billing data in bulk.
- You made your own one-time passcode or password reset mechanism.
- You have had double-charge, double-grant or stock mismatch enquiries.
The free URL check (JPY 0) looks only at what anyone can see from outside, and sends no flood of simultaneous requests, so resistance to them is checked in an assessment.
All amounts exclude tax. Web application assessment Lite starts from JPY 98,000 for up to 10 screens, and Standard from JPY 198,000 for up to 20 screens, with manual checks behind login. Extra screens beyond the range start from JPY 10,000 per screen. Fixing an individual vulnerability starts from JPY 10,000 per issue. Many screens behind login and urgency raise the amount. The formal quote is sent once the free assessment is complete. The assessment also covers one retest once the fixes are in.
For a first look, the free URL check shows the outside view. If you do not know which actions are one-time, contact us.
What cyber-shield checks
Our web application assessment adds a person's review to a tool scan, in the range agreed in the consent form.
- We pick out the one-time actions (coupons, points, bookings, one-time codes) from your list of screens.
- A person checks the business flows, including screens behind login, for loopholes (within Standard).
- We check whether check and update form one unit, from your design account and the double records in your ledgers.
- Whether to test simultaneous requests, and in what environment and time window, is agreed first in the consent form, so that testing does not cause real double processing or charges.
We do not go beyond the consent form or make real payments on a live site. We repair what the assessment finds on request, as individual vulnerability fixes. We write up the findings, with one re-assessment after the fixes.
Frequently asked questions
How is a race condition different from an ordinary bug?
It appears only when timing overlaps. It is hard to reproduce by operating screens one at a time, and the case in IPA's lessons-learned collection first surfaced after the system had run for over five years. Faults that occur only when use peaks arise the same way.
Can it happen on ready-made sites such as WordPress or Shopify?
It can. Custom features, and plugins that add points, coupons or bookings, each have their own check-and-update flow. List the parts that have one-time actions and ask your agency about them. Updating a part sometimes fixes it.
Do rate limits or a WAF prevent it?
Not by themselves. Even with limits on counts, two requests that arrive almost together fall inside the cap. What stops it is building check and update as one step. Add rate limiting as protection against a different problem.
What should I do first if something was processed twice?
Stop the affected feature for now, and keep the access logs and payment history. Then list the duplicated items and ask your agency to investigate. If someone else's information may have been visible, tell us through our emergency contact.
How much does it cost to check for race conditions?
The free URL check (JPY 0) looks only at what anyone can see from outside. Resistance to simultaneous requests is checked in an assessment, and Web application assessment Lite starts from JPY 98,000 (excl. tax, up to 10 screens). Screen count and screens behind login change the amount.
Next step: list the actions that pass only once
Today, list the actions that should pass once, ask your agency what happens when two arrive together, and decide who takes double-charge enquiries. Those three steps show where to look first. To have a specialist check whether requests really pass twice, contact us to agree an assessment scope. If damage is already happening, see our emergency guide. The free URL check shows what is visible from outside.
Frequently asked questions
How is a race condition different from an ordinary bug?
It appears only when timing overlaps. It is hard to reproduce by operating screens one at a time, and the case in IPA's lessons-learned collection first surfaced after the system had run for over five years. Faults that occur only when use peaks arise the same way.
Can it happen on ready-made sites such as WordPress or Shopify?
It can. Custom features, and plugins that add points, coupons or bookings, each have their own check-and-update flow. List the parts that have one-time actions and ask your agency about them. Updating a part sometimes fixes it.
Do rate limits or a WAF prevent it?
Not by themselves. Even with limits on counts, two requests that arrive almost together fall inside the cap. What stops it is building check and update as one step. Add rate limiting as protection against a different problem.
What should I do first if something was processed twice?
Stop the affected feature for now, and keep the access logs and payment history. Then list the duplicated items and ask your agency to investigate. If someone else's information may have been visible, tell us through our emergency contact.
How much does it cost to check for race conditions?
The free URL check (JPY 0) looks only at what anyone can see from outside. Resistance to simultaneous requests is checked in an assessment, and Web application assessment Lite starts from JPY 98,000 (excl. tax, up to 10 screens). Screen count and screens behind login change the amount.