Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessObtain local user account on host
-
ExploitRename or hard-link target file onto lock path
-
ExecutionVictim application acquires UnixFileLock
-
ImpactTarget file truncated or mode changed
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Incorrectly specified target
|
| Exploitation Conditions | Requires a second local user who has rename permission on the directory holding the UnixFileLock lock file (e.g. a group- or world-writable shared lock directory), OR a system with a permissive hard-link policy (Linux sysctl fs.protected_hardlinks=0) that lets the attacker hard-link an arbitrary target file onto the lock path. The mode-changing variant additionally requires the application to request an explicit mode and affects versions from 3.10.2 onward. Limiting factors: the attacker must already have a local account and write/rename access to the lock directory; default Linux hard-link protection (fs.protected_hardlinks=1) neutralizes the hard-link vector; applications that place lock files in per-user private directories not writable by others are not exposed; there is no remote or unauthenticated path. |
| Impact | This is a locally-exploitable, medium-severity integrity flaw, not an urgent remote threat. The provided CVSS 3.1 vector (AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:N, base 6.1) confirms the attacker must already hold a local account (PR:L) on the same host and have rename or hard-link access to the directory containing the lock file - there is no network vector. No EPSS score, no CISA KEV listing, and no POC were supplied in the input, so there is no signal of active or probable exploitation; exploitation status is 'no public exploit identified at time of analysis.' SSVC decision data was not provided. The signals are internally consistent (local vector matches a 'another local user' description), but note the 'Information Disclosure' tag understates the real impact: the dominant consequence is integrity/data-destruction (I:H, file truncation), with confidentiality only minor (C:L, from a possible mode change). Net: a legitimate but low-to-moderate-priority issue - patch in normal cycles, prioritized only where lock files sit in directories writable by untrusted local users. |
| Exploit ScenarioDerived | On a host where an application places its lock file in a directory shared with other local users, an attacker with rename permission renames (or, under a permissive hard-link policy, hard-links) a victim's regular file onto the lock path. When the victim's application next calls acquire() on its UnixFileLock, affected filelock versions open that planted file as their own lock file and truncate it, destroying its contents; if the application requested an explicit mode, versions from 3.10.2 also change the file's permission bits. No public exploit code is identified at time of analysis. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 20, 2026
Python filelock's UnixFileLock truncates a regular file that a second local user has renamed onto the lock path (or hard-linked there when hard-link protections are relaxed), destroying that file's contents; when an explicit mode is requested, versions from 3.10.2 onward can additionally fchmod the file to the lock's mode. Exploitation requires a low-privileged local account (CVSS PR:L) plus rename/write permission on the directory holding the lock file, or a host with fs.protected_hardlinks disabled, so only multi-user shared lock directories and permissive-hardlink systems are exposed - no remote or unauthenticated path exists. Fixed in 4.2.1; no public exploit identified at time of analysis, and EPSS/KEV data are not available for this CVE.
RemediationAI
Upgrade to filelock 4.2.1 or later - the vendor-released patch (https://github.com/tox-dev/filelock/releases/tag/4.2.1, advisory GHSA-69hj-f68j-2879, fix PR https://github.com/tox-dev/filelock/pull/835, commit e1e825b1992f69fb6b346dc395d5ae4893536c0a); because filelock is usually a transitive dependency, enumerate it with pip-audit or pip show filelock and pin the patched version in every environment, including CI images and build caches where lock files live. If upgrading is not immediately possible, the effective compensating controls are: (1) place lock files in a per-user directory created with mode 0700 and never in a group- or world-writable shared directory - this removes the attacker's rename primitive entirely, at the cost that cross-user coordination must be redesigned around a broker or per-user lock plus a separate coordination channel; (2) keep the Linux default hard-link protection enabled (fs.protected_hardlinks=1, verify with sysctl) - this neutralizes the hard-link vector but does nothing against the rename vector, and disabling it systemwide weakens protection for other software; (3) avoid passing an explicit mode to UnixFileLock on affected versions so the fchmod variant cannot apply, accepting that the truncation variant remains possible; (4) if the lock path may be attacker-influenced, wrap it so the parent directory is validated as owned by the running user and non-writable by others before locking. Auditing for prior exploitation is difficult because the truncated file is simply left empty, so check shared lock and cache directories for zero-length files whose owners do not match the writing process.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
filelock is a platform-independent advisory file-locking library used by pip, virtualenv, tox, and many Python build/cache tools to serialize access to shared resources. UnixFileLock opens the lock path with O_NOFOLLOW to defeat symlink redirection and then locks it with flock(2), but O_NOFOLLOW does not catch a hard link (a second name for the same file) or a plain rename of an attacker-chosen file onto the lock path; the resulting object is indistinguishable from a real lock file. Because the implementation treated whatever it opened as its own artifact, it truncated the file and, when an explicit mode was passed, applied fchmod to it. This is CWE-706 (Use of Incorrectly-Resolved Name or Reference): the code resolves a pathname to a file object and then operates on that object based on the assumption - never verified - that it created it. The fix in 4.2.1 makes UnixFileLock lock a file it did not create as found, without truncating it or changing its mode, moves truncation responsibility into the on_acquired hook that writes holder metadata, stops soft-lock writability checks from following a symlink swapped in at the lock path, and tightens several related oplock/lease and Windows ACL behaviors. Practical consequence of the flaw: an attacker with rename rights in the lock directory can cause the victim application to destroy or permission-alter any file the victim's process can open, which is why integrity impact is rated High while confidentiality is Low.
Know when Filelock gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:N
Local attacker needs an account with rename/link access to the lock directory (AV:L, PR:L); file truncation yields I:H, while a mode change leaks minor confidentiality (C:L), no availability impact.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
filelock is a platform-independent file lock for Python. Prior to 4.2.1, UnixFileLock can truncate a regular file renamed onto the lock path when another local user has actual rename permission, or hard-linked there under a permissive hard-link policy; when an explicit mode is requested, affected versions from 3.10.2 can also change that file's mode. This issue is fixed in version 4.2.1.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
filelock's SQLite-backed ReadWriteLock (versions 3.20.4 through 4.2.0) can be tricked into overwriting or unlinking the
The Python `filelock` package's opt-in `StrictSoftFileLock` (3.30.0 through <4.2.1) and `SoftReadWriteLock` (4.0.0 throu
Symlink redirection in filelock's ReadWriteLock and AsyncReadWriteLock (versions 3.20.4 through 4.0.8) allows a local us
SoftReadWriteLock in the Python filelock package (4.0.0 through 4.2.0) refreshes holder records by pathname without veri
A time-of-check-to-time-of-use (TOCTOU) flaw in the Python filelock library's ReadWriteLock, present from 4.1.0 through
Local denial of service in the Python `filelock` package (versions 3.20.4 through 4.2.0) allows a second local account t
A local, low-privileged user (PR:L) who can rename files in a shared, non-sticky-bit lock directory can abuse the Python
Python's filelock SoftFileLock implementation prior to version 3.20.3 contains a TOCTOU race condition that allows local
SoftFileLock, MarkerSoftFileLock, and SoftFileLease in the Python filelock package from 3.22.0 through 4.2.0 can be tric
The Python filelock library (versions 3.22.0 through 4.2.0) can admit two simultaneous lock holders because its SoftFile
Python's filelock library, versions 4.1.0 through 4.2.0, allows a local attacker who is already contending on the same l
Symlink or junction replacement of the `<path>.rw` lock tree in Python's filelock 4.1.0 through 4.2.0 lets a second, co-
EUVD-2026-105017
NVD
CVE.org
EPSS
GitHub
Exploit-DB