Description
filelock is a platform-independent file lock for Python. In versions prior to 3.20.1, a Time-of-Check-Time-of-Use (TOCTOU) race condition allows local attackers to corrupt or truncate arbitrary user files through symlink attacks. The vulnerability exists in both Unix and Windows lock file creation where filelock checks if a file exists before opening it with O_TRUNC. An attacker can create a symlink pointing to a victim file in the time gap between the check and open, causing os.open() to follow the symlink and truncate the target file. All users of filelock on Unix, Linux, macOS, and Windows systems are impacted. The vulnerability cascades to dependent libraries. The attack requires local filesystem access and ability to create symlinks (standard user permissions on Unix; Developer Mode on Windows 10+). Exploitation succeeds within 1-3 attempts when lock file paths are predictable. The issue is fixed in version 3.20.1. If immediate upgrade is not possible, use SoftFileLock instead of UnixFileLock/WindowsFileLock (note: different locking semantics, may not be suitable for all use cases); ensure lock file directories have restrictive permissions (chmod 0700) to prevent untrusted users from creating symlinks; and/or monitor lock file directories for suspicious symlinks before running trusted applications. These workarounds provide only partial mitigation. The race condition remains exploitable. Upgrading to version 3.20.1 is strongly recommended.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| tox-dev | filelock | < 3.20.1 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | python-filelock | 3.20.2-1 | — |
| Debian 13 | python-filelock | 3.18.0-1+deb13u1 | — |
| Debian 12 | python-filelock | 3.9.0-1+deb12u1 | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | python-filelock | No fix yet | — |
| Ubuntu 25.10 | python-filelock | No fix yet | — |
Show 4 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 24.04 LTS | python-filelock | 3.13.1-1ubuntu0.1~esm1 | USN-7999-1 |
| Ubuntu Pro 22.04 LTS | python-filelock | 3.6.0-1ubuntu0.1~esm1 | USN-7999-1 |
| Ubuntu Pro 20.04 LTS | python-filelock | 3.0.12-2ubuntu0.1~esm1 | USN-7999-1 |
| Ubuntu Pro 18.04 LTS | python-filelock | 3.0.4-1ubuntu0.1~esm1 | USN-7999-1 |
SUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES 15 SP7 | python-filelock | 3.0.12-150100.3.6.1 | SUSE-SU-2026:0082-1 |
| SLES 3 | python-filelock | 3.12.2-150400.10.8.1 | SUSE-SU-2026:0220-1 |
Show 2 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES for SAP 16.0 | python-filelock | 3.18.0-160000.3.1 | SUSE-SU-2026:20216-1 |
| SLES 16.0 | python-filelock | 3.18.0-160000.3.1 | SUSE-SU-2026:20216-1 |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Tumbleweed | ansible-lint | 26.11.0-2.1 | openSUSE-SU-2026:12481-1 |
| openSUSE Tumbleweed | python-filelock | 3.20.2-1.1 | openSUSE-SU-2026:10010-1 |
| openSUSE Tumbleweed | python-virtualenv | 20.36.1-1.1 | openSUSE-SU-2026:10055-1 |
| openSUSE Leap 16.0 | python-filelock | 3.18.0-160000.3.1 | openSUSE-SU-2026:20144-1 |
| openSUSE Leap 15.6 | python-filelock | 3.12.2-150400.10.8.1 | SUSE-SU-2026:0220-1 |
Amazon Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Amazon Linux 2023 | python3-filelock +1 | 3.3.1-1.amzn2023.0.2 | ALAS2023-2026-1415 |
| Amazon Linux 2023 | python3.13-filelock | 3.18.0-1.amzn2023.0.1 | ALAS2023-2026-1411 |
Azure Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Azure Linux 3 | python-filelock | 3.20.1-1 | — |
| Azure Linux 2 (CBL-Mariner) | python-filelock | No fix yet | — |
Wolfi
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Wolfi rolling | airflow-3 +3 | 3.1.5-r0 | — |
| Wolfi rolling | datadog-agent-7.72-core-integrations | No fix yet | — |
| Wolfi rolling | kserve +9 | 0.16.0-r6 | — |
| Wolfi rolling | open-webui +1 | 0.6.41-r1 | — |
| Wolfi rolling | py3-cassandra-medusa +1 | 0.26.0-r2 | — |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| PyPI | filelock | < 3.20.1 | 3.20.1 | GHSA-w853-jp5j-5j7f |
Advisories 12
- WID-SEC-2026-3046 IBM Concert: Mehrere Schwachstellen BSI CERT-Bund (WID) · Nov 10, 2026
- openSUSE-SU-2026:12481-1 ansible-lint-26.11.0-2.1 on GA media SUSE / openSUSE Security Updates · Nov 9, 2026
- WID-SEC-2026-1730 Xerox FreeFlow Print Server: Mehrere Schwachstellen ermöglichen nicht spezifizierten Angriff BSI CERT-Bund (WID) · Jul 16, 2026
- USN-7999-1 python-filelock vulnerabilities Ubuntu Security Notices (USN) · Apr 27, 2026
- openSUSE-SU-2026:20144-1 Security update for python-filelock SUSE / openSUSE Security Updates · Mar 23, 2026
- openSUSE-SU-2026:10055-1 python311-virtualenv-20.36.1-1.1 on GA media SUSE / openSUSE Security Updates · Mar 23, 2026
- openSUSE-SU-2026:10010-1 python311-filelock-3.20.2-1.1 on GA media SUSE / openSUSE Security Updates · Mar 23, 2026
- SUSE-SU-2026:20216-1 Security update for python-filelock SUSE / openSUSE Security Updates · Mar 23, 2026
- SUSE-SU-2026:0220-1 Security update for python-filelock SUSE / openSUSE Security Updates · Mar 23, 2026
- SUSE-SU-2026:0082-1 Security update for python-filelock SUSE / openSUSE Security Updates · Mar 23, 2026
- ALAS2023-2026-1411 Moderate: python3.13-filelock security update (Amazon Linux 2023) Amazon Linux Security Center (ALAS) · Feb 18, 2026
- ALAS2023-2026-1415 Moderate: python-filelock security update (Amazon Linux 2023) Amazon Linux Security Center (ALAS) · Feb 5, 2026