RustSec logo

History ⋅ Edit ⋅ JSON (OSV)

RUSTSEC-2026-0412

Arbitrary code execution when rerunning tests from a portable recording

Reported
Issued
Package
cargo-nextest (crates.io)
Type
Vulnerability
Categories
Keywords
#argument-injection #cargo-config #rerun
Aliases
References
CVSS Score
7.8 HIGH
CVSS Details
Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality Impact
High
Integrity Impact
High
Availability Impact
High
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Patched
  • >=0.9.150
Unaffected
  • <0.9.125

Description

Summary

Nextest versions between 0.9.125 and 0.9.149 (inclusive) allow the cargo nextest run --rerun (or -R) command with a malicious portable recording to run arbitrary code during the build. The result is arbitrary code execution with the privileges of the user running cargo nextest.

This vulnerability requires that the experimental run recording functionality is enabled. An attacker can plausibly trick a victim into enabling this feature.

Details

Nextest's portable recordings contain build scope arguments. These arguments are deserialized verbatim from portable recordings, and are not validated. As a result, it is possible to construct an archive with a custom --config argument that causes Cargo to execute arbitrary code.

Nextest 0.9.150 records the build scope as structured data, and passes each value to Cargo joined to its flag (for example, --package=<value>), so a recording can no longer add other Cargo options.

Impact

A malicious portable recording leads to arbitrary code execution as the user who runs cargo nextest run --rerun, during the build phase, before any test runs.

Exploitation requires convincing the victim to run cargo nextest run --rerun against an attacker-supplied portable recording. The rerun feature is experimental and must be enabled, via e.g. NEXTEST_EXPERIMENTAL_RECORD=1.

Remediations

Credit

Reported by inanna-malick.

Advisory available under CC0-1.0 license.