State Synchronization Error
Weakness ID: 373 (Weakness Base)Status: Draft
+ Description

Description Summary

State synchronization refers to a set of flaws involving contradictory states of execution in a process which result in undefined behavior.
+ Time of Introduction
  • Architecture and Design
  • Implementation
+ Applicable Platforms



+ Common Consequences

Depending on the nature of the state of corruption, any of the listed consequences may result.

+ Likelihood of Exploit

Medium to High

+ Demonstrative Examples

Example 1

(Bad Code)
Example Languages: C and C++ 
static void print(char * string) {
char * word;
int counter;
for(word = string; counter = *word++; )
putc(counter, stdout);

int main(void) {
pid_t pid;
if( (pid = fork()) < 0)
else if( pid == 0)
else print("parent\n");
(Bad Code)
Example Language: Java 
class read{
private int lcount;
private int rcount;
private int wcount;

public void getRead(){
while ((lcount == -1) || (wcount !=0));

public void getWrite(){
while ((lcount == -0);

public void killLocks(){
if (lcount==0)
else if (lcount == -1)
else lcount--;
+ Potential Mitigations

Phase: Implementation

Pay attention to asynchronous actions in processes and make copious use of sanity checks in systems that may be subject to synchronization errors.

+ Other Notes

The class of synchronization errors is large and varied, but all rely on the same essential flaw. The state of the system is not what the process expects it to be at a given time. Obviously, the range of possible symptoms is enormous, as is the range of possible solutions. The flaws presented in this section are some of the most difficult to diagnose and fix. It is more important to know how to characterize specific flaws than to gain information about them.

+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfCategoryCategory371State Issues
Development Concepts (primary)699
ChildOfWeakness BaseWeakness Base662Insufficient Synchronization
Research Concepts (primary)1000
PeerOfWeakness BaseWeakness Base367Time-of-check Time-of-use (TOCTOU) Race Condition
Research Concepts1000
PeerOfWeakness BaseWeakness Base476NULL Pointer Dereference
Research Concepts1000
+ Taxonomy Mappings
Mapped Taxonomy NameNode IDFitMapped Node Name
CLASPState synchronization error
+ Content History
Submission DateSubmitterOrganizationSource
CLASPExternally Mined
Modification DateModifierOrganizationSource
2008-07-01Eric DalciCigitalExternal
updated Time of Introduction
2008-09-08CWE Content TeamMITREInternal
updated Common Consequences, Relationships, Other Notes, Taxonomy Mappings