Skip to main content
Vulnerability Database/CVE-2026-112935

CVE-2026-112935: Tox-dev Filelock Race Condition Vulnerability

CVE-2026-112935 is a race condition flaw in Tox-dev Filelock that allows multiple lock holders due to improper marker handling. This post explains its technical details, affected versions, and mitigation steps.

Published:

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-112935 Overview

CVE-2026-112935 is a race condition vulnerability in the filelock library, a platform-independent file lock implementation for Python. The flaw affects SoftFileLock, MarkerSoftFileLock, and SoftFileLease classes in versions 3.22.0 through 4.2.0. An attacker holding a local lock can manipulate inode reuse and modification time comparisons to break a live holder's marker, admitting two concurrent lock holders. The vulnerability is categorized as a Time-of-Check Time-of-Use (TOCTOU) issue [CWE-367] and has been fixed in version 4.2.1.

Critical Impact

Two concurrent holders can be admitted to a lock meant for exclusive access, breaking integrity guarantees for data protected by SoftFileLock.

Affected Products

  • tox-dev filelock version 3.22.0 through 4.2.0
  • Python applications using SoftFileLock, MarkerSoftFileLock, or SoftFileLease
  • Environments on ext4 and similar filesystems where inode numbers can be reused

Discovery Timeline

  • 2026-10-20 - CVE-2026-112935 published to NVD
  • 2026-10-21 - Last updated in NVD database

Technical Details for CVE-2026-112935

Vulnerability Analysis

The filelock library provides cooperative file-based locking for Python processes. The SoftFileLock variant uses marker files to indicate ownership rather than kernel-level file locks. When a holder is suspected stale, contenders perform a two-step check-and-break sequence that reads the marker and then removes it.

This sequence is not atomic. On filesystems such as ext4, a freed inode number can be assigned to a newly created file. An attacker who frees their own marker after a stale read, while an honest contender creates a live successor on the reused inode, can cause the successor's modification time to appear not newer than the saved observation. The break logic then removes the live marker and admits a second holder.

Root Cause

The root cause is a TOCTOU race in the stale-break code path. The marker identity check relied on inode number plus modification time, both of which can collide after inode reuse. The patch notes describe five related cases where a live holder's marker could be removed or displaced, including placeholder removal after ENOSYS, cleanup after a successor took the path, and lifetime-break judging a marker by a reused inode number.

Attack Vector

Exploitation requires local access with permission to create files in the lock directory. The attacker must win a narrow timing window during a contender's stale-break operation. Successful exploitation does not disclose data or crash the process, but it violates the mutual-exclusion contract, which can corrupt data structures that assume single-writer semantics.

text
// Patch excerpt from docs/changelog/843.bugfix.rst
Fix filelock.SoftFileLock, filelock.MarkerSoftFileLock and filelock.SoftFileLease removing
or displacing a live holder's marker in five cases. ext4 gave a freed inode number to the next marker. A stalled
FileLock removed its ENOSYS placeholder after a peer replaced it. A failed acquire cleaned up
after a successor took the path. A stale break left the lock path empty while it checked the marker it had moved. A
lifetime break judged a marker by a reused inode number. On Linux and macOS a stale marker now changes hands in one
atomic exchange. On other platforms without one, except Windows, including NFS and SMB, the marker stays in place and
waits for timeout or break_lock().

Source: GitHub Commit 740ff66

Detection Methods for CVE-2026-112935

Indicators of Compromise

  • Unexpected concurrent modifications to resources protected by SoftFileLock
  • Application logs showing two processes reporting successful acquisition of the same lock path
  • Marker files appearing and disappearing at the lock path within sub-second windows
  • Data corruption or inconsistency in files guarded by SoftFileLock on ext4 or similar inode-reusing filesystems

Detection Strategies

  • Inventory Python dependencies and flag filelock versions in the range >=3.22.0,<4.2.1
  • Audit codebases for use of SoftFileLock, MarkerSoftFileLock, and SoftFileLease where exclusive access is required
  • Review filesystem audit logs for rapid create/unlink sequences in known lock directories

Monitoring Recommendations

  • Enable application-level invariant checks that detect two holders inside a critical section
  • Monitor host-level process activity for untrusted local accounts writing to shared lock directories
  • Collect endpoint telemetry on file create and rename operations in lock paths for post-incident forensics

How to Mitigate CVE-2026-112935

Immediate Actions Required

  • Upgrade filelock to version 4.2.1 or later across all Python environments
  • Restrict filesystem permissions on lock directories so only trusted principals can create files there
  • Where feasible, switch from SoftFileLock to the kernel-backed FileLock on platforms that support it

Patch Information

The fix is included in filelock version 4.2.1. See the GitHub Release v4.2.1, the GitHub Pull Request #843, and the GitHub Security Advisory GHSA-fq56-3cx3-fjxp. On Linux and macOS, the patch performs stale-marker transfer as a single atomic exchange. On NFS, SMB, and other platforms without atomic exchange (except Windows), the marker stays in place and waits for timeout or an explicit break_lock().

Workarounds

  • Place lock directories on filesystems that are not shared with untrusted local users
  • Increase lock timeout values and avoid relying on automatic stale-break behavior for integrity-critical workflows
  • Use fail-closed patterns as described in the filelock documentation on soft locks
bash
# Upgrade filelock to the patched version
pip install --upgrade 'filelock>=4.2.1'

# Verify the installed version
python -c "import filelock; print(filelock.__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

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.