Skip to content
RCE Write-up Advanced

The Persistence Engine: Configuration Reinstatement in uv

uv, a Python package manager, trusts several configuration sources that any code running as the user can write to, letting a malicious package install plant persistent hooks. An attacker could then get arbitrary code execution on later builds and virtual environment creation, and the planted components reinstate each other when a defender removes one.

Matt Landers Follow

Published on osec.com

uv is a unified Python package and project manager written in Rust. It replaces pip, pip-tools, pyenv, virtualenv, pipx, and poetry with a single binary: resolving and locking dependencies, managing virtual environments, downloading and caching Python interpreters, building and publishing packages, and running scripts…

Matt Landers, on osec.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the design trusts user-writable configuration and cache files without integrity checks, so any code running as the user can redirect downloads, inject build variables and poison interpreter metadata.

Impact

An attacker with code execution as the user could achieve persistent arbitrary code execution through poisoned interpreter caches, hijacked build backends and injected build variables, though venv substitution is blocked for uv-managed Pythons and the reinstatement engine does not fire inside isolated build subprocesses.

What the attacker needed

Code execution as the target user; victim builds a package from source; victim runs uv commands afterwards

The fix

uv should verify signatures or hashes on downloaded manifests and interpreters, and treat user-writable config and cache files as untrusted, but the text does not say this was fixed.

How it was found

  1. Point the Python downloads manifest URL at an attacker-controlled manifest.
  2. Run uv python install for the chosen version.
  3. uv downloads and installs the binary from the attacker's URL without an integrity check.
  4. Run uv run with that version and the malicious binary executes during uv's own interpreter probes.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

uv is a tool that installs Python packages and Python itself. It reads settings from files in the user's home directory, and any program that runs as that user can edit those files. The article shows that a bad package can quietly change those settings so that later, ordinary commands run the attacker's code, and the changes come back after you delete them.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Matt Landers

View all

4 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.