Skip to content

CWE-567: Unsynchronized Access to Shared Data in a Multithreaded Context

Base

The product does not properly synchronize shared data, such as static variables across threads, which can lead to undefined behavior and unpredictable data changes.

Within servlets, shared static variables are not protected from concurrent access, but servlets are multithreaded. This is a typical programming mistake in J2EE applications, since the multithreading is handled by the framework. When a shared variable can be influenced by an attacker, one thread could wind up modifying the variable to contain data that is not valid for a different thread that is also using the data within the variable. Note that this weakness is not unique to servlets.

Consequences

  • Confidentiality, Integrity, Availability: Read Application Data, Modify Application Data, DoS: Instability, DoS: Crash, Exit, or Restart

How to prevent it

  • Implementation: Remove the use of static variables used between servlets. If this cannot be avoided, use synchronized access for these variables.

Recent advisories

  • GHSA-7fq5-7wr8-rjwj — OliveTin has a Concurrent Template Parsing Race Condition which Leads to Cross-Request Command Contamination
  • GHSA-4g75-9r48-jf92 — ImageMagick: Race Condition in distributed pixel cache server can result in file descriptor hijacking

All advisories for CWE-567

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor