CVE-2022-46751: Ivy Apache Ivy External Entity Reference Vulnerability

HIGH
Advisory Identifier: GHSA-2jc4-r94c-rp7h
CVSS 8.2
CWE-91 CWE-611
Published
Advisory Summary

CVE-2022-46751 is a HIGH (CVSS 8.2) apache ivy external entity reference vulnerability (CWE-91: XML Injection (aka Blind XPath Injection)) affecting Ivy libraries in the Maven ecosystem. The issue involves apache ivy external entity reference vulnerability. Remediation is available by upgrading affected packages to version 2.5.2.

CVE-2022-46751 at a Glance

CVE Identifier CVE-2022-46751
GHSA Identifier GHSA-2jc4-r94c-rp7h
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-91: XML Injection (aka Blind XPath Injection)
Affected Product Ivy
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 8.2

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:N/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 None (I:N)
Availability Low (A:L)

How to Fix CVE-2022-46751

To remediate this vulnerability, upgrade all affected Ivy 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.ivy:ivy fixed: 2.5.2
<dependency>
    <groupId>org.apache.ivy</groupId>
    <artifactId>ivy</artifactId>
    <version>2.5.2</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.ivy

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2022-46751, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.apache.ivy

Analyze the terminal output to locate any version of Ivy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.5.2), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.apache.ivy 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-91: XML Injection (aka Blind XPath Injection), where the product does not properly neutralize special elements that are used in xml, allowing attackers to modify the syntax, content, or commands of the xml before it is processed by an end system. In Ivy, 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

Improper Restriction of XML External Entity Reference, XML Injection (aka Blind XPath Injection) vulnerability in Apache Software Foundation Apache Ivy.This issue affects any version of Apache Ivy prior to 2.5.2. When Apache Ivy prior to 2.5.2 parses XML files - either its own configuration, Ivy files or Apache Maven POMs - it will allow downloading external document type definitions and expand any entity references contained therein when used. This can be used to exfiltrate data, access resources only the machine running Ivy has access to or disturb the execution of Ivy in different ways. Starting with Ivy 2.5.2 DTD processing is disabled by default except when parsing Maven POMs where the default is to allow DTD processing but only to include a DTD snippet shipping with Ivy that is needed to deal with existing Maven POMs that are not valid XML files but are nevertheless accepted by Maven. Access can be be made more lenient via newly introduced system properties where needed. Users of Ivy prior to version 2.5.2 can use Java system properties to restrict processing of external DTDs, see the section about "JAXP Properties for External Access restrictions" inside Oracle's "Java API for XML Processing (JAXP) Security Guide".

CVE-2022-46751 Affected Ivy Versions

1 component(s)
Fixed Versions:
2.5.2
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.ivy:ivy
Maven
< 2.5.2
2.5.2

References

Frequently Asked Questions

What is CVE-2022-46751?
CVE-2022-46751 is a security vulnerability in Ivy involving Apache Ivy External Entity Reference vulnerability under CWE-91: XML Injection (aka Blind XPath Injection).
Which Ivy versions are affected?
Affected versions include releases prior to 2.5.2 across affected packages: org.apache.ivy:ivy.
What version fixes CVE-2022-46751?
Upgrading to 2.5.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ivy affected?
Yes, org.apache.ivy:ivy is affected in releases prior to 2.5.2. Upgrade your dependency to 2.5.2 or later.
What is the CVSS score of CVE-2022-46751?
CVE-2022-46751 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L.
What CWE is associated with CVE-2022-46751?
CVE-2022-46751 is classified under CWE-91: XML Injection (aka Blind XPath Injection) (The product does not properly neutralize special elements that are used in XML, allowing attackers to modify the syntax, content, or commands of the XML before it is processed by an end system.).
How can I check Maven dependencies for CVE-2022-46751?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.ivy'. 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-2jc4-r94c-rp7h",
  "modified" : "2025-02-13T19:10:25Z",
  "published" : "2023-08-21T09:30:21Z",
  "aliases" : [ "CVE-2022-46751" ],
  "summary" : "Apache Ivy External Entity Reference vulnerability",
  "details" : "Improper Restriction of XML External Entity Reference, XML Injection (aka Blind XPath Injection) vulnerability in Apache Software Foundation Apache Ivy.This issue affects any version of Apache Ivy prior to 2.5.2.\n\nWhen Apache Ivy prior to 2.5.2 parses XML files - either its own configuration, Ivy files or Apache Maven POMs - it will allow downloading external document type definitions and expand any entity references contained therein when used.\n\nThis can be used to exfiltrate data, access resources only the machine running Ivy has access to or disturb the execution of Ivy in different ways.\n\nStarting with Ivy 2.5.2 DTD processing is disabled by default except when parsing Maven POMs where the default is to allow DTD processing but only to include a DTD snippet shipping with Ivy that is needed to deal with existing Maven POMs that are not valid XML files but are nevertheless accepted by Maven. Access can be be made more lenient via newly introduced system properties where needed.\n\nUsers of Ivy prior to version 2.5.2 can use Java system properties to restrict processing of external DTDs, see the section about \"JAXP Properties for External Access restrictions\" inside Oracle's \"Java API for XML Processing (JAXP) Security Guide\".",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.ivy:ivy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.5.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-46751"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apache/ant-ivy/commit/2be17bc18b0e1d4123007d579e43ba1a4b6fab3d"
  }, {
    "type" : "WEB",
    "url" : "https://docs.oracle.com/en/java/javase/13/security/java-api-xml-processing-jaxp-security-guide.html#GUID-94ABC0EE-9DC8-44F0-84AD-47ADD5340477"
  }, {
    "type" : "WEB",
    "url" : "https://gitbox.apache.org/repos/asf?p=ant-ivy.git;a=commit;h=2be17bc18b0e1d4123007d579e43ba1a4b6fab3d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apache/ant-ivy"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread/1dj60hg5nr36kjr4p1100dwjrqookps8"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread/9gcz4xrsn8c7o9gb377xfzvkb8jltffr"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2023/09/06/9"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-611", "CWE-91" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-21T20:39:45Z",
    "nvd_published_at" : "2023-08-21T07:15:33Z"
  }
}