# GHSA-72JC-54PR-QQ5W: Crafted ASAR archive makes cdxgen write files outside the extraction directory

- Database: GitHub
- Severity: CVSS 9.8 (Critical)
- Published: 2026-11-13
- Modified: 2026-11-13

## Affected versions

- @cdxgen/cdxgen (npm): from 13.0.0, fixed in 13.8.0
- @cyclonedx/cdxgen (npm): from 12.4.0, through 12.9.1

## Description

### Summary

When cdxgen scans an Electron ASAR archive, a crafted archive header can make `extractAsarArchive()` create or overwrite any file the cdxgen process can write, anywhere on disk, with content and executable bit chosen by the archive. With formulation on (`--include-formulation`, or by default under `CI=true` from 13.7.0) and a user-writable directory ahead of the real `git` on `PATH`, as on common hosted CI runners, cdxgen later runs a planted file in the same scan.

### Details

`extractAsarArchive()` in `lib/ecosystems/asarutils.js` checks that each destination is inside the temporary extraction directory with `isPathWithin()`, which compares path strings. It then calls `mkdirSync()` with `recursive`, `symlinkSync()`, `writeFileSync()` and `chmodSync()` without looking at what already exists at that path.

Header names that contain lone UTF-16 surrogates are distinct keys while the header is validated, but Node.js writes every lone surrogate as U+FFFD, so two such names refer to the same file on disk. A link entry creates a symbolic link under one name, a later directory entry with the colliding name succeeds on that link, and entries below it are created through the link. A second link whose relative target was computed for the intended location then points outside the extraction root.

The ASAR project type must be selected (`-t asar`, or an input path that ends in `.asar`). In server mode the same code is reached with `/sbom?type=asar`, for a path or for a git URL, so no file on the server is needed.

### Impact

Arbitrary file creation and overwrite as the user running cdxgen, which leads to code execution through planted executables, shell start-up files or tool directories on `PATH`. Command-line and CI scans of untrusted `.asar` files are affected, as is any client that can reach `cdxgen --server`. `--no-install-deps` and `CDXGEN_SECURE_MODE=true` without the Node.js permission flags do not prevent it. `--dry-run` and the Node.js permission model (as configured in the `cdxgen-secure` image, which only allows writes to temporary and output directories) do.

### 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 affected from 12.4.0 through 12.9.1 and is fixed in `@cyclonedx/cdxgen` 12.9.2, which backports the same change to `lib/helpers/asarutils.js` (pull request #4791). 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`.

### Workarounds

- Scan untrusted Electron applications only with `--dry-run`, or under the Node.js permission model with `--allow-fs-write` limited to the temporary and output directories, for example with the `cdxgen-secure` image.
- Do not allow `type=asar` on servers reachable by untrusted clients.
- Run such scans as a user that cannot write to directories on `PATH`.

### Credit

This issue was found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-ZVECAU47.

### 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/4787
- Fixed in 12.x: https://github.com/cdxgen/cdxgen/pull/4791

## References

- https://github.com/cdxgen/cdxgen/security/advisories/GHSA-72jc-54pr-qq5w

Page: https://cve.now/GHSA-72JC-54PR-QQ5W

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