Quadratic-time parsing and backtracking regular expressions in project file parsers allow denial of service
Description
Crafted manifests, lock files and configuration files in a scanned tree make cdxgen spend CPU time that grows with the square of the input size, and in a few cases with its cube or exponentially. Kilobytes to a few megabytes of text hold a scan on one core for minutes or longer. Parsing is synchronous, so cdxgen --server answers no other request, /health included, while such a scan runs, and CDXGEN_SERVER_TIMEOUT_MS does not interrupt it. No build tool is involved, so --no-install-deps and secure mode do not help.
Details
The causes fall into three patterns: regular expressions with overlapping quantifiers that backtrack on crafted text, linear searches or repeated parsing inside loops over items the tree controls, and lists that are merged or deduplicated by rescanning them on every addition. Most of these parsers run in default scans of the matching ecosystem, including scans without -t; the table notes the cases that need an opt-in project type or option.
| Input | Code | First affected release |
|---|---|---|
| Thousands of tiny lock files in a JavaScript or Python project | createNodejsBom() in lib/cli/jsBom.js | 7.0.2 |
| A long import specifier or bun.lock package name (regular expression) | addWasmComponentsFromImports() in lib/cli/jsBom.js | 12.2.1 |
A long packages entry in pnpm-workspace.yaml (regular expression) | createNodejsBom() in lib/cli/jsBom.js | 12.4.4 |
| One import statement with many names and a long module specifier; also a very large BOM | addEvidenceForImports() in lib/ecosystems/jsEvidence.js | 9.6.0 |
Many descriptors on one yarn.lock key line | parseYarnLock() in lib/ecosystems/parsers-js.js | 9.9.0 |
| Yarn workspace members looked up linearly | parseYarnLock() in lib/ecosystems/parsers-js.js | 11.8.0 |
| A layered pnpm workspace lock file; time is exponential in the number of layers | _setTreeWorkspaceRef() in lib/ecosystems/parsers-js.js | 11.1.1 |
| Many locked versions of one installed pnpm package | pnpmMetadata() in lib/ecosystems/parsers-js.js | 11.5.0 |
| pnpm peer variants that inherit the base dependencies (cubic time and high memory) | parsePnpmLock() in lib/ecosystems/parsers-js.js | 10.7.0 |
vcpkg.json dependencies matched against all components collected so far | createCppBom() in lib/cli/nativeBom.js | 13.6.0 (not in 12.x) |
| Many C headers per component | mergeImportedSymbols() in lib/ecosystems/cppEvidence.js | 13.3.0 (not in 12.x) |
| Many directories that each hold a LICENSE file | createIncludeAttributor() in lib/ecosystems/cppIncludeResolver.js | 13.4.0 (not in 12.x) |
Strings of bare $ characters in CMakePresets.json | expandPresetMacros() in lib/parsers/cmakePresets.js | 13.4.0 (not in 12.x) |
Deep or wide preset inheritance in CMakePresets.json; also a very large BOM | expandPreset() in lib/parsers/cmakePresets.js | 13.4.0 (not in 12.x) |
Meson wraps read again for every meson*.cmake file | parseCmakeLikeFile() in lib/ecosystems/parsers-misc.js | 13.6.0 (not in 12.x) |
A shared Zig dependency resolved again for each build.zig.zon | createZigBom() in lib/cli/nativeBom.js | 13.0.0 (not in 12.x) |
| Thousands of Gradle lockfiles | parseGradleLockfiles() in lib/ecosystems/gradleutils.js | 13.7.0 (not in 12.x) |
Artifact names with _2.N suffixes in gradle.lockfile | mergeScalaDuplicateComponents() in lib/inventory/scalaDedupe.js | 13.6.0 (not in 12.x) |
| A large parent pom parsed again for every module (Maven not run) | locateLocalParentPom() in lib/ecosystems/parsers-jvm.js | 13.5.0 (not in 12.x) |
| Nested modules when Maven writes no dependency tree | readMavenModuleTrees() in lib/ecosystems/parsers-jvm.js | 13.4.0 (not in 12.x) |
Long require lines in go.mod; cost grows with the cube of the size | parseGoModData() in lib/ecosystems/parsers-go.js | 13.0.0 (not in 12.x) |
replace directives searched for every module graph edge | parseGoModGraph() in lib/ecosystems/parsers-go.js | 13.5.0 (not in 12.x) |
Many Cargo.lock entries of one crate | parseCargoDependencyData() in lib/ecosystems/parsers-rust.js | 13.3.0 (not in 12.x) |
A very long dependencies array in Cargo.lock | rollupCargoDependencyKinds() in lib/ecosystems/parsers-rust.js | 13.2.0 (not in 12.x) |
Thousands of [workspace] members (non-recursive scans) | parseCargoTomlData() in lib/ecosystems/parsers-rust.js | 12.3.1 |
| Long whitespace runs in Python lock file markers (regular expression) | markerExcludesCPython() in lib/ecosystems/parsers-python.js | 13.6.0 (not in 12.x) |
pyproject.toml parsed again for each pylock file | parsePyLockData() in lib/ecosystems/parsers-python.js | 12.3.0 |
Deeply nested __init__.py packages | projectModuleNames() in lib/ecosystems/pythonutils.js | 13.4.0 (not in 12.x) |
| Crafted entry names in a wheel (regular expressions) | distInfoStem() in lib/ecosystems/pep770.js | 13.0.0 (not in 12.x) |
One large .py file with the MCP inventory selected | extractPythonCallArguments() in lib/inventory/analyzer.js | 12.3.2 |
A long version re-encoded for every reference in Gemfile.lock | parseGemfileLockData() in lib/ecosystems/rubyutils.js | 10.1.0 |
A long required_ruby_version or Gemfile ruby line | rubyRequirementToVers() in lib/ecosystems/rubyutils.js | 13.3.0 (not in 12.x) |
Library files walked again for every target in project.assets.json; can also exhaust the heap | parseCsProjAssetsData() in lib/ecosystems/parsers-dotnet.js | 9.9.8 |
.props properties copied for every project | projectPropertyCandidates() in lib/ecosystems/parsers-dotnet.js | 13.4.0 (not in 12.x) |
Duplicate .terraform.lock.hcl blocks combined with many files in one provider directory | applyProviderLicense() in lib/ecosystems/parsers-terraform.js | 13.4.0 (not in 12.x) |
| Duplicate Terraform providers or modules | mergeIntoState() in lib/ecosystems/parsers-terraform.js | 13.4.0 (not in 12.x) |
| A shared local Terraform module parsed again for every root | processRoot() in lib/ecosystems/parsers-terraform.js | 13.4.0 (not in 12.x) |
Module calls walked again for every modules.json record | collectManifestRecords() in lib/ecosystems/parsers-terraform.js | 13.4.0 (not in 12.x) |
Root inputs of flake.lock searched linearly | parseFlakeLock() in lib/ecosystems/parsers-misc.js | 11.5.0 |
Unclosed braces in flake.nix or an opam file (regular expressions) | parseFlakeNix() in lib/ecosystems/parsers-misc.js and collectDependsEntry() in lib/ecosystems/parsers-opam.js | 11.5.0 |
Many depends entries in one opam lock file | collectDependsEntry() in lib/ecosystems/parsers-opam.js | 13.2.0 (not in 12.x) |
A crafted version constraint in elm.json (regular expression) | toSemverRange() in lib/ecosystems/parsers-elm.js | 13.2.0 (not in 12.x) |
A long scala-cli //> using directive or Ollama Modelfile line (regular expressions) | parseScalaCliDirectives() in lib/ecosystems/scalacliutils.js and the Modelfile parser | 13.4.0 (not in 12.x) |
| sbt builds nested inside one another when sbt is not installed | discoverSbtProjects() in lib/ecosystems/sbtutils.js | 12.7.0 |
| Long names in MCP bundles, normalized before they are truncated | sanitizeMcpRefToken() in lib/inventory/mcpDiscovery.js | 12.3.2 |
| One Hugging Face model named many times with differing variant lists (AI inventory) | mergePedigreeVariants() in lib/inventory/aiCollector.js | 12.5.1 |
| Many certificates with the same subject, for example in a Kubernetes TLS secret (certificate inventory) | linkFallbackIssuers() in lib/inventory/certificates.js | 13.5.0 (not in 12.x) |
| Many files that share one certificate or pinned key (certificate inventory) | mergeRecords() in lib/inventory/certificates.js | 13.5.0 (not in 12.x) |
| One crafted file with a certificate-like name (certificate inventory) | readOID() in lib/inventory/certificates.js | 13.5.0 (not in 12.x) |
| A large license policy that a config file in the working directory names | getComplianceAlert() in lib/inventory/licenseEnhancer.js | 12.7.1 |
A large bitbucket-pipelines.yml (container-manifest and universal scans) | addSkippedSrcFiles() in lib/managers/docker.js | 10.0.5 |
Impact
Loss of availability for CI jobs, hosted scanners and cdxgen --server instances that scan repositories, pull requests or archives from others. Most of these scans eventually finish with a correct BOM; the cases marked in the table also produce very large BOMs or exhaust memory. No data is disclosed or modified.
docs/THREAT_MODEL.md and SECURITY.md treat algorithmic complexity attacks triggered by untrusted project content as in scope, as distinct from slow scans of large but ordinary projects.
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 7.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
- Apply a time limit to scans of untrusted content, for example a CI job timeout or
timeout(1), and do not share a cdxgen process between untrusted scans and other work. - Pass
-twith only the project types needed. - Put
cdxgen --serverbehind a reverse proxy with authentication and restart it under a supervisor.
Credit
These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-UTC2ADO8, ANT-2026-8UKX1MRV, ANT-2026-U0DXEZ9A, ANT-2026-ZOF0XK2H, ANT-2026-8JSQHBCR, ANT-2026-NGA1759T, ANT-2026-SHO5JARA, ANT-2026-HYUIJSCH, ANT-2026-Z1FECQ47, ANT-2026-1J6VK8W4, ANT-2026-PFBGY65T, ANT-2026-5UE9I434, ANT-2026-F1WAMV94, ANT-2026-QJRLUSMT, ANT-2026-2T9D7US5, ANT-2026-MIRCWU4V, ANT-2026-159R9FEF, ANT-2026-ES1IPZY3, ANT-2026-HMBYPLI0, ANT-2026-T4J32G0T, ANT-2026-M3HRU4RH, ANT-2026-KT24X6FR, ANT-2026-7UXFCN5I, ANT-2026-FMK5NVXT, ANT-2026-HT39D52R, ANT-2026-RP1942XQ, ANT-2026-QET8WEG4, ANT-2026-B3ERN4AL, ANT-2026-LM0R76WN, ANT-2026-DD9IB9BY, ANT-2026-QCLMYEM5, ANT-2026-SDZU1ZSS, ANT-2026-OHKQ8SSA, ANT-2026-99ZTWD8F, ANT-2026-91JZMU0J, ANT-2026-AUC328EY, ANT-2026-3ZSXOFA5, ANT-2026-PCQU72FI, ANT-2026-R9YVANM6, ANT-2026-E2CAL1K5, ANT-2026-QX67CHW9, ANT-2026-2TLB49J4, ANT-2026-Z75RUVZI, ANT-2026-B8ECL8PJ, ANT-2026-TTK52GZH, ANT-2026-PMS69RUN, ANT-2026-44VV1MIE, ANT-2026-WAPKSOUZ, ANT-2026-IDTPHJZL, ANT-2026-R8UUR0YH, ANT-2026-WCRKXRGE.
References
- github.com/
cdxgen/ cdxgen/ security/ advisories/ GHSA-4v76-rxfx-x42x (earlier quadratic-time parsing advisory for CrewAI files) - github.com/
cdxgen/ cdxgen/ blob/ master/ SECURITY.md - github.com/
cdxgen/ cdxgen/ blob/ master/ docs/ THREAT_MODEL.md - Fixed in: github.com/
cdxgen/ cdxgen/ pull/ 4787