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-112939 Overview
CVE-2026-112939 affects filelock, a platform-independent file locking library for Python maintained by tox-dev. The vulnerability impacts versions from 3.22.0 up to but not including 4.2.1. The SoftFileLock implementation trusts a forged process identifier stored in a marker file that an attacker can modify but not remove. An authorized local contender, such as another process running under the lock holder's account or root, can act as a confused deputy. The contender removes the live marker and admits a different holder, breaking the mutual exclusion guarantee the lock is intended to provide [CWE-345: Insufficient Verification of Data Authenticity].
Critical Impact
A local actor with write access to the marker file can forge identity data, cause a legitimate lock holder's marker to be removed, and allow a second process to acquire the lock concurrently, leading to data corruption or inconsistent state in applications that rely on SoftFileLock for mutual exclusion.
Affected Products
- tox-dev filelock versions 3.22.0 through 4.2.0
- Python applications using filelock.SoftFileLock
- Python applications using filelock.MarkerSoftFileLock and filelock.SoftFileLease
Discovery Timeline
- 2026-10-20 - CVE-2026-112939 published to NVD
- 2026-10-21 - Last updated in NVD database
- Version 4.2.1 - tox-dev releases patched filelock version containing the fix in pull request #836
Technical Details for CVE-2026-112939
Vulnerability Analysis
The SoftFileLock class implements a portable advisory lock by writing a marker file whose contents identify the current holder. Before breaking a lock believed to be stale, a contender reads the marker and compares the recorded process identity, start time, and boot id against live system state. The flaw is that the marker is writable by any process sharing write access to the lock directory. An attacker who cannot delete the marker can still rewrite its contents, replacing the real holder's identity with a forged PID or start time that no longer matches a running process. The contender then concludes the marker is stale and removes it, admitting a new holder while the original owner still believes it holds the lock.
Root Cause
The staleness check derives trust from data stored inside an attacker-writable file rather than from the file's existence and ownership. The patch in pull request #836 also addresses related edge cases: Linux time namespaces with differing boottime offsets, hosts where /proc/sys/kernel/random/boot_id cannot be read (for example under systemd ProcSubset=pid), and process names containing carriage returns that caused the stale check to raise ValueError. Soft marker files no longer carry group or other write bits after the fix.
Attack Vector
Exploitation requires local access and existing low-privilege rights sufficient to open the marker file for writing. This typically means another process running under the same user account as the lock holder, or a root process. The attacker rewrites the marker with values that make the stale check fail, then waits for a contender to invoke acquisition logic that removes the marker and grants the lock to another caller.
// Patch excerpt from docs/changelog/836.bugfix.rst
Fix :class:`~filelock.SoftFileLock`, :class:`~filelock.MarkerSoftFileLock` and
:class:`~filelock.SoftFileLease` removing a live holder's marker in three cases:
- the holder and the contender run in Linux time namespaces with different
boottime offsets;
- only one of them can read the boot id;
- a process other than the owner rewrote the marker.
Soft markers no longer carry group or other write bits. A process name
containing a carriage return or another line separator no longer makes the
stale check raise ValueError. When /proc/self/ns/time exists but cannot be
read, the stale check no longer compares start times and keeps the marker.
Source: tox-dev/filelock commit eeceaa8
Detection Methods for CVE-2026-112939
Indicators of Compromise
- Soft lock marker files with modification times or contents that do not match the running holder process.
- Marker files with group or world write permissions on versions prior to 4.2.1.
- Application logs showing two processes entering a critical section guarded by the same SoftFileLock concurrently.
- Unexpected ValueError exceptions from the filelock stale check prior to the fix.
Detection Strategies
- Inventory Python dependencies and flag any project pinning filelock between 3.22.0 and 4.2.0 inclusive.
- Audit filesystem permissions on directories containing *.lock marker files for group or other write bits.
- Monitor file integrity on lock marker files to catch rewrites by processes other than the recorded owner PID.
Monitoring Recommendations
- Alert on write events to SoftFileLock marker files initiated by UIDs or PIDs that do not match the current holder.
- Track lock acquisition and release events in application telemetry to identify overlapping ownership windows.
- Review Software Bill of Materials (SBOM) data for the filelock package version across build and runtime environments.
How to Mitigate CVE-2026-112939
Immediate Actions Required
- Upgrade filelock to version 4.2.1 or later across all Python environments, including virtualenvs, container images, and CI runners.
- Rebuild and redeploy container images that bundle filelock as a transitive dependency.
- Restrict filesystem permissions on directories hosting soft lock markers so that only the owning account can write.
Patch Information
The fix is available in filelock 4.2.1, merged via pull request #836 and tracked in GitHub Security Advisory GHSA-rfpc-qcw5-3pc4. The patch stops removing a live holder's marker when the owner identity cannot be verified, removes group and other write bits from newly created markers, and keeps the marker in place when /proc/self/ns/time exists but cannot be read.
Workarounds
- Where feasible, replace SoftFileLock with FileLock, which uses OS-level advisory locking and is not affected.
- Place lock files in directories writable only by the lock owner's UID with mode 0700.
- Avoid sharing lock directories between accounts of differing trust levels until the upgrade is applied.
# Upgrade filelock to the patched release
pip install --upgrade 'filelock>=4.2.1'
# Verify the installed version
python -c "import filelock; print(filelock.__version__)"
# Harden the directory holding soft lock markers
chmod 0700 /path/to/lock/dir
chown "$USER" /path/to/lock/dir
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

