Vulnerability
CVE-2025-68146
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.
82 advisories report this vulnerability, across 10 ecosystems.
Advisories
-
ALAS2023-2026-1411
Amazon Linux 2023 - ALAS2023-2026-1411: Medium priority package update for python3.13-filelock
-
ALAS2023-2026-1415
Amazon Linux 2023 - ALAS2023-2026-1415: Medium priority package update for python-filelock
-
AZL-72739
CVE-2025-68146 affecting package python-filelock for versions less than 3.20.1-1
-
AZL-79232
CVE-2025-68146 affecting package python-filelock 3.0.12-13
- CGA-25mv-mrpw-hhjx
- CGA-278w-f7jq-78rg
- CGA-2hp2-6hq9-xjm5
- CGA-3c5p-4gfm-4r72
- CGA-3gv3-fqqh-9h5h
- CGA-3rjq-vgwg-4qh8
- CGA-3vg7-r79f-c6vc
- CGA-59c9-rrvv-m522
- CGA-59pm-8pxj-grwh
- CGA-5c6c-9cmw-pgx2
- CGA-5h32-2x32-g4f4
- CGA-5jhc-gg98-59pq
- CGA-6q82-j9hm-g529
- CGA-6w65-gc6j-836j
- CGA-74px-m7mf-3788
- CGA-84g6-h638-fp59
- CGA-85w4-rqj4-52rh
- CGA-8cm7-cw65-mmv5
- CGA-8m6r-mg3x-9jvv
- CGA-8mxf-5h82-gmq4
- CGA-8p52-2mcq-64vc
- CGA-9474-j7g3-56hx
- CGA-96pf-4qgx-7cm6
- CGA-98r7-ww3v-fp9f
- CGA-98xc-wp46-8xv9
- CGA-9mj3-c589-4v35
- CGA-c287-x95g-2w77
- CGA-cfc4-hv5p-hmvq
- CGA-ch64-h84r-hvf5
- CGA-cwqr-7jq9-6r8x
- CGA-f7r8-jj44-v7jv
- CGA-fcw8-pwjx-p39r
- CGA-ff6p-34w6-rvf6
- CGA-g5wp-vvgx-pwhc
- CGA-g6r2-pfhh-99g6
- CGA-g9vw-5vxf-698x
- CGA-h5mx-fjw3-7fm5
- CGA-hc82-ch33-89g5
- CGA-hj4m-v7hw-cx63
- CGA-hxvj-j7r6-wxv6
- CGA-j4rp-rjc4-rfgh
- CGA-jrjj-6g6v-c4vp
- CGA-m22m-6jw7-w6cr
- CGA-m6cf-7wqm-3xfm
- CGA-mpxp-2whw-w2h8
- CGA-mqj9-m856-h5qr
- CGA-pp5f-vjjp-443x
- CGA-pv3q-ch35-vm5f
- CGA-q6w2-836c-449j
- CGA-q89v-qjcw-fhfx
- CGA-qf8j-g9mg-jwp8
- CGA-qvv9-hcqh-4qgq
- CGA-r476-rwrf-9f9w
- CGA-r7r4-rmhg-chh4
- CGA-r8fw-rhw2-hfcq
- CGA-r8wv-f9jw-g69p
- CGA-r946-chw9-4cff
- CGA-rqrv-mrpm-cm7c
- CGA-v3fw-hcp8-vm9q
- CGA-v5pv-7x22-4hg3
- CGA-v9j6-76q9-6mm8
- CGA-vjmj-9h37-mjmw
- CGA-x93f-qqr6-xv3g
- CGA-xx96-f2r8-w68p
-
DEBIAN-CVE-2025-68146
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…
-
GHSA-w853-jp5j-5j7f
filelock has a TOCTOU race condition which allows symlink attacks during lock file creation
-
OESA-2026-3143
python-filelock security update
-
PYSEC-2026-1375
filelock has a TOCTOU race condition which allows symlink attacks during lock file creation
-
SUSE-SU-2026:0082-1
Security update for python-filelock
-
SUSE-SU-2026:0220-1
Security update for python-filelock
-
SUSE-SU-2026:20216-1
Security update for python-filelock
-
SUSEVEX-CVE-2025-68146
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…
-
UBUNTU-CVE-2025-68146
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…
-
USN-7999-1
python-filelock vulnerabilities
-
openSUSE-SU-2026:10010-1
python311-filelock-3.20.2-1.1 on GA media
-
openSUSE-SU-2026:10055-1
python311-virtualenv-20.36.1-1.1 on GA media
-
openSUSE-SU-2026:12481-1
ansible-lint-26.11.0-2.1 on GA media
-
openSUSE-SU-2026:20144-1
Security update for python-filelock