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-112912 Overview
CVE-2026-112912 affects filelock, a widely used platform-independent file locking library for Python maintained by tox-dev. Versions from 3.32.6 up to but not including 4.2.1 contain a symbolic link following flaw in the SoftFileLock implementation. During the conditional os.access writability check for a node lacking its owner-write bit, the library can follow a symbolic link swapped in at the lock path. A local user on a platform and directory configuration that follows the link can infer whether a chosen target path exists and is writable by observing the acquisition result. The flaw is categorized under CWE-59: Improper Link Resolution Before File Access.
Critical Impact
A local attacker can probe the existence and writability of arbitrary filesystem paths through observed lock acquisition behavior, leaking filesystem metadata about files the attacker could not otherwise inspect.
Affected Products
- tox-dev filelock versions 3.32.6 through 4.2.0
- Python applications using SoftFileLock on platforms and directory configurations that resolve swapped symlinks
- Downstream distributions bundling vulnerable filelock releases
Discovery Timeline
- 2026-10-20 - CVE-2026-112912 published to NVD
- 2026-10-21 - Last updated in NVD database
Technical Details for CVE-2026-112912
Vulnerability Analysis
The filelock library offers several locking strategies, including SoftFileLock, which uses the mere presence of a lock file as the mutual exclusion primitive rather than an OS-level advisory lock. Before acquisition, SoftFileLock performs a conditional writability check using os.access on the lock path when the file lacks the owner-write bit. os.access follows symbolic links by default. A local attacker who can create or replace the lock path with a symlink pointing to a target file causes the writability check to resolve against the target rather than the intended lock node. The observable acquisition outcome then reveals whether the target exists and is writable by the running process.
The impact is confined to confidentiality of filesystem metadata. The attacker neither modifies files nor executes code through this path. However, the leak can expose the presence of sensitive artifacts, home directory contents, or configuration files that would otherwise be unreadable to the attacker.
Root Cause
The root cause is that the writability probe used os.access without the follow_symlinks=False option on a path an unprivileged local user could substitute. Because SoftFileLock creates its lock node in a shared directory, another local account with write access to that directory can replace the node with a symlink between the check and acquisition. The library then performed the subsequent I/O based on a symlink-resolved view it should not have trusted.
Attack Vector
Exploitation requires local access and the ability to write into the directory containing the soft lock file. The attacker races to replace the lock path node with a symbolic link targeting an arbitrary filesystem path. When the victim process calls acquire(), the writability check follows the symlink and the acquisition result discloses whether the target is present and writable. The flaw is a classic time-of-check / file-system race aligned with [CWE-59].
# Patch summary from docs/changelog/835.bugfix.rst
+Fix five bugs in opening the lock file. :class:`~filelock.UnixFileLock` no longer truncates a file it did not create,
+such as one renamed to the lock path, and no longer applies ``mode`` to it. An ``on_acquired`` hook that writes holder
+metadata now truncates the file itself. A lease (Linux) or an oplock (Windows) on the lock file or a soft lock's marker
+no longer holds ``acquire()`` past its ``timeout`` or ``blocking=False``, and an oplock no longer holds ``release()``;
+:class:`~filelock.ReadWriteLock` on Windows waits for its ``timeout`` and raises :class:`~filelock.Timeout`. On Windows,
+a ``mode`` without group and other bits, such as ``0o600``, now creates the lock file with an owner-only permission
+list; the :class:`~filelock.ReadWriteLock` database gets the same. The soft locks' writability check no longer follows a
+symlink swapped in at the lock path. On a filesystem without ``flock``, a contender from another account now waits on a
+marker it cannot write instead of raising ``PermissionError``.
Source: GitHub Commit e1e825b
Detection Methods for CVE-2026-112912
Indicators of Compromise
- Unexpected symbolic links appearing at paths used by Python applications for SoftFileLock lock files.
- Lock files owned by or writable by accounts other than the application's service account.
- Repeated creation and deletion of symlinks in shared temp or working directories by unprivileged local users.
Detection Strategies
- Audit Python dependency manifests for filelock versions between 3.32.6 and 4.2.0 using pip list or SBOM tooling.
- Monitor process telemetry for symlink() and rename() system calls targeting known soft lock paths.
- Review application logs for anomalous acquisition failures or PermissionError events that may indicate link substitution attempts.
Monitoring Recommendations
- Enable filesystem auditing (auditd on Linux, Advanced Audit Policy on Windows) for directories hosting lock files.
- Alert on local accounts creating symlinks whose targets reside outside their home directory or standard writable paths.
- Track filelock library versions across build pipelines and CI runners through software composition analysis.
How to Mitigate CVE-2026-112912
Immediate Actions Required
- Upgrade filelock to version 4.2.1 or later in all Python environments.
- Relocate SoftFileLock files to directories writable only by the application's service account.
- Review third-party packages that transitively depend on filelock and refresh locked requirements.
Patch Information
The fix is published in GitHub Release 4.2.1 and implemented via GitHub Pull Request #835, commit e1e825b. The soft lock writability check no longer follows a symlink swapped in at the lock path. Additional hardening in the same release corrects truncation, mode application, and timeout handling behaviors. See the GitHub Security Advisory GHSA-9j6q-wvj5-jgjg for full details.
Workarounds
- Place lock files inside a directory whose permissions prevent other local users from creating entries, such as a per-user subdirectory under ~/.cache with mode 0o700.
- Prefer UnixFileLock or WindowsFileLock over SoftFileLock where OS-level advisory locks are available.
- Pre-create lock files with explicit owner-write permissions so the vulnerable conditional writability branch is not triggered.
# Upgrade filelock to the fixed release
python -m pip install --upgrade 'filelock>=4.2.1'
# Verify the installed version
python -c "import filelock; print(filelock.__version__)"
# Restrict the directory hosting SoftFileLock files to the service account
install -d -m 0700 -o appuser -g appuser /var/lib/myapp/locks
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

