PyPI: filelock
CVE-2025-68146
Safety vulnerability ID: SFTY-20251216-69491
Safety legacy ID: pyup.io-82754
Affected versions of this package are vulnerable to a TOCTOU (Time-of-Check to Time-of-Use) symlink vulnerability due to improper handling of symlinks during lock file creation. The vulnerability exists because the package does not adequately check for symlink manipulation between the time the lock file path is checked and the time it is used. An attacker can exploit this vulnerability by creating a malicious symlink, potentially leading to unauthorized access or modification of files, which could compromise the integrity and security of the system.
Overview
filelock has a TOCTOU race condition which allows symlink attacks during lock file creation
Advisory
Affected versions of this package are vulnerable to a TOCTOU (Time-of-Check to Time-of-Use) symlink vulnerability due to improper handling of symlinks during lock file creation. The vulnerability exists because the package does not adequately check for symlink manipulation between the time the lock file path is checked and the time it is used. An attacker can exploit this vulnerability by creating a malicious symlink, potentially leading to unauthorized access or modification of files, which could compromise the integrity and security of the system.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20251216-69491/CVE-2025-68146
- https://github.com/tox-dev/filelock/security/advisories/GHSA-w853-jp5j-5j7f
- https://github.com/tox-dev/filelock/commit/4724d7f8c3393ec1f048c93933e6e3e6ec321f0e
- https://github.com/tox-dev/filelock/releases/tag/3.20.1
- https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html
- https://github.com/advisories/GHSA-w853-jp5j-5j7f
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
