GitHub Advisoryadvisory · PyPI
GHSA-crv4-6mhj-j5jh filelock: SoftFileLock stale-break restore follows a swapped-in symbolic link and hard-links a file of the user running the lock into the lock directory
MEDIUM
Official page ↗
- Aliases
- CVE-2026-112914
- Ecosystem
- PyPI
- Packages
- filelock
- Severity
- Moderate
- CVSS vector
- CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:N
- Weaknesses
- CWE-363, CWE-59
- Reviewed
- 2026-10-23
Affected packages
• PyPI filelock: >= 4.1.0, < 4.2.1 → fixed in 4.2.1
Description
When a soft-lock stale break finds that the marker (the lock file at ``) it renamed aside was a live one recreated by a successor, the restore branch of `break_lock_file()` checks the break name with `lstat` (a check that reads a name without following a symbolic link) and then calls `os.link(break_path, lock_file)` by name. On CPython 3.12 and later on Linux (and on macOS) that call follows a symbolic link (a file that redirects to another path). A local user (the other user below) who can write a shared lock directory without the sticky bit (a directory flag that lets only a file's owner rename or remove it) replaces the break name with a symbolic link between those two calls.
The `SoftFileLock`, `MarkerSoftFileLock`, `SoftFileLease` or `lifetime` break of the user running the lock (the lock user below) then creates a hard link (a second name for the same file), in that directory, to any of the lock user's own files on the same filesystem. That includes files inside directories the other user cannot enter and links that `fs.protected_hardlinks` (a Linux setting that forbids hard links to files one does not own) refuses the other user when it asks itself. The link exposes the file's size, times, mode and owner, keeps the inode (the kernel's identity for a file, independent of its name) alive, and gives the other user a name it can move. On 4.2.0 a later `FileLock` of the lock user on that name truncated the file. Affected versions: filelock >= 4.1.0 and .`. In a directory without the sticky bit the lock user may rename a file it does not own.
2. The other user still owns that file and gives it a newer mtime (modification time) after the `lstat` on line 113. Line 117 then takes it for a recreated marker, and line 119 sees a regular file.
3. The other user r…
Related
Alias · CVE (1)
- CVE-2026-112914 filelock is a platform-independent file lock for Python. vulnerability
References
- https://github.com/tox-dev/filelock/security/advisories/GHSA-crv4-6mhj-j5jh web
- https://nvd.nist.gov/vuln/detail/CVE-2026-112914 advisory
- https://github.com/tox-dev/filelock/pull/843 web
- https://github.com/tox-dev/filelock/commit/740ff666b62a88496c8d7394e4e6230605e4d62b web
- https://github.com/tox-dev/filelock package
- https://github.com/tox-dev/filelock/releases/tag/4.2.1 web