This vulnerability occurs when a non-reentrant function is called, and during its execution, another call is triggered that unexpectedly re-enters the same non-reentrant code path, corrupting its internal state.
In complex software, a single function call can branch into many unexpected execution paths, especially when processing external inputs. Attackers can often manipulate these inputs—like scripts in a web browser or embedded code in a PDF—to force the program into a state where a nested call re-enters code that wasn't designed to handle re-invocation. This is dangerous because the non-reentrant code typically relies on global or static data that gets corrupted when called again before the first invocation finishes. For developers, the core issue is that a function assumes its own internal state or global resources remain stable for the duration of its execution. When a nested call—perhaps via a callback, event handler, or virtual method—breaks that assumption, it leads to race conditions, data corruption, or crashes. To prevent this, you must audit code paths triggered during non-reentrant operations and isolate or protect any state that shouldn't be accessed concurrently, even from within the same thread.
Impact: Unexpected State
Exploitation of this weakness can leave the application in an unexpected state and cause variables to be reassigned before the first invocation has completed. This may eventually result in memory corruption or unexpected code execution.
Effectiveness: High
Effectiveness: High
c++c++