conda/rattler: entry-point path traversal in noarch:python install (arbitrary file write)
EntryPoint::FromStr in rattler_conda_types only trims the command field. A malicious noarch:python package writes an executable outside the install prefix, or clobbers an existing in-prefix entry point such as bin/pip.
Background
conda/rattler is the Rust reimplementation of the conda package management stack maintained by Prefix.dev. Its rattler::install crate is the linker that materialises a resolved package into a target prefix. It is the install path behind pixi install, py-rattler (mamba install in mixed configurations), rattler-build, and any third-party tool that imports rattler::install.
A noarch:python package can declare console-script entry points in info/link.json. The linker turns each entry point into an executable wrapper script under the prefix's bin/ (Unix) or Scripts/ (Windows). The name of that wrapper is taken from the package metadata. It is never validated against path traversal.
The parser
EntryPoint::FromStr at crates/rattler_conda_types/src/package/entry_point.rs:33-49 is the only parser in the chain, and it trims whitespace and nothing else:
let (command, module_and_function) = s.split_once('=').ok_or("missing entry point separator")?;
let (module, function) = module_and_function.split_once(':').ok_or("missing module and function separator")?;
Ok(EntryPoint {
command: command.trim().to_string(),
module: module.trim().to_string(),
function: function.trim().to_string(),
})
command is stored verbatim. There is no rejection of /, \, \0, .., a leading ., or an absolute path. The deserialiser delegates to FromStr, so any string in the entry_points array of info/link.json reaches the linker unchanged. link.json itself is parsed by LinkJson::from_slice (serde_json::from_slice, no post-validate).
The linker
The Unix entry-point writer at crates/rattler/src/install/entry_point.rs:112-151:
let relative_path = python_info.bin_dir.join(&entry_point.command); // bin_dir = PathBuf::from("bin")
let script_path = target_dir.path().join(&relative_path);
std::fs::create_dir_all(script_path.parent().expect(...))?;
let script_contents = python_entry_point_template(target_prefix, false, entry_point, python_info);
let (hash, size) = write_and_hash(&script_path, script_contents)?;
#[cfg(unix)]
std::fs::set_permissions(script_path, std::os::unix::fs::PermissionsExt::from_mode(0o775))?;
Rust's PathBuf::join keeps .. components literal and replaces the receiver entirely when the argument is absolute. The kernel resolves .. at create_dir_all and File::create time. There is no canonicalisation, no starts_with(target_prefix) check, and no rejection on the resolved path. The Windows path at :38-103 doubles the primitive: it writes both <prefix>/Scripts/<command>-script.py and <prefix>/Scripts/<command>.exe, a copy of the embedded launcher.
The only containment check anywhere in the install crate is at crates/rattler/src/install/link.rs:527 (if !normalized.starts_with(target_prefix)), and it applies only to symlink sources from paths.json, not to entry-point file writes. The maintainer's own comment at entry_point.rs:81 and :141 records the gap: // todo: clobbering of entry points not handled yet.
Reproducer
The cleanest pivot is clobbering an existing in-prefix entry point. info/link.json:
{
"package_metadata_version": 1,
"noarch": {
"type": "python",
"entry_points": [
"../bin/pip = innocuous_pkg.evil:main"
]
}
}
After EntryPoint::FromStr, command = "../bin/pip". The linker computes script_path = <prefix>/bin/../bin/pip, which the kernel resolves to <prefix>/bin/pip. The existing pip is overwritten with the rendered template at mode 0o775. On the victim's next pip install, attacker Python runs in the prefix with the user's environment.
Two further variants follow from the same primitive. An out-of-prefix write lands wherever the parent directory already exists:
{ "entry_points": ["../../../.config/systemd/user/x = innocuous_pkg.evil:main"] }
And because Path::join discards the left side on an absolute right side, an absolute path writes anywhere the process can:
{ "entry_points": ["/tmp/PWN = innocuous_pkg.evil:main"] }
The analysis is static. I did not assemble a .conda and run it through rattler; the chain was re-traced at the pinned commit a0e61a33da8b9d6de712fab2a879fa9da977e6e3, the Path::join semantics were replicated in a small Python harness, and the maintainer's todo: clobbering of entry points not handled yet comments confirm the gap was unaddressed.
Impact
Arbitrary file write with attacker-controlled content, executable bit set on Unix and a launcher .exe plus script on Windows, during the default install flow. This is realistic supply-chain RCE on pixi install / mamba install / any rattler::install consumer that resolves a malicious noarch:python package. Pixi's headline defence (RunPostLinkScripts::False by default) does not cover this primitive, because entry-point creation runs in the linker pipeline, not in the post-link-script runner.
The attacker model is any author of a conda package the victim resolves: a compromised conda-forge maintainer account, a typosquat on defaults, or an insider on a private corporate channel. CI runners (RUN pixi install in Docker builds) often execute as root, magnifying blast radius.
CVSS 3.1 AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H = 8.5 High (the reporter's own assessment at the time of the report), aligned with the prior-art uv install-time traversal (GHSA-pjjw-68hj-v9mw). An AV:N argument is defensible because the malicious package is fetched over the network during the install command, which would raise the score toward Critical; the conservative AV:L number is used here for peer alignment.
The fix
Validate command after .trim() in EntryPoint::FromStr: reject empty, reject any /, \, or \0, reject ., .., and leading-dot names, and reject absolute paths. Add defence-in-depth in both entry-point writers before any filesystem write: normalise bin_dir.join(command) and require it to starts_with(bin_dir). The module and function fields should additionally be validated against a Python-identifier pattern, since the template interpolates them into the rendered script body verbatim, which is a second injection surface.
Class-wide pattern
This is one instance of a five-codebase class: auto-generated console-script wrappers whose name field is derived from a package-metadata string and never validated against path traversal. The siblings, reported under coordinated disclosure across Anaconda, Prefix.dev, Quansight, PyPA and Astral, are astral-sh/uv, pypa/pip (vendored distlib), conda/conda, and mamba-org/mamba (libmamba). The prior art in the same class is GHSA-pjjw-68hj-v9mw (uv uninstall-side path traversal, fixed April 2026).
Timeline
- 2026-05-14: PGP-signed advisory submitted to conda/rattler as a private GitHub Security Advisory, part of the five-codebase coordinated disclosure.
- 2026-05-19 07:27 UTC: maintainer Bas Zalmstra accepted GHSA-q53q-5r4j-5729; full advisory body pushed roughly 27 minutes later.
- 2026-05-19: CVE-2026-47425 issued by the GitHub CNA. Reporter credit on berkant-koc.
References
- CVE-2026-47425:
https://www.cve.org/CVERecord?id=CVE-2026-47425 - GHSA-q53q-5r4j-5729:
https://github.com/conda/rattler/security/advisories/GHSA-q53q-5r4j-5729 - Pinned audit commit:
a0e61a33da8b9d6de712fab2a879fa9da977e6e3 - Prior art: GHSA-pjjw-68hj-v9mw (uv uninstall-side path traversal)
- CWE-22: Improper Limitation of a Pathname to a Restricted Directory ("Path Traversal")