CVE-2022-34305: Apache Tomcat Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-6j88-6whg-x687
CVSS 6.1
CWE-79
Published
Advisory Summary

CVE-2022-34305 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Apache Tomcat libraries in the Maven ecosystem. The issue involves cross-site scripting in apache tomcat. Remediation is available by upgrading affected packages to version 10.1.0-M17, 10.0.22, 9.0.65, 8.5.82.

CVE-2022-34305 at a Glance

CVE Identifier CVE-2022-34305
GHSA Identifier GHSA-6j88-6whg-x687
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Apache Tomcat
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 6.1

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:R/S:C/C:L/I:L/A:N).

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

How to Fix CVE-2022-34305

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.1.0-M17
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat</artifactId>
    <version>10.1.0-M17</version>
</dependency>
org.apache.tomcat:tomcat fixed: 10.0.22
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat</artifactId>
    <version>10.0.22</version>
</dependency>
org.apache.tomcat:tomcat fixed: 9.0.65
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat</artifactId>
    <version>9.0.65</version>
</dependency>
org.apache.tomcat:tomcat fixed: 8.5.82
<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>tomcat</artifactId>
    <version>8.5.82</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-34305, 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.1.0-M17), 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. 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

In Apache Tomcat 10.1.0-M1 to 10.1.0-M16, 10.0.0-M1 to 10.0.22, 9.0.30 to 9.0.64 and 8.5.50 to 8.5.81 the Form authentication example in the examples web application displayed user provided data without filtering, exposing a XSS vulnerability.

CVE-2022-34305 Affected Apache Tomcat Versions

4 component(s)
Fixed Versions:
10.1.0-M1710.0.229.0.658.5.82
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.tomcat:tomcat
Maven
≥ 10.1.0-M1
< 10.1.0-M17
10.1.0-M17
org.apache.tomcat:tomcat
Maven
≥ 10.0.0-M1
< 10.0.22
10.0.22
org.apache.tomcat:tomcat
Maven
≥ 9.0.30
< 9.0.65
9.0.65
org.apache.tomcat:tomcat
Maven
≥ 8.5.50
< 8.5.82
8.5.82

References

Frequently Asked Questions

What is CVE-2022-34305?
CVE-2022-34305 is a security vulnerability in Apache Tomcat involving Cross-site Scripting in Apache Tomcat under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Apache Tomcat versions are affected?
Affected versions include releases prior to 10.1.0-M17, 10.0.22, 9.0.65, 8.5.82 across affected packages: org.apache.tomcat:tomcat.
What version fixes CVE-2022-34305?
Upgrading to 10.1.0-M17, 10.0.22, 9.0.65, 8.5.82 (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.1.0-M17, 10.0.22, 9.0.65, 8.5.82. Upgrade your dependency to 10.1.0-M17, 10.0.22, 9.0.65, 8.5.82 or later.
What is the CVSS score of CVE-2022-34305?
CVE-2022-34305 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2022-34305?
CVE-2022-34305 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Maven dependencies for CVE-2022-34305?
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-6j88-6whg-x687",
  "modified" : "2022-07-05T18:03:05Z",
  "published" : "2022-06-24T00:00:32Z",
  "aliases" : [ "CVE-2022-34305" ],
  "summary" : "Cross-site Scripting in Apache Tomcat",
  "details" : "In Apache Tomcat 10.1.0-M1 to 10.1.0-M16, 10.0.0-M1 to 10.0.22, 9.0.30 to 9.0.64 and 8.5.50 to 8.5.81 the Form authentication example in the examples web application displayed user provided data without filtering, exposing a XSS vulnerability.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tomcat:tomcat"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "10.1.0-M1"
      }, {
        "fixed" : "10.1.0-M17"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 10.1.0-M16"
    }
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tomcat:tomcat"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "10.0.0-M1"
      }, {
        "fixed" : "10.0.22"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tomcat:tomcat"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "9.0.30"
      }, {
        "fixed" : "9.0.65"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.tomcat:tomcat"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.5.50"
      }, {
        "fixed" : "8.5.82"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-34305"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread/k04zk0nq6w57m72w5gb0r6z9ryhmvr4k"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202208-34"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20220729-0006"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2022/06/23/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-06-25T07:23:42Z",
    "nvd_published_at" : "2022-06-23T11:15:00Z"
  }
}