libmamba: entry-point path traversal in noarch:python install (arbitrary executable file write)
parse_entry_point in libmamba only whitespace-strips the command field. A malicious noarch:python package writes an executable wrapper outside the install prefix, or clobbers an in-prefix entry point such as bin/pip, during a default micromamba/mamba install. The strongest variant of the entry-point traversal primitive shared across the conda toolchain.
Background
libmamba is the C++ core of the mamba package manager. It backs the standalone micromamba binary, the mamba 2.x CLI through the libmambapy Python bindings, server-side linkers such as Quetz, and build tooling such as boa. Whenever any of these install a conda package, libmamba performs the linking step that materialises the package's files into the target environment prefix.
conda packages can be noarch:python, a platform-independent layout where Python sources are shipped once and the installer is responsible for generating the executable entry-point wrappers. The list of wrappers a package wants comes from info/link.json, specifically noarch.entry_points. Each element is a string of the form "<COMMAND> = <module>:<func>", where <COMMAND> is the name of the wrapper script that ends up in the environment's bin/ (or Scripts/ on Windows). The installer parses this string, joins <COMMAND> onto the bin directory, and writes a small launcher that imports <module> and calls <func>.
The trust boundary is the package author. Anyone who can publish a package to a channel the victim resolves controls the bytes of info/link.json. That set includes conda-forge and bioconda contributors, internal corporate channels, typosquats, and hijacked maintainer accounts. The April 2025 conda-forge upload incident tracked as CVE-2025-31484 is a documented instance of this class of attacker actually reaching real users. The victim is anyone running mamba install, micromamba install, mamba env create, boa build, or any libmamba-backed transaction, including unattended CI runners.
This writeup is one of a cluster. The same info/link.json entry-point wire format is parsed independently by pip (via vendored distlib), astral-sh/uv, conda/conda (the canonical Python implementation), and conda/rattler (the Rust reimplementation). Each reimplements the entry-point parser and each got the validation wrong in its own way. libmamba is the strongest variant of the primitive, for the reasons in the Impact section.
The bug
libmamba does no meaningful validation on the <COMMAND> field before turning it into a filesystem path. The entire parser, parse_entry_point in libmamba/src/core/link.cpp, splits the definition string and applies util::strip, which only trims surrounding whitespace:
python_entry_point_parsed parse_entry_point(const std::string& ep_def)
{
auto cmd_mod_func = util::rsplit(ep_def, ":", 1);
auto command_module = util::rsplit(cmd_mod_func[0], "=", 1);
python_entry_point_parsed result;
result.command = util::strip(command_module[0]);
result.module = util::strip(command_module[1]);
result.func = util::strip(cmd_mod_func[1]);
return result;
}
There is no rejection of /, \, .., NUL bytes, newlines, absolute paths, or Windows drive prefixes. The result.command string is then joined onto the hardcoded bin directory at the iteration call site, with no filter and no canonicalisation:
for (auto& ep : link_json["noarch"]["entry_points"])
{
auto entry_point_parsed = parse_entry_point(ep.get<std::string>());
auto entry_point_path = get_bin_directory_short_path()
/ entry_point_parsed.command;
auto files = create_python_entry_point(entry_point_path,
entry_point_parsed);
...
}
The join uses C++17's std::filesystem::path::operator/. That operator keeps .. components verbatim and, critically, lets an absolute right-hand operand replace the left-hand operand entirely. So "bin" / "../../../tmp/PWN" is "bin/../../../tmp/PWN", and "bin" / "/etc/cron.d/zzz" is just "/etc/cron.d/zzz". The attacker therefore controls a path that can both traverse upward out of the prefix and be made fully absolute.
LinkPackage::create_python_entry_point is the writer. On the Unix branch it computes the final path by joining the attacker-controlled path onto the target prefix, then writes the rendered launcher there:
const fs::u8path& target_prefix = m_context->prefix_params().target_prefix;
fs::u8path script_path = target_prefix / path;
if (fs::exists(script_path))
{
m_clobber_warnings.push_back(
fs::relative(script_path, target_prefix).string());
fs::remove(script_path); // silent overwrite
}
if (!fs::is_directory(script_path.parent_path()))
{
fs::create_directories(script_path.parent_path()); // auto-makedirs
}
std::ofstream out_file = open_ofstream(script_path);
...
python_entry_point_template(out_file, entry_point);
out_file.close();
if (!python_path.empty())
{
make_executable(script_path); // chmod 0o775
}
Three behaviours combine into a strong write primitive. The fs::remove silently deletes any file that already exists at the resolved location, populating a m_clobber_warnings list but never stopping the install. The fs::create_directories call walks the traversal chain at kernel mkdir() time, so the destination's parent directory does not need to pre-exist on the victim machine. And make_executable (defined in libmamba/include/mamba/core/util.hpp, setting owner_all | group_all | others_read | others_exec) chmods the result world-executable for every noarch:python install on Unix.
The bug class is path traversal under external control of a file path (CWE-22, CWE-73), with code execution as the secondary consequence of the dropped executable (CWE-94). It was reachable in mamba-org/mamba at HEAD 7b5761e15b185bc8709667a6402d045e6052ba96, which is the 2.6.1 release tagged 2026-05-13, and the audit notes the same code path has been present since at least 2020.
Reproducer
The audit is static-analysis only; the .conda archive was not built and run against a live micromamba. The cross-implementation reasoning rests on the sibling pip + distlib finding, which was demonstrated live: os.path.join(target_dir, "../../etc/cron.d/x") resolved outside target_dir and the resulting file landed executable. C++ std::filesystem::path::operator/ has the documented equivalent semantics, so the C++ kernel-side traversal mirrors the Python one shown live.
The intended trigger is a hand-assembled .conda archive (CEP-3 layout: a zip of two zstd tarballs) whose info/link.json declares a malicious entry point:
{
"package_metadata_version": 1,
"noarch": {
"type": "python",
"entry_points": [
"../bin/pip = innocuous_pkg.evil:main"
]
}
}
That resolves script_path to <prefix>/bin/../bin/pip, i.e. <prefix>/bin/pip, which exists in every conda environment. libmamba removes the real pip, writes the attacker's launcher in its place, and sets the execute bit. The victim's next pip install runs attacker code. Steps to confirm end-to-end:
- Build
micromambafrommamba-org/mambaat commit7b5761e1. - Assemble the malicious
.condawith thelink.jsonabove and a payload moduleinnocuous_pkg.evil. - Serve a local channel with a minimal
repodata.jsonreferencing the.conda(for example viapython -m http.server). - Run
micromamba install -c http://localhost:8000 evil-pkg -n testenv. - Assert
<prefix>/bin/pipis now the attacker's script with mode 0o775.
The out-of-prefix variant uses "../../../tmp/PWN = innocuous_pkg.evil:main"; fs::create_directories walks the .. chain at mkdir() time and the file lands at the user's tmp/ or /tmp/PWN with mode 0o775.
Impact
The primitive is an arbitrary-path executable file write, with the execute bit set, during the default install path of mamba / micromamba / libmambapy for any noarch:python package. No flag, no opt-in, no prompt. The most practical pivot is the in-prefix clobber of bin/pip shown above, which converts the file write into code execution on the victim's next pip install. Because fs::create_directories does not require the destination parent to pre-exist, out-of-prefix targets are also reachable: ~/.config/jupyter/jupyter_notebook_config.py (sourced on Jupyter startup), shell rc files, and existing binaries in ~/.local/bin are all candidates.
On Windows the writer produces two arbitrary-write primitives per entry point: the -script.py launcher and a fully functional .exe (the bundled conda_exe blob). Dropping both into the user's StartUp folder yields code execution on next login.
In CI the consequence is supply-chain RCE. micromamba is a common single-binary bootstrap installer in Docker base images, frequently run as root. One malicious package anywhere in a resolved conda-forge dependency tree gives root code execution on the build worker, a poisoned base image, and backdoored downstream containers.
libmamba is the strongest of the entry-point traversal cluster. Compared to the canonical conda implementation it auto-creates parent directories (so out-of-prefix targets work with no precondition on the victim), it silently overwrites existing files (the clobber list is populated but execution continues, with no equivalent of conda's path_conflict policy gate), and make_executable is always called for noarch:python installs on Unix rather than being conditional on shebang generation.
The audit records two defensible CVSS 3.1 scores. The peer-aligned floor is AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H, 8.8 High, which matches the sibling pip finding and is the figure used in the frontmatter here. A scope-changed reading, AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H, 9.6 Critical, is also defensible because the auto-makedirs behaviour genuinely escapes the install prefix without precondition. The report carries 8.8 as its stated preference.
The fix
No fix was shipped at the time of disclosure. The proposed fix has two parts. In parse_entry_point, validate result.command as a simple filename: reject /, \, .., NUL, and newline characters, reject the literal . and .., reject leading .., and reject absolute paths including Windows drive prefixes. Validate result.module and result.func as Python identifier chains. Throw on anything invalid. As defence in depth, after computing script_path in create_python_entry_point, assert that the resolved path stays within target_prefix using fs::weakly_canonical (which resolves .. without requiring the target to exist) and a component-wise comparison against the prefix.
A third recommendation is to stop the silent fs::remove on clobber and adopt a path-conflict policy mirroring canonical conda's: refuse the overwrite by default, allow only under an explicit user flag.
Coordination and status
The first disclosure email went out on 2026-05-14 at 05:09 CEST to the two addresses in the project's SECURITY.md, wolf.vollprecht@quantstack.net and info@quantstack.net. The 1984.is relay accepted both recipients, but the Proton MX rejected wolf.vollprecht@quantstack.net with SMTP 550 "Address does not exist". The SECURITY.md file had not been touched since 2021-07-01; Wolf Vollprecht has moved to prefix.dev and his QuantStack mailbox no longer delivers.
A bounce-recovery analysis identified the current de facto maintainer, Julien Jerphanion (@jjerphan), who authored 22 of the most recent 25 commits including the 2.6.1 release tag. His canonical published address contact@jjerphan.xyz was verified through his PGP UID on keys.openpgp.org and a live Proton MX. GitHub Private Vulnerability Reporting was disabled on the repository, so a self-served GHSA draft was not possible without the maintainer first enabling PVR. A re-send addressed to Julien, with Johan Mabille as a secondary contact, was prepared and held for manual approval.
At the time this writeup was assembled there was no acknowledgement on record, no CVE assignment, and no GHSA for libmamba. The disclosure status is reported. This stands in contrast to the sibling reports in the same cluster, which did receive identifiers: conda/rattler as CVE-2026-47425 / GHSA-q53q-5r4j-5729, conda/conda as CVE-2026-53940 / GHSA-9m8m-c4j3-rj2c, and pdm as CVE-2026-47757. The libmamba report also asked the maintainers, as a courtesy, to refresh the stale SECURITY.md and enable Private Vulnerability Reporting so future reports do not bounce.
References
mamba-org/mambarepository: https://github.com/mamba-org/mamba- Vulnerable commit
7b5761e15b185bc8709667a6402d045e6052ba96(2.6.1 release HEAD) libmamba/src/core/link.cpp(parse_entry_point,create_python_entry_point, entry-point iteration)libmamba/include/mamba/core/util.hpp(make_executable)- CWE-22: Improper Limitation of a Pathname to a Restricted Directory
- CWE-73: External Control of File Name or Path
- CWE-94: Improper Control of Generation of Code
- Public threat backdrop: CVE-2025-31484, the April 2025 conda-forge upload incident
- Sibling reports in the same primitive cluster: conda/rattler (CVE-2026-47425), conda/conda (CVE-2026-53940), pdm (CVE-2026-47757)