CVE-2021-30640: Apache Tomcat Authentication Bypass Vulnerability
MODERATECVE-2021-30640 is a MODERATE (CVSS 6.5) authentication bypass vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting Apache Tomcat libraries in the Maven ecosystem. The issue involves authentication bypass by alternate name in apache tomcat. Remediation is available by upgrading affected packages to version 10.0.5, 9.0.45, 8.5.65.
CVE-2021-30640 at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N).
How to Fix CVE-2021-30640
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.
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>10.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>9.0.45</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>8.5.65</version>
</dependency>
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-2021-30640, 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.5), 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-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. 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
CVE-2021-30640 Affected Apache Tomcat Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.apache.tomcat:tomcat
|
Maven |
≥ 10.0.0-M1
< 10.0.5
|
10.0.5
|
|
org.apache.tomcat:tomcat
|
Maven |
≥ 9.0.0M1
< 9.0.45
|
9.0.45
|
|
org.apache.tomcat:tomcat
|
Maven |
≥ 8.5.0
< 8.5.65
|
8.5.65
|
References
Frequently Asked Questions
What is CVE-2021-30640?
Which Apache Tomcat versions are affected?
What version fixes CVE-2021-30640?
Is tomcat affected?
What is the CVSS score of CVE-2021-30640?
What CWE is associated with CVE-2021-30640?
How can I check Maven dependencies for CVE-2021-30640?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-36qh-35cm-5w2w",
"modified" : "2022-02-08T21:08:59Z",
"published" : "2021-08-13T15:21:24Z",
"aliases" : [ "CVE-2021-30640" ],
"summary" : "Authentication Bypass by Alternate Name in Apache Tomcat",
"details" : "A vulnerability in the JNDI Realm of Apache Tomcat allows an attacker to authenticate using variations of a valid user name and/or to bypass some of the protection provided by the LockOut Realm. This issue affects Apache Tomcat 10.0.0-M1 to 10.0.5; 9.0.0.M1 to 9.0.45; 8.5.0 to 8.5.65.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.apache.tomcat:tomcat"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "10.0.0-M1"
}, {
"fixed" : "10.0.5"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.apache.tomcat:tomcat"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "9.0.0M1"
}, {
"fixed" : "9.0.45"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.apache.tomcat:tomcat"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "8.5.0"
}, {
"fixed" : "8.5.65"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-30640"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/r59f9ef03929d32120f91f4ea7e6e79edd5688d75d0a9b65fd26d1fe8%40%3Cannounce.tomcat.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2021/08/msg00009.html"
}, {
"type" : "WEB",
"url" : "https://security.gentoo.org/glsa/202208-34"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20210827-0007"
}, {
"type" : "WEB",
"url" : "https://www.debian.org/security/2021/dsa-4952"
}, {
"type" : "WEB",
"url" : "https://www.debian.org/security/2021/dsa-4986"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com//security-alerts/cpujul2021.html"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpujan2022.html"
}, {
"type" : "WEB",
"url" : "https://www.oracle.com/security-alerts/cpuoct2021.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-116", "CWE-287", "CWE-289" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-07-13T19:21:02Z",
"nvd_published_at" : "2021-07-12T15:15:00Z"
}
}