CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-144381

CVE-2026-144381: Unintended Directory Permission Modification in Python filelock StrictSoftFileLock

Alon Barad
Alon Barad
Software Engineer

Dec 5, 2026·11 min read·1 visit

Executive Summary (TL;DR)

Prior to version 4.3.0, Python's filelock library narrows permissions on any existing <path>.filelock directory owned by the calling user before verifying its contents. In shared writable directories without the sticky bit, a local attacker can rename a victim's directory to the coordination path, causing StrictSoftFileLock to overwrite its permissions via fchmod and disrupt access.

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.

Vulnerability Overview

The Python filelock library provides a platform-independent file locking mechanism for inter-process synchronization. In addition to standard OS-level advisory locks (flock and fcntl), filelock provides StrictSoftFileLock, which implements a locking protocol using POSIX filesystem directory hierarchies. This class creates and manages a coordination directory at <path>.filelock containing a claims subdirectory where active lock claim records are linked.

CVE-2026-144381 (tracked as GHSA-gqj6-5294-r46r) is an incorrect permission assignment vulnerability (CWE-732) in the StrictSoftFileLock coordination initialization routine (src/filelock/_strict.py). The vulnerability affects all versions of filelock prior to 4.3.0 on Unix-like operating systems, including Linux, macOS, and BSD variants. Windows platforms are not affected because NTFS does not implement the POSIX directory mode bit adjustments performed by _settle_directory_mode.

When StrictSoftFileLock initializes its coordination directory, it enforces strict permission boundaries by applying the sticky bit (stat.S_ISVTX) and narrowing the directory mode to the configured lock permissions (such as 0o700 or 0o600). In vulnerable versions, the library verifies that the target directory's owner matches the effective UID (os.geteuid()) of the calling process and immediately applies os.fchmod() before inspecting the directory's contents.

In multi-user environments where a parent directory is group-writable or world-writable (0o775 or 0o777) without the POSIX sticky bit (+t / 0o1000), an unprivileged local user can rename an existing, unrelated directory owned by a victim user so that its name matches <path>.filelock. When the victim user runs software that acquires StrictSoftFileLock on <path>, the library modifies the permissions of the unrelated directory and creates a claims subdirectory inside it. This alters the directory's discretionary access control (DAC) bits and disrupts legitimate access for other users or services.

Root Cause Analysis

The root cause of CVE-2026-144381 lies in the execution ordering within _ensure_protocol_directory and _settle_directory_mode inside src/filelock/_strict.py. To defend against symlink tampering and unauthorized access, StrictSoftFileLock opens directory file descriptors using O_NOFOLLOW and dir_fd, verifies that the directory belongs to the calling user's effective UID or the parent directory's owner, and then normalizes the directory permissions.

Prior to version 4.3.0, _ensure_protocol_directory invoked _settle_directory_mode immediately after verifying UID ownership. Inside _settle_directory_mode, the code computed the target mode using the formula found.st_mode & 0o7000 | found.st_mode & mode & 0o777 | stat.S_ISVTX. If found.st_uid == os.geteuid() evaluated to true and the current mode differed from the computed mode, the function called os.fchmod(fd, settled) without checking whether the directory was actually an empty or valid filelock coordination directory.

Under POSIX filesystem semantics, the ability to rename an existing directory depends on the permissions of the parent directory rather than the permissions of the directory being renamed. If a parent directory has write permissions enabled for a group or all users and does not have the sticky bit (S_ISVTX) set, any user with write access to the parent directory can rename directories owned by other users within that same parent directory.

Because _settle_directory_mode relied solely on found.st_uid == os.geteuid() as proof that the directory at <path>.filelock was a legitimate coordination artifact created by the current user, it failed to account for directory substitution via rename(2). An existing directory owned by the victim satisfies the UID check, causing StrictSoftFileLock to treat arbitrary user directories as its own internal lock state.

Code Analysis

In versions prior to 4.3.0, the vulnerable implementation in src/filelock/_strict.py separated directory mode settling from directory content inspection, performing the os.fchmod system call before validating entries.

# Vulnerable implementation prior to 4.3.0 (src/filelock/_strict.py)
def _ensure_protocol_directory(lock_file: str, directory: Path, mode: int, parent_fd: int | None) -> None:
    ...
    if owner is not None:
        reason = f"{directory} belongs to uid {owner}, not to this process's account or the parent's owner"
        raise SoftFileLockProtocolError(lock_file, None, reason) from None
    # VULNERABILITY: Mode is modified immediately upon UID match without verifying directory contents
    _settle_directory_mode(lock_file, directory, mode, parent_fd)
 
 
def _settle_directory_mode(lock_file: str, directory: Path, mode: int, parent_fd: int | None) -> None:
    try:
        fd = _open_directory(os.fspath(directory), dir_fd=parent_fd)
    except OSError as error:
        raise SoftFileLockProtocolError(lock_file, None, f"cannot open {directory}") from error
    try:
        found = os.fstat(fd)
        settled = found.st_mode & 0o7000 | found.st_mode & mode & 0o777 | stat.S_ISVTX
        if found.st_uid == os.geteuid() and settled != stat.S_IMODE(found.st_mode):
            os.fchmod(fd, settled)
    except OSError as error:
        raise SoftFileLockProtocolError(lock_file, None, f"cannot set the mode of {directory}") from error
    finally:
        os.close(fd)

Commit f028e2bea5e8c45c47b30a9c33ec38b015d5da22 (Pull Request #978) resolves this issue by introducing strict content validation functions that execute on the opened directory file descriptor prior to calling os.fchmod.

# Patched implementation in 4.3.0 (src/filelock/_strict.py)
def _settle_directory_mode(
    lock_file: str,
    directory: Path,
    mode: int,
    parent_fd: int | None,
    *,
    verify_contents: Callable[[str, Path, int], None] | None = None,
) -> None:
    try:
        fd = _open_directory(os.fspath(directory), dir_fd=parent_fd)
    except OSError as error:
        raise SoftFileLockProtocolError(lock_file, None, f"cannot open {directory}") from error
    try:
        # FIX: Verify that all entries inside the directory conform to the lock protocol
        if verify_contents is not None:
            verify_contents(lock_file, directory, fd)
        # Only modify permissions after content verification succeeds
        _settle_opened_directory_mode(lock_file, directory, mode, fd)
    finally:
        os.close(fd)
 
 
def _refuse_unrelated_coordination_entries(lock_file: str, directory: Path, fd: int) -> None:
    try:
        with _scandir_relative((os.fspath(directory), fd)) as entries:
            claim_entry = next(entries, None)
            unrelated = claim_entry is not None and (
                claim_entry.name != _CLAIM_DIRECTORY_NAME
                or not claim_entry.is_dir(follow_symlinks=False)
                or next(entries, None) is not None
            )
    except OSError as error:
        raise SoftFileLockProtocolError(lock_file, None, f"cannot list {directory}") from error
    if unrelated:
        raise SoftFileLockProtocolError(lock_file, None, f"{directory} holds entries that are not this lock's")
    if claim_entry is None:
        return
    try:
        claims_fd = _open_directory(
            claim_entry.name if _OPEN_SUPPORTS_DIR_FD else claim_entry.path,
            dir_fd=fd if _OPEN_SUPPORTS_DIR_FD else None,
        )
    except OSError as error:
        raise SoftFileLockProtocolError(
            lock_file, claim_entry.name, f"cannot open {directory / claim_entry.name}"
        ) from error
    try:
        _refuse_unrelated_claim_entries(lock_file, directory / claim_entry.name, claims_fd)
    finally:
        os.close(claims_fd)

The patch introduces two verification routines: _refuse_unrelated_coordination_entries and _refuse_unrelated_claim_entries. When _ensure_protocol_directory runs on a coordination directory, it passes _refuse_unrelated_coordination_entries as the verify_contents callback. This function iterates over the directory contents using an already-opened file descriptor (fd) and verifies that the directory is either completely empty or contains only a single subdirectory named claims (_CLAIM_DIRECTORY_NAME) with no symlinks or extra entries.

If a claims subdirectory is present, the function opens it relative to fd and invokes _refuse_unrelated_claim_entries. That secondary check verifies that every entry inside claims is a regular file matching the valid claim naming format (_parse_claim_name), a claim probe (_is_claim_probe_name), or an NFS silly-rename artifact (.nfs*).

Regarding fix completeness, operating directly on the opened file descriptor fd via _scandir_relative and dir_fd prevents time-of-check to time-of-use (TOCTOU) path substitution between the content check and the os.fchmod(fd, settled) call in _settle_opened_directory_mode. Note that an completely empty directory owned by the victim can still pass _refuse_unrelated_coordination_entries if renamed to <path>.filelock, as an empty directory is indistinguishable from a freshly created coordination directory prior to claims creation. However, any populated directory containing user files or subdirectories immediately triggers SoftFileLockProtocolError before permissions are altered.

Exploitation

Exploitation requires local access to a Unix-like system where a victim process acquires a StrictSoftFileLock inside a directory that is writable by the attacker and lacks the sticky bit (+t). In addition, a directory owned by the victim user must reside within the same writable parent directory (or on the same mounted filesystem if the victim directory's parent is also writable by the attacker without the sticky bit, permitting a cross-directory rename(2) syscall).

  1. Identify a shared directory (such as /shared/workgroup/) with permissions 0o775 or 0o777 (no sticky bit) where a victim user or service regularly executes StrictSoftFileLock("/shared/workgroup/job.lock", mode=0o600).
  2. Locate an existing directory owned by the victim user (e.g., /shared/workgroup/web_assets/ with mode 0o755) that contains files accessed by other users or services.
  3. Execute mv /shared/workgroup/web_assets /shared/workgroup/job.lock.filelock prior to the victim process acquiring the lock.
  4. Wait for the victim process to invoke StrictSoftFileLock.acquire(). The victim process verifies that job.lock.filelock belongs to its UID, executes os.fchmod() to change its permissions from 0o755 to 0o1600 (or 0o1700), and creates /shared/workgroup/job.lock.filelock/claims.

The following proof-of-concept script, derived from the regression test suite in tests/test_strict_soft_failures.py, demonstrates how filelock behaves before and after the patch when an unrelated directory is moved into the coordination path:

import os
import stat
from pathlib import Path
from filelock import StrictSoftFileLock, SoftFileLockProtocolError
 
# Setup shared parent directory (simulating group-writable directory without sticky bit)
tmp_dir = Path("/tmp/shared_workgroup")
tmp_dir.mkdir(parents=True, exist_ok=True)
 
lock_path = tmp_dir / "service.lock"
coordination_dir = Path(f"{lock_path}.filelock")
 
# Victim account owns an unrelated directory with 0o755 permissions
site_dir = tmp_dir / "my_web_site"
site_dir.mkdir(exist_ok=True)
(site_dir / "index.html").write_text("Hello World", encoding="utf-8")
site_dir.chmod(0o755)
 
# Local attacker renames the victim's directory to the protocol coordination path
site_dir.rename(coordination_dir)
 
# Victim process attempts to acquire StrictSoftFileLock with restrictive mode 0o600
try:
    lock = StrictSoftFileLock(lock_path, mode=0o600, timeout=0)
    lock.acquire()
except SoftFileLockProtocolError as exc:
    # On filelock >= 4.3.0, SoftFileLockProtocolError is raised before fchmod
    print(f"Refused compromised directory: {exc}")
 
# On filelock < 4.3.0, current_mode would be modified and 'claims' created.
# On filelock >= 4.3.0, permissions remain 0o755 and 'claims' is not created.
current_mode = stat.S_IMODE(coordination_dir.stat().st_mode)
assert current_mode == 0o755
assert (coordination_dir / "index.html").exists()
assert not (coordination_dir / "claims").exists()

Impact Assessment

The security impact of CVE-2026-144381 is confined to local integrity and availability within the victim user's security scope. The vulnerability carries a CVSS v3.1 base score of 3.6 (Low) with the vector CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L.

  • Confidentiality (C:N): The flaw only narrows permissions (found.st_mode & mode & 0o777) and adds the sticky bit (stat.S_ISVTX). Because the bitwise AND operation (found.st_mode & mode) can only clear permission bits and never set additional read, write, or execute bits that were not already present on the directory, an attacker cannot use this flaw to expand access permissions or read restricted files.
  • Integrity (I:L): An attacker can force the victim process to modify the POSIX mode bits of an arbitrary directory owned by the victim and pollute its directory structure by creating a claims subdirectory and lock claim files inside it.
  • Availability (A:L): Two distinct denial-of-service conditions occur. First, renaming the victim's directory and stripping group/world read and traverse (r-x) permissions prevents legitimate processes (such as web servers or group collaborators) from accessing the files inside the directory. Second, even on patched versions (>= 4.3.0), renaming an unrelated directory into <path>.filelock causes StrictSoftFileLock to abort with SoftFileLockProtocolError, halting the application requesting the lock (which is the intended fail-safe behavior in compromised shared directories).

The EPSS score for CVE-2026-144381 is 0.0024 (16.10th percentile), and it is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The high attack complexity (AC:H) reflects the requirement for a misconfigured shared directory lacking the POSIX sticky bit (+t) alongside local attacker access.

Remediation

To remediate CVE-2026-144381, upgrade the filelock package to version 4.3.0 or later. Version 4.3.0 validates that both the <path>.filelock coordination directory and the <path>.filelock/claims directory contain only valid lock protocol entries before executing os.fchmod().

# Upgrade using pip
pip install --upgrade "filelock>=4.3.0"
 
# Upgrade using uv
uv add "filelock>=4.3.0"
 
# Upgrade using Poetry
poetry add "filelock>=4.3.0"

> [!NOTE] > Upgrading to filelock>=4.3.0 prevents unintended fchmod calls and directory pollution by raising SoftFileLockProtocolError when foreign files are detected. However, to prevent local users from renaming directories in the first place, administrators must also apply filesystem-level permission hardening.

In environments where immediate package upgrades are not feasible, or as a defense-in-depth measure against local denial of service:

  1. Enable the Sticky Bit on Shared Directories: Ensure that any shared or group-writable directory used for storing lock files has the POSIX sticky bit (+t / 0o1000) enabled. When the sticky bit is active on a directory, the OS kernel restricts rename(2) and unlink(2) operations so that only the owner of the target file/directory, the owner of the parent directory, or root can rename or delete entries.
    chmod +t /path/to/shared_directory
    # Or explicitly set 1775 / 1777
    chmod 1775 /path/to/shared_directory
  2. Isolate Lock Directories: Configure applications using StrictSoftFileLock to place lock files inside dedicated directories owned exclusively by the service account (0o700 or 0o750) rather than inside shared collaborative trees or unhardened temporary directories.

Official Patches

tox-devGitHub Security Advisory GHSA-gqj6-5294-r46r
tox-devPull Request #978 implementing directory entry verification before mode adjustment
tox-devfilelock 4.3.0 Release

Fix Analysis (1)

Technical Appendix

CVSS Score
3.6/ 10
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L
EPSS Probability
0.24%
Top 84% most exploited

Affected Systems

Python filelock (< 4.3.0) on Unix-like platforms (Linux, macOS, BSD)

Affected Versions Detail

Product
Affected Versions
Fixed Version
filelock
tox-dev
< 4.3.04.3.0
AttributeDetail
CVE IDCVE-2026-144381 (GHSA-gqj6-5294-r46r)
Affected Componentfilelock (StrictSoftFileLock in src/filelock/_strict.py)
Vulnerability ClassCWE-732: Incorrect Permission Assignment for Critical Resource
Attack VectorLocal (Shared writable parent directory lacking sticky bit)
CVSS v3.1 Score3.6 Low (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L)
EPSS Score0.24% (16.10th Percentile)
ImpactUnintended directory chmod and structure modification leading to local DoS
Patched Versionfilelock >= 4.3.0

MITRE ATT&CK Mapping

T1222.002File and Directory Permissions Modification: Linux and Mac File and Directory Permissions Modification
Defense Evasion
CWE-732
Incorrect Permission Assignment for Critical Resource

The product specifies permissions for a security-critical resource in a way that exposes that resource to unintended actors or alters legitimate resource permissions unintentionally.

Vulnerability Timeline

Fix committed (f028e2bea5e8c45c47b30a9c33ec38b015d5da22) and Pull Request #978 merged
2026-11-20
GitHub Security Advisory GHSA-gqj6-5294-r46r and CVE-2026-144381 published
2026-12-03
NVD entry updated with CVSS v3.1 scoring and CWE-732 classification
2026-12-04

References & Sources

  • [1]NVD - CVE-2026-144381
  • [2]CVE.org Record - CVE-2026-144381
  • [3]GitHub Security Advisory GHSA-gqj6-5294-r46r
  • [4]GitHub Pull Request #978
  • [5]Fix Commit f028e2bea5e8c45c47b30a9c33ec38b015d5da22
  • [6]filelock 4.3.0 Release Tag
  • [7]CVE List v5 JSON Record

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-144382
3.6

CVE-2026-144382: Unverified Ownership and Lock Bypass via Linux Overflow UID in Python filelock

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.

Alon Barad
Alon Barad
4 views•12 min read
•about 2 hours ago•CVE-2026-144341
2.5

CVE-2026-144341: Windows Oplock Asynchronous Cancellation Delay in Python filelock

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.

Amit Schendel
Amit Schendel
2 views•10 min read
•about 3 hours ago•CVE-2026-144334
4.7

CVE-2026-144334: Local Denial of Service via Drive-Relative Path Interception in Python filelock on Windows

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.

Alon Barad
Alon Barad
4 views•11 min read
•about 4 hours ago•CVE-2026-144338
3.3

CVE-2026-144338: Unbounded Directory Enumeration Denial of Service in Python filelock ReadWriteLock

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.

Amit Schendel
Amit Schendel
3 views•10 min read
•about 5 hours ago•CVE-2026-144342
2.5

CVE-2026-144342: Windows Opportunistic Lock Denial of Service in Python filelock StrictSoftFileLock

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.

Alon Barad
Alon Barad
3 views•10 min read
•about 6 hours ago•CVE-2026-145370
7.7

CVE-2026-145370: Control-Plane Denial of Service via Unbounded JWKS Fetch in Istio

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.

Alon Barad
Alon Barad
4 views•9 min read