@cyclonedx/cdxgen
Affected
- introduced
0, fixed12.4.3(semver)
Fixed versions
12.4.3
Fix
- Fixed version
12.4.3npm install @cyclonedx/[email protected]
Advisory
Also known as: None
@cyclonedx/cdxgen: Maven project scanning may allow shell command injection through repository-controlled module paths
Summary
A command injection vulnerability existed in the Maven scanning flow of cdxgen before version 12.4.3.
When cdxgen scanned an attacker-controlled Maven project, repository-controlled paths could be used in the Maven command construction. In affected versions, some Maven invocations were executed with shell: true. A directory name containing shell metacharacters could therefore be interpreted by the shell instead of being treated only as a filesystem path.
This could allow an attacker who controls a scanned repository to execute commands in the cdxgen process context.
The issue affected both the CLI and server mode. The issue is patched in 12.4.3.
Affected asset
POST /sbomPatch
Version 12.4.3 includes hardening for this issue with PR #4059
The patch adds multiple mitigations:
shell: isWin where needed.safeSpawnSync now blocks shell: true invocations when the command or direct argument values contain shell metacharacters.Workarounds
The recommended remediation is to upgrade to 12.4.3 or later.
If immediate upgrade is not possible:
Use cdxgen secure/dry-run modes where suitable to inspect planned operations before performing scans.
Configure host and command allowlists where applicable, such as:
These mitigations reduce exposure but do not fully address the vulnerable command construction in affected versions.
Threat model clarification
The mitigation added in 12.4.3 applies to the cdxgen process boundary. Specifically, cdxgen now hardens command, option, and path values that cdxgen itself passes to external processes through safeSpawnSync.
This does not mean cdxgen sanitizes every nested path, module name, generated path, or project-controlled value that an external build tool later discovers and interprets inside its own process. Once cdxgen safely invokes Maven, Gradle, Bazel, SBT, or another build tool, that tool’s internal behavior remains a separate trust boundary.
In scope for this fix:
Out of scope for this specific mitigation:
This residual risk is documented in the cdxgen threat model and is why untrusted project scans should still be run in sandboxed, least-privileged environments.
Detection
Possible indicators of exploitation or probing include:
;
&
|
<
>
$
backticks
newlines
Example suspicious path pattern:
evil;cd${IFS}..;cd${IFS}..;printf${IFS}...>...;#
Credits
Reported-By: @aleff-github
Resources
Medium Basis: The source's own band: MODERATE
0, fixed 12.4.3 (semver)12.4.3
12.4.3npm install @cyclonedx/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0