GHSA-98X4-H74Q-H84H
Swift evidence passes compiler plugin options from a committed .build directory to sourcekitten
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-98X4-H74Q-H84H divulgada · CVSS 7.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
With installs off (`--no-install-deps`, `--lifecycle pre-build` or secure mode), `cdxgen -t swift --evidence` is meant to drop compiler plugin options that it reads from a committed `.build/**/debug/description.json` before it runs `sourcekitten index`. Two gaps in that filter let a scanned Swift package put plugin-loading options on the sourcekitten command line, so the Swift frontend can be made to load a macro plugin library or plugin server from the repository.
Details
Both gaps are in `withoutSwiftPluginArgs()` in `lib/evinser/swiftsem.js`:
- The filter compares every token with `SWIFT_CODE_LOADING_ARGS`, including tokens that are the value of an option it keeps, and on a match it also drops the token that follows. An argument list that uses `-Xcc` as the value of an allowed option, placed before an allowed `-Xfrontend` group, loses that group's first `-Xfrontend`. The rest of the list shifts by one, and a value that `sanitizeSwiftModuleArgs()` admitted only as a feature name reaches the Swift frontend as an option such as `-load-resolved-plugin` (Swift 6.1 or later).
- The list has no entry for `-sdk`. On macOS the Swift driver derives an external plugin directory and a `swift-plugin-server` executable from the SDK path, so a package that points `-sdk` into its own tree can probably name a plugin server of its own.
The reports show the resulting sourcekitten command lines. SourceKit loading the plugin or starting the server was not observed, because no Swift toolchain was available for the test.
The operator must run `cdxgen -t swift --evidence` with sourcekitten available (the macOS plugin or the container image), the package must pin at least one dependency, and the description must list an existing source file.
Impact
Code execution through a compiler plugin for the author of a scanned Swift package, in the modes where cdxgen documents that such plugin options are dropped.
Patches
Fixed in `@cdxgen/cdxgen` 13.8.0. Versions 13.5.0 through 13.7.0 of `@cdxgen/cdxgen` are affected. The 12.x line, published as `@cyclonedx/cdxgen`, does not contain the affected code.
First affected release of each issue:
- token shift in the plugin filter: 13.5.0 (not in 12.x)
- `-sdk` not filtered: 13.5.0 (not in 12.x)
Workarounds
- Do not generate Swift evidence for untrusted packages.
- Delete the `.build` directory from untrusted checkouts before scanning.
Credit
These issues were found by Anthropic's OSS Scanner (scan cdxgen-20261108-009) and reported as ANT-2026-3YNP8VJQ, ANT-2026-R921RNH1.
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
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@cdxgen/cdxgen |
Corregida | 13.8.0 | — | — |
13.8.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/cdxgen/cdxgen/security/advisories/GHSA-98x4-h74q-h84hLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
