CVE-2024-31573: Medium severity maven/org.xmlunit:xmlunit-core vulnerability

Published May 1, 2024
·
Updated

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 JAXP Security Guide

Other sources

XMLUnit for Java before 2.10.0, in the default configuration, might allow code execution via an untrusted stylesheet (used for an XSLT transformation), because XSLT extension functions are enabled.

— MITRE

Affected Software

1 affected componentFixes available
maven/org.xmlunit:xmlunit-core<2.10.0
2.10.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade maven/org.xmlunit:xmlunit-core to a version that resolves this vulnerability.

    Fixed in 2.10.0
  2. Upgrade

    Upgrade XMLUnit for Java to a version that resolves this vulnerability.

    Fixed in 2.10.0
  3. Configuration

    Use XMLUnit's APIs to provide a pre-configured TraX TransformerFactory with extension functions disabled via features and attributes when processing untrusted stylesheets.

    XMLUnit for Java XSLT transformations XSLT extension functions = disabled

Event History

May 1, 2024
Advisory Published
via GitHub·04:40 PM
Oct 17, 2025
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:15 PM
DescriptionSeverityWeakness
Oct 19, 2025
Data Sourced
via Microsoft·01:01 AM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Who is realistically exposed to this issue?

Users are exposed when XMLUnit for Java performs XSLT transformations using a stylesheet whose source is not trusted. XMLUnit's main use case is XML testing, so users that do not perform arbitrary XSLT transformations are less likely to be affected.

2

What does an attacker need to exploit it?

An attacker needs a way to influence the XSLT stylesheet used by an XMLUnit transformation. If the stylesheet can be supplied externally, exploitation may lead to remote code execution depending on the XSLT processor in use.

3

What should be done if upgrading is not immediately possible?

Explicitly provide XMLUnit with a pre-configured TraX TransformerFactory that disables extension functions through its features and attributes. XMLUnit APIs for supplying the factory, including setFactory or setTransformerFactory, have been available since version 2.0.0.

4

Which version changes the unsafe default?

XMLUnit for Java 2.10.0 changes the default to disable XSLT extension functions. Users are advised to upgrade to that version.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203