Unbounded memory growth from crafted project files crashes cdxgen and its server
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.
| Input | Code | First affected release |
|---|---|---|
Brace patterns in pnpm-workspace.yaml exclusions, expanded into many globs | createNodejsBom() in lib/cli/jsBom.js | 12.4.4 |
| Yarn workspace references matched by name only | parseYarnLock() in lib/ecosystems/parsers-js.js | 11.8.0 |
find_package versions in CMakeCache.txt | createCppBom() in lib/cli/nativeBom.js | 13.0.0 (not in 12.x) |
A long override version in vcpkg.json, copied per letter-case variant | parseVcpkgManifest() in lib/ecosystems/cppEvidence.js | 13.6.0 (not in 12.x) |
Include directories in compile_commands.json | includeDirectories() in lib/parsers/compileCommands.js | 13.4.0 (not in 12.x) |
A CMakePresets.json include of a /proc path, which has no size limit | readSmallFile() in lib/inventory/cmakeBuildDirs.js | 13.4.0 (not in 12.x) |
| Long version and revision values in Meson wrap files; also a slow regular expression | readMesonWraps() in lib/ecosystems/parsers-misc.js | 13.6.0 (not in 12.x) |
A long configuration name in xmake-requires.lock | parseXmakeRequiresLock() in lib/ecosystems/parsers-misc.js | 13.2.0 (not in 12.x) |
| Lua and Nim lock files parsed again for every manifest beside them | createLuaBom() and createNimBom() in lib/cli/nativeBom.js | 13.2.0 (not in 12.x) |
| One Zig package hash listed under many dependency names | resolveZigGraph() in lib/ecosystems/zigResolver.js | 13.0.0 (not in 12.x) |
version.ref chains in a Gradle version catalog | resolveCatalogVersion() in lib/ecosystems/gradleutils.js | 13.2.0 (not in 12.x) |
Nested property references in pom.xml | parsePom() in lib/ecosystems/parsers-jvm.js | 13.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 to | getAarClasses() and readEmbeddedJarMetadata() in lib/inventory/deps.js | 13.4.0 (not in 12.x) |
Target framework properties in a .csproj | parseCsProjData() in lib/ecosystems/parsers-dotnet.js | 10.9.11 |
| One LICENSE file shared by many Go modules | parseGoListDep() in lib/ecosystems/parsers-go.js | 12.1.2 |
Placeholder expansion in composer.lock dist.url (a 7.6 kB file is enough) | parseComposerLock() in lib/ecosystems/parsers-misc.js | 11.6.0 |
pyproject.toml dependency groups copied to every locked version | parsePyLockData() in lib/ecosystems/parsers-python.js | 10.10.0 |
metadata.files in poetry.lock, pdm.lock or uv.lock copied to every version | collectPythonLockMetadataFileEntries() in lib/ecosystems/parsers-python.js | 11.0.8 |
A long package name in pylock.toml, copied into every wheel reference | createArtifactComponent() in lib/ecosystems/pylockutils.js | 12.5.1 |
| A wheel holding many PEP 770 SBOM documents | collectEmbeddedSboms() in lib/ecosystems/pep770.js | 13.0.0 (not in 12.x) |
| A long Cargo target selector copied to every transitive crate | applyCargoDependencyKindMetadata() in lib/ecosystems/parsers-rust.js | 13.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 crate | parseCargoTomlData() and parseCargoData() in lib/ecosystems/parsers-rust.js | 10.10.0 |
A long remote: (or revision:, branch:, tag:) line in Gemfile.lock, copied onto every gem | parseGemfileLockData() in lib/ecosystems/rubyutils.js | 10.1.1 |
| String interpolation in a gemspec (also reached in container image scans) | expandGemspecInterpolation() in lib/ecosystems/rubyutils.js | 13.3.0 (not in 12.x) |
A long Scala version copied into every ::: dependency of a scala-cli project | scalaCliComponent() in lib/ecosystems/scalacliutils.js | 13.4.0 (not in 12.x) |
A long parent name in a caxa metadata.json | parseCaxaMetadata() in lib/ecosystems/caxa.js | 12.1.0-alpha.0 |
A highly compressed manifest in a .vsix file | parseVsixFile() in lib/helpers/vsixutils.js | 12.2.0 |
Step lists shared through YAML anchors in .circleci/config.yml (formulation) | parseCircleCiFile() in lib/inventory/ciParsers/circleCi.js | 12.2.0 |
| A git commit with a very large message (formulation) | gitTreeHashes() in lib/inventory/envcontext.js | 12.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 tree | addLicenseText() in lib/inventory/spdx.js | 2.0.2 |
| A long custom label in a license policy that a config file in the working directory names | normalizeAlertLabel() in lib/inventory/licenseEnhancer.js | 12.7.1 |
langgraph.json dependencies copied to every graph (-t ai-skill) | parseLanggraphConfig() in lib/inventory/communityAiConfigParser.js | 12.3.1 |
An MCP server.json name copied into every package (-t mcp) | mcpServerManifestParser.parse() in lib/inventory/mcpServerManifest.js | 13.2.0 (not in 12.x) |
Many links to one .safetensors file (AI inventory) | collectJsAiInventory() in lib/inventory/aiCollector.js | 13.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.js | 12.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
-twith only the project types needed, and keep formulation, AI inventory and MCP inventory off for untrusted content unless required. - Run
cdxgen --serverunder 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.