CVE-2024-38374: Cyclonedx core java Cyclonedx-core-java Vulnerability
HIGHCVE-2024-38374 is a HIGH (CVSS 7.5) cyclonedx-core-java vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting Cyclonedx core java libraries in the Maven ecosystem. The issue involves cyclonedx-core-java. Remediation is available by upgrading affected packages to version 9.0.4.
CVE-2024-38374 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2024-38374
To remediate this vulnerability, upgrade all affected Cyclonedx core java dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-core-java</artifactId>
<version>9.0.4</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.cyclonedx
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2024-38374, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.cyclonedx
Analyze the terminal output to locate any version of Cyclonedx core java in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.0.4), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.cyclonedx 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 CWE-611: Improper Restriction of XML External Entity Reference, where the product processes an xml document that can contain xml entities with uris that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. In Cyclonedx core java, 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
CVE-2024-38374 Affected Cyclonedx core java Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.cyclonedx:cyclonedx-core-java
|
Maven |
≥ 2.1.0
< 9.0.4
|
9.0.4
|
References
Frequently Asked Questions
What is CVE-2024-38374?
Which Cyclonedx core java versions are affected?
What version fixes CVE-2024-38374?
Is cyclonedx-core-java affected?
What is the CVSS score of CVE-2024-38374?
What CWE is associated with CVE-2024-38374?
How can I check Maven dependencies for CVE-2024-38374?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-683x-4444-jxh8",
"modified" : "2024-06-28T18:58:48Z",
"published" : "2024-06-24T20:44:48Z",
"aliases" : [ "CVE-2024-38374" ],
"summary" : "Improper Restriction of XML External Entity Reference in org.cyclonedx:cyclonedx-core-java",
"details" : "### Impact\n\nBefore 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.\n\nXXE injection can be exploited to exfiltrate local file content, or perform Server Side Request Forgery (SSRF) to access infrastructure adjacent to the vulnerable application.\n\n### PoC\n\n```java\nimport org.cyclonedx.parsers.XmlParser;\n\nclass Poc {\n\n public static void main(String[] args) {\n // Will throw org.cyclonedx.exception.ParseException: java.net.ConnectException: Connection refused\n new XmlParser().parse(\"\"\"\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <!DOCTYPE bom [<!ENTITY % sp SYSTEM \"https://localhost:1010/does-not-exist/file.dtd\"> %sp;]>\n <bom xmlns=\"http://cyclonedx.org/schema/bom/1.5\"/>\n \"\"\".getBytes());\n }\n\n}\n```\n\n### Patches\n\nThe vulnerability has been fixed in _cyclonedx-core-java_ version 0.9.4.\n\n### Workarounds\n\nIf feasible, applications can reject XML documents before handing them to _cyclonedx-core-java_ for parsing.\nThis may be an option if incoming CycloneDX BOMs are known to be in JSON format.\n\n### References\n\n* Issue was fixed via <https://github.com/CycloneDX/cyclonedx-core-java/pull/434>\n* Issue was introduced via <https://github.com/CycloneDX/cyclonedx-core-java/commit/162aa594f347b3f612fe0a45071693c3cd398ce9>\n* <https://owasp.org/www-community/vulnerabilities/XML_External_Entity_(XXE)_Processing>\n* <https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#xpathexpression>\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.cyclonedx:cyclonedx-core-java"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.1.0"
}, {
"fixed" : "9.0.4"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/CycloneDX/cyclonedx-core-java/security/advisories/GHSA-683x-4444-jxh8"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-38374"
}, {
"type" : "WEB",
"url" : "https://github.com/CycloneDX/cyclonedx-core-java/pull/434"
}, {
"type" : "WEB",
"url" : "https://github.com/CycloneDX/cyclonedx-core-java/pull/434/commits/ab0bc9c530d24f737970dbd0287d1190b129853d"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/CycloneDX/cyclonedx-core-java"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-611" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-06-24T20:44:48Z",
"nvd_published_at" : "2024-06-28T18:15:04Z"
}
}