CVE-2022-25762: Apache Tomcat Improper Socket Reuse Vulnerability

HIGH
Advisory Identifier: GHSA-h3ch-5pp2-vh6w
CVSS 8.6
CWE-404
Published
Advisory Summary

CVE-2022-25762 is a HIGH (CVSS 8.6) improper socket reuse vulnerability (CWE-404: Improper Resource Shutdown or Release) affecting Apache Tomcat libraries in the Maven ecosystem. The issue involves improper socket reuse in apache tomcat. Remediation is available by upgrading affected packages to version 8.5.75, 9.0.20.

CVE-2022-25762 at a Glance

CVE Identifier CVE-2022-25762
GHSA Identifier GHSA-h3ch-5pp2-vh6w
Severity HIGH
CVSS v3.1 Base Score 8.6
CWE Classification CWE-404: Improper Resource Shutdown or Release
Affected Product Apache Tomcat
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 8.6

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

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

How to Fix CVE-2022-25762

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: 8.5.75
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat</artifactId>
    <version>8.5.75</version>
</dependency>
org.apache.tomcat:tomcat fixed: 9.0.20
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat</artifactId>
    <version>9.0.20</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-25762, 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 8.5.75), 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-404: Improper Resource Shutdown or Release, where the product does not release or incorrectly releases a resource before it is made available for re-use. 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

If a web application sends a WebSocket message concurrently with the WebSocket connection closing when running on Apache Tomcat 8.5.0 to 8.5.75 or Apache Tomcat 9.0.0.M1 to 9.0.20, it is possible that the application will continue to use the socket after it has been closed. The error handling triggered in this case could cause the a pooled object to be placed in the pool twice. This could result in subsequent connections using the same object concurrently which could result in data being returned to the wrong use and/or other errors.

CVE-2022-25762 Affected Apache Tomcat Versions

2 component(s)
Fixed Versions:
8.5.759.0.20
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.tomcat:tomcat
Maven
≥ 8.5.0
< 8.5.75
8.5.75
org.apache.tomcat:tomcat
Maven
≥ 9.0.0M1
< 9.0.20
9.0.20

References

Frequently Asked Questions

What is CVE-2022-25762?
CVE-2022-25762 is a security vulnerability in Apache Tomcat involving Improper socket reuse in Apache Tomcat under CWE-404: Improper Resource Shutdown or Release.
Which Apache Tomcat versions are affected?
Affected versions include releases prior to 8.5.75, 9.0.20 across affected packages: org.apache.tomcat:tomcat.
What version fixes CVE-2022-25762?
Upgrading to 8.5.75, 9.0.20 (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 8.5.75, 9.0.20. Upgrade your dependency to 8.5.75, 9.0.20 or later.
What is the CVSS score of CVE-2022-25762?
CVE-2022-25762 has a CVSS v3.1 base score of 8.6 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L.
What CWE is associated with CVE-2022-25762?
CVE-2022-25762 is classified under CWE-404: Improper Resource Shutdown or Release (The product does not release or incorrectly releases a resource before it is made available for re-use.).
How can I check Maven dependencies for CVE-2022-25762?
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-h3ch-5pp2-vh6w",
  "modified" : "2022-05-25T22:52:21Z",
  "published" : "2022-05-14T00:01:50Z",
  "aliases" : [ "CVE-2022-25762" ],
  "summary" : "Improper socket reuse in Apache Tomcat",
  "details" : "If a web application sends a WebSocket message concurrently with the WebSocket connection closing when running on Apache Tomcat 8.5.0 to 8.5.75 or Apache Tomcat 9.0.0.M1 to 9.0.20, it is possible that the application will continue to use the socket after it has been closed. The error handling triggered in this case could cause the a pooled object to be placed in the pool twice. This could result in subsequent connections using the same object concurrently which could result in data being returned to the wrong use and/or other errors.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tomcat:tomcat"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.5.0"
      }, {
        "fixed" : "8.5.75"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tomcat:tomcat"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "9.0.0M1"
      }, {
        "fixed" : "9.0.20"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-25762"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apache/tomcat"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread/6ckmjfb1k61dyzkto9vm2k5jvt4o7w7c"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220629-0003"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-404" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-05-25T22:52:21Z",
    "nvd_published_at" : "2022-05-13T08:15:00Z"
  }
}