Skip to main content

filelock CVE-2026-112940

| EUVDEUVD-2026-105031 HIGH
Race Condition Enabling Link Following (CWE-363)
2026-10-20 GitHub_M
7.1
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Gain rename access in non-sticky parent dir
  2. Delivery
    Plant journal/side-file names beside database
  3. Exploit
    Win TOCTOU race during lock acquire
  4. Execution
    SQLite reopens files by planted name
  5. Impact
    Overwrite or unlink victim-owned files

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Race condition in multi-threaded env
Exploitation Conditions

Requires: (1) a POSIX system running filelock 3.20.4 through 4.2.0 using the ReadWriteLock (SQLite-backed) feature; (2) a local attacker account holding rename/write access in a non-sticky parent directory at or above the lock database path, so the attacker can swap names between the lock's checks and SQLite's open; and (3) for attacker-chosen CONTENT overwrites specifically, an additionally writable adjacent hot journal file (name-swap alone yields overwrite/unlink). LIMITING FACTORS: exploitation is local only (no network vector), requires an existing low-privileged account, and is a timing-sensitive race. It does NOT apply when every parent directory is owned by the locking account or root and is either non-group/other-writable or carries the sticky bit, and is fixed outright in 4.2.1.

Impact

This is a genuine but conditional local-privilege issue, not a widespread remote threat. The provided CVSS 3.1 vector (AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H, base 7.1) correctly scopes it as LOCAL with low privileges and no confidentiality impact - the damage is integrity/availability via file overwrite and unlink. CWE-363 (race condition / TOCTOU link-following) and the description's dependence on winning a swap window suggest the AC:L in the input is optimistic; a reliable attacker-chosen-content overwrite additionally requires a writable adjacent hot journal, which in practice argues for higher attack complexity than AC:L. No EPSS score, no CISA KEV listing, and no POC were supplied, so there is no public exploit identified at time of analysis and no signal of active or automated exploitation. Signals are internally consistent except for one conflict: the 'Information Disclosure' tag contradicts the CVSS C:N (no confidentiality impact) - the real impact is file overwrite/unlink, so treat the disclosure framing as mislabeled. Net: a real fix-worthy local race in a hugely popular library, but exploitation is gated on multi-user shared-directory conditions, so prioritize patching on shared/multi-tenant hosts rather than treating it as an internet-facing emergency.

Exploit ScenarioDerived

On a shared POSIX host, a low-privileged local user with write/rename access to a non-sticky directory that contains (or sits above) another account's ReadWriteLock SQLite database races the lock acquire, swapping in crafted '-journal'/'-wal'/'-shm' side-file names so SQLite reopens and acts on attacker-controlled names. This lets the attacker unlink or overwrite victim-owned files, and with a writable adjacent hot journal, overwrite them with attacker-chosen content. No public exploit is identified at time of analysis; the attack requires winning a TOCTOU window and is local-only.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 20, 2026

filelock's SQLite-backed ReadWriteLock (versions 3.20.4 through 4.2.0) can be tricked into overwriting or unlinking the side files SQLite keeps next to a locked database, and - when a writable hot journal is also present - into writing attacker-chosen content into that database. This is a genuine but conditional local-privilege issue rather than a widespread remote threat: it requires an existing low-privileged local account with rename/write access in a non-sticky parent directory at or above the database path, and it is a timing-sensitive race that does not apply when every parent directory is owned by the locking account or root and is either non-group/other-writable or carries the sticky bit. No public exploit identified at time of analysis and no CISA KEV entry; vendor-released patch: 4.2.1.

RemediationAI

Upgrade to filelock 4.2.1 or later (https://github.com/tox-dev/filelock/releases/tag/4.2.1, advisory https://github.com/tox-dev/filelock/security/advisories/GHSA-v4x8-3wr5-3wq8), which is the vendor-released fix and changes behavior for shared directories. If upgrading immediately is not possible, the actionable compensating control is placement: keep the ReadWriteLock database in a directory only the locking account (or root) can write, and ensure every parent directory above it is owned by the locking account or root and is either not group/other-writable or has the sticky bit set - moving the database out of shared locations such as /tmp or world-writable working directories fully removes the prerequisite rename ability, at the cost of relocating state and any path assumptions in your code. On Windows, equivalent protection comes from a directory whose ACL grants add-file/add-subdirectory/delete rights only to the locking account, SYSTEM and Administrators (for example a directory under %LOCALAPPDATA%). Before rolling out 4.2.1, validate the target filesystem supports hard links, since on a filesystem without them (some network/FUSE mounts) the lock now raises OSError; also note that WAL-mode databases and databases whose schema takes more than a few kilobytes to load now raise ValueError instead of operating, so plan for those design constraints rather than treating them as regressions. Do not rely on the pre-4.2.1 symlink check alone as mitigation.

Affected VersionsENISA

filelock 3.20.4, < 4.2.1

Affected Packages

euvd filelock fix: 4.2.1

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

The weakness class is CWE-363 (Missing Ownership Check for Critical Resource), realized here as a name-based TOCTOU against SQLite's side files. SQLite does not open only the database file: it also resolves the sibling names '<database>-journal', '<database>-wal' and '<database>-shm', and a hot journal is replayed into the database and then unlinked. Because filelock validated the database path and then let SQLite reopen it by name, a process that can rename entries in a parent directory can substitute the path between the lock's check and SQLite's first statement, redirecting SQLite at a different name - with a planted journal file that means attacker-chosen content is replayed into the lock database. The 4.2.1 fix (PR 834, commit 5e3f2ec) stops relying on bare names: when the containing directory is writable by other accounts, filelock opens the database through a private hard link inside a '.filelock-*' directory readable only by the locking account, removes link directories via a checked descriptor rather than by name, and reads a link directory's name only when the locking account owns it; on Windows the same decision is driven by the directory ACL, requiring the owner and every ACE granting add-file/add-subdir/delete to belong to the locking account, SYSTEM or Administrators. Filesystems lacking hard-link support now raise OSError, WAL-mode databases raise ValueError, and a database whose schema takes more than a few kilobytes to load also raises ValueError instead of running past the acquire timeout.

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

Vendor (GitHub_M) PRIMARY 7.1 HIGH
AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
vuln.today AI 6.3 MEDIUM

Local co-tenant with directory rename rights (PR:L, AV:L); a TOCTOU race plus writable-hot-journal precondition makes it AC:H; overwrite/unlink gives I:H/A:H with no disclosure (C:N).

3.1 AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
4.0 AV:L/AC:H/AT:P/PR:L/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
High

Lifecycle Timeline

2
Patch available
Oct 20, 2026 - 16:02 EUVD
CVE Published
Oct 20, 2026 - 14:41 cve.org
HIGH 7.1

DescriptionCVE.org

filelock is a platform-independent file lock for Python. From 3.20.4 until 4.2.1, ReadWriteLock let SQLite reopen the database and side files by name; on POSIX systems an attacker with rename access in a non-sticky parent can swap those names to cause overwrite or unlink operations, while a writable adjacent hot journal is additionally required for attacker-chosen content overwrites. This issue is fixed in version 4.2.1.

Technical POC Analysis

CWE-363 as assigned by the reporter; the operative bug class is link-following combined with a TOCTOU window.

Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.

Executive ViewAI

Why It Matters

A flaw in the widely used Python 'filelock' package (versions 3.20.4 through 4.2.0) can let someone who already holds a low-privileged local account on a host overwrite or delete SQLite side files and, under narrow timing conditions, inject attacker-controlled content into the associated database. The practical exposure is therefore to data integrity on shared multi-user systems, CI runners, and build/automation hosts where untrusted local accounts coexist with databases held under permissive parent directories - not to external or remote attackers. Leadership should care because the library is typically pulled in transitively and rarely tracked: affected hosts may be invisible without a dependency inventory.

Business Impact: Medium
Compensating Controls

Apply vendor patch: upgrade to filelock 4.2.1 (the fix version named in the advisory, notwithstanding the feed's conflicting patch-status field). If the upgrade cannot be completed immediately, restrict local account access on affected hosts and ensure every parent directory at or above a locked database is owned by the locking account or root and is either non-group/other-writable or carries the sticky bit.

Threat Intelligence Overview

EPSS Score
0.1%
Top 99% exploitable
Prevalence
High
filelock is a ubiquitous Python dependency, but vulnerable ReadWriteLock feature is new and niche
Data Quality
5 sources
Confidence: Medium

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact
Medium

Priority Score

36
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +36
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0
CVE-2026-112911 MEDIUM
6.3 Oct 20

The Python `filelock` package's opt-in `StrictSoftFileLock` (3.30.0 through <4.2.1) and `SoftReadWriteLock` (4.0.0 throu

CVE-2026-112936 MEDIUM
6.1 Oct 20

Symlink redirection in filelock's ReadWriteLock and AsyncReadWriteLock (versions 3.20.4 through 4.0.8) allows a local us

CVE-2026-112934 MEDIUM
6.1 Oct 20

SoftReadWriteLock in the Python filelock package (4.0.0 through 4.2.0) refreshes holder records by pathname without veri

CVE-2026-112909 MEDIUM
6.1 Oct 20

Python filelock's UnixFileLock truncates a regular file that a second local user has renamed onto the lock path (or hard

CVE-2026-112937 MEDIUM
6.1 Oct 20

A time-of-check-to-time-of-use (TOCTOU) flaw in the Python filelock library's ReadWriteLock, present from 4.1.0 through

CVE-2026-112915 MEDIUM
5.5 Oct 20

Local denial of service in the Python `filelock` package (versions 3.20.4 through 4.2.0) allows a second local account t

CVE-2026-112914 MEDIUM
5.3 Oct 20

A local, low-privileged user (PR:L) who can rename files in a shared, non-sticky-bit lock directory can abuse the Python

CVE-2026-22701 MEDIUM
5.3 Jan 10

Python's filelock SoftFileLock implementation prior to version 3.20.3 contains a TOCTOU race condition that allows local

CVE-2026-112939 MEDIUM
4.7 Oct 20

SoftFileLock, MarkerSoftFileLock, and SoftFileLease in the Python filelock package from 3.22.0 through 4.2.0 can be tric

CVE-2026-112935 MEDIUM
4.7 Oct 20

The Python filelock library (versions 3.22.0 through 4.2.0) can admit two simultaneous lock holders because its SoftFile

CVE-2026-112906 MEDIUM
4.7 Oct 20

Python's filelock library, versions 4.1.0 through 4.2.0, allows a local attacker who is already contending on the same l

CVE-2026-112941 LOW
3.3 Oct 20

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-

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy