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-144353

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

Amit Schendel
Amit Schendel
Senior Security Researcher

Dec 5, 2026·11 min read·2 visits

Executive Summary (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.

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.

Vulnerability Overview

The filelock package provides a platform-independent file-locking mechanism for Python applications. In versions 4.0.0 and later, filelock includes a ReadWriteLock class that coordinates concurrent reader and writer locks across multiple processes using an underlying SQLite database. Because SQLite automatically manages transaction state using auxiliary side files adjacent to the main database file—specifically <database>-journal, <database>-wal, and <database>-shm—operating on a database located in a shared directory exposes the locking process to path-based attacks.

To prevent local users from hijacking database operations via crafted side files or symbolic links in shared directories (such as /tmp), filelock implements a two-tier connection strategy in src/filelock/_read_write.py. If the parent directory is determined to be private to the calling user, filelock connects directly to the database path. If the directory is writable by other accounts, filelock creates an isolated, private subdirectory and establishes a hard link to the database file inside it, opening the database via the hard link so that SQLite looks for side files only inside the protected subdirectory.

In versions of filelock prior to 4.3.0, the safety verification logic checks whether the parent directory is private at the exact moment of connection, but fails to verify whether SQLite side files already exist alongside the database file. If a directory initially permits write access by untrusted local users and is subsequently restricted via chmod or ACL modification to become private, any side files planted while the directory was shared remain on disk.

Tracked as CVE-2026-144353 (and GitHub Security Advisory GHSA-hjx8-83j4-9x3q) and classified under CWE-73 (External Control of File Name or Path), this flaw allows a local attacker to achieve arbitrary file deletion. By placing a malformed SQLite rollback journal containing a super-journal (master journal) reference in the shared directory prior to the permission transition, the attacker causes the victim process's SQLite engine to automatically unlink the referenced target file upon journal rollback recovery.

Root Cause Analysis

The root cause of CVE-2026-144353 is an incomplete state validation check during the SQLite database connection bootstrap in _connect (for Windows) and _connect_through_descriptor (for POSIX) within src/filelock/_read_write.py. The security model of ReadWriteLock assumes that if a directory's current permissions forbid writes by other non-root users, no untrusted files can exist adjacent to the target database file. This assumption fails under temporal permission transitions, as changing directory permissions (e.g., from 0o777 to 0o755 or 0o700) does not remove files created when permissions were permissive.

When sqlite3.connect() opens a database file directly by name, the SQLite pager subsystem immediately checks the filesystem for the presence of a rollback journal (<database>-journal) or Write-Ahead Log (<database>-wal). If a rollback journal is present without an active lock, SQLite treats it as a "hot journal" resulting from an interrupted transaction and initiates an automatic rollback recovery procedure before allowing any SQL queries to execute.

SQLite supports atomic commits across multiple attached databases using a master journal (referred to internally as a super-journal). At the end of a standard rollback journal, SQLite permits a trailer structure containing a file path string pointing to the master journal, followed by a 4-byte length integer, a 4-byte checksum integer, and an 8-byte magic byte sequence (0xd9d505f920a163d7).

During hot journal recovery, SQLite reads the trailer, validates the checksum of the master journal path string, and checks whether the referenced master journal file exists and contains references to other active journals. If the referenced file does not prevent rollback completion, SQLite concludes the multi-database transaction recovery by invoking an OS-level unlink() on the master journal file path. Consequently, because filelock connected directly to the database path instead of routing through a clean hard-link subdirectory, SQLite processes the attacker's leftover journal and deletes the arbitrary file path embedded in the trailer.

Code Analysis

In filelock versions prior to 4.3.0, the connection handlers in src/filelock/_read_write.py evaluate directory privacy using directory_is_private() on Windows and os.lstat() mode bitmasks on POSIX systems. On POSIX platforms, _connect_through_descriptor inspects the parent directory's st_uid and checks the group and world write bits (stat.S_IWGRP | stat.S_IWOTH). If the directory is owned by the calling user (or root, UID 0) and is not writable by group or others, the code bypasses _link_beside() and passes the raw database path directly to sqlite3.connect().

Commit 4c4010fc87a432a903c2ea8a2766d9b6f4a66000 (merged via PR #976) resolves this vulnerability by introducing a new helper function, _side_file_exists(), and incorporating it into the conditional branching logic for both Windows and POSIX platforms.

--- 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
     )
 
 
+# Checks for any pre-existing SQLite auxiliary files, including broken symlinks via lexists
+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(

The implementation of _side_file_exists() uses os.path.lexists() rather than os.path.exists(). This distinction is critical because os.path.lexists() returns True even if the side file is a broken symbolic link pointing to a non-existent destination. If any -journal, -wal, or -shm artifact is detected alongside the primary database path, filelock refuses to open the database directly and instead triggers _link_beside() (or _link_beside_on_windows()), creating a fresh hard link inside an isolated temporary directory.

Regarding fix completeness, evaluating _side_file_exists() after verifying that the parent directory is private is free from Time-of-Check to Time-of-Use (TOCTOU) race conditions. If the directory is already private, external non-privileged users cannot create a new side file after _side_file_exists() returns False. Conversely, if the directory is not private, the short-circuit OR condition immediately forces the isolated hard-link route regardless of whether side files currently exist.

Exploitation

Exploiting CVE-2026-144353 requires local filesystem access and a specific directory lifecycle where a directory hosting a ReadWriteLock database is initially writable by a low-privileged user account and later restricted to a target victim account. Once the attacker has write access during the initial window, they must construct a valid SQLite hot journal trailer containing the absolute filesystem path of the target file they wish to delete.

To construct the payload, the attacker encodes the target file path as bytes and appends a 16-byte binary footer formatted in big-endian byte order (>II). The first 4-byte unsigned integer specifies the byte length of the target path string, and the second 4-byte unsigned integer contains the additive checksum (the sum of all byte values in the path string). This is followed by the 8-byte SQLite journal magic sequence 0xd9d505f920a163d7.

The unit test committed alongside the fix in tests/test_read_write.py demonstrates the exact payload generation and exploitation sequence:

def _hot_journal(super_journal: Path) -> bytes:
    name = bytes(super_journal)
    # Pack path length, byte-sum checksum, and SQLite SECTOR_MAGIC
    return name + struct.pack(">II", len(name), sum(name)) + bytes.fromhex("d9d505f920a163d7")
 
@pytest.mark.requires_hard_links
def test_closed_directory_ignores_a_journal_left_beside_the_database(
    shared_database: Path, tmp_path: Path
) -> None:
    # Target file owned by the locking account that the attacker wants deleted
    named = tmp_path / "notes.txt"
    named.write_text("keep")
    
    # Initialize the SQLite database while directory is shared
    with closing(sqlite3.connect(shared_database)) as connection:
        connection.execute("CREATE TABLE application (value)")
        
    # Attacker drops the crafted hot journal beside the database
    Path(f"{shared_database}-journal").write_bytes(_hot_journal(named))
    
    # Directory permissions transition from shared to private (0o755)
    shared_database.parent.chmod(0o755)
 
    # Victim acquires ReadWriteLock; in < 4.3.0, this unlinks 'notes.txt'
    with ReadWriteLock(shared_database, is_singleton=False).read_lock():
        pass
 
    assert named.read_text() == "keep"

> [!NOTE] > For SQLite to process the master-journal pointer and execute the unlink() call on the target file, the victim process running ReadWriteLock must possess both read and unlink permissions on the target file path (named in the example above), and the underlying SQLite database must already contain an initialized schema header.

Impact Assessment

The primary security impact of CVE-2026-144353 is unauthorized local file deletion operating under the privileges of the victim process invoking ReadWriteLock. An unprivileged local attacker cannot directly read or modify the contents of protected files through this mechanism, nor can they inject arbitrary SQL commands into the database without causing journal checksum validation failures. However, deleting sensitive files owned by another user or service account can cause localized denial of service (by removing application state, lock files, or configuration data) or subvert security controls that rely on the presence of specific marker or restriction files.

The vulnerability is rated Low severity with a CVSS v3.1 base score of 3.3 (CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:N/I:L/A:L). The Attack Vector is Local (AV:L) and Privileges Required is Low (PR:L), reflecting the need for an existing local foothold capable of writing to the target directory. Attack Complexity is rated High (AC:H) and User Interaction is Required (UI:R) because successful exploitation depends on an external administrative or application workflow that transitions a shared directory to private permissions without purging its contents, followed by a privileged user executing a lock acquisition.

Because no data is disclosed, Confidentiality Impact is None (C:N). Integrity Impact and Availability Impact are both rated Low (I:L/A:L), as the attacker's capabilities are strictly limited to unlinking files that the victim account is permitted to read and remove.

Threat intelligence metrics confirm a low likelihood of widespread exploitation in the wild. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog, has no associated public exploit modules outside of the vendor regression test suite, and holds an EPSS score of 0.00245 (16.84th percentile).

Remediation

To remediate CVE-2026-144353, upgrade the filelock package to version 4.3.0 or later. Version 4.3.0 enforces hard-link subdirectory isolation whenever any -journal, -wal, or -shm file is present adjacent to the target database file, regardless of whether the parent directory permissions are private.

pip install --upgrade "filelock>=4.3.0"

In environments where an immediate dependency upgrade is not feasible, operators and developers should apply operational workarounds when managing directories that store ReadWriteLock database files:

  1. Purge Side Files on Permission Changes: Whenever a directory's permissions or ownership are tightened from shared to private, explicitly inspect the directory and delete any existing <database>-journal, <database>-wal, and <database>-shm artifacts (including symbolic links) before starting any processes that invoke filelock.
  2. Pre-Isolate Lock Directories: Configure applications to place ReadWriteLock databases inside dedicated directories initialized with restrictive permissions (0o700) at creation time, rather than converting previously world-writable or group-writable directories in place.

> [!WARNING] > Simply changing directory permissions via chmod 0700 or chmod 0755 on an existing shared directory is insufficient to neutralize this vulnerability in filelock versions prior to 4.3.0; existing journal files must be actively unlinked prior to database connection.

Official Patches

tox-dev (GitHub Security Advisory)Official GitHub Security Advisory GHSA-hjx8-83j4-9x3q for CVE-2026-144353
tox-dev (Pull Request)Pull Request #976 implementing _side_file_exists check
tox-dev (Release)filelock 4.3.0 release containing the security fix

Fix Analysis (1)

Technical Appendix

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

Affected Systems

Python filelock (< 4.3.0)

Affected Versions Detail

Product
Affected Versions
Fixed Version
filelock
tox-dev
< 4.3.04.3.0
AttributeDetail
CVE IDCVE-2026-144353 (GHSA-hjx8-83j4-9x3q)
Weakness ClassCWE-73: External Control of File Name or Path
Attack VectorLocal Filesystem (Shared-to-Private Directory State Transition)
CVSS v3.1 Score3.3 LOW (CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:N/I:L/A:L)
EPSS Score0.24% (16.84th Percentile)
Security ImpactArbitrary file deletion within victim process privileges
Exploit StatusProof-of-Concept (Unit test in official patch commit)
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1070.004Indicator Removal: File Deletion
Defense Evasion
T1565.001Data Manipulation: Stored Data Manipulation
Impact
T1059.006Command and Scripting Interpreter: Python
Execution
CWE-73
External Control of File Name or Path

The software allows user input to control or influence paths or file names that are used in filesystem operations, enabling an attacker to access, modify, or delete unauthorized files.

Known Exploits & Detection

GitHubOfficial regression test demonstrating crafted SQLite hot journal payload with super-journal path unlinking.

Vulnerability Timeline

Fix committed via PR #976 (commit 4c4010fc87a432a903c2ea8a2766d9b6f4a66000) and released in filelock 4.3.0
2026-11-20
GitHub Security Advisory GHSA-hjx8-83j4-9x3q and CVE-2026-144353 published
2026-12-03
NVD analysis and CVSS v3.1 scoring completed
2026-12-04

References & Sources

  • [1]GitHub Security Advisory GHSA-hjx8-83j4-9x3q
  • [2]GitHub Pull Request #976: fix(read-write): avoid leftover side files
  • [3]Fix Commit 4c4010fc87a432a903c2ea8a2766d9b6f4a66000
  • [4]filelock 4.3.0 Release Tag
  • [5]National Vulnerability Database (NVD) - CVE-2026-144353
  • [6]CVE.org Record - CVE-2026-144353
  • [7]CVEProject cvelistV5 Entry for CVE-2026-144353

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

•3 minutes ago•CVE-2026-144386
2.5

CVE-2026-144386: TOCTOU Race Condition and Inode Reuse in Python filelock SoftReadWriteLock

CVE-2026-144386 is a Time-of-Check to Time-of-Use (TOCTOU) race condition and inode reuse vulnerability in the Python filelock library prior to version 4.3.0. In multi-user environments sharing a directory on filesystems that recycle inode numbers (such as ext4), the SoftReadWriteLock heartbeat mechanism can be manipulated into overwriting the leading bytes of an unrelated victim-owned file with lock holder metadata.

Alon Barad
Alon Barad
0 views•11 min read
•about 2 hours ago•CVE-2026-144381
3.6

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

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.

Alon Barad
Alon Barad
4 views•11 min read
•about 3 hours 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
6 views•12 min read
•about 4 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
4 views•10 min read
•about 5 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
6 views•11 min read
•about 6 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
4 views•10 min read