Debian Patches

Status for python-filelock/3.18.0-1+deb13u1

Patch Description Author Forwarded Bugs Origin Last update
cve-2025-68146.patch [PATCH] Fix TOCTOU symlink vulnerability in lock file creation
A race condition existed between checking if the lock file exists and opening it with O_TRUNC, allowing
local attackers to create a symlink pointing to victim files. When the lock was acquired, os.open() would
follow the symlink and truncate the target file, causing data loss or corruption.

The vulnerability affected both Unix and Windows platforms and cascaded through dependent libraries:
- virtualenv: Could overwrite user configs with virtualenv metadata, leaking file contents
- PyTorch: Could truncate CPU ISA cache causing crashes, or corrupt compiled model checkpoints preventing
model loading (DoS for ML pipelines)

Unix/Linux/macOS fix:
- Add O_NOFOLLOW flag to os.open() call in UnixFileLock._acquire()
- System returns ELOOP error if lock path is a symlink, preventing the attack

Windows fix:
- Use GetFileAttributesW API via ctypes to detect reparse points (symlinks/junctions)
- Refuse to open lock file if FILE_ATTRIBUTE_REPARSE_POINT flag is set
- Raises OSError before attempting to open, closing the race window

This addresses CWE-362 (Race Condition), CWE-367 (TOCTOU), and CWE-59 (Link Following).
Bernát Gábor <bgabor8@bloomberg.net> no 2025-12-15

All known versions for source package 'python-filelock'

Links