CVE-2026-112911
Protocol directory takeover lets other local users modify lock state, causing unsafe concurrency.
- CVSS 6.3
- CWE-283
- Race Conditions
- Local
filelock is a platform-independent file lock for Python. From 3.30.0 until 4.2.1, StrictSoftFileLock versions from 3.30.0 and SoftReadWriteLock versions from 4.0.0 can adopt a protocol directory created first by another local user in a shared parent directory, allowing that user to alter protocol state and admit concurrent holders. This issue is fixed in version 4.2.1.
- CWE
- CWE-283
- CVSS base score
- 6.3
- Published
- 2026-10-20
- OWASP
- A01 Broken Access Control
- Orthogonal defect classification
- Timing/Serialization
- Code defect classification
- Serialization Issues
- Category
- Race Conditions
- Subcategory
- Race Condition in File Operations
- 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 StrictSoftFileLock
def write_shared_file(path: str, data: str) -> None:
# VULNERABLE: uses default protocol directory, allowing another user to pre‑create it
lock = StrictSoftFileLock(path + ".lock")
with lock:
with open(path, "a") as f:
f.write(data + "\n")Patched code sample
import os
import tempfile
from filelock import StrictSoftFileLock
def write_shared_file(path: str, data: str) -> None:
# FIX: lock uses a private protocol directory under a user‑only temp folder
private_dir = os.path.join(tempfile.gettempdir(), f"user_{os.getuid()}")
os.makedirs(private_dir, exist_ok=True)
lock = StrictSoftFileLock(path + ".lock", lock_dir=private_dir)
with lock:
with open(path, "a") as f:
f.write(data + "\n")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_nonceand 44 more
Cite this entry
@misc{vaitp:cve2026112911,
title = {{Protocol directory takeover lets other local users modify lock state, causing unsafe concurrency.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-112911},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112911/}}
}
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 ::
