Dev.to Security 🔐 Cybersecurity 👁 2 📖 3 min read

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

CVE-2026-144338: Unbounded Directory Enumeration Denial of Service in Python filelock ReadWriteLock Vulnerability ID: CVE-2026-144338 CVSS Score: 3.3 Published: 2026-12-04 CVE-2026-144338 is a local denial-of-servic

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

Vulnerability ID: CVE-2026-144338
CVSS Score: 3.3
Published: 2026-12-04

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.

TL;DR

Unbounded synchronous directory enumeration in Python filelock (< 4.3.0) allows local unprivileged users to cause thread blocking and asyncio event-loop starvation by creating excessive .filelock-* directories inside shared parent paths.

⚠️ Exploit Status: POC

Technical Details

  • CVE ID: CVE-2026-144338 (GHSA-5qxg-3g64-7g62)
  • Weakness Class: CWE-770: Allocation of Resources Without Limits or Throttling
  • Attack Vector: Local Filesystem (Shared POSIX Directories)
  • CVSS v3.1 Score: 3.3 Low (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L)
  • EPSS Score: 0.28% (21.51st Percentile)
  • Impact: Local Denial of Service (Thread Blocking & Asyncio Event-Loop Starvation)
  • Exploit Status: Proof-of-Concept in Repository Test Suite
  • Patched Version: filelock 4.3.0

Affected Systems

  • Python filelock (< 4.3.0) on POSIX platforms using ReadWriteLock or AsyncReadWriteLock in shared parent directories
  • filelock: < 4.3.0 (Fixed in: 4.3.0)

Code Analysis

Commit: d7324f5

Replace unbounded _sweep_links_of_the_dead with _LinkSweeps class enforcing 50ms time budget, 60s retry backoff, non-blocking lock gate, and bounded generator cache.

-def _sweep_links_of_the_dead(parent: pathlib.Path, identity: _DatabaseIdentity, owner: int):
-    if identity in _SWEPT_DATABASES:
-        return
-    _SWEPT_DATABASES.add(identity)
-    try:
-        with os.scandir(parent) as entries:
-            names = [
-                entry.name
-                for entry in entries
-                if entry.name.startswith(_LINK_PREFIX) and entry.is_dir(follow_symlinks=False)
-            ]
-    except OSError:
-        return
-    for name in names:
-        with suppress(OSError):
-            _remove_dead_links(parent / name, identity, owner)
+
+_MAX_REMEMBERED_SWEEPS: Final[int] = 1024
+_MAX_PENDING_SWEEPS: Final[int] = 16
+_SweepKey: TypeAlias = tuple[pathlib.Path, int, int, _DatabaseIdentity, int]
+
+class _LinkSweeps:
+    def __init__(self) -> None:
+        self._gate = threading.Lock()
+        self._retry_at: collections.OrderedDict[_SweepKey, float] = collections.OrderedDict()
+        self._pending: collections.OrderedDict[_SweepKey, Generator[None]] = collections.OrderedDict()
+
+    def sweep(self, parent: pathlib.Path, identity: _DatabaseIdentity, owner: int) -> None:
+        if not self._gate.acquire(blocking=False):
+            return
+        try:
+            with suppress(OSError):
+                directory = parent.stat()
+                self._advance((parent, directory.st_dev, directory.st_ino, identity, owner))
+        finally:
+            self._gate.release()

Exploit Details

  • GitHub: Unit and regression test cases in tests/test_read_write_private_link.py demonstrating directory flooding and bounded sweep behavior.

Mitigation Strategies

  • Upgrade the Python filelock library to version 4.3.0 or newer to enforce bounded 50ms directory sweep time slices and 60-second cooldown periods.
  • Store ReadWriteLock and AsyncReadWriteLock files inside dedicated, non-shared directories owned by the service account with 0700 permissions to bypass private hard-link directory sweeps.
  • Apply filesystem inode limits (quotas) on multi-tenant hosts to prevent unprivileged local users from creating tens of thousands of dummy directories in shared paths.

Remediation Steps:

  1. Identify all Python environments and container images utilizing filelock versions prior to 4.3.0 via pip list or software bill of materials (SBOM) scanners.
  2. Update project dependency specifications (requirements.txt, pyproject.toml, or Poetry/Pipenv lockfiles) to require filelock>=4.3.0.
  3. Audit application lock file paths to ensure lock databases are placed in private application state directories (such as /run//) rather than /tmp whenever possible.

References

Read the full report for CVE-2026-144338 on our website for more details including interactive diagrams and full exploit analysis.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.