VAITP Dataset

← Back to the dataset

CVE-2026-112912

SoftFileLock follows symlinks in os.access check, leaking path existence/writability.

  • CVSS 2.5
  • CWE-59
  • Information Leakage
  • Local

filelock is a platform-independent file lock for Python. From 3.32.6 until 4.2.1, SoftFileLock can follow a swapped symbolic link during the conditional os.access writability check for a node without its owner-write bit, allowing another local user on a platform and directory configuration that follows the link to infer whether a chosen path exists and is writable from the observable acquisition result. This issue is fixed in version 4.2.1.

CVSS base score
2.5
Published
2026-10-20
OWASP
A01 Broken Access Control
Orthogonal defect classification
Checking
Code defect classification
Incorrect Check
Category
Information Leakage
Subcategory
Information Disclosure
Accessibility scope
Local
Impact
Information Disclosure
Affected component
Python
Fixed by upgrading
Yes

Solution

Upgrade filelock to version 4.2.1 or later.

Vulnerable code sample

import os
from filelock import SoftFileLock

def acquire_lock(lock_path: str) -> SoftFileLock:
    # VULNERABLE: os.access follows symlinks, leaking existence of target
    if not os.access(lock_path, os.W_OK):
        raise PermissionError(f"Path {lock_path} is not writable")
    lock = SoftFileLock(lock_path)
    lock.acquire()
    return lock

Patched code sample

import os
import stat
from filelock import SoftFileLock

def acquire_lock(lock_path: str) -> SoftFileLock:
    # FIX: use lstat to examine the lock file itself, not a symlink target
    st = os.lstat(lock_path)
    if not (st.st_mode & stat.S_IWUSR):
        raise PermissionError(f"Path {lock_path} is not writable by owner")
    lock = SoftFileLock(lock_path)
    lock.acquire()
    return lock

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(open): keep lock files intact, honor deadlines and mode (#835) (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/_soft.py · _read_lock_file, src/filelock/_strict.py, src/filelock/_unix.py, src/filelock/_util.py and 4 more

Cite this entry

@misc{vaitp:cve2026112912,
  title        = {{SoftFileLock follows symlinks in os.access check, leaking path existence/writability.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-112912},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112912/}}
}

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.