Skip to main content
VulnerabilityPublished Updated

CVE-2026-22702: Hatch · virtualenv Has TOCTOU Vulnerabilities in Directory Creation

Affects hatchSource GCVE Database

0
Authoritative record:CVE-2026-22702· Medium 4.5

Not known to be exploited · CVSS 4.5 Medium : upgrade to 1.16.2_2 or 1.6.2 when convenient.

Data as of 27 Oct 2026, 23:13 UTC

CVSS 3.1 base score
4.5Medium
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 1.16.2_2, 1.6.2
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 10 Jan 2026

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponised: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 26 Oct 2026.

What to do

Upgrade hatch to 1.16.2_2 or 1.6.2.

Affected software

ProductAffectedFixed in
Homebrewhatchpkg:brew/hatchOther threatsAffected
  • >=1.2.0 <1.6.2
  • >=1.9.3 <1.16.2_2
Fixed in
  • 1.6.2
  • 1.16.2_2

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

Description

## Impact TOCTOU (Time-of-Check-Time-of-Use) vulnerabilities in `virtualenv` allow local attackers to perform symlink-based attacks on directory creation operations. An attacker with local access can exploit a race condition between directory existence checks and creation to redirect virtualenv's app_data and lock file operations to attacker-controlled locations. **Affected versions:** All versions up to and including 20.36.1 **Affected users:** Any user running `virtualenv` on multi-user systems where untrusted local users have filesystem access to shared temporary directories or where `VIRTUALENV_OVERRIDE_APP_DATA` points to a user-writable location. **Attack scenarios:** - Cache poisoning: Attacker corrupts wheels or Python metadata in the cache - Information disclosure: Attacker reads sensitive cached data or metadata - Lock bypass: Attacker controls lock file semantics to cause concurrent access violations - Denial of service: Lock starvation preventing virtualenv operations ## Patches The vulnerability has been patched by replacing check-then-act patterns with atomic `os.makedirs(..., exist_ok=True)` operations. **Fixed in:** PR #3013 **Versions with the fix:** 20.36.2 and later Users should upgrade to version 20.36.2 or later. ## Workarounds If you cannot upgrade immediately: 1. Ensure `VIRTUALENV_OVERRIDE_APP_DATA` points to a directory owned by the current user with restricted permissions (mode 0700) 2. Avoid running `virtualenv` in shared temporary directories where other users have write access 3. Use separate user accounts for different projects to isolate app_data directories ## References - GitHub PR: https://github.com/pypa/virtualenv/pull/3013 - Vulnerability reported by: @tsigouris007 - CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization (TOCTOU) - CWE-59: Improper Link Resolution Before File Access

References

Community reviews

Loading reviews…