GHSA-683x-4444-jxh8

Suggest an improvement
Source
https://github.com/advisories/GHSA-683x-4444-jxh8
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/06/GHSA-683x-4444-jxh8/GHSA-683x-4444-jxh8.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-683x-4444-jxh8
Aliases
  • CVE-2024-38374
Related
Published
2024-06-24T20:44:48Z
Modified
2024-06-28T19:03:05.897393Z
Severity
  • 7.5 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N CVSS Calculator
Summary
Improper Restriction of XML External Entity Reference in org.cyclonedx:cyclonedx-core-java
Details

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

Database specific
{
    "nvd_published_at": "2024-06-28T18:15:04Z",
    "cwe_ids": [
        "CWE-611"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2024-06-24T20:44:48Z"
}
References

Affected packages

Maven / org.cyclonedx:cyclonedx-core-java

Package

Name
org.cyclonedx:cyclonedx-core-java
View open source insights on deps.dev
Purl
pkg:maven/org.cyclonedx/cyclonedx-core-java

Affected ranges

Type
ECOSYSTEM
Events
Introduced
2.1.0
Fixed
9.0.4

Affected versions

2.*

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.*

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.*

4.0.0
4.0.1
4.0.2
4.0.3
4.1.0
4.1.1
4.1.2

5.*

5.0.0
5.0.1
5.0.2
5.0.3
5.0.4
5.0.5

6.*

6.0.0

7.*

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.*

8.0.0
8.0.1
8.0.2
8.0.3

9.*

9.0.0
9.0.1
9.0.2
9.0.3