chore(deps): update dependency filelock to v3.20.3 [security]#1510
chore(deps): update dependency filelock to v3.20.3 [security]#1510renovate-bot wants to merge 2 commits intogoogleapis:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the filelock dependency from version 3.19.1 to 3.20.3 in .devcontainer/requirements.txt. This is a security update to address the vulnerabilities CVE-2025-68146 and CVE-2026-22701, which are Time-of-Check-Time-of-Use (TOCTOU) race conditions. The change correctly updates the package version and its corresponding hashes. The update is appropriate and necessary.
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. |
This PR contains the following updates:
==3.19.1→==3.20.3GitHub Vulnerability Alerts
CVE-2025-68146
Impact
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.
Who is impacted:
All users of filelock on Unix, Linux, macOS, and Windows systems. The vulnerability cascades to dependent libraries:
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.
Patches
Fixed in version 3.20.1.
Unix/Linux/macOS fix: Added O_NOFOLLOW flag to os.open() in UnixFileLock._acquire() to prevent symlink following.
Windows fix: Added GetFileAttributesW API check to detect reparse points (symlinks/junctions) before opening files in WindowsFileLock._acquire().
Users should upgrade to filelock 3.20.1 or later immediately.
Workarounds
If immediate upgrade is not possible:
Warning: These workarounds provide only partial mitigation. The race condition remains exploitable. Upgrading to version 3.20.1 is strongly recommended.
Technical Details: How the Exploit Works
The Vulnerable Code Pattern
Unix/Linux/macOS (
src/filelock/_unix.py:39-44):Windows (
src/filelock/_windows.py:19-28):The Race Window
The vulnerability exists in the gap between operations:
Unix variant:
Windows variant:
Step-by-Step Attack Flow
1. Attacker Setup:
2. Attacker Creates Race Condition:
3. Victim Application Runs:
4. What Happens Inside os.open():
On Unix systems, when
os.open()is called:Without
O_NOFOLLOWflag, the kernel follows the symlink and truncates the target file.Why the Attack Succeeds Reliably
Timing Characteristics:
Success factors:
Real-World Attack Scenarios
Scenario 1: virtualenv Exploitation
Scenario 2: PyTorch Cache Poisoning
Why Standard Defenses Don't Help
File permissions don't prevent this:
Directory permissions help but aren't always feasible:
File locking doesn't prevent this:
Exploitation Proof-of-Concept Results
From empirical testing with the provided PoCs:
Simple Direct Attack (
filelock_simple_poc.py):virtualenv Attack (
weaponized_virtualenv.py):PyTorch Attack (
weaponized_pytorch.py):Discovered and reported by: George Tsigourakos (@tsigouris007)
CVE-2026-22701
Vulnerability Summary
Title: Time-of-Check-Time-of-Use (TOCTOU) Symlink Vulnerability in SoftFileLock
Affected Component:
filelockpackage -SoftFileLockclassFile:
src/filelock/_soft.pylines 17-27CWE: CWE-362, CWE-367, CWE-59
Description
A TOCTOU race condition vulnerability exists in the
SoftFileLockimplementation of the filelock package. An attacker with local filesystem access and permission to create symlinks can exploit a race condition between the permission validation and file creation to cause lock operations to fail or behave unexpectedly.The vulnerability occurs in the
_acquire()method betweenraise_on_not_writable_file()(permission check) andos.open()(file creation). During this race window, an attacker can create a symlink at the lock file path, potentially causing the lock to operate on an unintended target file or leading to denial of service.Attack Scenario
Impact
What kind of vulnerability is it? Who is impacted?
This is a Time-of-Check-Time-of-Use (TOCTOU) race condition vulnerability affecting any application using
SoftFileLockfor inter-process synchronization.Affected Users:
filelock.SoftFileLockdirectlyFileLockon systems withoutfcntlsupport (e.g., GraalPy)Consequences:
CVSS v4.0 Score: 5.6 (Medium)
Vector: CVSS:4.0/AV:L/AT:L/PR:L/UI:N/VC:N/VI:L/VA:H/SC:N/SI:N/SA:N
Attack Requirements:
Patches
Has the problem been patched? What versions should users upgrade to?
Yes, the vulnerability has been patched by adding the
O_NOFOLLOWflag to prevent symlink following during lock file creation.Patched Version: Next release (commit: 255ed068bc85d1ef406e50a135e1459170dd1bf0)
Mitigation Details:
O_NOFOLLOWflag is added conditionally and gracefully degrades on platforms without supportO_NOFOLLOWsupport (most modern systems): symlink attacks are completely preventedO_NOFOLLOW(e.g., GraalPy): TOCTOU window remains but is documentedUsers should:
UnixFileLockorWindowsFileLockinstead of the fallbackSoftFileLockWorkarounds
Is there a way for users to fix or remediate the vulnerability without upgrading?
For users unable to update immediately:
Avoid
SoftFileLockin security-sensitive contexts - useUnixFileLockorWindowsFileLockwhen available (these were already patched for CVE-2025-68146)Restrict filesystem permissions - prevent untrusted users from creating symlinks in lock file directories:
Use process isolation - isolate untrusted code from lock file paths to prevent symlink creation
Monitor lock operations - implement application-level checks to verify lock acquisitions are successful before proceeding with critical operations
References
Are there any links users can visit to find out more?
Reported by: George Tsigourakos (@tsigouris007)
Release Notes
tox-dev/py-filelock (filelock)
v3.20.3Compare Source
What's Changed
Full Changelog: tox-dev/filelock@3.20.2...3.20.3
v3.20.2Compare Source
What's Changed
New Contributors
Full Changelog: tox-dev/filelock@3.20.1...3.20.2
v3.20.1Compare Source
What's Changed
Full Changelog: tox-dev/filelock@3.20.0...3.20.1
v3.20.0Compare Source
What's Changed
New Contributors
Full Changelog: tox-dev/filelock@3.19.1...3.20.0
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.