CVE-2026-112936
Symlink attack on filelock's SQLite path lets local users bypass lock protection.
- CVSS 6.1
- CWE-59
- Input Validation and Sanitization
- Local
filelock is a platform-independent file lock for Python. From 3.20.4 until 4.0.9, ReadWriteLock and AsyncReadWriteLock versions from 3.20.4 resolve the lock path and pass it to SQLite without rejecting a final symbolic link, allowing another local user who can create names in the lock directory to redirect database creation and locking or split mutual exclusion between targets. This issue is fixed in version 4.0.9.
- CWE
- CWE-59
- CVSS base score
- 6.1
- Published
- 2026-10-20
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Path Traversal
- Accessibility scope
- Local
- Impact
- Data Theft
- Affected component
- Python
- Fixed by upgrading
- Yes
Solution
Upgrade the filelock package to version 4.0.9 or newer.
Vulnerable code sample
import os
import sqlite3
from filelock import ReadWriteLock
def init_db(lock_dir: str, db_file: str):
# VULNERABLE: does not reject a symlink in the lock directory
lock_path = os.path.join(lock_dir, "mydb.lock")
lock = ReadWriteLock(lock_path)
with lock.read_lock():
conn = sqlite3.connect(db_file)
conn.execute("CREATE TABLE IF NOT EXISTS data(id INTEGER PRIMARY KEY)")
conn.commit()
conn.close()Patched code sample
import os
import sqlite3
from filelock import ReadWriteLock
def init_db(lock_dir: str, db_file: str):
# FIX: reject symlink in lock directory to prevent path traversal
lock_path = os.path.join(lock_dir, "mydb.lock")
if os.path.islink(lock_path):
raise ValueError("Lock path must not be a symbolic link")
lock = ReadWriteLock(lock_path)
with lock.read_lock():
conn = sqlite3.connect(db_file)
conn.execute("CREATE TABLE IF NOT EXISTS data(id INTEGER PRIMARY KEY)")
conn.commit()
conn.close()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.
- Merge commit from fork (tox-dev/filelock)
src/filelock/_read_write.py,src/filelock/_read_write.py · ReadWriteLock.__init__,src/filelock/_read_write.py · _connect,src/filelock/_read_write.py · _ReadWriteLockMeta.__call__,src/filelock/_windows.py
Cite this entry
@misc{vaitp:cve2026112936,
title = {{Symlink attack on filelock's SQLite path lets local users bypass lock protection.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-112936},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112936/}}
}
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 ::
