Every CVE Search/ Get API key

CVE-2025-68146

filelock has TOCTOU race condition that allows symlink attacks during lock file creation

6.3 MediumFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Local
Complexity
High
Privileges needed
Low
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
High
Availability
High

Exploit likelihood

0.20%Up 0.2 points since Dec 17, 2025
90%50%10%1%

What each source reports

CVE List Score used 6.3

filelock has TOCTOU race condition that allows symlink attacks during lock file creation

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.

Record
CVE-2025-68146
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
Weakness
CWE-367, CWE-59, CWE-362
Updated
2026-11-02
EUVDEUVD-2025-203839 6.3

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.

Record
EUVD-2025-203839
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-w853-jp5j-5j7f 6.3

filelock has a TOCTOU race condition which allows symlink attacks during lock file creation

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:

  • virtualenv users: Configuration files can be overwritten with virtualenv metadata, leaking sensitive paths
  • PyTorch users: CPU ISA cache or model checkpoints can be corrupted, causing crashes or ML pipeline failures
  • poetry/tox users: through using virtualenv or filelock on their own.

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:

  1. Use SoftFileLock instead of UnixFileLock/WindowsFileLock (note: different locking semantics, may not be suitable for all use cases)
  2. Ensure lock file directories have restrictive permissions (chmod 0700) to prevent untrusted users from creating symlinks
  3. Monitor lock file directories for suspicious symlinks before running trusted applications

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):

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 (src/filelock/_windows.py:19-28):

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 Window

The vulnerability exists in the gap between operations:

Unix variant:

Time    Victim Thread                          Attacker Thread
----    -------------                          ---------------
T0      Check: lock_file exists? → False
T1                                             ↓ RACE WINDOW
T2                                             Create symlink: lock → victim_file
T3      Open lock_file with O_TRUNC
        → Follows symlink
        → Opens victim_file
        → Truncates victim_file to 0 bytes! ☠️

Windows variant:

Time    Victim Thread                          Attacker Thread
----    -------------                          ---------------
T0      Check: lock_file writable?
T1                                             ↓ RACE WINDOW
T2                                             Create symlink: lock → victim_file
T3      Open lock_file with O_TRUNC
        → Follows symlink/junction
        → Opens victim_file
        →…
Record
GHSA-w853-jp5j-5j7f
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
Weakness
CWE-59, CWE-362, CWE-367
Updated
2026-11-02
NVD 6.3

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.

Record
CVE-2025-68146
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
CVSS 3.1
6.5 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:H
Weakness
CWE-59, CWE-362, CWE-367
Updated
2026-11-02
OSVBELL-CVE-2025-68146 6.5
Record
BELL-CVE-2025-68146
CVSS 3.1
6.5 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:H
Updated
2026-11-02
OSV 6.3

filelock has TOCTOU race condition that allows symlink attacks during lock file creation

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.

Record
CVE-2025-68146
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
Weakness
CWE-362, CWE-367, CWE-59
Updated
2026-11-02
Show 15 moreShow less
OSVDEBIAN-CVE-2025-68146 6.5

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.

Record
DEBIAN-CVE-2025-68146
CVSS 3.1
6.5 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:H
Updated
2026-11-02
OSVGHSA-w853-jp5j-5j7f 6.3

filelock has a TOCTOU race condition which allows symlink attacks during lock file creation

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:

  • virtualenv users: Configuration files can be overwritten with virtualenv metadata, leaking sensitive paths
  • PyTorch users: CPU ISA cache or model checkpoints can be corrupted, causing crashes or ML pipeline failures
  • poetry/tox users: through using virtualenv or filelock on their own.

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:

  1. Use SoftFileLock instead of UnixFileLock/WindowsFileLock (note: different locking semantics, may not be suitable for all use cases)
  2. Ensure lock file directories have restrictive permissions (chmod 0700) to prevent untrusted users from creating symlinks
  3. Monitor lock file directories for suspicious symlinks before running trusted applications

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):

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 (src/filelock/_windows.py:19-28):

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 Window

The vulnerability exists in the gap between operations:

Unix variant:

Time    Victim Thread                          Attacker Thread
----    -------------                          ---------------
T0      Check: lock_file exists? → False
T1                                             ↓ RACE WINDOW
T2                                             Create symlink: lock → victim_file
T3      Open lock_file with O_TRUNC
        → Follows symlink
        → Opens victim_file
        → Truncates victim_file to 0 bytes! ☠️

Windows variant:

Time    Victim Thread                          Attacker Thread
----    -------------                          ---------------
T0      Check: lock_file writable?
T1                                             ↓ RACE WINDOW
T2                                             Create symlink: lock → victim_file
T3      Open lock_file with O_TRUNC
        → Follows symlink/junction
        → Opens victim_file
        →…
Record
GHSA-w853-jp5j-5j7f
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
Weakness
CWE-362, CWE-367, CWE-59
Updated
2026-11-02
OSVOESA-2026-3143 6.5

python-filelock security update

Security Fix(es):

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.(CVE-2025-68146)

Record
OESA-2026-3143
CVSS 3.1
6.5 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:H
Updated
2026-11-02
OSVPYSEC-2026-1375 6.3

filelock has a TOCTOU race condition which allows symlink attacks during lock file creation

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:

  • virtualenv users: Configuration files can be overwritten with virtualenv metadata, leaking sensitive paths
  • PyTorch users: CPU ISA cache or model checkpoints can be corrupted, causing crashes or ML pipeline failures
  • poetry/tox users: through using virtualenv or filelock on their own.

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:

  1. Use SoftFileLock instead of UnixFileLock/WindowsFileLock (note: different locking semantics, may not be suitable for all use cases)
  2. Ensure lock file directories have restrictive permissions (chmod 0700) to prevent untrusted users from creating symlinks
  3. Monitor lock file directories for suspicious symlinks before running trusted applications

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):

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 (src/filelock/_windows.py:19-28):

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 Window

The vulnerability exists in the gap between operations:

Unix variant:

Time    Victim Thread                          Attacker Thread
----    -------------                          ---------------
T0      Check: lock_file exists? → False
T1                                             ↓ RACE WINDOW
T2                                             Create symlink: lock → victim_file
T3      Open lock_file with O_TRUNC
        → Follows symlink
        → Opens victim_file
        → Truncates victim_file to 0 bytes! ☠️

Windows variant:

Time    Victim Thread                          Attacker Thread
----    -------------                          ---------------
T0      Check: lock_file writable?
T1                                             ↓ RACE WINDOW
T2                                             Create symlink: lock → victim_file
T3      Open lock_file with O_TRUNC
        → Follows symlink/junction
        → Opens victim_file
        →…
Record
PYSEC-2026-1375
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
Updated
2026-11-02
OSVROOT-APP-PYPI-CVE-2025-68146 6.3

CVE-2025-68146 in rootio-filelock - Patched by Root

Root has patched CVE-2025-68146 in the rootio-filelock package for Root:PyPI. Multiple fixed versions available.

Record
ROOT-APP-PYPI-CVE-2025-68146
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
Updated
2026-11-02
OSVUBUNTU-CVE-2025-68146 6.3

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.

Record
UBUNTU-CVE-2025-68146
CVSS 3.1
6.3 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
CVSS 3.1
6.5 MediumCVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:H
Updated
2026-11-02
OSVAZL-72739 No score

CVE-2025-68146 affecting package python-filelock for versions less than 3.20.1-1

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.

Record
AZL-72739
Updated
2026-11-02
OSVAZL-79232 No score

CVE-2025-68146 affecting package python-filelock 3.0.12-13

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.

Record
AZL-79232
Updated
2026-11-02
OSVopenSUSE-SU-2026:10010-1 No score

python311-filelock-3.20.2-1.1 on GA media

These are all security issues fixed in the python311-filelock-3.20.2-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:10010-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:10055-1 No score

python311-virtualenv-20.36.1-1.1 on GA media

These are all security issues fixed in the python311-virtualenv-20.36.1-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:10055-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:20144-1 No score

Security update for python-filelock

This update for python-filelock fixes the following issues:

  • CVE-2025-68146: TOCTOU race condition may allow local attackers to corrupt or truncate arbitrary user files (bsc#1255244).
  • CVE-2026-22701: TOCTOU race condition in the SoftFileLock implementation (bsc#1256457).
Record
openSUSE-SU-2026:20144-1
Updated
2026-11-02
OSVSUSE-SU-2026:0082-1 No score

Security update for python-filelock

This update for python-filelock fixes the following issues:

  • CVE-2025-68146: TOCTOU race condition may allow local attackers to corrupt or truncate arbitrary user files (bsc#1255244).
Record
SUSE-SU-2026:0082-1
Updated
2026-11-02
OSVSUSE-SU-2026:0220-1 No score

Security update for python-filelock

This update for python-filelock fixes the following issues:

  • CVE-2025-68146: TOCTOU race condition may allow local attackers to corrupt or truncate arbitrary user files (bsc#1255244).
  • CVE-2026-22701: TOCTOU race condition in the SoftFileLock implementation (bsc#1256457).
Record
SUSE-SU-2026:0220-1
Updated
2026-11-02
OSVSUSE-SU-2026:20216-1 No score

Security update for python-filelock

This update for python-filelock fixes the following issues:

  • CVE-2025-68146: TOCTOU race condition may allow local attackers to corrupt or truncate arbitrary user files (bsc#1255244).
  • CVE-2026-22701: TOCTOU race condition in the SoftFileLock implementation (bsc#1256457).
Record
SUSE-SU-2026:20216-1
Updated
2026-11-02
OSVUSN-7999-1 No score

python-filelock vulnerabilities

It was discovered that Filelock incorrectly handled symlinks in temp files. A local attacker could possibly use this issue to cause lock operations to fail or behave unexpectedly. (CVE-2026-22701)

It was discovered that the file locking implementation in the Filelock package contained a race condition. A local attacker could possibly use this to cause a denial of service or corrupt arbitrary user files. (CVE-2025-68146)

Record
USN-7999-1
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
filelock
PyPI
before 3.20.1
3.20.1
python-filelock
Azure Linux:3
before 3.20.1-1
3.20.1-1
python-filelock
Azure Linux:2
through 3.0.12-13 None known
py3-filelock
Alpaquita:23
3.8.0-r1 and later None known
py3-filelock
Alpaquita:25
3.16.1-r1 and later None known
py3-filelock
Alpaquita:stream
3.8.0-r1 and later None known
python-filelock
Debian:12
before 3.9.0-1+deb12u1, plus listed versions
3.9.0-1
3.9.0-1+deb12u1
python-filelock
Debian:13
before 3.18.0-1+deb13u1, plus listed versions
3.18.0-1
3.18.0-1+deb13u1
python-filelock
Debian:14
before 3.20.2-1, plus listed versions
3.18.0-13.19.1-13.20.0-1
3.20.2-1
filelock
PyPI
before 3.20.1, plus listed versions
0.2.00.2.10.2.21.0.01.0.1
Show 45 moreShow less
1.0.21.0.32.0.02.0.12.0.102.0.112.0.122.0.132.0.42.0.52.0.62.0.72.0.82.0.93.0.03.0.103.0.123.0.23.0.33.0.43.0.63.0.83.0.93.1.03.10.03.10.13.10.23.10.33.10.43.10.53.10.63.10.73.11.03.12.03.12.13.12.23.12.33.12.43.13.03.13.13.13.23.13.33.13.43.14.03.15.0
3.20.1
Show 26 moreShow less
Affected packages
PackageAffectedFixed
python-filelock
openEuler:24.03-LTS-SP1
before 3.13.1-5.oe2403sp1
3.13.1-5.oe2403sp1
python-filelock
openEuler:24.03-LTS-SP3
before 3.13.1-5.oe2403sp3
3.13.1-5.oe2403sp3
python-filelock
openEuler:24.03-LTS-SP4
before 3.13.1-5.oe2403sp4
3.13.1-5.oe2403sp4
python-filelock
openEuler:20.03-LTS-SP4
before 3.0.12-2.oe2003sp4
3.0.12-2.oe2003sp4
python-filelock
openEuler:22.03-LTS-SP4
before 3.0.12-4.oe2203sp4
3.0.12-4.oe2203sp4
rootio-filelock
Root:PyPI
before 3.19.1+root.io.2
3.19.1+root.io.23.20.0+root.io.23.19.1+root.io.33.20.0+root.io.33.18.0+root.io.13.12.2+root.io.1
filelock
Root:PyPI
before 3.19.1+aikido.3
3.19.1+aikido.33.20.0+aikido.3
python-filelock
SUSE:Linux Enterprise Module for Development Tools 15 SP7
before 3.0.12-150100.3.6.1
3.0.12-150100.3.6.1
python-filelock
SUSE:Linux Enterprise Module for Package Hub 15 SP7
before 3.0.12-150100.3.6.1
3.0.12-150100.3.6.1
python-filelock
SUSE:Linux Enterprise Module for Python 3 15 SP7
From an advisory covering 2 CVEs
before 3.12.2-150400.10.8.1
3.12.2-150400.10.8.1
python-filelock
openSUSE:Leap 15.6
From an advisory covering 2 CVEs
before 3.12.2-150400.10.8.1
3.12.2-150400.10.8.1
python-filelock
SUSE:Linux Enterprise Server 16.0
From an advisory covering 2 CVEs
before 3.18.0-160000.3.1
3.18.0-160000.3.1
python-filelock
SUSE:Linux Enterprise Server for SAP applications 16.0
From an advisory covering 2 CVEs
before 3.18.0-160000.3.1
3.18.0-160000.3.1
python-filelock
Ubuntu:Pro:18.04:LTS
before 3.0.4-1ubuntu0.1~esm1, plus listed versions
2.0.11-12.0.12-12.0.13-13.0.0-23.0.3-13.0.4-1
3.0.4-1ubuntu0.1~esm1
python-filelock
Ubuntu:Pro:22.04:LTS
before 3.6.0-1ubuntu0.1~esm1, plus listed versions
3.0.12-23.3.2-13.4.0-13.4.2-13.4.2-23.6.0-1
3.6.0-1ubuntu0.1~esm1
python-filelock
Ubuntu:Pro:24.04:LTS
before 3.13.1-1ubuntu0.1~esm1, plus listed versions
3.12.2-13.12.4-13.13.1-1
3.13.1-1ubuntu0.1~esm1
python-filelock
Ubuntu:25.10
All versions, plus listed versions
3.18.0-1
None known
python-filelock
Ubuntu:26.10
All versions, plus listed versions
3.20.3-13.29.4-13.32.0-13.32.2-1
None known
python-filelock
Ubuntu:26.04:LTS
All versions, plus listed versions
3.18.0-13.20.0-13.20.2-13.20.3-1
None known
python-filelock
Ubuntu:Pro:18.04:LTS
From an advisory covering 2 CVEs
before 3.0.4-1ubuntu0.1~esm1, plus listed versions
2.0.11-12.0.12-12.0.13-13.0.0-23.0.3-13.0.4-1
3.0.4-1ubuntu0.1~esm1
python-filelock
Ubuntu:Pro:20.04:LTS
From an advisory covering 2 CVEs
before 3.0.12-2ubuntu0.1~esm1, plus listed versions
3.0.12-13.0.12-2
3.0.12-2ubuntu0.1~esm1
python-filelock
Ubuntu:Pro:22.04:LTS
From an advisory covering 2 CVEs
before 3.6.0-1ubuntu0.1~esm1, plus listed versions
3.0.12-23.3.2-13.4.0-13.4.2-13.4.2-23.6.0-1
3.6.0-1ubuntu0.1~esm1
python-filelock
Ubuntu:Pro:24.04:LTS
From an advisory covering 2 CVEs
before 3.13.1-1ubuntu0.1~esm1, plus listed versions
3.12.2-13.12.4-13.13.1-1
3.13.1-1ubuntu0.1~esm1
python-filelock
openSUSE:Tumbleweed
before 3.20.2-1.1
3.20.2-1.1
python-virtualenv
openSUSE:Tumbleweed
From an advisory covering 2 CVEs
before 20.36.1-1.1
20.36.1-1.1
python-filelock
openSUSE:Leap 16.0
From an advisory covering 2 CVEs
before 3.18.0-160000.3.1
3.18.0-160000.3.1

History

History
RecordedChangedSources
affected, facts
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2025-68146 is a medium vulnerability (CVSS 6.3) in Tox-dev Filelock, published December 16, 2025. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.20%, the 9th percentile. Fixed in filelock 3.20.1.

References

Show 20 moreShow less
This page doesn't list everything

Left out here: 28 versions and the rest of 3 source descriptions. The JSON record has them.

MoveEnter Open