Vulnerabilities in pkg:maven/org.apache.commons/commons-text

PACKAGE
Advisory Identifier: GHSA-599f-7c49-w659
Advisory Summary

CVE-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.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:maven/org.apache.commons/commons-text

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:maven/org.apache.commons/commons-text. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-599f-7c49-w659 CVE-2022-42889 CRITICAL Arbitrary code execution in Apache Commons Text

CVE-2022-42889 at a Glance

CVE Identifier CVE-2022-42889
GHSA Identifier GHSA-599f-7c49-w659
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Commons text
Package Ecosystem Maven
Published Date
Last Updated

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).

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 High (I:H)
Availability High (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.

org.apache.commons:commons-text fixed: 1.10.0
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-text</artifactId>
    <version>1.10.0</version>
</dependency>
com.guicedee.services:commons-text fixed: Latest secure release
<dependency>
    <groupId>com.guicedee.services</groupId>
    <artifactId>commons-text</artifactId>
    <version>Latest secure release</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.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

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.

CVE-2022-42889 Affected Commons text Versions

2 component(s)
Fixed Versions:
1.10.0
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?
CVE-2022-42889 is a security vulnerability in Commons text involving Arbitrary code execution in Apache Commons Text under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Commons text versions are affected?
Affected versions include releases prior to 1.10.0 across affected packages: org.apache.commons:commons-text, com.guicedee.services:commons-text.
What version fixes CVE-2022-42889?
Upgrading to 1.10.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is commons-text affected?
Yes, org.apache.commons:commons-text is affected in releases prior to 1.10.0, Latest secure release. Upgrade your dependency to 1.10.0, Latest secure release or later.
What is the CVSS score of CVE-2022-42889?
CVE-2022-42889 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-42889?
CVE-2022-42889 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (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.).
How can I check Maven dependencies for CVE-2022-42889?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.commons'. 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-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"
  }
}