When multiple threads can read or modify the same data, use synchronization techniques to avoid software flaws that could can lead to security vulnerabilities. Concurrency problems can often result in abnormal termination or denial of service, but it is possible for them to result in more serious vulnerabilities.
...
Assume this simplified code is part of a multithreaded bank system. Threads call credit() and debit() as money is deposited into and withdrawn from the single account. Because the addition and subtraction operations are not atomic, it is possible that two operations could can occur concurrently, but only the result of one would be saved. For example, an attacker could can credit the account with a sum of money and make a very large number of small debits concurrently. Some of the debits might not affect the account balance because of the race condition, so the attacker is effectively creating money.
...
Race conditions caused by multiple threads concurrently accessing and modifying the same data could can lead to abnormal termination and denial-of-service attacks, or data integrity violations.
...