VAITP Dataset

← Back to the dataset

CVE-2026-112935

SoftFileLock may delete a valid marker, allowing two processes to hold the lock.

  • CVSS 4.7
  • CWE-367
  • Race Conditions
  • Local

filelock is a platform-independent file lock for Python. From 3.22.0 until 4.2.1, SoftFileLock can break a stale marker after an attacker frees its own marker following the stale read, an honest contender creates a live successor on the reused inode, and the successor's modification time is not newer than the saved observation, causing the live marker to be removed and two holders to be admitted. This issue is fixed in version 4.2.1.

CVSS base score
4.7
Published
2026-10-20
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Timing/Serialization
Code defect classification
Serialization Issues
Category
Race Conditions
Subcategory
Race Condition in File Operations
Accessibility scope
Local
Impact
Unauthorized Access
Affected component
filelock
Fixed by upgrading
Yes

Solution

Upgrade filelock to version 4.2.1 or later.

Vulnerable code sample

import os
from filelock import SoftFileLock

def critical_section(lock_path: str):
    # VULNERABLE: SoftFileLock may delete a stale marker, allowing two processes simultaneously
    lock = SoftFileLock(lock_path)
    lock.acquire()
    try:
        # critical work that must be exclusive
        with open(os.path.join(os.path.dirname(lock_path), "resource.txt"), "a") as f:
            f.write("update\n")
    finally:
        lock.release()

Patched code sample

import os
from filelock import SoftFileLock

def critical_section(lock_path: str):
    # FIX: enable stale‑marker protection to prevent race on reuse of inode
    lock = SoftFileLock(lock_path, stale_check=True)
    lock.acquire()
    try:
        # critical work that must be exclusive
        with open(os.path.join(os.path.dirname(lock_path), "resource.txt"), "a") as f:
            f.write("update\n")
    finally:
        lock.release()

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

  • 🐛 fix(soft): break stale markers without emptying the lock path (#843) (tox-dev/filelock)
    src/filelock/_api.py, src/filelock/_api.py · BaseFileLock._try_break_expired_lock, src/filelock/_lease.py, src/filelock/_lease.py · SoftFileLease._read_peer, src/filelock/_lease.py · SoftFileLease._try_break_stale_lock, src/filelock/_lease.py · _RefreshLoop.run, src/filelock/_marker.py, src/filelock/_marker.py · MarkerSoftFileLock._try_break_stale_lock, src/filelock/_soft.py, src/filelock/_soft.py · SoftFileLock._acquire, src/filelock/_soft.py · SoftFileLock._marker_unchanged_for, src/filelock/_soft.py · SoftFileLock._release and 7 more

Cite this entry

@misc{vaitp:cve2026112935,
  title        = {{SoftFileLock may delete a valid marker, allowing two processes to hold the lock.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-112935},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112935/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.