CVE-2022-23181: Apache Tomcat Race Condition Vulnerability

HIGH
Advisory Identifier: GHSA-9f3j-pm6f-9fm5
CVSS 7.0
CWE-367
Published
Advisory Summary

CVE-2022-23181 is a HIGH (CVSS 7.0) race condition vulnerability (CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition) affecting Apache Tomcat libraries in the Maven ecosystem. The issue involves race condition in apache tomcat. Remediation is available by upgrading affected packages to version 10.0.16, 9.0.58, 8.5.75.

CVE-2022-23181 at a Glance

CVE Identifier CVE-2022-23181
GHSA Identifier GHSA-9f3j-pm6f-9fm5
Severity HIGH
CVSS v3.1 Base Score 7.0
CWE Classification CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition
Affected Product Apache Tomcat
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-23181

To remediate this vulnerability, upgrade all affected Apache Tomcat dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.apache.tomcat:tomcat fixed: 10.0.16
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat</artifactId>
    <version>10.0.16</version>
</dependency>
org.apache.tomcat:tomcat fixed: 9.0.58
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat</artifactId>
    <version>9.0.58</version>
</dependency>
org.apache.tomcat:tomcat fixed: 8.5.75
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat</artifactId>
    <version>8.5.75</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.apache.tomcat

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2022-23181, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.apache.tomcat

Analyze the terminal output to locate any version of Apache Tomcat in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 10.0.16), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.apache.tomcat command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition, where the product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check. In Apache Tomcat, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

The fix for bug CVE-2020-9484 introduced a time of check time of use vulnerability into Apache Tomcat 10.1.0-M1 to 10.1.0-M8, 10.0.0-M5 to 10.0.14, 9.0.35 to 9.0.56 and 8.5.55 to 8.5.73 that allowed a local attacker to perform actions with the privileges of the user that the Tomcat process is using. This issue is only exploitable when Tomcat is configured to persist sessions using the FileStore.

CVE-2022-23181 Affected Apache Tomcat Versions

3 component(s)
Fixed Versions:
10.0.169.0.588.5.75
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.tomcat:tomcat
Maven
≥ 10.0.0
< 10.0.16
10.0.16
org.apache.tomcat:tomcat
Maven
≥ 9.0.0
< 9.0.58
9.0.58
org.apache.tomcat:tomcat
Maven
< 8.5.75
8.5.75

References

Frequently Asked Questions

What is CVE-2022-23181?
CVE-2022-23181 is a security vulnerability in Apache Tomcat involving Race condition in Apache Tomcat under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition.
Which Apache Tomcat versions are affected?
Affected versions include releases prior to 10.0.16, 9.0.58, 8.5.75 across affected packages: org.apache.tomcat:tomcat.
What version fixes CVE-2022-23181?
Upgrading to 10.0.16, 9.0.58, 8.5.75 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tomcat affected?
Yes, org.apache.tomcat:tomcat is affected in releases prior to 10.0.16, 9.0.58, 8.5.75. Upgrade your dependency to 10.0.16, 9.0.58, 8.5.75 or later.
What is the CVSS score of CVE-2022-23181?
CVE-2022-23181 has a CVSS v3.1 base score of 7.0 (HIGH) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-23181?
CVE-2022-23181 is classified under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition (The product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check.).
How can I check Maven dependencies for CVE-2022-23181?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.tomcat'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9f3j-pm6f-9fm5",
  "modified" : "2022-04-19T15:24:44Z",
  "published" : "2022-02-01T00:45:44Z",
  "aliases" : [ "CVE-2022-23181" ],
  "summary" : "Race condition in Apache Tomcat",
  "details" : "The fix for bug CVE-2020-9484 introduced a time of check time of use vulnerability into Apache Tomcat 10.1.0-M1 to 10.1.0-M8, 10.0.0-M5 to 10.0.14, 9.0.35 to 9.0.56 and 8.5.55 to 8.5.73 that allowed a local attacker to perform actions with the privileges of the user that the Tomcat process is using. This issue is only exploitable when Tomcat is configured to persist sessions using the FileStore.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tomcat:tomcat"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "10.0.0"
      }, {
        "fixed" : "10.0.16"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tomcat:tomcat"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "9.0.0"
      }, {
        "fixed" : "9.0.58"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tomcat:tomcat"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "8.5.75"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-23181"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apache/tomcat"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread/l8x62p3k19yfcb208jo4zrb83k5mfwg9"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2022/10/msg00029.html"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220217-0010"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2022/dsa-5265"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-367" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-01-31T19:06:23Z",
    "nvd_published_at" : "2022-01-27T13:15:00Z"
  }
}