Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS02ODN4LTQ0NDQtanhoOM4AA9UM
Improper Restriction of XML External Entity Reference in org.cyclonedx:cyclonedx-core-java
Impact
Before deserializing CycloneDX Bill of Materials in XML format, cyclonedx-core-java leverages XPath expressions to determine the schema version of the BOM. The DocumentBuilderFactory
used to evaluate XPath expressions was not configured securely, making the library vulnerable to XML External Entity (XXE) injection.
XXE injection can be exploited to exfiltrate local file content, or perform Server Side Request Forgery (SSRF) to access infrastructure adjacent to the vulnerable application.
PoC
import org.cyclonedx.parsers.XmlParser;
class Poc {
public static void main(String[] args) {
// Will throw org.cyclonedx.exception.ParseException: java.net.ConnectException: Connection refused
new XmlParser().parse("""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bom [<!ENTITY % sp SYSTEM "https://localhost:1010/does-not-exist/file.dtd"> %sp;]>
<bom xmlns="http://cyclonedx.org/schema/bom/1.5"/>
""".getBytes());
}
}
Patches
The vulnerability has been fixed in cyclonedx-core-java version 0.9.4.
Workarounds
If feasible, applications can reject XML documents before handing them to cyclonedx-core-java for parsing.
This may be an option if incoming CycloneDX BOMs are known to be in JSON format.
References
- Issue was fixed via https://github.com/CycloneDX/cyclonedx-core-java/pull/434
- Issue was introduced via https://github.com/CycloneDX/cyclonedx-core-java/commit/162aa594f347b3f612fe0a45071693c3cd398ce9
- https://owasp.org/www-community/vulnerabilities/XML_External_Entity_(XXE)_Processing
- https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#xpathexpression
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS02ODN4LTQ0NDQtanhoOM4AA9UM
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: 3 months ago
Updated: 2 months ago
CVSS Score: 7.5
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Identifiers: GHSA-683x-4444-jxh8, CVE-2024-38374
References:
- https://github.com/CycloneDX/cyclonedx-core-java/security/advisories/GHSA-683x-4444-jxh8
- https://nvd.nist.gov/vuln/detail/CVE-2024-38374
- https://github.com/CycloneDX/cyclonedx-core-java/pull/434
- https://github.com/CycloneDX/cyclonedx-core-java/pull/434/commits/ab0bc9c530d24f737970dbd0287d1190b129853d
- https://github.com/advisories/GHSA-683x-4444-jxh8
Blast Radius: 13.5
Affected Packages
maven:org.cyclonedx:cyclonedx-core-java
Dependent packages: 13Dependent repositories: 63
Downloads:
Affected Version Ranges: >= 2.1.0, < 9.0.4
Fixed in: 9.0.4
All affected versions: 2.1.0, 2.1.1, 2.5.0, 2.5.1, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.8, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.1.0, 4.1.1, 4.1.2, 5.0.0, 5.0.1, 5.0.2, 5.0.3, 5.0.4, 5.0.5, 6.0.0, 7.0.0, 7.1.0, 7.1.1, 7.1.2, 7.1.3, 7.1.4, 7.1.5, 7.1.6, 7.2.0, 7.2.1, 7.3.0, 7.3.1, 7.3.2, 8.0.0, 8.0.1, 8.0.2, 8.0.3, 9.0.0, 9.0.1, 9.0.2, 9.0.3
All unaffected versions: 1.0.0, 1.0.1, 1.0.2, 1.1.0, 1.1.1, 1.1.2, 2.0.0, 2.0.1, 2.0.2, 9.0.4, 9.0.5