Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-113724 Overview
CVE-2026-113724 is a symlink following vulnerability [CWE-59] in virtualenv, the widely used tool for creating isolated Python environments. The flaw affects all versions prior to 21.14.9. The safe_delete() error handler responds to a failed removal by calling os.lstat(path) to read mode bits and then os.chmod(path, ...) to apply owner-write permission. Because os.chmod follows symbolic links, a planted link inside a read-only directory can redirect the permission change to a victim-owned file outside the destination tree.
Critical Impact
A local user can abuse the deletion error path to make a victim-owned file broadly writable, provided the invoking user owns the target and can change its mode.
Affected Products
- virtualenv versions prior to 21.14.9
- Python toolchains and CI pipelines that invoke virtualenv cleanup paths
- Shared multi-user Linux and macOS hosts where virtualenv runs across trust boundaries
Discovery Timeline
- 2026-10-20 - CVE-2026-113724 published to NVD
- 2026-10-22 - Last updated in NVD database
Technical Details for CVE-2026-113724
Vulnerability Analysis
The weakness lives in src/virtualenv/util/path/_sync.py, specifically in the error handler used by safe_delete(). When removal of a directory entry fails, the handler attempts to recover by widening permissions on the offending path. It reads the current mode with os.lstat(path) but then calls os.chmod(path, ...) to add owner-write bits. On POSIX systems, os.chmod dereferences symbolic links by default.
If an attacker plants a symlink inside a read-only directory that virtualenv is attempting to delete, the retry path will chmod the symlink's target rather than the link itself. The outcome is a permission change on a file outside the intended destination tree. The operation does not read file contents, so this is a tampering primitive rather than an information disclosure.
Exploitation requires that the invoking user owns the final target and has rights to change its mode. The scenario is a time-of-check/time-of-use style race between lstat and chmod, combined with insecure link handling.
Root Cause
The root cause is the mismatch between os.lstat, which inspects the symlink itself, and os.chmod, which follows the link to its target. Trust in the earlier lstat result does not carry through to the subsequent chmod call. The fix in pull request #3427 removes the owner-write chmod branch on POSIX and routes Windows read-only clearing through a dedicated clear_readonly helper from ._win.
Attack Vector
The attack vector is local with high complexity and low privileges. An attacker places a crafted directory structure containing a read-only directory and a symlink pointing to a victim-owned file. When the virtualenv deletion routine fails on the read-only entry and enters the recovery handler, the chmod operation widens the target file's permissions. Another local account can then write to the target if it can traverse the parent directories.
# Patch excerpt - src/virtualenv/util/path/_sync.py
import shutil
import sys
from pathlib import Path
-from stat import S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR
+from stat import S_IXGRP, S_IXOTH, S_IXUSR
from typing import TYPE_CHECKING, Final
+if os.name == "nt":
+ from ._win import clear_readonly
+
if TYPE_CHECKING:
from collections.abc import Callable
from types import TracebackType
# Source: https://github.com/pypa/virtualenv/commit/2bfdc0230d1b2685fedfcfe66c835b9a2ec7c440
The fix removes the S_IWUSR import and the owner-write chmod on POSIX. Windows read-only clearing is isolated to a platform-specific helper that cannot follow POSIX symlinks.
Detection Methods for CVE-2026-113724
Indicators of Compromise
- Symbolic links discovered inside virtualenv destination directories that resolve to files outside the project tree.
- Unexpected mode changes on user-owned files that gain group or other write bits shortly after a virtualenv create or delete operation.
- Audit log entries showing chmod syscalls issued by Python processes against paths unrelated to the active virtual environment.
Detection Strategies
- Monitor process execution of python and virtualenv invocations that terminate with removal errors, then correlate with subsequent chmod syscalls on sensitive paths.
- Deploy Linux auditd rules on chmod, fchmodat, and lchmod syscalls, filtering for parent processes tied to Python package tooling.
- Inventory installed virtualenv versions across endpoints and build agents, flagging any below 21.14.9.
Monitoring Recommendations
- Alert on symlinks that cross trust boundaries inside directories owned by shared users such as CI runners or build service accounts.
- Track permission drift on configuration files, SSH keys, and crontabs in home directories where developers run virtualenv.
- Review package manager and pip install telemetry for virtualenv installs on multi-tenant hosts.
How to Mitigate CVE-2026-113724
Immediate Actions Required
- Upgrade virtualenv to version 21.14.9 or later on all endpoints, build servers, and container base images.
- Audit shared Linux hosts for stale virtualenv directories owned by other users that contain symlinks pointing outside the project tree.
- Restrict virtualenv execution so that one user's build process cannot operate on paths controlled by another user.
Patch Information
The fix is included in GitHub Release 21.14.9 and tracked under GitHub Security Advisory GHSA-43mp-35q3-x3fq. The underlying change is in GitHub Commit 2bfdc02 merged via GitHub Pull Request #3427. Install the fixed release with pip install --upgrade "virtualenv>=21.14.9".
Workarounds
- Avoid running virtualenv cleanup operations on directories that may contain attacker-controlled symlinks.
- Create and delete virtual environments inside directories that only the invoking user can modify, such as a private subdirectory of $HOME.
- On shared build hosts, pin virtualenv in a managed virtual environment or system package to prevent unprivileged users from substituting vulnerable versions.
# Upgrade virtualenv to the fixed release
python -m pip install --upgrade "virtualenv>=21.14.9"
# Verify installed version
python -m virtualenv --version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

