Dec 5, 2026·10 min read·2 visits
In filelock versions prior to 4.3.0 on Windows, a local user with read access to a SQLite lock database can use Windows opportunistic locks (oplocks) to trap worker threads in an uninterruptible polling loop, delaying AsyncReadWriteLock coroutine cancellation and application shutdown.
CVE-2026-144341 (GHSA-x9cq-qqfm-8972) is a local denial-of-service vulnerability affecting the Python filelock library prior to version 4.3.0 on Microsoft Windows systems. A local user account with read access to a SQLite lock database file can place a Windows Opportunistic Lock (oplock) on the database, forcing the low-level file open routine into an uninterruptible synchronous polling loop. Because AsyncReadWriteLock executes SQLite database operations inside a background worker thread via asyncio executor dispatch, task cancellations and process shutdown routines cannot interrupt the oplock wait loop, delaying coroutine termination up to the full lock acquisition timeout.
filelock (tox-dev/filelock) is an open-source, platform-independent file locking library for Python. In addition to standard advisory and mandatory file locks, the library provides cross-process reader-writer locking semantics through ReadWriteLock and its asynchronous counterpart AsyncReadWriteLock. These classes manage shared and exclusive lock states across independent threads and processes by reading and writing records within a local SQLite database file, avoiding the need for external lock management daemons.
Because the standard library sqlite3 module in Python exposes only a synchronous C-API binding, AsyncReadWriteLock cannot perform non-blocking file I/O directly on the event loop. To bridge synchronous SQLite operations with Python's asyncio concurrency model, AsyncReadWriteLock dispatches database connection and transaction steps to a background thread pool using loop.run_in_executor. When an asynchronous task awaits lock acquisition, the event loop waits on the executor future while the background worker thread establishes the file handle and executes SQLite queries.
Prior to version 4.3.0, the Windows platform backend (src/filelock/_windows.py) contained an excessive iteration flaw classified under CWE-834 (Excessive Iteration). When opening the SQLite database file on Windows, the low-level file opening routine open_non_reparse_fd entered a tight, synchronous retry loop whenever it encountered a pending Windows Opportunistic Lock (oplock) break (STATUS_OPLOCK_BREAK_IN_PROGRESS). This loop polled until the oplock break completed or the entire lock acquisition timeout elapsed, without consulting the asynchronous operation's cancellation state.
Consequently, on multi-user Windows hosts where a SQLite lock database is readable by another local account, an unprivileged local user can request a read oplock on the database file and stall the break acknowledgment. If the victim application attempts to cancel the AsyncReadWriteLock acquisition task due to a caller deadline or graceful shutdown signal, the background worker thread remains trapped inside the oplock wait loop. The task cancellation and application shutdown hang past their intended deadlines until the underlying lock timeout or connection initialization timeout expires.
To defend against symlink manipulation and Time-of-Check to Time-of-Use (TOCTOU) race conditions on Microsoft Windows, filelock does not rely on standard Python open() calls when initializing the SQLite lock database. Instead, it invokes the Windows Native API function NtCreateFile (via the internal helper _nt_open) with the FILE_OPEN_REPARSE_POINT flag and validates file ownership and security descriptors before passing the resulting file descriptor to SQLite.
On Windows file systems such as NTFS and ReFS, any process with read access to a file can request an Opportunistic Lock (oplock) via the FSCTL_REQUEST_OPLOCK control code. Oplocks allow clients to cache file data locally and receive kernel notifications when another process attempts to open the file with conflicting access rights. When a conflicting open occurs, the Windows I/O Manager suspends or rejects the incoming open request with the NTSTATUS code _STATUS_OPLOCK_BREAK_IN_PROGRESS (0x00000108) while waiting for the oplock holder to acknowledge the break and flush its buffers.
In filelock versions prior to 4.3.0, the function open_non_reparse_fd in src/filelock/_windows.py accepted an oplock_wait duration parameter. During connection setup in _open_for_acquisition, the caller passed the full lock acquisition timeout (or a hardcoded 5.0-second timeout during object construction) directly into oplock_wait. Inside open_non_reparse_fd, the code computed an absolute monotonic deadline (oplock_deadline = time.monotonic() + oplock_wait) and executed a while True loop that slept for _ACCESS_DENIED_RETRY intervals and re-invoked _nt_open as long as _STATUS_OPLOCK_BREAK_IN_PROGRESS was returned.
The root cause of CVE-2026-144341 is the architectural disconnect between the synchronous oplock retry loop in open_non_reparse_fd and the cooperative cancellation mechanism of AsyncReadWriteLock. While AsyncReadWriteLock maintains an _Operation state object equipped with a thread-safe cancel_check callback to abort long-running SQLite transactions when the parent asyncio.Task is canceled, this callback was never passed to _open_lock_database or open_non_reparse_fd. Because Python threads cannot be forcibly preempted by asyncio.Task.cancel(), the executor thread remained blind to the cancellation event until time.monotonic() >= oplock_deadline evaluated to true.
In the vulnerable implementation prior to version 4.3.0, src/filelock/_windows.py handled both transient access-denied states and oplock break states inside a single monolithic loop within open_non_reparse_fd. The function signature required oplock_wait: float and blocked the calling thread for the entire duration whenever _STATUS_OPLOCK_BREAK_IN_PROGRESS persisted.
# Vulnerable implementation in src/filelock/_windows.py (< 4.3.0)
def open_non_reparse_fd(path: str, mode: int, *, oplock_wait: float) -> int | None:
...
handle, status = _nt_open(path, read_only=read_only, owner_only=owner_only)
oplock_deadline = time.monotonic() + oplock_wait
denied_probes = 0
while True:
if status == _STATUS_ACCESS_DENIED:
if denied_probes >= _ACCESS_DENIED_PROBES:
break
denied_probes += 1
elif status == _STATUS_OPLOCK_BREAK_IN_PROGRESS:
# Vulnerable: Blocks inside low-level open without checking async cancellation
if time.monotonic() >= oplock_deadline:
break
else:
break
time.sleep(_ACCESS_DENIED_RETRY)
handle, status = _nt_open(path, read_only=read_only, owner_only=owner_only)Commit 2a7f045f0e000e9e554f07ab6aebd4c3adbbda22 (Pull Request #1059) resolves this issue by refactoring how database open contention is handled across both the low-level Windows layer and the high-level reader-writer lock orchestration in src/filelock/_read_write.py. First, in src/filelock/_windows.py, the oplock_wait parameter and the _STATUS_OPLOCK_BREAK_IN_PROGRESS retry branch were completely removed from open_non_reparse_fd. The function now only retries a bounded number of times (_ACCESS_DENIED_PROBES) for transient _STATUS_ACCESS_DENIED conditions and immediately fails with a timeout exception if an oplock blocks the open.
# Patched implementation in src/filelock/_windows.py (>= 4.3.0)
def open_non_reparse_fd(path: str, mode: int) -> int | None:
...
handle, status = _nt_open(path, read_only=read_only, owner_only=owner_only)
# Fixed: Only retry bounded transient ACCESS_DENIED probes; return immediately on oplock contention
for _ in range(_ACCESS_DENIED_PROBES):
if status != _STATUS_ACCESS_DENIED:
break
time.sleep(_ACCESS_DENIED_RETRY)
handle, status = _nt_open(path, read_only=read_only, owner_only=owner_only)Second, the patch introduces a higher-level retry wrapper method named _open_waiting in src/filelock/_read_write.py. When _open_for_acquisition opens the SQLite database connection, it invokes self._open_waiting(sqlite_timeout, cancel_check=operation.cancel_check). If _open_connection raises a Timeout exception due to an active Windows oplock or Linux file lease, _open_waiting catches the exception, evaluates cancel_check(), and sleeps only for min(remaining, _CANCEL_POLL_INTERVAL) before retrying.
# Patched implementation in src/filelock/_read_write.py (>= 4.3.0)
def _open_waiting(self, timeout: float, *, cancel_check: Callable[[], bool] | None) -> _ForkSafeConnection:
deadline = time.perf_counter() + timeout
while True:
try:
return self._open_connection(sqlite_timeout=timeout)
except Timeout:
remaining = deadline - time.perf_counter()
# Fixed: Promptly abort the retry loop if the caller task was canceled
if remaining <= 0 or (cancel_check is not None and cancel_check()):
raise
time.sleep(min(remaining, _CANCEL_POLL_INTERVAL))
timeout = deadline - time.perf_counter()
if timeout <= 0:
raise> [!NOTE]
> Fix Completeness Assessment: The patch also addresses an analogous contention condition on Linux systems where kernel file leases (F_SETLEASE) held on the SQLite database file could cause _open_waiting to spin at 100% CPU utilization. By routing all open refusals through _open_waiting with _CANCEL_POLL_INTERVAL sleeps and cancel_check verification, the fix completely eliminates uninterruptible open waits during asynchronous lock acquisition. Note that synchronous constructor initialization (__init__) calls self._open_waiting(5.0, cancel_check=None), which remains bounded to 5.0 seconds as constructors cannot be asynchronously canceled.
Exploiting CVE-2026-144341 requires local access to the Windows host running the target Python application. Additionally, the attacker's local user account must possess at least FILE_READ_DATA or GENERIC_READ permissions on the SQLite database file utilized by AsyncReadWriteLock. While filelock versions 4.0.9 and later attempt to apply owner-only Discretionary Access Control Lists (DACLs) on newly created database files, older pre-existing database files or databases stored in deliberately shared directories may grant read permissions to other local accounts (Users or Authenticated Users).
To trigger the vulnerability, the local attacker opens a handle to the target .db file using CreateFileW with FILE_READ_ATTRIBUTES | GENERIC_READ and FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE. Using this handle, the attacker issues an asynchronous DeviceIoControl call with the FSCTL_REQUEST_OPLOCK control code, requesting a Read-Caching (OPLOCK_LEVEL_CACHE_READ) or Read-Handle (OPLOCK_LEVEL_CACHE_READ | OPLOCK_LEVEL_CACHE_HANDLE) opportunistic lock.
When the victim Python process calls await lock.acquire_write(timeout=60.0) or await lock.acquire_read(timeout=60.0), its executor worker thread calls NtCreateFile to open the database. Because the victim's open request conflicts with the attacker's oplock, the Windows kernel initiates an oplock break and returns STATUS_OPLOCK_BREAK_IN_PROGRESS. So long as the attacker process withholds acknowledgment of the oplock break (up to the Windows kernel's oplock break timeout, typically 35 seconds, or repeatedly re-arms the oplock across multiple handles), _nt_open continues to encounter _STATUS_OPLOCK_BREAK_IN_PROGRESS.
The regression test added in tests/test_async_read_write_cancel_wait.py within commit 2a7f045f0e000e9e554f07ab6aebd4c3adbbda22 illustrates how an active oplock delays caller deadlines on vulnerable versions:
@pytest.mark.skipif(sys.platform != "win32", reason="oplocks exist only on Windows")
@pytest.mark.asyncio
async def test_async_acquire_oplocked_database_honors_caller_deadline(
tmp_path: Path, hold_oplock: Callable[[Path], Callable[[], None]]
) -> None:
database = tmp_path / "lock.db"
lock = AsyncReadWriteLock(database, is_singleton=False)
close_holder = hold_oplock(database)
try:
# Prior to 4.3.0, canceling the acquisition task waited for the full _HOLD lock timeout.
# In 4.3.0+, _open_waiting checks cancel_check() every _CANCEL_POLL_INTERVAL and aborts promptly.
elapsed = await _acquire_within_deadline(lock, "write", _HOLD)
assert elapsed < _HOLD / 2
finally:
close_holder()
await lock.close()The security impact of CVE-2026-144341 is confined to local availability degradation within the affected Python process. The vulnerability is scored at 2.5 (Low) under CVSS v3.1 (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L). It does not permit unauthorized disclosure of sensitive information, memory corruption, privilege escalation, or subversion of the lock's mutual exclusion guarantees.
When triggered, the primary consequence is the failure of cooperative task cancellation in asyncio applications. Services that wrap AsyncReadWriteLock acquisition inside asyncio.wait_for() or asyncio.timeout() blocks expect timeouts to raise asyncio.TimeoutError immediately upon deadline expiration. Under active oplock contention in filelock < 4.3.0, the task ignores the cancellation signal and remains suspended until the full lock timeout elapses.
This behavior also impacts application lifecycle management and thread pool health. Because AsyncReadWriteLock runs blocking calls on the default asyncio thread pool executor, stalled worker threads consume executor slots for the duration of the oplock wait. Furthermore, when an application receives a termination signal (SIGINT or SIGTERM) and attempts a graceful shutdown by canceling outstanding tasks, the process hangs until all trapped executor threads exit their oplock wait loops.
Threat intelligence metrics confirm a minimal likelihood of widespread exploitation. The Exploit Prediction Scoring System (EPSS) assigns CVE-2026-144341 a score of 0.00206 (0.21%, 11.29th percentile), and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The combination of a local attack vector, Windows-specific kernel behavior, and required read permissions on the database file limits exposure to multi-user Windows workstations, terminal servers, or CI/CD runners sharing workspace directories.
The primary remediation for CVE-2026-144341 is to upgrade the filelock package to version 4.3.0 or later. Version 4.3.0 decouples low-level Windows file opening from synchronous oplock waiting and polls the asynchronous cancellation token between open attempts.
Administrators and developers can update the package via pip using the following command:
pip install --upgrade "filelock>=4.3.0"For environments where an immediate dependency upgrade is not feasible, operators should enforce strict file system access controls on the directories hosting SQLite lock databases. On multi-user Windows systems, store lock database files inside directories protected by explicit Windows Discretionary Access Control Lists (DACLs) that grant read and write access solely to the specific service account or user running the Python process. Avoid placing shared lock databases in world-readable root temporary directories without user-isolated subdirectories.
Additionally, developers should review the timeout parameter passed to AsyncReadWriteLock acquisition methods (acquire_read and acquire_write). Avoid passing excessively large or unbounded timeouts when relying on external asyncio.timeout() wrappers, as the internal lock timeout serves as the upper bound for thread blockage in unpatched versions.
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L| Product | Affected Versions | Fixed Version |
|---|---|---|
filelock tox-dev | < 4.3.0 | 4.3.0 |
| Attribute | Detail |
|---|---|
| CVE ID | CVE-2026-144341 (GHSA-x9cq-qqfm-8972) |
| CWE Classification | CWE-834: Excessive Iteration |
| CVSS v3.1 Score | 2.5 Low (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L) |
| Attack Vector | Local (Windows Opportunistic Lock on readable SQLite database) |
| Affected Component | tox-dev/filelock (AsyncReadWriteLock / open_non_reparse_fd) |
| EPSS Score | 0.21% (11.29th Percentile) |
| Exploit Status | Regression PoC available in patch commit; not in CISA KEV |
| Patched Version | filelock 4.3.0 |
The product performs iteration or looping that consumes excessive time or resources, or fails to terminate iterations promptly when cancellation or deadline triggers occur.
CVE-2026-144381 (GHSA-gqj6-5294-r46r) is a local permission assignment and directory validation vulnerability in the Python filelock library prior to version 4.3.0. In Unix-like environments where a shared parent directory is writable by multiple users and lacks the sticky bit, an unprivileged local user can rename an unrelated directory owned by a victim account to match the filelock coordination path (<path>.filelock). When the victim process subsequently invokes StrictSoftFileLock, the library verifies ownership of the directory via os.geteuid() and executes os.fchmod() to restrict its permissions without first validating that the directory contents conform to the lock protocol. This modifies the permission bits of the victim's directory and injects a claims subdirectory, resulting in unauthorized permission modifications and local denial of service.
CVE-2026-144382 (GHSA-7mx6-8qvh-pvc4) is an unverified ownership vulnerability (CWE-283) in the tox-dev/filelock Python library prior to version 4.3.0. On Linux systems utilizing user namespaces or idmapped mounts, unmapped user identifiers are reported by the kernel as the overflow UID (typically 65534). When lock coordination directories or files reside within a shared sticky directory such as /tmp, filelock's ownership verification fails to distinguish between unrelated host accounts that resolve to the same overflow UID. This allows a local attacker to plant a lock protocol tree that is trusted by victim processes, breaking mutual exclusion guarantees in SoftReadWriteLock, StrictSoftFileLock, and UnixFileLock.
CVE-2026-144334 is a local denial-of-service vulnerability affecting the Python filelock package prior to version 4.3.0 on Microsoft Windows systems. The host_name() function unconditionally probes the POSIX path /proc/self/ns/pid to retrieve the Linux PID namespace inode. On Windows, a path beginning with a single leading slash resolves relative to the root of the current working drive (e.g., C:\proc\self\ns\pid). Because default Windows NTFS permissions allow unprivileged local users to create directories at the drive root, a local attacker can plant this file structure to inject an arbitrary NTFS file index into the host identity string recorded by SoftFileLock and MarkerSoftFileLock. If the lock-holding process terminates abnormally and the planted path is subsequently altered, removed, or evaluated from a different working drive, contending processes observe a hostname mismatch and fail closed, permanently blocking stale lock recovery.
CVE-2026-144338 is a local denial-of-service vulnerability affecting the Python filelock library prior to version 4.3.0. On POSIX systems, when ReadWriteLock or AsyncReadWriteLock operates within a shared parent directory, an unprivileged local user can flood the directory with entries matching the .filelock-* prefix. Because connection initialization executes an unbounded synchronous directory sweep before evaluating user-supplied lock timeouts, this flooding stalls calling threads and starves the asyncio event loop.
CVE-2026-144342 (GHSA-jcqr-c9r9-vgjh) is an uncontrolled resource consumption vulnerability in the Python filelock package affecting Windows environments. When applications utilize the StrictSoftFileLock locking protocol in directories shared across multiple local accounts, a low-privileged user with read-only access can exploit Windows NTFS opportunistic locking (oplock) semantics on aged, abandoned private claim records. By holding an unacknowledged read oplock on a stale temporary file, an attacker forces subsequent lock claimants attempting to unlink the record during directory reclamation scans into an indefinite kernel-level I/O wait, bypassing configured acquisition timeout limits.
CVE-2026-145370 (GHSA-7vw6-2xxx-fch6) is a resource allocation vulnerability in the Istio control plane (istiod). Prior to versions 1.30.9, 1.31.5, and 1.32.1, the JWKS resolver routine getRemoteContentWithRetry used an unbounded io.ReadAll call to retrieve remote JWKS and OpenID discovery documents. An authenticated Kubernetes user with permissions to create or modify a RequestAuthentication custom resource can specify an endpoint that returns an arbitrarily large or infinite stream, exhausting control-plane memory and placing istiod into a persistent CrashLoopBackOff state.