GHSA-jx7c-7mj5-9438 BIT-tomcat-2021-43980 CVE-2021-43980
Apache Tomcat Race Condition vulnerability
- Severity
- 3.7 / 10
- Low · CVSS 3.1
- Exploit chance (EPSS)
- 2.36%
- Chance of exploitation in the next 30 days. Higher than 83.78% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
- Fix
8.5.78- Upgrade org.apache.tomcat:tomcat to this version or later
Description
The simplified implementation of blocking reads and writes introduced in Tomcat 10 and back-ported to Tomcat 9.0.47 onwards exposed a long standing (but extremely hard to trigger) concurrency bug in Apache Tomcat 10.1.0 to 10.1.0-M12, 10.0.0-M1 to 10.0.18, 9.0.0-M1 to 9.0.60 and 8.5.0 to 8.5.77 that could cause client connections to share an Http11Processor instance resulting in responses, or part responses, to be received by the wrong client.
Affected versions
Maven
| Package | Vulnerable | Fixed in |
|---|---|---|
| org.apache.tomcat:tomcat | >= 8.5.0, < 8.5.78 |
8.5.78 |
| org.apache.tomcat:tomcat | >= 9.0.0-M1, < 9.0.62 |
9.0.62 |
| org.apache.tomcat:tomcat | >= 10.0.0-M1, < 10.0.20 |
10.0.20 |
| org.apache.tomcat:tomcat | >= 10.1.0-M1, < 10.1.0-M14 |
10.1.0-M14 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
org.apache.tomcat:tomcat Maven → 8.5.78
- maven
<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat</artifactId><version>8.5.78</version></dependency>- gradle
implementation("org.apache.tomcat:tomcat:8.5.78")
Severity breakdown
CVSS 3.1 3.7
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
- Attack vector
- Network
- Attack complexity
- High
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- Low
- Integrity
- None
- Availability
- None
Weakness
CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.
How to prevent it
- Architecture and Design: In languages that support it, use synchronization primitives. Only wrap these around critical code to minimize the impact on performance.
- Architecture and Design: Use thread-safe capabilities such as the data access abstraction in Spring.
- Architecture and Design: Minimize the usage of shared resources in order to remove as much complexity as possible from the control flow and to reduce the likelihood of unexpected conditions occurring. Additionally, this will minimize the amount of synchronization necessary and may even help to reduce the likelihood of a denial of service where an attacker may be able to repeatedly trigger a critical section (CWE-400).
- Implementation: When using multithreading and operating on shared variables, only use thread-safe functions.
- Implementation: Use atomic operations on shared variables. Be wary of innocent-looking constructs such as "x++". This may appear atomic at the code layer, but it is actually non-atomic at the instruction layer, since it involves a read, followed by a computation, followed by a write.
- Implementation: Use a mutex if available, but be sure to avoid related weaknesses such as CWE-412.
- Implementation: Avoid double-checked locking (CWE-609) and other implementation errors that arise when trying to avoid the overhead of synchronization.
- Implementation: Disable interrupts or signals over critical parts of the code, but also make sure that the code does not go into a large or infinite loop.
- Implementation: Use the volatile type modifier for critical variables to avoid unexpected compiler optimization or reordering. This does not necessarily solve the synchronization problem, but it can help.
- Architecture and Design, Operation: Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
References
Advisories
Packages
Other links
- github.com/apache/tomcat/commit/170e0f792bd18ff031677890ba2fe50eb7a376c1
- github.com/apache/tomcat/commit/17f177eeb7df5938f67ef9ea580411b120195f13
- github.com/apache/tomcat/commit/4a00b0c0890538b9d3107eef8f2e0afadd119beb
- github.com/apache/tomcat/commit/9651b83a1d04583791525e5f0c4c9089f678d9fc
- lists.apache.org/thread/3jjqbsp6j88b198x5rmg99b1qr8ht3g3
- lists.debian.org/debian-lts-announce/2022/10/msg00029.html
- tomcat.apache.org/security-10.html
- tomcat.apache.org/security-8.html
- tomcat.apache.org/security-9.html
- debian.org/security/2022/dsa-5265
- openwall.com/lists/oss-security/2022/09/28/1
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-69r9-qgr7-g2wj Apache Tomcat Missing Encryption of Sensitive Data vulnerability | High Known exploited | Also affects org.apache.tomcat:tomcat |
| GHSA-h3x4-894j-xpx5 Apache Tomcat's FORM authentication process has an Incorrect Authorization vulnerability | Critical | Also affects org.apache.tomcat:tomcat |
| GHSA-9xv2-5v5q-p794 Apache Tomcat's DIGEST authenticator has an Authentication Bypass by Capture-replay vulnerability | Critical | Also affects org.apache.tomcat:tomcat |
| GHSA-gcx9-497g-6cp6 Apache Tomcat has an Improper Access Control, Incorrect Authorization vulnerability | Critical | Also affects org.apache.tomcat:tomcat |
| GHSA-5m62-pw8w-7w9f Apache Tomcat - Security constraints not correctly applied | Critical | Also affects org.apache.tomcat:tomcat |
| GHSA-9m89-8frq-c98c Apache Tomcat - AJP secret compared in non-constant time | Low | Also affects org.apache.tomcat:tomcat |
| GHSA-5mp6-jrq3-r938 Apache Tomcat: LockOutRealm treats user names as case-sensitive | High | Also affects org.apache.tomcat:tomcat |
| GHSA-h6fc-48rj-7qqh Apache Tomcat - Digest authenticator will authenticate any unknown user | Critical | Also affects org.apache.tomcat:tomcat |
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