Skip to main content
Menu
Advisories

Unbounded memory growth from crafted project files crashes cdxgen and its server

GHSA-6PC3-X5Q2-853PPublished Updated GitHub

Description

Crafted project files make cdxgen build BOMs hundreds of times larger than the scanned tree, allocate gigabytes, or abort. Typical inputs are a few kilobytes to a few hundred kilobytes; a 7.6 kB composer.lock and a 56-byte CMakePresets.json are enough in two cases. V8 heap exhaustion is a fatal error rather than an exception, so in cdxgen --server a single scan ends the server process for every client until it is restarted. No build tool is involved, so --no-install-deps and secure mode do not help.

Details

Most cases copy a value whose length the tree controls (a version, a remote URL, a name, a license text) onto every component, dependency or metric, so the output grows with the product of two sizes the attacker picks. Others expand nested references without a limit, inflate archive entries beyond the size they declare, read a /proc file that has no end, or crash on a dependency named after an Object.prototype member.

InputCodeFirst affected release
Brace patterns in pnpm-workspace.yaml exclusions, expanded into many globscreateNodejsBom() in lib/cli/jsBom.js12.4.4
Yarn workspace references matched by name onlyparseYarnLock() in lib/ecosystems/parsers-js.js11.8.0
find_package versions in CMakeCache.txtcreateCppBom() in lib/cli/nativeBom.js13.0.0 (not in 12.x)
A long override version in vcpkg.json, copied per letter-case variantparseVcpkgManifest() in lib/ecosystems/cppEvidence.js13.6.0 (not in 12.x)
Include directories in compile_commands.jsonincludeDirectories() in lib/parsers/compileCommands.js13.4.0 (not in 12.x)
A CMakePresets.json include of a /proc path, which has no size limitreadSmallFile() in lib/inventory/cmakeBuildDirs.js13.4.0 (not in 12.x)
Long version and revision values in Meson wrap files; also a slow regular expressionreadMesonWraps() in lib/ecosystems/parsers-misc.js13.6.0 (not in 12.x)
A long configuration name in xmake-requires.lockparseXmakeRequiresLock() in lib/ecosystems/parsers-misc.js13.2.0 (not in 12.x)
Lua and Nim lock files parsed again for every manifest beside themcreateLuaBom() and createNimBom() in lib/cli/nativeBom.js13.2.0 (not in 12.x)
One Zig package hash listed under many dependency namesresolveZigGraph() in lib/ecosystems/zigResolver.js13.0.0 (not in 12.x)
version.ref chains in a Gradle version catalogresolveCatalogVersion() in lib/ecosystems/gradleutils.js13.2.0 (not in 12.x)
Nested property references in pom.xmlparsePom() in lib/ecosystems/parsers-jvm.js13.5.0 (not in 12.x)
Jar or aar entries in the Maven, Gradle or sbt cache that declare a smaller size than they inflate togetAarClasses() and readEmbeddedJarMetadata() in lib/inventory/deps.js13.4.0 (not in 12.x)
Target framework properties in a .csprojparseCsProjData() in lib/ecosystems/parsers-dotnet.js10.9.11
One LICENSE file shared by many Go modulesparseGoListDep() in lib/ecosystems/parsers-go.js12.1.2
Placeholder expansion in composer.lock dist.url (a 7.6 kB file is enough)parseComposerLock() in lib/ecosystems/parsers-misc.js11.6.0
pyproject.toml dependency groups copied to every locked versionparsePyLockData() in lib/ecosystems/parsers-python.js10.10.0
metadata.files in poetry.lock, pdm.lock or uv.lock copied to every versioncollectPythonLockMetadataFileEntries() in lib/ecosystems/parsers-python.js11.0.8
A long package name in pylock.toml, copied into every wheel referencecreateArtifactComponent() in lib/ecosystems/pylockutils.js12.5.1
A wheel holding many PEP 770 SBOM documentscollectEmbeddedSboms() in lib/ecosystems/pep770.js13.0.0 (not in 12.x)
A long Cargo target selector copied to every transitive crateapplyCargoDependencyKindMetadata() in lib/ecosystems/parsers-rust.js13.2.0 (not in 12.x)
A Cargo dependency named after an Object.prototype member; the scan exits with an uncaught error and no BOM, or drops the crateparseCargoTomlData() and parseCargoData() in lib/ecosystems/parsers-rust.js10.10.0
A long remote: (or revision:, branch:, tag:) line in Gemfile.lock, copied onto every gemparseGemfileLockData() in lib/ecosystems/rubyutils.js10.1.1
String interpolation in a gemspec (also reached in container image scans)expandGemspecInterpolation() in lib/ecosystems/rubyutils.js13.3.0 (not in 12.x)
A long Scala version copied into every ::: dependency of a scala-cli projectscalaCliComponent() in lib/ecosystems/scalacliutils.js13.4.0 (not in 12.x)
A long parent name in a caxa metadata.jsonparseCaxaMetadata() in lib/ecosystems/caxa.js12.1.0-alpha.0
A highly compressed manifest in a .vsix fileparseVsixFile() in lib/helpers/vsixutils.js12.2.0
Step lists shared through YAML anchors in .circleci/config.yml (formulation)parseCircleCiFile() in lib/inventory/ciParsers/circleCi.js12.2.0
A git commit with a very large message (formulation)gitTreeHashes() in lib/inventory/envcontext.js12.1.0-alpha.1
One file in the scan root copied onto every component as license text; the lookup also follows a link to a file outside the treeaddLicenseText() in lib/inventory/spdx.js2.0.2
A long custom label in a license policy that a config file in the working directory namesnormalizeAlertLabel() in lib/inventory/licenseEnhancer.js12.7.1
langgraph.json dependencies copied to every graph (-t ai-skill)parseLanggraphConfig() in lib/inventory/communityAiConfigParser.js12.3.1
An MCP server.json name copied into every package (-t mcp)mcpServerManifestParser.parse() in lib/inventory/mcpServerManifest.js13.2.0 (not in 12.x)
Many links to one .safetensors file (AI inventory)collectJsAiInventory() in lib/inventory/aiCollector.js13.2.0 (not in 12.x)
A Hugging Face model card whose dataset name is copied into every metric (AI inventory)createPerformanceMetrics() in lib/parsers/huggingfaceUtils.js12.5.1

Impact

Loss of availability for CI jobs, hosted scanners and cdxgen --server: scans end without a BOM, and the server process exits for all clients. Where a scan finishes, its BOM can be hundreds of megabytes. Apart from the license text case, which also copies a linked file from outside the tree, no data is disclosed or modified.

Patches

Fixed in @cdxgen/cdxgen 13.8.0. Versions 13.0.0 through 13.7.0 of @cdxgen/cdxgen are affected. The 12.x line, published as @cyclonedx/cdxgen, is also affected by some of the issues above from 2.0.2 through 12.9.1, and no 12.x release contains the fix. Users of 12.x should move to @cdxgen/cdxgen 13.8.0 or apply the workarounds below. File paths in this advisory refer to the 13.x source tree; in 12.x most of the same functions are under lib/helpers/ or in lib/cli/index.js. The first affected release of each issue is in the table above.

Workarounds

  • Run scans of untrusted content with a memory limit (for example a container limit) and a time limit, in a process that does no other work.
  • Pass -t with only the project types needed, and keep formulation, AI inventory and MCP inventory off for untrusted content unless required.
  • Run cdxgen --server under a supervisor that restarts it, behind a reverse proxy with authentication.

Credit

These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-W82ZOPEH, ANT-2026-1MK970BP, ANT-2026-4X7KHXBV, ANT-2026-3E0A84FI, ANT-2026-3YZ4XWPD, ANT-2026-PLLNCMF7, ANT-2026-K4T8285C, ANT-2026-926UMZWT, ANT-2026-TP8TI8DW, ANT-2026-17F1X6S9, ANT-2026-NJQYWMPV, ANT-2026-FNUJPOXK, ANT-2026-9ANE78KV, ANT-2026-DF8ESY8X, ANT-2026-ZBSY8B0F, ANT-2026-LEYWLFVB, ANT-2026-26X5PY11, ANT-2026-A1I20JTG, ANT-2026-4JYGWOL3, ANT-2026-XYG10KDQ, ANT-2026-K7FHUQX8, ANT-2026-QL56DUN6, ANT-2026-K17PJT4Q, ANT-2026-22BAY6GP, ANT-2026-AWO6K1SM, ANT-2026-HZEMAPLM, ANT-2026-KE8SUCLM, ANT-2026-4DXU5BTU, ANT-2026-0Z39VIW6, ANT-2026-G7YI1SOW, ANT-2026-EBTODQDE, ANT-2026-7WLFQYUY, ANT-2026-IYKU02MX, ANT-2026-YNJ0622Z, ANT-2026-ZMVJ80TO.

References

Affected versions

References

GitHub · cdxgen/cdxgen