# GHSA-5PC2-GG7C-37C9: Evidence, output and cache paths let a scanned tree make cdxgen write or delete files outside the scan

- Database: GitHub
- Severity: CVSS 6.0 (Medium)
- Published: 2026-11-19
- Modified: 2026-11-19

## Affected versions

- @cdxgen/cdxgen (npm): from 13.0.0, fixed in 13.9.0
- @cyclonedx/cdxgen (npm): from 2.2.3, through 12.9.2

## Description

### Summary

Several output paths follow symbolic links or take names from the scanned tree. A repository, archive or registry host can make cdxgen overwrite a file next to the BOM or behind a link, copy a file over another, or delete files in the cache directory. Most routes work with `--no-install-deps` and in secure mode.

### Details

- **Evidence slices.** `analyzeGolemProject()` in `lib/ecosystems/golem.js` and the matching rusi, atom and dosai code wrote evidence reports through links that the repository planted. `scalasemOutputFile()` in `lib/ecosystems/scalasem.js` took the output name of the Scala semantics slices from the repository's own option, so it could overwrite any file next to the BOM.

- **Output directory checks.** `isDeviceOrProcessPath()` in `lib/core/fs.js` blocked output to `/proc/self/...` paths but not to `/proc/self/cwd`, which a `.cdxgenrc` file could name; `isContainedPath()` in `lib/core/projectConfig.js` accepted a `..` segment that follows a link in a `.cdxgen.json` output path.

- **File copies.** `safeCopyFileSync()` in `lib/core/fs.js` follows symbolic links, so the sbt plugin backup wrote outside the repository, and `getGradleCommand()` in `lib/ecosystems/gradleutils.js` changed the mode of a symlinked `gradlew` outside the tree in dry runs.

- **cdxrs cache.** `cdxrsCanServe()` in `lib/inventory/fetchBatch.js` let a registry host such as `..` make the cdxrs helper delete files in `CDXGEN_CACHE_DIR`.

The findings in this advisory are:

| Issue | Code | First affected release |
|---|---|---|
| Output symlink fix bypassed via /proc/self/cwd in .cdxgenrc | `isDeviceOrProcessPath()` in `lib/core/fs.js` | 13.7.0 (12.x: 12.9.1) |
| scalasem: repo's semantics-slices-file can overwrite any file next to the BOM | `scalasemOutputFile()` in `lib/ecosystems/scalasem.js` | 13.4.0 (no match found in 12.x) |
| Path traversal via registry host makes cdxrs delete files in CDXGEN_CACHE_DIR | `cdxrsCanServe()` in `lib/inventory/fetchBatch.js` | 13.0.0 (no match found in 12.x) |
| Dry run can chmod files outside the scanned tree via symlinked gradlew | `getGradleCommand()` in `lib/ecosystems/gradleutils.js` | not stated (no match found in 12.x) |
| safeCopyFileSync follows symlinks: sbt plugin backup writes outside the repo | `safeCopyFileSync()` in `lib/core/fs.js` | 2.2.3 |
| Evidence slices are written through repo symlinks, even in secure mode | `analyzeGolemProject()` in `lib/ecosystems/golem.js` | 12.8.2 |
| Path traversal in .cdxgen.json output via .. after a symlink | `isContainedPath()` in `lib/core/projectConfig.js` | 9.8.10 |

### Impact

Overwriting or deleting files that the user running cdxgen can write, from content the operator did not write. The contents written are mostly JSON from the scan, so the effect is destruction or corruption of files such as configuration and startup scripts, not a chosen payload.

### Patches

Fixed in `@cdxgen/cdxgen` 13.9.0 (cdxgen/cdxgen#4880). Versions 13.0.0 through 13.8.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.2.3 through 12.9.2, and no 12.x release contains the fix. Users of 12.x should move to `@cdxgen/cdxgen` 13.9.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`.

Known limits of the fix.
Files that atom names itself (the `.chen` cache and `flowsummary-*.json.tmp`) are written by atom, not by cdxgen: see AppThreat/atom#422 and AppThreat/atom#423. atom-tools may write an OpenAPI file through a link as well (AppThreat/atom-tools#111). The cdxrs helper issue is tracked as cdxgen/cdxgen-plugins-bin#217. These are not fixed by cdxgen 13.9.0.

### Workarounds

- Scan untrusted trees as a user that can write nothing outside a scratch directory, for example in a container with a read-only root.
- Write the BOM with `-o` to a fresh directory and avoid `.cdxgenrc` and `.cdxgen.json` files from untrusted trees.

### Credit

These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261117-013) and reported as ANT-2026-G91J9NO4, ANT-2026-GK648I0X, ANT-2026-M42WZAK8, ANT-2026-U4EPE5FT, ANT-2026-VM4MXRET, ANT-2026-VPAUSI5G, ANT-2026-Y1OX7VKS, and were fixed by AI agents working for the cdxgen maintainers.

### References

- https://github.com/cdxgen/cdxgen/blob/master/SECURITY.md
- https://github.com/cdxgen/cdxgen/blob/master/docs/THREAT_MODEL.md
- Fixed in: https://github.com/cdxgen/cdxgen/pull/4880

## References

- https://github.com/cdxgen/cdxgen/security/advisories/GHSA-5pc2-gg7c-37c9

Page: https://cve.now/GHSA-5PC2-GG7C-37C9

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
