CVE-2024-31573: Xmlunit core XMLUnit For Java Has Insecure Vulnerability

LOW
Advisory Identifier: GHSA-chfm-68vv-pvw5
Published
Advisory Summary

CVE-2024-31573 is a LOW xmlunit for java has insecure vulnerability (General Security Weakness) affecting Xmlunit core libraries in the Maven ecosystem. The issue involves xmlunit for java has insecure defaults when processing xslt stylesheets. Remediation is available by upgrading affected packages to version 2.10.0.

CVE-2024-31573 at a Glance

CVE Identifier CVE-2024-31573
GHSA Identifier GHSA-chfm-68vv-pvw5
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Xmlunit core
Package Ecosystem Maven
Published Date
Last Updated

How to Fix CVE-2024-31573

To remediate this vulnerability, upgrade all affected Xmlunit core 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.xmlunit:xmlunit-core fixed: 2.10.0
<dependency>
    <groupId>org.xmlunit</groupId>
    <artifactId>xmlunit-core</artifactId>
    <version>2.10.0</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.xmlunit

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=org.xmlunit

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

Note: The mvn dependency:tree -Dincludes=org.xmlunit 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 General Security Weakness. In Xmlunit core, 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

### Impact When performing XSLT transformations XMLUnit for Java did not disable XSLT extension functions by default. Depending on the XSLT processor being used this could allow arbitrary code to be executed when XMLUnit is used to transform data with a stylesheet who's source can not be trusted. If the stylesheet can be provided externally this may even lead to a remote code execution. ## Patches Users are advised to upgrade to XMLUnit for Java 2.10.0 where the default has been changed by means of https://github.com/xmlunit/xmlunit/commit/b81d48b71dfd2868bdfc30a3e17ff973f32bc15b ### Workarounds XMLUnit's main use-case is performing tests on code that generates or processes XML. Most users will not use it to perform arbitrary XSLT transformations. Users running XSLT transformations with untrusted stylesheets should explicitly use XMLUnit's APIs to pass in a pre-configured TraX `TransformerFactory` with extension functions disabled via features and attributes. The required `setFactory` or `setTransformerFactory` methods have been available since XMLUnit for Java 2.0.0. ### References [Bug Report](https://github.com/xmlunit/xmlunit/issues/264) [JAXP Security Guide](https://docs.oracle.com/en/java/javase/22/security/java-api-xml-processing-jaxp-security-guide.html#GUID-E345AA09-801E-4B95-B83D-7F0C452538AA)

CVE-2024-31573 Affected Xmlunit core Versions

1 component(s)
Fixed Versions:
2.10.0
Product / Package Ecosystem Affected Versions Fixed Version
org.xmlunit:xmlunit-core
Maven
< 2.10.0
2.10.0

References

Frequently Asked Questions

What is CVE-2024-31573?
CVE-2024-31573 is a security vulnerability in Xmlunit core involving XMLUnit for Java has Insecure Defaults when Processing XSLT Stylesheets under General Security Weakness.
Which Xmlunit core versions are affected?
Affected versions include releases prior to 2.10.0 across affected packages: org.xmlunit:xmlunit-core.
What version fixes CVE-2024-31573?
Upgrading to 2.10.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is xmlunit-core affected?
Yes, org.xmlunit:xmlunit-core is affected in releases prior to 2.10.0. Upgrade your dependency to 2.10.0 or later.
What CWE is associated with CVE-2024-31573?
CVE-2024-31573 is classified under General Security Weakness.
How can I check Maven dependencies for CVE-2024-31573?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.xmlunit'. 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-chfm-68vv-pvw5",
  "modified" : "2024-05-01T16:40:01Z",
  "published" : "2024-05-01T16:40:01Z",
  "aliases" : [ "CVE-2024-31573" ],
  "summary" : "XMLUnit for Java has Insecure Defaults when Processing XSLT Stylesheets",
  "details" : "### Impact\nWhen performing XSLT transformations XMLUnit for Java did not disable XSLT extension functions by default. Depending on the XSLT processor being used this could allow arbitrary code to be executed when XMLUnit is used to transform data with a stylesheet who's source can not be trusted. If the stylesheet can be provided externally this may even lead to a remote code execution.\n\n## Patches\nUsers are advised to upgrade to XMLUnit for Java 2.10.0 where the default has been changed by means of https://github.com/xmlunit/xmlunit/commit/b81d48b71dfd2868bdfc30a3e17ff973f32bc15b\n\n### Workarounds\nXMLUnit's main use-case is performing tests on code that generates or processes XML. Most users will not use it to perform arbitrary XSLT transformations.\n\nUsers running XSLT transformations with untrusted stylesheets should explicitly use XMLUnit's APIs to pass in a pre-configured TraX `TransformerFactory` with extension functions disabled via features and attributes. The required `setFactory` or `setTransformerFactory` methods have been available since XMLUnit for Java 2.0.0.\n\n### References\n[Bug Report](https://github.com/xmlunit/xmlunit/issues/264)\n[JAXP Security Guide](https://docs.oracle.com/en/java/javase/22/security/java-api-xml-processing-jaxp-security-guide.html#GUID-E345AA09-801E-4B95-B83D-7F0C452538AA)\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.xmlunit:xmlunit-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.10.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/xmlunit/xmlunit/security/advisories/GHSA-chfm-68vv-pvw5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/xmlunit/xmlunit/issues/264"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/xmlunit/xmlunit/commit/b81d48b71dfd2868bdfc30a3e17ff973f32bc15b"
  }, {
    "type" : "WEB",
    "url" : "https://docs.oracle.com/en/java/javase/22/security/java-api-xml-processing-jaxp-security-guide.html#GUID-E345AA09-801E-4B95-B83D-7F0C452538AA"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/xmlunit/xmlunit"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-01T16:40:01Z",
    "nvd_published_at" : null
  }
}