VAITP Dataset

← Back to the dataset

CVE-2026-112907

SoftFileLock on Windows can be stalled by an oplock, causing lock acquisition to hang.

  • CVSS 2.5
  • CWE-667
  • Race Conditions
  • Local

filelock is a platform-independent file lock for Python. From 3.22.0 until 4.2.1, soft lock classes on Windows read an existing marker with _read_lock_file and remove a stale marker through break_lock_file using pathname operations that wait for an oplock break. Another local account with read access to an unheld marker can keep a Level 1 or batch oplock unanswered, causing SoftFileLock.acquire and related async or fallback locks to wait beyond timeout, blocking=False, and cancel_check. A stale marker under the oplock cannot be broken, but mutual exclusion remains intact and no file other than the marker is accessed. This issue is fixed in version 4.2.1.

CVSS base score
2.5
Published
2026-11-05
OWASP
A04 Insecure Design
Orthogonal defect classification
Timing/Serialization
Code defect classification
Timing Issues
Category
Race Conditions
Subcategory
Race Condition in File Operations
Accessibility scope
Local
Impact
Denial of Service (DoS)
Affected component
filelock
Fixed by upgrading
Yes

Solution

Upgrade filelock to version 4.2.1 or later.

Vulnerable code sample

import time
from filelock import SoftFileLock

def safe_write(path: str, data: str, timeout: float = 5.0) -> None:
    """Write data to *path* while holding a soft file lock."""
    lock_path = f"{path}.lock"
    lock = SoftFileLock(lock_path, timeout=timeout)

    # VULNERABLE: acquiring without breaking a stale marker can deadlock on Windows
    lock.acquire()
    try:
        with open(path, "w", encoding="utf-8") as f:
            f.write(data)
    finally:
        lock.release()

Patched code sample

import time
from filelock import SoftFileLock

def safe_write(path: str, data: str, timeout: float = 5.0) -> None:
    """Write data to *path* while holding a soft file lock."""
    lock_path = f"{path}.lock"
    lock = SoftFileLock(lock_path, timeout=timeout)

    # FIX: break a stale marker before acquiring to avoid oplock deadlock
    lock.break_lock()
    lock.acquire()
    try:
        with open(path, "w", encoding="utf-8") as f:
            f.write(data)
    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(windows): read and break markers without waiting (tox-dev/filelock)
    src/filelock/_soft.py, src/filelock/_soft.py · _read_lock_file, src/filelock/_util.py, src/filelock/_util.py · _break_by_rename, src/filelock/_windows.py
  • =?UTF-8?q?=F0=9F=90=9B=20fix(open):=20keep=20lock=20files?= (tox-dev/filelock)
    src/filelock/_api.py · BaseFileLock.__init__, src/filelock/_descriptor.py, src/filelock/_read_write.py, src/filelock/_read_write.py · ReadWriteLock._open_connection, src/filelock/_read_write.py · _connect, src/filelock/_read_write.py · _open_lock_database, src/filelock/_soft.py, src/filelock/_soft.py · SoftFileLock._windows_unlink_if_ours, src/filelock/_strict.py, src/filelock/_unix.py, src/filelock/_util.py, src/filelock/_util.py · raise_on_not_writable_file and 3 more

Cite this entry

@misc{vaitp:cve2026112907,
  title        = {{SoftFileLock on Windows can be stalled by an oplock, causing lock acquisition to hang.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-112907},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112907/}}
}

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.