Formulation section records the operator's credentials from the environment
Description
When cdxgen writes the formulation section of a BOM, it records parts of its own environment. Three gaps let the operator's credentials through in clear text: variable names that end in _PAT, _PSW or _PWD, URL passwords that contain certain punctuation, and secrets in JVM option variables that java --version echoes. Anyone who receives the BOM (a release attachment, a Dependency-Track upload, a customer copy) gets a working repository token or registry password. No attacker input is needed.
Details
- Name blocklist.
addFormulationSection()inlib/inventory/formulationParsers.jskeeps environment variables whose names start with prefixes such asGIT_,MAVEN_,GRADLE_andCARGO_, unless the name or value contains one of the substrings inENV_BLOCKLIST. The list hastoken,pass,keyandsecret, but not the short forms_PAT,_PSW(the suffix Jenkins'credentials()uses for passwords) or_PWD, and values are not checked against the token shapes inlib/core/propertySanitizer.js. These values appear in the stub workflow that is built when no CI parser produced one. - URL credential stripping.
stripUrlCredentials()cuts a URL at the first of;,,,',|,", a backtick,<or>and only then looks for the@of the user information. A password that contains one of these characters, which RFC 3986 allows unescaped for several of them, leaves the whole value in place. - Java options.
collectJavaInfo()inlib/inventory/envcontext.jsstores the output ofjava --versionandjava --list-modulesin the formulationjavacomponent.getCommandOutput()joins stdout and stderr, and a JVM started withJAVA_TOOL_OPTIONS,_JAVA_OPTIONSorJDK_JAVA_OPTIONSprints that value on stderr, so the secret is written twice, although the environment recorder withholds the same variable.
Formulation is written with --include-formulation and --bom-audit, and from 13.7.0 also by default when CI=true.
Impact
Disclosure of the operator's CI credentials to everyone who receives the BOM. The exposure is largest in CI, where such variables are common and BOMs are published.
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 10.0.0 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.
First affected release of each issue:
- name blocklist: 10.0.0
- URL credential stripping: 13.7.0 (not in 12.x)
- Java options: 12.1.0-alpha.1
Workarounds
- Turn formulation off (do not pass
--include-formulation; from 13.7.0, pass--no-include-formulationin CI) for BOMs that are shared. - Do not keep secrets in variables with the listed prefixes or in JVM option variables in the environment of the cdxgen step, and percent-encode special characters in URL passwords.
- Review the
formulationsection before publishing a BOM.
Credit
These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-1S1RFDK3, ANT-2026-FZ7WCM0Q, ANT-2026-APD8U05F.