PyPI: filelock

CVE-2026-112941

Safety vulnerability ID: SFTY-20261020-53058

Affected versions of the `filelock` package are vulnerable to Time-of-check Time-of-use (TOCTOU) Race Condition due to caching a successful check of the lock tree and resolving its names again later. `SoftReadWriteLock` and `AsyncSoftReadWriteLock` validate the `<path>.rw` lock tree once and then resolve its names again during later record operations without repeating the check. A local attacker who can replace that tree after the first acquisition can redirect lock record writes into any directory the lock user can write to.

Created at: Oct 28, 2026Updated at: Oct 28, 2026

Overview

filelock: SoftReadWriteLock follows a lock tree swapped in after its first acquire and writes lock records into directories of the user running the lock

Advisory

filelock – Time-of-check Time-of-use (TOCTOU) Race Condition

Affected Package

Affecting filelock package, versions>=4.1.0,<=4.2.0

Also affects

---

How to Fix

Upgradefilelockto4.2.1or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

Verified by Safety

Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.

Learn more