CVE-2025-68146filelock has TOCTOU race condition that allows symlink attacks during lock file creation
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.
What to do
Fixed builds are available from Debian, PyPI: see the table below for the fixed version per release.
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.10 | python-filelock | Fix pending | UBUNTU-CVE-2025-68146 | |
| Ubuntu 26.04 | python-filelock | Not affected vulnerable_code_not_present | ||
| Ubuntu 25.10 | python-filelock | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2025-68146 | |
| Ubuntu 24.04 | python-filelock | Fix pending | 3.13.1-1ubuntu0.1~esm1 (Ubuntu Pro) | UBUNTU-CVE-2025-68146 |
| Ubuntu 22.04 | python-filelock | Fix pending | 3.6.0-1ubuntu0.1~esm1 (Ubuntu Pro) | UBUNTU-CVE-2025-68146 |
| Ubuntu 18.04 | python-filelock | Fix pending | 3.0.4-1ubuntu0.1~esm1 (Ubuntu Pro) | UBUNTU-CVE-2025-68146 |
| Debian 14 | python-filelock | Fixed | 3.20.2-1 | DEBIAN-CVE-2025-68146 |
| Debian 13 | python-filelock | Fixed | 3.18.0-1+deb13u1 | DEBIAN-CVE-2025-68146 |
| Debian 12 | python-filelock | Fixed | 3.9.0-1+deb12u1 | DEBIAN-CVE-2025-68146 |
| PyPI library | filelock | Fixed | 3.20.1 | PYSEC-2026-1375 |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- tox-dev filelock: affected: < 3.20.1
References
- https://github.com/tox-dev/filelock/security/advisories/GHSA-w853-jp5j-5j7f
- https://github.com/tox-dev/filelock/pull/461
- https://github.com/tox-dev/filelock/commit/4724d7f8c3393ec1f048c93933e6e3e6ec321f0e
- https://github.com/tox-dev/filelock/releases/tag/3.20.1
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.