Skip to main content
Vulnerability Database/CVE-2026-112937

CVE-2026-112937: Tox-dev Filelock Information Disclosure

CVE-2026-112937 is an information disclosure vulnerability in Tox-dev Filelock affecting versions 4.1.0 to 4.2.1. Local users can exploit ReadWriteLock cleanup to observe live names or forge dead-owner sweep names. This article covers technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-112937 Overview

CVE-2026-112937 is a race condition vulnerability in filelock, a platform-independent file locking library for Python maintained by tox-dev. The flaw affects the ReadWriteLock class in versions 4.1.0 through 4.2.0. During cleanup, ReadWriteLock can remove a randomized .filelock-* private-hard-link directory. A local attacker with rename access in a non-sticky parent directory can observe a live name or forge a dead-owner sweep name. The attacker then renames a sibling directory onto that name, causing it to be deleted by the victim process. The issue is categorized as [CWE-367] Time-of-check Time-of-use (TOCTOU) and is fixed in version 4.2.1.

Critical Impact

A local attacker can trick a victim process using filelock.ReadWriteLock into deleting an attacker-chosen sibling directory, enabling integrity loss and limited denial of service.

Affected Products

  • tox-dev filelock versions 4.1.0 through 4.2.0
  • Python applications depending on filelock.ReadWriteLock
  • Multi-user Linux and Unix hosts where filelock state resides in non-sticky parent directories

Discovery Timeline

  • 2026-10-20 - CVE-2026-112937 published to NVD
  • 2026-10-21 - Last updated in NVD database
  • Version 4.2.1 - tox-dev releases the patched filelock release containing commit 5e3f2ec0c5fb17cb2635b60b2b68bc63ab81ca2d

Technical Details for CVE-2026-112937

Vulnerability Analysis

The vulnerability lives in the cleanup logic of filelock.ReadWriteLock. The lock creates a randomized .filelock-* directory used as a private hard-link marker. When the owning process exits or performs a sweep for dead owners, it removes directories matching that pattern by name rather than through a verified file descriptor.

Because the removal path operates on the directory name only, there is a window between the name lookup and the rmdir or unlink call. Another local user who can create or rename entries in the same parent directory can exploit that window. The attacker renames an unrelated sibling directory onto the targeted .filelock-* name, so the victim process deletes a directory it never created.

The cleanup also runs a dead-owner sweep. An attacker who can predict or observe the random name can forge a matching entry and have the sweep remove it, leveraging the victim's privileges without needing to win a tight race in every case.

Root Cause

The root cause is a classic [CWE-367] time-of-check time-of-use flaw. The cleanup routine resolves a path by name and then issues the destructive syscall on that same name, instead of acting on a descriptor obtained with O_NOFOLLOW and verified via fstat. In a parent directory without the sticky bit, any local user with write access can rename entries belonging to others, so the name observed at check time no longer refers to the same inode at use time.

Attack Vector

Exploitation requires local access and write permission to the parent directory holding the lock state. The attacker does not need elevated privileges. Impact is limited to integrity of the filesystem namespace and availability of the targeted directory. Confidentiality is not affected.

text
// Patch summary from filelock 4.2.1 changelog (docs/changelog/834.bugfix.rst)
Fix ReadWriteLock acting on -journal, -wal or -shm files another process puts
beside its database: a write could land in another file, a reader could get in
beside a writer, and an acquire could fail. SQLite now opens the database by
name only in a directory no other account can write, and through a private hard
link elsewhere. The lock removes link directories through a checked descriptor
rather than by name, reads a link directory's name only when the locking account
owns it, and leaves alone a directory with other content renamed onto a link
directory's name.

Source: tox-dev/filelock commit 5e3f2ec

Detection Methods for CVE-2026-112937

Indicators of Compromise

  • Unexpected rmdir or unlinkat syscalls from Python processes targeting .filelock-* names owned by other users.
  • Rename operations on .filelock-* entries where the source and destination inodes have different owners.
  • filelock.ReadWriteLock acquire failures or OSError entries in application logs correlated with activity from unrelated local accounts.

Detection Strategies

  • Audit renameat2, rename, and rmdir syscalls on parent directories that host .filelock-* entries using auditd or eBPF tracing.
  • Flag Python processes that remove directories they did not create by correlating inotify events with process ancestry.
  • Inventory installed Python packages across hosts and alert on filelock versions between 4.1.0 and 4.2.0.

Monitoring Recommendations

  • Monitor shared lock directories, including /tmp and application state paths, for cross-user rename activity.
  • Collect filesystem telemetry via OCSF-normalized endpoint logs and retain it for TOCTOU-pattern threat hunting.
  • Alert when Python runtimes under one UID issue destructive syscalls against paths last modified by a different UID.

How to Mitigate CVE-2026-112937

Immediate Actions Required

  • Upgrade filelock to version 4.2.1 or later in all Python environments, including virtualenvs, container images, and build pipelines.
  • Audit services that import filelock.ReadWriteLock and restart them after upgrade so the new code is loaded.
  • Relocate lock state away from world-writable, non-sticky directories; prefer per-user paths under $XDG_RUNTIME_DIR or a directory writable only by the service account.

Patch Information

The fix landed in filelock4.2.1 via commit 5e3f2ec0c5fb17cb2635b60b2b68bc63ab81ca2d and pull request #834. The patch removes link directories through a checked descriptor instead of by name, reads a link directory's name only when the locking account owns it, and leaves directories with foreign content alone during cleanup. Refer to the GitHub Security Advisory GHSA-jqc4-5cvw-7w85 and the filelock 4.2.1 release notes for full details.

Workarounds

  • Set the sticky bit (chmod +t) on parent directories hosting .filelock-* entries so only owners can rename or unlink their files.
  • Isolate services that depend on filelock into dedicated user accounts with private state directories inaccessible to other local users.
  • Where upgrade is not immediately possible, avoid using filelock.ReadWriteLock on multi-tenant hosts and fall back to the standard FileLock class on exclusive paths.
bash
# Upgrade filelock across environments and enforce a sticky lock directory
pip install --upgrade 'filelock>=4.2.1'
pip show filelock | grep -i version

# Harden shared lock state parents against cross-user rename attacks
install -d -m 1777 /var/lock/myapp   # sticky bit prevents foreign renames
chmod +t /var/lock/myapp

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.