VAITP Dataset

← Back to the dataset

CVE-2026-112914

SoftFileLock can be tricked via symlink to hard‑link files into the lock directory.

  • CVSS 5.3
  • CWE-59
  • Design Defects
  • Local

filelock is a platform-independent file lock for Python. From 4.1.0 until 4.2.1, SoftFileLock can restore a stale marker by name after moving it aside, allowing another local user with rename access in a non-sticky lock directory to swap in a symbolic link and, on a runtime that follows the link and a same-filesystem target, make the lock user hard-link one of its files into the lock directory. This issue is fixed in version 4.2.1.

CVSS base score
5.3
Published
2026-10-20
OWASP
A01 Broken Access Control
Orthogonal defect classification
Interface
Code defect classification
Incorrect Algorithm
Category
Design Defects
Subcategory
Poorly Designed Access Controls
Accessibility scope
Local
Impact
Unauthorized Access
Affected component
Python
Fixed by upgrading
Yes

Solution

Upgrade filelock to version 4.2.1 or newer.

Vulnerable code sample

import os
from filelock import SoftFileLock

def write_protected(path: str, data: str) -> None:
    lock_path = os.path.join(os.path.dirname(path), "my.lock")
    # VULNERABLE: SoftFileLock can be tricked via symlink attack after marker rename
    lock = SoftFileLock(lock_path)
    with lock:
        with open(path, "w") as f:
            f.write(data)

Patched code sample

import os
from filelock import FileLock

def write_protected(path: str, data: str) -> None:
    lock_path = os.path.join(os.path.dirname(path), "my.lock")
    # FIX: Use FileLock which atomically creates a hard‑link‑safe lock file
    lock = FileLock(lock_path)
    with lock:
        with open(path, "w") as f:
            f.write(data)

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:cve2026112914,
  title        = {{SoftFileLock can be tricked via symlink to hard‑link files into the lock directory.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-112914},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112914/}}
}

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.