VAITP Dataset

← Back to the dataset

CVE-2026-112934

SoftReadWriteLock can be hijacked via renamed pipes or hard links to stall or write through the lock.

  • CVSS 6.1
  • CWE-62
  • Design Defects
  • Local

filelock is a platform-independent file lock for Python. From 4.0.0 until 4.2.1, SoftReadWriteLock refreshes holder records by name, allowing another local user with rename access to the lock directory to replace a record with a named pipe and stall the lock, or under a permissive hard-link policy to link a reachable target file and cause the lock user to write through it. This issue is fixed in version 4.2.1.

CVSS base score
6.1
Published
2026-10-20
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Timing/Serialization
Code defect classification
Serialization Issues
Category
Design Defects
Subcategory
Poorly Designed Access Controls
Accessibility scope
Local
Impact
Denial of Service (DoS)
Affected component
Python
Fixed by upgrading
Yes

Solution

Upgrade the filelock package to version 4.2.1 or later.

Vulnerable code sample

import os
from filelock import SoftReadWriteLock

def critical_section(path: str):
    # VULNERABLE: refreshes holder record by name, allowing replacement attacks
    lock = SoftReadWriteLock(os.path.join(path, "lockdir"))
    lock.acquire()
    try:
        # critical work on a file inside the locked directory
        with open(os.path.join(path, "data.txt"), "a") as f:
            f.write("update\n")
    finally:
        lock.release()

Patched code sample

import os
from filelock import SoftReadWriteLock

def critical_section(path: str):
    # FIX: use inode‑based validation to prevent record replacement
    lock = SoftReadWriteLock(os.path.join(path, "lockdir"))
    lock.refresh_by_name = False  # disable name‑based refresh
    lock.acquire()
    try:
        # critical work on a file inside the locked directory
        with open(os.path.join(path, "data.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(strict): keep claim directories private to the lock (#839) (tox-dev/filelock)
    src/filelock/_lease.py, src/filelock/_soft_rw/_protocol.py, src/filelock/_soft_rw/_protocol.py · Files.create, src/filelock/_soft_rw/_protocol.py · Files.overwrite, src/filelock/_soft_rw/_protocol.py · GenerationLog.commit, src/filelock/_soft_rw/_protocol.py · GenerationLog._extends_the_log, src/filelock/_soft_rw/_protocol.py · GenerationLog._list, src/filelock/_soft_rw/_protocol.py · Ledger.observe, src/filelock/_soft_rw/_protocol.py · Participant.heartbeat, src/filelock/_soft_rw/_protocol.py · Participant.leave, src/filelock/_soft_rw/_protocol.py · Participant._create_holder, src/filelock/_soft_rw/_protocol.py · Participant._refresh_nonce and 44 more

Cite this entry

@misc{vaitp:cve2026112934,
  title        = {{SoftReadWriteLock can be hijacked via renamed pipes or hard links to stall or write through the lock.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-112934},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112934/}}
}

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.