Skip to main content
Menu
Advisories

Quadratic-time parsing and backtracking regular expressions in project file parsers allow denial of service

GHSA-246Q-M53Q-RJ22Published Updated GitHub

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.

InputCodeFirst affected release
Thousands of tiny lock files in a JavaScript or Python projectcreateNodejsBom() in lib/cli/jsBom.js7.0.2
A long import specifier or bun.lock package name (regular expression)addWasmComponentsFromImports() in lib/cli/jsBom.js12.2.1
A long packages entry in pnpm-workspace.yaml (regular expression)createNodejsBom() in lib/cli/jsBom.js12.4.4
One import statement with many names and a long module specifier; also a very large BOMaddEvidenceForImports() in lib/ecosystems/jsEvidence.js9.6.0
Many descriptors on one yarn.lock key lineparseYarnLock() in lib/ecosystems/parsers-js.js9.9.0
Yarn workspace members looked up linearlyparseYarnLock() in lib/ecosystems/parsers-js.js11.8.0
A layered pnpm workspace lock file; time is exponential in the number of layers_setTreeWorkspaceRef() in lib/ecosystems/parsers-js.js11.1.1
Many locked versions of one installed pnpm packagepnpmMetadata() in lib/ecosystems/parsers-js.js11.5.0
pnpm peer variants that inherit the base dependencies (cubic time and high memory)parsePnpmLock() in lib/ecosystems/parsers-js.js10.7.0
vcpkg.json dependencies matched against all components collected so farcreateCppBom() in lib/cli/nativeBom.js13.6.0 (not in 12.x)
Many C headers per componentmergeImportedSymbols() in lib/ecosystems/cppEvidence.js13.3.0 (not in 12.x)
Many directories that each hold a LICENSE filecreateIncludeAttributor() in lib/ecosystems/cppIncludeResolver.js13.4.0 (not in 12.x)
Strings of bare $ characters in CMakePresets.jsonexpandPresetMacros() in lib/parsers/cmakePresets.js13.4.0 (not in 12.x)
Deep or wide preset inheritance in CMakePresets.json; also a very large BOMexpandPreset() in lib/parsers/cmakePresets.js13.4.0 (not in 12.x)
Meson wraps read again for every meson*.cmake fileparseCmakeLikeFile() in lib/ecosystems/parsers-misc.js13.6.0 (not in 12.x)
A shared Zig dependency resolved again for each build.zig.zoncreateZigBom() in lib/cli/nativeBom.js13.0.0 (not in 12.x)
Thousands of Gradle lockfilesparseGradleLockfiles() in lib/ecosystems/gradleutils.js13.7.0 (not in 12.x)
Artifact names with _2.N suffixes in gradle.lockfilemergeScalaDuplicateComponents() in lib/inventory/scalaDedupe.js13.6.0 (not in 12.x)
A large parent pom parsed again for every module (Maven not run)locateLocalParentPom() in lib/ecosystems/parsers-jvm.js13.5.0 (not in 12.x)
Nested modules when Maven writes no dependency treereadMavenModuleTrees() in lib/ecosystems/parsers-jvm.js13.4.0 (not in 12.x)
Long require lines in go.mod; cost grows with the cube of the sizeparseGoModData() in lib/ecosystems/parsers-go.js13.0.0 (not in 12.x)
replace directives searched for every module graph edgeparseGoModGraph() in lib/ecosystems/parsers-go.js13.5.0 (not in 12.x)
Many Cargo.lock entries of one crateparseCargoDependencyData() in lib/ecosystems/parsers-rust.js13.3.0 (not in 12.x)
A very long dependencies array in Cargo.lockrollupCargoDependencyKinds() in lib/ecosystems/parsers-rust.js13.2.0 (not in 12.x)
Thousands of [workspace] members (non-recursive scans)parseCargoTomlData() in lib/ecosystems/parsers-rust.js12.3.1
Long whitespace runs in Python lock file markers (regular expression)markerExcludesCPython() in lib/ecosystems/parsers-python.js13.6.0 (not in 12.x)
pyproject.toml parsed again for each pylock fileparsePyLockData() in lib/ecosystems/parsers-python.js12.3.0
Deeply nested __init__.py packagesprojectModuleNames() in lib/ecosystems/pythonutils.js13.4.0 (not in 12.x)
Crafted entry names in a wheel (regular expressions)distInfoStem() in lib/ecosystems/pep770.js13.0.0 (not in 12.x)
One large .py file with the MCP inventory selectedextractPythonCallArguments() in lib/inventory/analyzer.js12.3.2
A long version re-encoded for every reference in Gemfile.lockparseGemfileLockData() in lib/ecosystems/rubyutils.js10.1.0
A long required_ruby_version or Gemfile ruby linerubyRequirementToVers() in lib/ecosystems/rubyutils.js13.3.0 (not in 12.x)
Library files walked again for every target in project.assets.json; can also exhaust the heapparseCsProjAssetsData() in lib/ecosystems/parsers-dotnet.js9.9.8
.props properties copied for every projectprojectPropertyCandidates() in lib/ecosystems/parsers-dotnet.js13.4.0 (not in 12.x)
Duplicate .terraform.lock.hcl blocks combined with many files in one provider directoryapplyProviderLicense() in lib/ecosystems/parsers-terraform.js13.4.0 (not in 12.x)
Duplicate Terraform providers or modulesmergeIntoState() in lib/ecosystems/parsers-terraform.js13.4.0 (not in 12.x)
A shared local Terraform module parsed again for every rootprocessRoot() in lib/ecosystems/parsers-terraform.js13.4.0 (not in 12.x)
Module calls walked again for every modules.json recordcollectManifestRecords() in lib/ecosystems/parsers-terraform.js13.4.0 (not in 12.x)
Root inputs of flake.lock searched linearlyparseFlakeLock() in lib/ecosystems/parsers-misc.js11.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.js11.5.0
Many depends entries in one opam lock filecollectDependsEntry() in lib/ecosystems/parsers-opam.js13.2.0 (not in 12.x)
A crafted version constraint in elm.json (regular expression)toSemverRange() in lib/ecosystems/parsers-elm.js13.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 parser13.4.0 (not in 12.x)
sbt builds nested inside one another when sbt is not installeddiscoverSbtProjects() in lib/ecosystems/sbtutils.js12.7.0
Long names in MCP bundles, normalized before they are truncatedsanitizeMcpRefToken() in lib/inventory/mcpDiscovery.js12.3.2
One Hugging Face model named many times with differing variant lists (AI inventory)mergePedigreeVariants() in lib/inventory/aiCollector.js12.5.1
Many certificates with the same subject, for example in a Kubernetes TLS secret (certificate inventory)linkFallbackIssuers() in lib/inventory/certificates.js13.5.0 (not in 12.x)
Many files that share one certificate or pinned key (certificate inventory)mergeRecords() in lib/inventory/certificates.js13.5.0 (not in 12.x)
One crafted file with a certificate-like name (certificate inventory)readOID() in lib/inventory/certificates.js13.5.0 (not in 12.x)
A large license policy that a config file in the working directory namesgetComplianceAlert() in lib/inventory/licenseEnhancer.js12.7.1
A large bitbucket-pipelines.yml (container-manifest and universal scans)addSkippedSrcFiles() in lib/managers/docker.js10.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 -t with only the project types needed.
  • Put cdxgen --server behind 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

Affected versions

References

GitHub · cdxgen/cdxgen