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

CVE-2026-112911: Tox-dev Filelock Privilege Escalation Flaw

CVE-2026-112911 is a privilege escalation vulnerability in Tox-dev Filelock that allows local users to alter protocol state in shared directories. This post explains its impact, affected versions, 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-112911 Overview

CVE-2026-112911 is a local privilege and integrity flaw in filelock, a platform-independent file locking library for Python maintained by tox-dev. The vulnerability affects StrictSoftFileLock from version 3.30.0 and SoftReadWriteLock from version 4.0.0 through 4.2.0. When these lock implementations create a protocol directory inside a shared parent directory, a local attacker who created that directory first can retain ownership of it. The attacker then alters protocol state and admits concurrent lock holders, breaking the mutual exclusion guarantee the library is designed to provide. The issue is tracked under [CWE-283: Unverified Ownership] and is fixed in filelock 4.2.1.

Critical Impact

A local user sharing a parent directory such as /tmp can hijack a filelock coordination directory, defeat lock exclusivity, and corrupt the state of a privileged process relying on StrictSoftFileLock or SoftReadWriteLock.

Affected Products

  • tox-dev filelock 3.30.0 through 4.2.0 (StrictSoftFileLock)
  • tox-dev filelock 4.0.0 through 4.2.0 (SoftReadWriteLock)
  • Python applications depending on these lock classes with lock paths under shared parent directories

Discovery Timeline

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

Technical Details for CVE-2026-112911

Vulnerability Analysis

The filelock library coordinates mutual exclusion between processes by creating a protocol directory next to the lock path. For StrictSoftFileLock, this is a <path>.filelock directory containing a claims subdirectory. For SoftReadWriteLock, it is a <path>.rw directory with gen and holders records inside.

Before the fix, these classes would adopt and reuse a pre-existing protocol directory regardless of who owned it. A local user who created the directory first in a shared parent could keep write access to the protocol state. That user could then insert claim entries, forge holder records, or redirect the directory tree through symlinks, allowing concurrent holders to acquire what the application believed was an exclusive lock.

Root Cause

The root cause is unverified ownership of filesystem artifacts used for inter-process coordination. The lock classes did not confirm that the protocol directory and its sentinel records belonged to the current lock holder before trusting them. They also followed symbolic links and junctions when traversing the protocol tree, so another local user could swap in a directory of their choosing after the initial mkdir succeeded.

Attack Vector

Exploitation requires local access and the ability to write into the parent directory of the target lock path, such as a world-writable /tmp. The attacker races to create <path>.filelock or <path>.rw before the privileged consumer and populates it with records they control. When the privileged process later invokes StrictSoftFileLock or SoftReadWriteLock against that path, it adopts the attacker-owned structure. The attacker can then admit extra holders or point protocol records at symlinks, breaking exclusivity and corrupting any state the application protects with the lock.

The following patch excerpt from docs/changelog/839.bugfix.rst describes the enforcement added in 4.2.1:

text
:class:`~filelock.StrictSoftFileLock` creates ``<path>.filelock`` and its ``claims`` directory with the lock's ``mode``
and sets the sticky bit (a directory flag that lets only a file's owner remove it) on both. On the next acquisition it
narrows a directory it owns that an earlier release created wider; it leaves a directory of another account as it is,
so remove such leftovers by hand. It reaches ``claims`` through a descriptor opened without following symlinks; on
Windows it holds both directories open and refuses a junction (a directory that points at another directory). Under a
sticky parent such as ``/tmp`` it refuses a coordination directory of another account, as
:class:`~filelock.SoftReadWriteLock` does for ``<path>.rw``.

Source: GitHub commit bfa066d

Detection Methods for CVE-2026-112911

Indicators of Compromise

  • Presence of <path>.filelock or <path>.rw directories in shared locations owned by a user other than the application identity.
  • Symlinks or Windows junctions where claims, gen, or holders records are expected to be regular directories or files.
  • Non-regular filesystem nodes (FIFOs, sockets, symlinks) appearing at sentinel private-record names inside the protocol directory.

Detection Strategies

  • Inventory Python environments and application dependency manifests for filelock versions in the range >=3.30.0,<4.2.1.
  • Audit filesystem telemetry for mkdir and open operations against *.filelock and *.rw paths followed by cross-user access.
  • Review application logs for SoftFileLockProtocolError or unexpected lock acquisition patterns indicating concurrent holders.

Monitoring Recommendations

  • Monitor world-writable parent directories such as /tmp for creation of filelock protocol directories by unexpected UIDs.
  • Alert on symlink or junction creation at paths matching known application lock prefixes.
  • Track package-manager and container-image changes to confirm filelock upgrades propagate to production hosts.

How to Mitigate CVE-2026-112911

Immediate Actions Required

  • Upgrade filelock to version 4.2.1 or later in all Python environments, container images, and virtualenvs.
  • Move lock paths out of shared parents such as /tmp and into process-private directories owned by the application user.
  • Manually remove stale <path>.filelock and <path>.rw directories owned by other accounts; the patched library intentionally refuses to adopt them.

Patch Information

The fix landed in filelock pull request #839 via commit bfa066d and shipped in filelock 4.2.1. The patch enforces sticky-bit protection on protocol directories, opens them without following symlinks, holds directory handles on Windows to refuse junctions, and raises SoftFileLockProtocolError on non-regular sentinel nodes. Additional background is available in the GHSA-9c4x-gm8v-wgc4 advisory.

Workarounds

  • Place lock files under a directory writable only by the application's own UID, for example /var/run/<app> or a per-user XDG_RUNTIME_DIR path.
  • Set the sticky bit on any shared parent directory that must host lock files so only owners can remove entries inside it.
  • Prefer FileLock (OS-level fcntl/LockFileEx) over StrictSoftFileLock and SoftReadWriteLock where kernel-mediated locking is available.
bash
# Upgrade filelock across Python environments
pip install --upgrade 'filelock>=4.2.1'

# Verify installed version
python -c "import filelock; print(filelock.__version__)"

# Create a private lock directory and set the sticky bit on shared parents
install -d -m 0700 -o appuser -g appgroup /var/run/myapp
chmod +t /tmp

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.