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·11 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

•34 minutes ago•CVE-2026-126299
7.5

CVE-2026-126299: Quadratic Algorithmic Complexity Denial of Service in NLTK CCG Lexicon Parser

An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.

Alon Barad
Alon Barad
1 views•10 min read
•about 2 hours ago•CVE-2026-126295
7.1

CVE-2026-126295: Path Traversal and Unconfined File Access in NLTK BllipParser

CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.

Amit Schendel
Amit Schendel
2 views•11 min read
•about 3 hours ago•CVE-2026-126300
5.3

CVE-2026-126300: Algorithmic Complexity Denial of Service in NLTK TreebankWordTokenizer.span_tokenize

CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.

Amit Schendel
Amit Schendel
3 views•10 min read
•about 4 hours ago•GHSA-GPWC-27CW-RH9R
5.3

CVE-2026-126301: Quadratic CPU Exhaustion in NLTK LegalitySyllableTokenizer

The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.

Amit Schendel
Amit Schendel
4 views•10 min read
•about 5 hours ago•CVE-2026-126304
8.7

CVE-2026-126304: Symlink Path Traversal in NLTK YCOECorpusReader

CVE-2026-126304 is a symlink path traversal vulnerability (CWE-59) in the Natural Language Toolkit (NLTK) versions 3.10.0 prior to 3.10.4. The YCOECorpusReader class constructs internal sub-readers for the 'psd' and 'pos' subdirectories using FileSystemPathPointer.join(), which relies exclusively on lexical string-prefix validation rather than canonical path resolution. An attacker who supplies a crafted YCOE corpus containing symbolic links in place of the 'psd' or 'pos' subdirectories can bypass directory confinement and read arbitrary files from sibling corpora or sensitive directories within the NLTK data sandbox.

Amit Schendel
Amit Schendel
6 views•9 min read
•about 6 hours ago•CVE-2026-128077
6.5

CVE-2026-128077: Authorization Bypass via Request Path Desynchronization in Nuxt and @nuxt/nitro-server

CVE-2026-128077 (GHSA-r99w-jh2x-3mg9) is an authorization bypass and interpretation conflict vulnerability affecting Nuxt and its underlying @nuxt/nitro-server package in versions 4.6.0 through 4.6.3. When an incoming HTTP request path begins with a double forward slash (e.g., //x/admin), the WHATWG URL parser within the Nuxt server-side page renderer interprets the initial segment as a network host/authority and resolves the remaining path (/admin) against the application's page router. Because Nitro server middleware, route-scoped serverHandlers, and Nitro routeRules evaluate the unparsed request path (//x/admin), path-based access controls, redirects, and security header policies configured for /admin fail to match and are bypassed.

Amit Schendel
Amit Schendel
5 views•10 min read