# CVE-2025-68146: filelock has TOCTOU race condition that allows symlink attacks during lock file creation

CVE-2025-68146 is fixed in 4 products on 1 platform, first by DEBIAN-CVE-2025-68146, released December 16, 2025. It is not reported as exploited. Patch Radar priority: Routine.

- Web page: https://patchblox.com/security/cve/CVE-2025-68146
- Priority: Routine
- CVSS: 6.5 (Moderate)
- EPSS: 0.0020
- CISA KEV: not listed
- Exploited (vendor report): no
- Publicly disclosed: no
- Published: Dec 16, 2025
- Weakness: Time-of-check Time-of-use (TOCTOU) Race Condition
- Vendor advisory: https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-68146

## 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.

## Where it's fixed

| Platform | Product | Fixed in | Fix | Released |
|---|---|---|---|---|
| Linux | python-filelock Debian 12.15 (bookworm) | 3.9.0-1+deb12u1 | [DEBIAN-CVE-2025-68146](https://patchblox.com/security/data/fix/linux/debian-cve-2025-68146.md) | Dec 16, 2025 |
| Linux | python-filelock Debian 13.5 (trixie) | 3.18.0-1+deb13u1 | [DEBIAN-CVE-2025-68146](https://patchblox.com/security/data/fix/linux/debian-cve-2025-68146.md) | Dec 16, 2025 |
| Linux | python-filelock Debian 14 | 3.20.2-1 | [DEBIAN-CVE-2025-68146](https://patchblox.com/security/data/fix/linux/debian-cve-2025-68146.md) | Dec 16, 2025 |
| Linux | python-filelock Ubuntu 18.04.6 LTS (bionic) | 3.0.4-1ubuntu0.1~esm1 | [python-filelock 3.0.4-1ubuntu0.1~esm1](https://patchblox.com/security/data/fix/linux/ubuntu-bionic-python-filelock-3.0.4-1ubuntu0.1-esm1.md) | Jan 9, 2026 |
| Linux | python-filelock opensuse-leap 15.6 | 3.12.2-150400.10.8.1 | [SUSE-SU-2026:0220-1](https://patchblox.com/security/data/fix/linux/suse-su-2026-0220-1.md) | Jan 22, 2026 |
| Linux | python-filelock opensuse-leap 16.0 | 3.18.0-160000.3.1 | [OPENSUSE-SU-2026:20144-1](https://patchblox.com/security/data/fix/linux/opensuse-su-2026-20144-1.md) | Jan 30, 2026 |
| Linux | python-filelock sles 15.7 | 3.12.2-150400.10.8.1 | [SUSE-SU-2026:0220-1](https://patchblox.com/security/data/fix/linux/suse-su-2026-0220-1.md) | Jan 22, 2026 |
| Linux | python-filelock sles 16.0 | 3.18.0-160000.3.1 | [SUSE-SU-2026:20216-1](https://patchblox.com/security/data/fix/linux/suse-su-2026-20216-1.md) | Jan 30, 2026 |
| Linux | python-filelock-doc amzn 2023 | 3.3.1-1.amzn2023.0.2 | [ALAS2023-2026-1415](https://patchblox.com/security/data/fix/linux/alas2023-2026-1415.md) | Feb 5, 2026 |
| Linux | python3-filelock Ubuntu 18.04.6 LTS (bionic) | 3.0.4-1ubuntu0.1~esm1 | [python3-filelock 3.0.4-1ubuntu0.1~esm1](https://patchblox.com/security/data/fix/linux/ubuntu-bionic-python3-filelock-3.0.4-1ubuntu0.1-esm1.md) | Jan 9, 2026 |
| Linux | python3-filelock Ubuntu 22.04.1 LTS (jammy) | 3.6.0-1ubuntu0.1~esm1 | [python3-filelock 3.6.0-1ubuntu0.1~esm1](https://patchblox.com/security/data/fix/linux/ubuntu-jammy-python3-filelock-3.6.0-1ubuntu0.1-esm1.md) | Jan 9, 2026 |
| Linux | python3-filelock Ubuntu 24.04.5 LTS (noble) | 3.13.1-1ubuntu0.1~esm1 | [python3-filelock 3.13.1-1ubuntu0.1~esm1](https://patchblox.com/security/data/fix/linux/ubuntu-noble-python3-filelock-3.13.1-1ubuntu0.1-esm1.md) | Jan 9, 2026 |
| Linux | python3-filelock amzn 2023 | 3.3.1-1.amzn2023.0.2 | [ALAS2023-2026-1415](https://patchblox.com/security/data/fix/linux/alas2023-2026-1415.md) | Feb 5, 2026 |
| Linux | python3.13-filelock amzn 2023 | 3.18.0-1.amzn2023.0.1 | [ALAS2023-2026-1411](https://patchblox.com/security/data/fix/linux/alas2023-2026-1411.md) | Feb 16, 2026 |

---

Data as of 2026-11-08T19:12:23Z UTC. Source: Patchblox Patch Radar (https://patchblox.com/security/patch-radar). Patchblox finds out-of-date software on Windows, macOS and Linux and updates it through release rings: https://patchblox.com/demo

Free to use with attribution: show "Data: Patchblox Patch Radar" with a link to https://patchblox.com/security/patch-radar. Terms, including what needs a written agreement: https://patchblox.com/security/patch-radar/use-the-data

Product names, logos and trademarks shown on Patch Radar belong to their respective owners. They are used only to identify the software each security fix applies to and to help readers find their platform. Their use does not imply any affiliation with, or endorsement by, those owners, and Patchblox is not affiliated with any of them.
