CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-112937

CVE-2026-112937: Arbitrary Directory Deletion via TOCTOU Race Condition in filelock ReadWriteLock

Alon Barad
Alon Barad
Software Engineer

Oct 23, 2026·5 min read·3 visits

Executive Summary (TL;DR)

Local unprivileged users can manipulate lock directories created by filelock's ReadWriteLock, causing victim processes to recursively delete arbitrary directories using path-based shutil.rmtree calls.

A Time-of-Check Time-of-Use (TOCTOU) race condition in the Python `filelock` library (versions 4.1.0 to 4.2.0) allows local unprivileged attackers to cause arbitrary directory deletion by swapping file system targets during lock cleanup or dead owner sweeps.

Vulnerability Overview

The filelock package is a platform-independent Python implementation used to manage inter-process file locks. Starting with version 4.1.0, the package introduced SQLite-backed reader/writer lock primitives, implemented in ReadWriteLock and AsyncReadWriteLock. These classes allow multiple concurrent readers or an exclusive writer to synchronize operations across independent operating system processes.

When operating in fallback environments where direct file descriptor interaction via /proc/self/fd is unavailable or when utilizing shared directories, ReadWriteLock creates temporary private directories formatted as .filelock-* in the database parent directory. These directories hold hard-linked entries (lock.db) corresponding to active process lock instances.

Prior to version 4.2.1, releasing a lock or cleaning up stale lock entries during dead-owner sweeps triggered recursive path-based deletion via shutil.rmtree(). In non-sticky, world-writable directories, a local attacker can exploit this design by swapping the expected directory path with a target victim directory prior to deletion.

Root Cause Analysis

The technical root cause of CVE-2026-112937 lies in relying on path string resolution during recursive directory cleanup instead of using file descriptor pinning. In src/filelock/_read_write.py, the lock mechanism invoked shutil.rmtree(directory) with a string path representing .filelock-<pid>-<hash>.

Because string-based path traversal performs resolution dynamically at execution time, a window of exposure exists between when the lock directory is identified and when shutil.rmtree() performs recursive directory unlinking. An attacker with write and rename permissions in the shared parent directory can move the legitimate .filelock-* directory and replace it with a directory owned by the victim process.

When the victim process finishes lock release or executes the _sweep_links_of_the_dead routine, it passes the string path to shutil.rmtree(). Python traverses the substituted directory path using the process's effective permissions, systematically unlinking all child items and removing the directory hierarchy.

Code Analysis & Patch Inspection

In vulnerable versions, link directories were unlinked directly via shutil.rmtree without verifying directory inode stability or permissions:

# Vulnerable implementation in filelock/_read_write.py
def _purge_link_directory(self, directory: str) -> None:
    # Vulnerable path string resolution
    if os.path.exists(directory):
        shutil.rmtree(directory)

The fix implemented in commit 5e3f2ec0c5fb17cb2635b60b2b68bc63ab81ca2d replaces path-based deletion with file descriptor-pinned operations through _remove_link_directory(link). The patched implementation opens the target directory directly and verifies its device and inode identifier:

# Patched implementation in filelock/_read_write.py
def _remove_link_directory(link: Link) -> None:
    # Open directory file descriptor securely
    fd = os.open(link.path, _DIRECTORY_FLAGS)
    try:
        opened = os.fstat(fd)
        # Verify device and inode match expected identity
        if (opened.st_dev, opened.st_ino) != link.identity:
            raise SecurityError("Directory identity mismatch detected")
        # Perform directory-relative unlinks using dir_fd
        _unlink_contents_at(fd)
    finally:
        os.close(fd)

Additionally, filelock introduced _names_are_private and _directory_is_private helpers to ensure parent directories restrict write access strictly to the owner before link operations proceed. Sweeping functions now enforce user identity checks via os.fstat(fd).st_uid == owner.

Exploitation Mechanics

To exploit this vulnerability, an attacker requires local unprivileged shell access and write access to the parent directory where the filelock database resides. Shared temporary locations without sticky bits (such as unprotected custom subdirectories under /tmp) represent primary attack vectors.

The attack flow operates in four distinct stages:

  1. The attacker monitors the target shared parent directory for new .filelock-* entries created by the victim process.
  2. The attacker uses standard filesystem utilities (such as rename) to move .filelock-<pid>-<hash> to a temporary name.
  3. The attacker creates a new directory or symbolic link named .filelock-<pid>-<hash> pointing to a victim-owned target directory (e.g., /home/victim/project).
  4. Upon lock release or dead owner cleanup, the victim process calls shutil.rmtree(), traversing the attacker-placed reference and deleting the target directory tree.

Impact Assessment

The impact of CVE-2026-112937 is restricted to localized integrity loss and application denial of service. The vulnerability does not provide arbitrary code execution or direct read access to confidential file contents.

Because the deletion occurs under the user privileges running the filelock library, an attacker can induce destruction of any file or directory writable by that user account. If the victim process runs as a privileged account (such as root or Administrator), an unprivileged attacker can delete critical system configurations or database directories.

This vulnerability has been assigned a CVSS v3.1 score of 6.1 (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L). EPSS scoring is rated at 0.00096, reflecting no observed exploitation in wild ransomware or automated attack frameworks.

Remediation & Mitigation Guidance

Organizations and developers should update the filelock dependency to version 4.2.1 or higher immediately.

For Python environments managed via pip:

pip install --upgrade "filelock>=4.2.1"

For projects using pyproject.toml dependencies:

[dependencies]
filelock = ">=4.2.1"

If immediate dependency updates cannot be deployed, teams must apply filesystem configuration workarounds. Ensure all lock databases and link directories reside inside restricted directories owned by the process user with strict permissions (0o700). Avoid placing lock instances in shared world-writable paths like /tmp unless sticky bits (S_ISVTX) are strictly enforced.

Official Patches

tox-devPull Request #834: Fix directory TOCTOU removal race condition
tox-devRelease tag 4.2.1

Fix Analysis (1)

Technical Appendix

CVSS Score
6.1/ 10
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L
EPSS Probability
0.10%
Top 99% most exploited

Affected Systems

Python environments utilizing tox-dev filelock versions 4.1.0 through 4.2.0Systems deploying ReadWriteLock or AsyncReadWriteLock in shared parent directories

Affected Versions Detail

Product
Affected Versions
Fixed Version
filelock
tox-dev
>= 4.1.0, < 4.2.14.2.1
AttributeDetail
CVE IDCVE-2026-112937
Weakness ClassCWE-367: Time-of-Check Time-of-Use (TOCTOU) Race Condition
CVSS v3.1 Score6.1 (Medium)
CVSS VectorCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L
Attack VectorLocal (Unprivileged)
Exploit MaturityNone (No public weaponized exploit)
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1036Masquerading
Defense Evasion
T1070Indicator Removal
Defense Evasion
T1222File and Directory Permissions Modification
Defense Evasion
CWE-367
Time-of-Check Time-of-Use (TOCTOU) Race Condition

The software checks the state of a resource before acting upon it, but the resource's state changes before the action is executed.

Vulnerability Timeline

Fix commit merged in GitHub PR #834
2026-10-17
Official release of filelock version 4.2.1
2026-10-20
GitHub Security Advisory GHSA-jqc4-5cvw-7w85 published
2026-10-20
CVE-2026-112937 published
2026-10-20

References & Sources

  • [1]GitHub Security Advisory GHSA-jqc4-5cvw-7w85
  • [2]Official Patch Commit 5e3f2ec0c5fb17cb2635b60b2b68bc63ab81ca2d
  • [3]GitHub Pull Request #834
  • [4]filelock Version 4.2.1 Release Notes
  • [5]NVD Vulnerability Detail - CVE-2026-112937
  • [6]CVE Record CVE-2026-112937

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-112906
4.7

CVE-2026-112906: Mutual Exclusion Bypass via Inode Recycling and Time Tracking Race in filelock

A local race condition and mutual exclusion bypass vulnerability exists in filelock versions 4.1.0 through 4.2.0. On Linux filesystems with rapid inode reuse, a local attacker can manipulate modification timestamps and lock files to cause waiting processes to falsely evict active soft lock markers.

Amit Schendel
Amit Schendel
7 views•6 min read
•about 2 hours ago•CVE-2026-114055
7.5

CVE-2026-114055: Uncontrolled Resource Consumption in vLLM via Unvalidated Multimodal Kwargs

vLLM prior to version 0.31.0 contains an uncontrolled resource consumption vulnerability (CWE-400) in its HTTP API request handling logic. Unauthenticated remote attackers can transmit per-request keyword arguments (`mm_processor_kwargs` and `media_io_kwargs`) that are passed directly into internal multimodal preprocessing pipelines, causing CPU/GPU memory exhaustion and crashing the engine process.

Amit Schendel
Amit Schendel
6 views•5 min read
•about 3 hours ago•CVE-2026-62204
6.6

CVE-2026-62204: Arbitrary Bazaar Package Overwrite in SiYuan via Parameter Mismatch

An insufficient verification of data authenticity vulnerability in SiYuan prior to version 3.7.4 allows an attacker to overwrite arbitrary installed marketplace packages (plugins, widgets, themes, and templates). By providing a mismatched package name and package archive repository URL during a Bazaar installation request, arbitrary file write into trusted plugin directories can be achieved, enabling persistence and execution across application restarts.

Alon Barad
Alon Barad
7 views•5 min read
•about 4 hours ago•CVE-2026-115478
7.1

CVE-2026-115478: Incorrect Authorization and Incomplete Cleanup in obsidian-tc

In obsidian-tc versions 1.0.1 through 1.31.3, memory lifecycle tools fail to validate note ownership prior to rematerializing Markdown files and execute non-atomic SQLite database mutations. An authorized caller can overwrite arbitrary note bodies on disk and cause persistent desynchronization between the database memory graph and physical vault files.

Amit Schendel
Amit Schendel
8 views•5 min read
•about 5 hours ago•CVE-2026-115477
7.1

CVE-2026-115477: Human-in-the-Loop Authorization Bypass in obsidian-tc

A high-severity authorization bypass vulnerability in obsidian-tc allows clients to bypass Human-In-The-Loop (HITL) confirmation prompts over Streamable HTTP deployments. Due to incomplete validation of returned prompt responses, an attacker echoing a signed requestState token can force execution of destructive vault operations even if a human user declines or cancels the prompt.

Alon Barad
Alon Barad
10 views•5 min read
•about 6 hours ago•CVE-2026-113790
6.0

CVE-2026-113790: Uncontrolled Resource Consumption in pypdf Container Parsing

A Denial of Service (DoS) vulnerability in pypdf versions prior to 6.21.0 allows remote attackers to cause high CPU and memory resource exhaustion by supplying PDF files containing oversized or deeply nested arrays, dictionaries, or content streams.

Alon Barad
Alon Barad
8 views•5 min read