CVE-2022-42889: Commons text Arbitrary Code Execution Vulnerability
CRITICALCVE-2022-42889 is a CRITICAL (CVSS 9.8) arbitrary code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Commons text libraries in the Maven ecosystem. The issue involves arbitrary code execution in apache commons text. Remediation is available by upgrading affected packages to version 1.10.0.
CVE-2022-42889 at a Glance
Security Impact
CVSS: 9.8
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:H/A:H).
How to Fix CVE-2022-42889
To remediate this vulnerability, upgrade all affected Commons text 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.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>com.guicedee.services</groupId>
<artifactId>commons-text</artifactId>
<version>Latest secure release</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.commons
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2022-42889, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.apache.commons
Analyze the terminal output to locate any version of Commons text in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.10.0), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.apache.commons 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Commons text, 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-2022-42889 Affected Commons text Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.apache.commons:commons-text
|
Maven |
≥ 1.5
< 1.10.0
|
1.10.0
|
|
com.guicedee.services:commons-text
|
Maven |
≤ 1.2.2.1-jre17
|
|
References
Frequently Asked Questions
What is CVE-2022-42889?
Which Commons text versions are affected?
What version fixes CVE-2022-42889?
Is commons-text affected?
What is the CVSS score of CVE-2022-42889?
What CWE is associated with CVE-2022-42889?
How can I check Maven dependencies for CVE-2022-42889?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-599f-7c49-w659",
"modified" : "2022-10-17T17:34:05Z",
"published" : "2022-10-13T19:00:17Z",
"aliases" : [ "CVE-2022-42889" ],
"summary" : "Arbitrary code execution in Apache Commons Text",
"details" : "Apache Commons Text performs variable interpolation, allowing properties to be dynamically evaluated and expanded. The standard format for interpolation is \"${prefix:name}\", where \"prefix\" is used to locate an instance of org.apache.commons.text.lookup.StringLookup that performs the interpolation. Starting with version 1.5 and continuing through 1.9, the set of default Lookup instances included interpolators that could result in arbitrary code execution or contact with remote servers. These lookups are: - \"script\" - execute expressions using the JVM script execution engine (javax.script) - \"dns\" - resolve dns records - \"url\" - load values from urls, including from remote servers Applications using the interpolation defaults in the affected versions may be vulnerable to remote code execution or unintentional contact with remote servers if untrusted configuration values are used. Users are recommended to upgrade to Apache Commons Text 1.10.0, which disables the problematic interpolators by default.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.apache.commons:commons-text"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.5"
}, {
"fixed" : "1.10.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "com.guicedee.services:commons-text"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "1.2.2.1-jre17"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-42889"
}, {
"type" : "WEB",
"url" : "https://arxiv.org/pdf/2306.05534"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/apache/commons-text"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread/n2bd4vdsgkqh2tm14l1wyc3jyol7s1om"
}, {
"type" : "WEB",
"url" : "https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2022-0022"
}, {
"type" : "WEB",
"url" : "https://security.gentoo.org/glsa/202301-05"
}, {
"type" : "WEB",
"url" : "https://security.netapp.com/advisory/ntap-20221020-0004"
}, {
"type" : "ADVISORY",
"url" : "https://securitylab.github.com/advisories/GHSL-2022-018_Apache_Commons_Text"
}, {
"type" : "WEB",
"url" : "http://packetstormsecurity.com/files/171003/OX-App-Suite-Cross-Site-Scripting-Server-Side-Request-Forgery.html"
}, {
"type" : "WEB",
"url" : "http://packetstormsecurity.com/files/176650/Apache-Commons-Text-1.9-Remote-Code-Execution.html"
}, {
"type" : "WEB",
"url" : "http://seclists.org/fulldisclosure/2023/Feb/3"
}, {
"type" : "WEB",
"url" : "http://www.openwall.com/lists/oss-security/2022/10/13/4"
}, {
"type" : "WEB",
"url" : "http://www.openwall.com/lists/oss-security/2022/10/18/1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-10-13T20:22:17Z",
"nvd_published_at" : "2022-10-13T13:15:00Z"
}
}