PyPI: filelock

CVE-2026-112909

Safety vulnerability ID: SFTY-20261020-81101

Affected versions of the `filelock` package are vulnerable to Link Following due to truncating, and with an explicit `mode` also changing the permissions of, whatever regular file is found at the lock path, whether or not the acquire created it. `UnixFileLock`, the backend of `FileLock` and `AsyncFileLock` on Unix, empties the file at the lock path once it holds the lock, and the `O_NOFOLLOW` defence added for CVE-2025-68146 does not see a renamed file or a hard link. A local attacker who can rename or hard-link one of the lock user's files onto the lock path gets that file truncated by the next `acquire()`, and with a mode such as `0o666` gains read and write access to it.

Created at: Oct 27, 2026Updated at: Oct 27, 2026

Overview

filelock: UnixFileLock truncates and chmods any regular file another user renames or hard-links onto the lock path

Advisory

filelock – Link Following

Affected Package

Affecting filelock package, versions<=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