Dev.to Security 🔐 Cybersecurity 👁 0 📖 4 min read

CVE-2026-144353: CVE-2026-144353: Arbitrary File Deletion via Leftover SQLite Journals in Python filelock

CVE-2026-144353: Arbitrary File Deletion via Leftover SQLite Journals in Python filelock Vulnerability ID: CVE-2026-144353 CVSS Score: 3.3 Published: 2026-12-04 CVE-2026-144353 is an arbitrary file deletion vulnerab

CVE-2026-144353: Arbitrary File Deletion via Leftover SQLite Journals in Python filelock

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

CVE-2026-144353 is an arbitrary file deletion vulnerability affecting the filelock library for Python in versions prior to 4.3.0. The defect resides in the SQLite connection setup logic within the ReadWriteLock implementation. When a directory housing an SQLite lock database transitions from shared (world- or group-writable) permissions to private permissions, pre-existing SQLite side files such as rollback journals are not automatically purged. Because the vulnerable code evaluates only the current directory permissions at the time of connection, it bypasses its protective hard-link isolation mechanism and opens the database directly by name. A local attacker who plants a crafted hot rollback journal containing a master-journal pointer before the permission change can induce SQLite to unlink arbitrary files that the locking process has permissions to read and delete.

TL;DR

Versions of Python filelock prior to 4.3.0 fail to check for pre-existing SQLite journal files when opening a ReadWriteLock database in a directory that changed from shared to private permissions. Local attackers can plant a crafted SQLite rollback journal with a master-journal pointer to force a victim process to delete arbitrary files within its privilege boundary.

⚠️ Exploit Status: POC

Technical Details

  • CVE ID: CVE-2026-144353 (GHSA-hjx8-83j4-9x3q)
  • Weakness Class: CWE-73: External Control of File Name or Path
  • Attack Vector: Local Filesystem (Shared-to-Private Directory State Transition)
  • CVSS v3.1 Score: 3.3 LOW (CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:N/I:L/A:L)
  • EPSS Score: 0.24% (16.84th Percentile)
  • Security Impact: Arbitrary file deletion within victim process privileges
  • Exploit Status: Proof-of-Concept (Unit test in official patch commit)
  • CISA KEV Status: Not Listed

Affected Systems

  • Python filelock (< 4.3.0)
  • filelock: < 4.3.0 (Fixed in: 4.3.0)

Code Analysis

Commit: 4c4010f

fix(read-write): avoid leftover side files (#976)

--- a/src/filelock/_read_write.py
+++ b/src/filelock/_read_write.py
@@ -1137,7 +1137,7 @@ def _connect(database: str, *, factory: type[_ForkSafeConnection], timeout: floa
         try:
             _raise_if_wal(fd, database)
             target = database
-            if not directory_is_private(os.fspath(pathlib.Path(database).parent)):
+            if not directory_is_private(os.fspath(pathlib.Path(database).parent)) or _side_file_exists(database):
                 link = _link_beside_on_windows(database, identity_of_fd(fd))
                 target = os.fspath(link.database)
             try:
@@ -1157,6 +1157,10 @@ def _connect(database: str, *, factory: type[_ForkSafeConnection], timeout: floa
     )


+def _side_file_exists(database: str) -> bool:
+    return any(os.path.lexists(f"{database}{suffix}") for suffix in ("-journal", "-wal", "-shm"))
+
+
 def _connect_through_descriptor(  # pragma: win32 no cover
     database: str, *, factory: type[_ForkSafeConnection], timeout: float, owner: int
 ) -> _ForkSafeConnection:
@@ -1172,13 +1176,14 @@ def _connect_through_descriptor(  # pragma: win32 no cover
         _PROBE_DESCRIPTORS.drain()
         _raise_if_wal(fd, database)
         target = database
-        # SQLite opens the name it is given, following symlinks, and uses the -journal, -wal and -shm names beside it,
-        # so the database name is safe only where no process of another account can create names. A descriptor path
-        # such as /proc/self/fd/<n> is no better: SQLite reads it back into the name the kernel reports.
+        # SQLite also acts on side files left before a directory was made private. A descriptor path such as
+        # /proc/self/fd/<n> is no better: SQLite reads it back into the name the kernel reports.
         status: Final[os.stat_result] = os.lstat(pathlib.Path(database).parent)  # pragma: needs posix-hard-link
         # The sticky bit still lets others create names, so a directory anyone else may write to never qualifies.
         writable_by_others: Final[int] = status.st_mode & (stat.S_IWGRP | stat.S_IWOTH)  # pragma: needs posix-hard-link
-        if status.st_uid not in {owner, 0} or writable_by_others:  # pragma: needs posix-hard-link
+        if (
+            status.st_uid not in {owner, 0} or writable_by_others or _side_file_exists(database)
+        ):  # pragma: needs posix-hard-link
             link = _link_beside(database, identity, owner)
             target = os.fspath(link.database)
         connection = sqlite3.connect(

Exploit Details

  • GitHub: Official regression test demonstrating crafted SQLite hot journal payload with super-journal path unlinking.

Mitigation Strategies

  • Upgrade the Python filelock library to version 4.3.0 or later across all virtual environments, containers, and deployment artifacts.
  • Provision dedicated, strictly private directories (e.g., mode 0700) from creation time for storing ReadWriteLock SQLite database files rather than repurposing shared directories.
  • Audit and remove leftover SQLite auxiliary files (-journal, -wal, -shm) whenever modifying directory permissions or ownership from shared to private.

Remediation Steps:

  1. Identify all Python environments and dependency manifests (requirements.txt, pyproject.toml, Pipfile.lock) referencing filelock versions prior to 4.3.0.
  2. Run pip install --upgrade "filelock>=4.3.0" to install the patched release.
  3. Inspect existing lock directories on multi-user hosts and remove any unexpected <database>-journal, <database>-wal, or <database>-shm files.
  4. Restart long-running Python services to ensure the updated filelock._read_write module is loaded into memory.

References

Read the full report for CVE-2026-144353 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.