# CVE-2024-34345: @cyclonedx/cyclonedx-library Improper Restriction of XML External Entity Reference vulnerability

> An attacker can exploit XML External Entity injection in the CycloneDX JavaScript library's validator to read sensitive data or cause denial of service.

- **Severity:** High 8.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 9 May 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-38gf-rh2w-gmj7

## What is CVE-2024-34345?

CVE-2024-34345 is a high-severity vulnerability in cyclonedx-javascript-library, published on 9 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The CycloneDX JavaScript library contains the core functionality of OWASP CycloneDX for JavaScript. In 6.7.0, XML External entity injections were possible, when running the provided XML Validator on arbitrary input. This issue was fixed in version 6.7.1.

Weakness: CWE-611 (Improper Restriction of XML External Entity Reference)

## Which versions are affected by CVE-2024-34345?

2 open source packages ship an affected version, including @cyclonedx/cyclonedx-library.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@cyclonedx/cyclonedx-library` | npm | From 6.7.0 | 6.7.1 |
| `@cyclonedx/cyclonedx-library` | npm | From 6.7.0 | 6.7.1 |

## How do I fix CVE-2024-34345?

Upgrade @cyclonedx/cyclonedx-library to 6.7.1 or later.

## Is CVE-2024-34345 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-34345 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-34345 and fix it if it is affected.

What it is: CVE-2024-34345 is a high-severity vulnerability in cyclonedx-javascript-library, published on 9 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-34345 exists.

Affected packages and fixed versions:
- @cyclonedx/cyclonedx-library (npm): affected from 6.7.0; fixed in 6.7.1
- @cyclonedx/cyclonedx-library (npm): affected from 6.7.0; fixed in 6.7.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-34345/ (Markdown: https://insights.sbomify.com/CVE-2024-34345/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-34345
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-34345
- OSV: https://osv.dev/vulnerability/CVE-2024-34345

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-34345/
Summaries are generated and may contain mistakes; the official description above is the record.
