VAITP Dataset

← Back to the dataset

CVE-2026-112939

SoftFileLock trusts a forged PID marker, enabling a confused‑deputy attack.

  • CVSS 4.7
  • CWE-345
  • Design Defects
  • Local

filelock is a platform-independent file lock for Python. From 3.22.0 until 4.2.1, SoftFileLock can trust a forged process identifier in a marker that an attacker can modify but cannot remove, allowing an authorized contender such as another process of the holder's account or root to act as a confused deputy, remove the live marker, and admit another holder. This issue is fixed in version 4.2.1.

CVSS base score
4.7
Published
2026-10-20
OWASP
A01 Broken Access Control
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Design Defects
Subcategory
Poorly Designed Access Controls
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 os
from filelock import SoftFileLock

def update_shared_resource(path: str, data: str) -> None:
    lock_path = f"{path}.lock"
    lock = SoftFileLock(lock_path)

    # VULNERABLE: trusts forged PID in marker file
    lock.acquire()
    try:
        # Read the PID marker that SoftFileLock wrote
        with open(lock_path, "r") as marker:
            holder_pid = int(marker.read().strip())
        # Use the trusted PID for an access decision (confused deputy)
        if os.getuid() != os.stat(f"/proc/{holder_pid}").st_uid:
            raise PermissionError("Lock holder not authorized")
        with open(path, "a") as f:
            f.write(data + "\n")
    finally:
        lock.release()

Patched code sample

import os
from filelock import SoftFileLock

def update_shared_resource(path: str, data: str) -> None:
    lock_path = f"{path}.lock"
    lock = SoftFileLock(lock_path)

    # FIX: do not trust the PID marker; rely on the lock itself
    lock.acquire()
    try:
        # No reading of the marker file; the lock guarantees exclusive access
        with open(path, "a") as f:
            f.write(data + "\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.

Cite this entry

@misc{vaitp:cve2026112939,
  title        = {{SoftFileLock trusts a forged PID marker, enabling a confused‑deputy attack.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-112939},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112939/}}
}

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.