Vulnerabilities in pkg:npm/@cyclonedx/cyclonedx-library
PACKAGECVE-2024-34345 is a HIGH (CVSS 8.1) @cyclonedx/cyclonedx-library improper restriction of xml vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting @cyclonedx/cyclonedx library libraries in the npm ecosystem. The issue involves @cyclonedx/cyclonedx-library improper restriction of xml external entity reference vulnerability. Remediation is available by upgrading affected packages to version 6.7.1.
pkg:npm/@cyclonedx/cyclonedx-library
Vulnerability advisories affecting package pkg:npm/@cyclonedx/cyclonedx-library. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-38gf-rh2w-gmj7 | CVE-2024-34345 | HIGH | @cyclonedx/cyclonedx-library Improper Restriction of XML External Entity Reference vulnerability |
CVE-2024-34345 at a Glance
Security Impact
CVSS: 8.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2024-34345
To remediate this vulnerability, upgrade all affected @cyclonedx/cyclonedx library dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @cyclonedx/cyclonedx-library@6.7.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @cyclonedx/cyclonedx-library
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-34345, inspect your project dependencies using npm:
npm ls @cyclonedx/cyclonedx-library
Analyze the terminal output to locate any version of @cyclonedx/cyclonedx library in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.7.1), your application is affected.
Note: The npm ls @cyclonedx/cyclonedx-library command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
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/cyclonedx library, 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-34345 Affected @cyclonedx/cyclonedx library Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@cyclonedx/cyclonedx-library
|
npm |
≥ 6.7.0
< 6.7.1
All 1 versions
6.7.0
|
6.7.1
|
References
Frequently Asked Questions
What is CVE-2024-34345?
Which @cyclonedx/cyclonedx library versions are affected?
What version fixes CVE-2024-34345?
Is @cyclonedx/cyclonedx-library affected?
What is the CVSS score of CVE-2024-34345?
What CWE is associated with CVE-2024-34345?
How can I check npm dependencies for CVE-2024-34345?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-38gf-rh2w-gmj7",
"modified" : "2024-05-14T20:01:46Z",
"published" : "2024-05-08T19:55:37Z",
"aliases" : [ "CVE-2024-34345" ],
"summary" : "@cyclonedx/cyclonedx-library Improper Restriction of XML External Entity Reference vulnerability",
"details" : "### Impact\n\nXML External entity injections could be possible, when running the provided XML Validator on arbitrary input.\n\n#### POC\n\n```js\nconst {\n Spec: { Version },\n Validation: { XmlValidator }\n} = require('@cyclonedx/cyclonedx-library');\n\nconst version = Version.v1dot5;\nconst validator = new XmlValidator(version);\nconst input = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE poc [\n <!ENTITY xxe SYSTEM \"file:///etc/passwd\">\n]>\n<bom xmlns=\"http://cyclonedx.org/schema/bom/1.5\">\n <components>\n <component type=\"library\">\n <name>testing</name>\n <version>1.337</version>\n <licenses>\n <license>\n <id>&xxe;</id><!-- << XML external entity (XXE) injection -->\n </license>\n </licenses>\n </component>\n </components>\n</bom>`;\n\n// validating this forged(^) input might lead to unintended behaviour\n// for the fact that the XML external entity would be taken into account.\nvalidator.validate(input).then(ve => {\n console.error('validation error', ve);\n});\n```\n\n### Patches\n\nThis issue was fixed in `@cyclonedx/cyclonedx-library@6.7.1 `.\n\n\n\n### Workarounds\n\nDo not run the provided XML validator on untrusted inputs.\n\n### References\n\n* issue was introduced via <https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1063>. \n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@cyclonedx/cyclonedx-library"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "6.7.0"
}, {
"fixed" : "6.7.1"
} ]
} ],
"versions" : [ "6.7.0" ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/CycloneDX/cyclonedx-javascript-library/security/advisories/GHSA-38gf-rh2w-gmj7"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-34345"
}, {
"type" : "WEB",
"url" : "https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1063"
}, {
"type" : "WEB",
"url" : "https://github.com/CycloneDX/cyclonedx-javascript-library/commit/5e5e1e0b9422f47d2de81c7c4064b803a01e7203"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/CycloneDX/cyclonedx-javascript-library"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-611" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-05-08T19:55:37Z",
"nvd_published_at" : "2024-05-14T15:38:40Z"
}
}