Skip to content

XMLUnit for Java has Insecure Defaults when Processing XSLT Stylesheets

Low severity GitHub Reviewed Published May 1, 2024 in xmlunit/xmlunit • Updated May 1, 2024

Package

maven org.xmlunit:xmlunit-core (Maven)

Affected versions

< 2.10.0

Patched versions

2.10.0

Description

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 xmlunit/xmlunit@b81d48b

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

References

@bodewig bodewig published to xmlunit/xmlunit May 1, 2024
Published to the GitHub Advisory Database May 1, 2024
Reviewed May 1, 2024
Last updated May 1, 2024

Severity

Low

Weaknesses

No CWEs

CVE ID

CVE-2024-31573

GHSA ID

GHSA-chfm-68vv-pvw5

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.