Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. filelock
  4. ›
  5. CVE-2026-112912

CVE-2026-112912: filelock: Symlink swap during SoftFileLock's writability check leaks whether a path exists and is writable by the lock taker

October 28, 2026

raise_on_not_writable_file() is the check that SoftFileLock and the locks sharing its acquire path run before every attempt. It looks at the lock path with os.lstat, so that it judges a planted symlink (a file that points at another path) by itself. When the node has no owner-write bit, it then calls os.access(filename, os.W_OK), which follows symlinks. A local user who can create entries in the lock’s directory can swap the path between a mode-0466 file and a symlink to a path of their choosing. The second call then reports on the symlink’s target with the permissions of the user running the lock (below: the lock user). The lock user’s acquire() ends in PermissionError within a fraction of a second when the target is missing or not writable by the lock user, and in the ordinary Timeout otherwise.

That yields one bit per watched acquire. The bit says whether a path exists and is writable by the lock taker. It covers paths under directories the other user cannot search, or any path when root takes the lock. The lock does not open, create or modify anything through the symlink. On Linux, fs.protected_symlinks (a kernel setting that refuses to follow another user’s symlink in a sticky world-writable directory) blocks it in a directory such as /tmp. It does not block it in a 0777 directory without the sticky bit (a directory flag that lets only a file’s owner remove or rename it) or in a sticky group-writable one. This reopens the leak PR #567 closed. Affected versions are filelock 3.32.6 through 4.2.0.

Anthropic’s OSS Scanner reported this in private. Finding covered by this advisory:

  • ANT-2026-RQ91AXTW [medium, CWE-59]: Symlink TOCTOU in raise_on_not_writable_file leaks file existence.

References

  • github.com/advisories/GHSA-9j6q-wvj5-jgjg
  • github.com/tox-dev/filelock/commit/e1e825b1992f69fb6b346dc395d5ae4893536c0a
  • github.com/tox-dev/filelock/pull/835
  • github.com/tox-dev/filelock/releases/tag/4.2.1
  • github.com/tox-dev/filelock/security/advisories/GHSA-9j6q-wvj5-jgjg
  • nvd.nist.gov/vuln/detail/CVE-2026-112912

Code Behaviors & Features

Detect and mitigate CVE-2026-112912 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions starting from 3.32.6 before 4.2.1

Fixed versions

  • 4.2.1

Solution

Upgrade to version 4.2.1 or above.

Impact 2.5 LOW

CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N

Learn more about CVSS

Weakness

  • CWE-59: Improper Link Resolution Before File Access ('Link Following')

Source file

pypi/filelock/CVE-2026-112912.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:17:24 +0000.