CWE-59
Weakness AllowedImproper 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.
Modes of introduction
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
updated Time_of_Introduction
updated Alternate_Terms, Applicable_Platforms, Relationships, Other_Notes, Relationship_Notes, Taxonomy_Mappings, Weakness_Ordinalities
updated Relationships, Taxonomy_Mappings
updated Relationships
updated Description, Name
updated Background_Details, Other_Notes
updated Potential_Mitigations, Relationships
updated Related_Attack_Patterns
updated Common_Consequences
updated Relationships, Taxonomy_Mappings
updated Common_Consequences, Observed_Examples, References, Relationships
updated Potential_Mitigations
updated Common_Consequences, Other_Notes
updated Detection_Factors, Relationships, Taxonomy_Mappings
updated Relationships
updated Affected_Resources, Applicable_Platforms, Causal_Nature, Common_Consequences, Functional_Areas, Likelihood_of_Exploit, Modes_of_Introduction, Relationships, Taxonomy_Mappings
updated Taxonomy_Mappings
updated Relationships
updated Relationships
updated Relationships
updated Relationships
updated Research_Gaps
updated Relationships
updated Alternate_Terms, Background_Details, Observed_Examples, References, Relationship_Notes, Theoretical_Notes
updated Description
updated Relationships
updated Mapping_Notes
updated Detection_Factors, References
updated Applicable_Platforms, Relationships
updated Alternate_Terms, Name, Observed_Examples
2742 vulnerabilities reference this CWE, most recent first.
GHSA-9HG3-M3P7-MJM6
Vulnerability from github – Published: 2026-07-14 03:31 – Updated: 2026-07-14 03:31A vulnerability was detected in mosaxiv clawlet up to 0.2.10. This impacts the function read_file/write_file/edit_file of the file tools/fs_ops.go of the component File Tools. Performing a manipulation results in link following. The attack needs to be approached locally. The reported GitHub issue was closed with the label "not planned".
{
"affected": [],
"aliases": [
"CVE-2026-15621"
],
"database_specific": {
"cwe_ids": [
"CWE-59"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-07-14T01:16:17Z",
"severity": "MODERATE"
},
"details": "A vulnerability was detected in mosaxiv clawlet up to 0.2.10. This impacts the function read_file/write_file/edit_file of the file tools/fs_ops.go of the component File Tools. Performing a manipulation results in link following. The attack needs to be approached locally. The reported GitHub issue was closed with the label \"not planned\".",
"id": "GHSA-9hg3-m3p7-mjm6",
"modified": "2026-07-14T03:31:34Z",
"published": "2026-07-14T03:31:34Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-15621"
},
{
"type": "WEB",
"url": "https://github.com/mosaxiv/clawlet/issues/15"
},
{
"type": "WEB",
"url": "https://github.com/mosaxiv/clawlet"
},
{
"type": "WEB",
"url": "https://vuldb.com/cve/CVE-2026-15621"
},
{
"type": "WEB",
"url": "https://vuldb.com/submit/855796"
},
{
"type": "WEB",
"url": "https://vuldb.com/vuln/378124"
},
{
"type": "WEB",
"url": "https://vuldb.com/vuln/378124/cti"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/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-9HH6-P5C5-MMMF
Vulnerability from github – Published: 2022-05-24 17:44 – Updated: 2026-10-14 12:31An issue was discovered in GNOME GLib before 2.66.8. When g_file_replace() is used with G_FILE_CREATE_REPLACE_DESTINATION to replace a path that is a dangling symlink, it incorrectly also creates the target of the symlink as an empty file, which could conceivably have security relevance if the symlink is attacker-controlled. (If the path is a symlink to a file that already exists, then the contents of that file correctly remain unchanged.)
{
"affected": [],
"aliases": [
"CVE-2021-28153"
],
"database_specific": {
"cwe_ids": [
"CWE-59"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-03-11T22:15:00Z",
"severity": "MODERATE"
},
"details": "An issue was discovered in GNOME GLib before 2.66.8. When g_file_replace() is used with G_FILE_CREATE_REPLACE_DESTINATION to replace a path that is a dangling symlink, it incorrectly also creates the target of the symlink as an empty file, which could conceivably have security relevance if the symlink is attacker-controlled. (If the path is a symlink to a file that already exists, then the contents of that file correctly remain unchanged.)",
"id": "GHSA-9hh6-p5c5-mmmf",
"modified": "2026-10-14T12:31:17Z",
"published": "2022-05-24T17:44:27Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-28153"
},
{
"type": "WEB",
"url": "https://cert-portal.siemens.com/productcert/html/ssa-398330.html"
},
{
"type": "WEB",
"url": "https://gitlab.gnome.org/GNOME/glib/-/issues/2325"
},
{
"type": "WEB",
"url": "https://lists.debian.org/debian-lts-announce/2022/06/msg00006.html"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6RXTD5HCP2K4AAUSWWZTBKQNHRCTAEOF"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ICUTQPHZNZWX2DZR46QFLQZRHVMHIILJ"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/6RXTD5HCP2K4AAUSWWZTBKQNHRCTAEOF"
},
{
"type": "WEB",
"url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ICUTQPHZNZWX2DZR46QFLQZRHVMHIILJ"
},
{
"type": "WEB",
"url": "https://security.gentoo.org/glsa/202107-13"
},
{
"type": "WEB",
"url": "https://security.netapp.com/advisory/ntap-20210416-0003"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-9HH8-9M39-758P
Vulnerability from github – Published: 2022-05-24 17:34 – Updated: 2022-05-24 17:34Trend Micro Security 2020 (Consumer) contains a vulnerability in the installer package that could be exploited by placing a malicious DLL in a non-protected location with high privileges (symlink attack) which can lead to obtaining administrative privileges during the installation of the product.
{
"affected": [],
"aliases": [
"CVE-2020-27697"
],
"database_specific": {
"cwe_ids": [
"CWE-426",
"CWE-59"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2020-11-18T19:15:00Z",
"severity": "HIGH"
},
"details": "Trend Micro Security 2020 (Consumer) contains a vulnerability in the installer package that could be exploited by placing a malicious DLL in a non-protected location with high privileges (symlink attack) which can lead to obtaining administrative privileges during the installation of the product.",
"id": "GHSA-9hh8-9m39-758p",
"modified": "2022-05-24T17:34:31Z",
"published": "2022-05-24T17:34:31Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-27697"
},
{
"type": "WEB",
"url": "https://helpcenter.trendmicro.com/en-us/article/TMKA-10036"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-9HJG-77W4-4H5J
Vulnerability from github – Published: 2025-04-16 21:30 – Updated: 2025-04-16 21:30A Improper Link Resolution vulnerability (CWE-59) in the SonicWall Connect Tunnel Windows (32 and 64 bit) client, this results in unauthorized file overwrite, potentially leading to denial of service or file corruption.
{
"affected": [],
"aliases": [
"CVE-2025-32817"
],
"database_specific": {
"cwe_ids": [
"CWE-59"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2025-04-16T20:15:19Z",
"severity": "HIGH"
},
"details": "A Improper Link Resolution vulnerability (CWE-59) in the SonicWall Connect Tunnel Windows (32 and 64 bit) client, this results in unauthorized file overwrite, potentially leading to denial of service or file corruption.",
"id": "GHSA-9hjg-77w4-4h5j",
"modified": "2025-04-16T21:30:57Z",
"published": "2025-04-16T21:30:57Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-32817"
},
{
"type": "WEB",
"url": "https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2025-0007"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L",
"type": "CVSS_V3"
}
]
}
GHSA-9HQ4-HM3J-JMPH
Vulnerability from github – Published: 2026-11-09 22:37 – Updated: 2026-11-09 22:37Summary
The CVE-2026-32885 ZipSlip fix added a symlink-target escape check to Untar, but the check rebases an ABSOLUTE symlink target into dest before validating (filepath.Join(dest, "/etc") stays lexically inside dest and passes), while the symlink is then created with the RAW absolute target via os.Symlink(file.Linkname, ...), so a malicious archive plants a host-absolute symlink and a following regular-file entry writes through it, restoring arbitrary host file create/overwrite (reaching $HOME rc-files, hence RCE). Confirmed at HEAD.
The defect (the symlink check is a no-op for absolute targets)
CVE-2026-32885 (fixed v1.25.2, commit 05cbe299) added a lexical containment check on the entry path and a NEW symlink-target validation. pkg/archive/archive.go, Untar, tar.TypeSymlink case:
if filepath.IsAbs(file.Linkname) {
resolvedTarget = filepath.Join(dest, file.Linkname) // line 298: absolute target REBASED into dest
} else {
resolvedTarget = filepath.Join(fullPathDir, file.Linkname)
}
if !strings.HasPrefix(filepath.Clean(resolvedTarget)+sep, filepath.Clean(dest)+sep) { // line 302
return ...escapes destination... // line 303
}
_ = os.Remove(fullPath) // line 307
err = os.Symlink(file.Linkname, fullPath) // line 310: writes the RAW Linkname
For an absolute Linkname like /Users/victim, line 298 computes filepath.Join(dest, "/Users/victim") = dest/Users/victim (lexically inside dest), so the escape check at line 302 PASSES. But line 310 creates the symlink with the raw file.Linkname, so the on-disk symlink dest/link points at the real host path /Users/victim. The value validated (rebased) is not the value written (raw): a check-one-thing / do-another divergence.
Write-through: the archive carries a second regular-file entry whose Name traverses the planted link (e.g. link/.zshrc). Its fullPath is lexically inside dest so the line-238 check passes (that check is purely lexical and does not resolve the symlink), then os.Create follows the planted symlink and overwrites /Users/victim/.zshrc on the host. Overwriting a shell rc-file, git hook, or cron entry yields code execution. Reachable via ddev add-on get (the exact remote-add-on vector the advisory names), and via ddev import-db / import-files. GitHub codeload tarballs preserve symlinks.
Verification
EXECUTED (go test driving the real Untar): a file was written OUTSIDE dest and Untar returned nil (VULNERABLE); a pre-existing host file was truncated and overwritten with the attacker payload; the negative controls (a relative ../ symlink escape, and a plain ../ file entry) are both correctly rejected, isolating the bug to the absolute-symlink branch. NOT verified: the end-to-end add-on get over the network (the caller chain is source-confirmed); Windows (reliable on macOS/Linux, DDEV's primary hosts). Unzip is NOT affected (tar-only).
Suggested fix
Reject absolute symlink targets outright (a dev-environment archive has no need to plant host-absolute symlinks), or validate the RAW target that will actually be written rather than a rebased copy. Additionally, resolve symlinks when validating each regular-file entry's parent so a write cannot traverse a previously-planted link (or extract to a staging dir and reject any entry whose realpath escapes). The lexical line-238 check does not defend against a planted symlink.
Tooling
AI assistance was used while investigating. The write-through is executed-verified with negative controls (an absolute-symlink entry plus a follow-up file entry wrote and overwrote files OUTSIDE dest while relative-escape and plain-ZipSlip controls were correctly rejected), and I confirmed at HEAD that Untar rebases an absolute symlink target into dest for the escape check (line 298) but creates the symlink with the raw absolute target (line 310).
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/ddev/ddev"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.25.4"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-108262"
],
"database_specific": {
"cwe_ids": [
"CWE-22",
"CWE-59"
],
"github_reviewed": true,
"github_reviewed_at": "2026-11-09T22:37:58Z",
"nvd_published_at": "2026-11-06T19:17:06Z",
"severity": "HIGH"
},
"details": "## Summary\n\nThe CVE-2026-32885 ZipSlip fix added a symlink-target escape check to Untar, but the check rebases an ABSOLUTE symlink target into dest before validating (filepath.Join(dest, \"/etc\") stays lexically inside dest and passes), while the symlink is then created with the RAW absolute target via os.Symlink(file.Linkname, ...), so a malicious archive plants a host-absolute symlink and a following regular-file entry writes through it, restoring arbitrary host file create/overwrite (reaching $HOME rc-files, hence RCE). Confirmed at HEAD.\n\n## The defect (the symlink check is a no-op for absolute targets)\n\nCVE-2026-32885 (fixed v1.25.2, commit 05cbe299) added a lexical containment check on the entry path and a NEW symlink-target validation. pkg/archive/archive.go, Untar, tar.TypeSymlink case:\n\n```go\nif filepath.IsAbs(file.Linkname) {\n resolvedTarget = filepath.Join(dest, file.Linkname) // line 298: absolute target REBASED into dest\n} else {\n resolvedTarget = filepath.Join(fullPathDir, file.Linkname)\n}\nif !strings.HasPrefix(filepath.Clean(resolvedTarget)+sep, filepath.Clean(dest)+sep) { // line 302\n return ...escapes destination... // line 303\n}\n_ = os.Remove(fullPath) // line 307\nerr = os.Symlink(file.Linkname, fullPath) // line 310: writes the RAW Linkname\n```\n\nFor an absolute Linkname like /Users/victim, line 298 computes filepath.Join(dest, \"/Users/victim\") = dest/Users/victim (lexically inside dest), so the escape check at line 302 PASSES. But line 310 creates the symlink with the raw file.Linkname, so the on-disk symlink dest/link points at the real host path /Users/victim. The value validated (rebased) is not the value written (raw): a check-one-thing / do-another divergence.\n\nWrite-through: the archive carries a second regular-file entry whose Name traverses the planted link (e.g. link/.zshrc). Its fullPath is lexically inside dest so the line-238 check passes (that check is purely lexical and does not resolve the symlink), then os.Create follows the planted symlink and overwrites /Users/victim/.zshrc on the host. Overwriting a shell rc-file, git hook, or cron entry yields code execution. Reachable via ddev add-on get \u003crepo|url\u003e (the exact remote-add-on vector the advisory names), and via ddev import-db / import-files. GitHub codeload tarballs preserve symlinks.\n\n## Verification\n\nEXECUTED (go test driving the real Untar): a file was written OUTSIDE dest and Untar returned nil (VULNERABLE); a pre-existing host file was truncated and overwritten with the attacker payload; the negative controls (a relative ../ symlink escape, and a plain ../ file entry) are both correctly rejected, isolating the bug to the absolute-symlink branch. NOT verified: the end-to-end add-on get over the network (the caller chain is source-confirmed); Windows (reliable on macOS/Linux, DDEV\u0027s primary hosts). Unzip is NOT affected (tar-only).\n\n## Suggested fix\n\nReject absolute symlink targets outright (a dev-environment archive has no need to plant host-absolute symlinks), or validate the RAW target that will actually be written rather than a rebased copy. Additionally, resolve symlinks when validating each regular-file entry\u0027s parent so a write cannot traverse a previously-planted link (or extract to a staging dir and reject any entry whose realpath escapes). The lexical line-238 check does not defend against a planted symlink.\n\n## Tooling\n\nAI assistance was used while investigating. The write-through is executed-verified with negative controls (an absolute-symlink entry plus a follow-up file entry wrote and overwrote files OUTSIDE dest while relative-escape and plain-ZipSlip controls were correctly rejected), and I confirmed at HEAD that Untar rebases an absolute symlink target into dest for the escape check (line 298) but creates the symlink with the raw absolute target (line 310).",
"id": "GHSA-9hq4-hm3j-jmph",
"modified": "2026-11-09T22:37:59Z",
"published": "2026-11-09T22:37:58Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/ddev/ddev/security/advisories/GHSA-9hq4-hm3j-jmph"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-108262"
},
{
"type": "WEB",
"url": "https://github.com/ddev/ddev/pull/8625"
},
{
"type": "WEB",
"url": "https://github.com/ddev/ddev/commit/7034963403c5374fecceb02070d27b335329cede"
},
{
"type": "PACKAGE",
"url": "https://github.com/ddev/ddev"
},
{
"type": "WEB",
"url": "https://github.com/ddev/ddev/releases/tag/v1.25.4"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "DDEV incomplete tar symlink traversal fix allows host file overwrite - Incomplete fix of CVE-2026-32885"
}
GHSA-9HX9-W2J6-RW76
Vulnerability from github – Published: 2017-10-24 18:33 – Updated: 2025-04-13 23:26The Show In Browser (show_in_browser) gem 0.0.3 for Ruby allows local users to inject arbitrary web script or HTML via a symlink attack on /tmp/browser.html.
{
"affected": [
{
"package": {
"ecosystem": "RubyGems",
"name": "show_in_browser"
},
"versions": [
"0.0.3"
]
}
],
"aliases": [
"CVE-2013-2105"
],
"database_specific": {
"cwe_ids": [
"CWE-59"
],
"github_reviewed": true,
"github_reviewed_at": "2020-06-16T21:28:50Z",
"nvd_published_at": "2014-04-22T14:23:33Z",
"severity": "MODERATE"
},
"details": "The Show In Browser (show_in_browser) gem 0.0.3 for Ruby allows local users to inject arbitrary web script or HTML via a symlink attack on `/tmp/browser.html`.",
"id": "GHSA-9hx9-w2j6-rw76",
"modified": "2025-04-13T23:26:43Z",
"published": "2017-10-24T18:33:37Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2013-2105"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/84378"
},
{
"type": "PACKAGE",
"url": "https://github.com/jonleung/show_in_browser"
},
{
"type": "WEB",
"url": "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/show_in_browser/CVE-2013-2105.yml"
},
{
"type": "WEB",
"url": "http://vapid.dhs.org/advisories/show_in_browser.html"
},
{
"type": "WEB",
"url": "http://www.openwall.com/lists/oss-security/2013/05/18/4"
}
],
"schema_version": "1.4.0",
"severity": [],
"summary": "Script Injection in Show In Browser gem"
}
GHSA-9J6Q-WVJ5-JGJG
Vulnerability from github – Published: 2026-10-28 21:08 – Updated: 2026-10-28 21:08raise_on_not_writable_file() is the check that SoftFileLock and the locks sharing its acquire path run before every attempt. It looks at the lock path with os.lstat, so that it judges a planted symlink (a file that points at another path) by itself. When the node has no owner-write bit, it then calls os.access(filename, os.W_OK), which follows symlinks. A local user who can create entries in the lock's directory can swap the path between a mode-0466 file and a symlink to a path of their choosing. The second call then reports on the symlink's target with the permissions of the user running the lock (below: the lock user). The lock user's acquire() ends in PermissionError within a fraction of a second when the target is missing or not writable by the lock user, and in the ordinary Timeout otherwise.
That yields one bit per watched acquire. The bit says whether a path exists and is writable by the lock taker. It covers paths under directories the other user cannot search, or any path when root takes the lock. The lock does not open, create or modify anything through the symlink. On Linux, fs.protected_symlinks (a kernel setting that refuses to follow another user's symlink in a sticky world-writable directory) blocks it in a directory such as /tmp. It does not block it in a 0777 directory without the sticky bit (a directory flag that lets only a file's owner remove or rename it) or in a sticky group-writable one. This reopens the leak PR #567 closed. Affected versions are filelock 3.32.6 through 4.2.0.
Anthropic's OSS Scanner reported this in private. Finding covered by this advisory:
ANT-2026-RQ91AXTW[medium, CWE-59]: Symlink TOCTOU in raise_on_not_writable_file leaks file existence.
Severity
CVSS 3.1 CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N scores 2.5 (Low).
AV:L (local): the other user needs an account on the same host. PR:L (low privileges): an ordinary account is enough. UI:N (no user interaction). AC:H (high attack complexity): the swap has to land between two system calls a few bytecodes apart (6 to 12 % of back-to-back acquires with the other user on a second CPU, 1 in 8 000 on one CPU), and the other user has to observe how the lock user's acquire ended. C:L (partial confidentiality impact): one bit per acquire (existence or writability of a chosen path), no content. I:N and A:N (no integrity or availability impact). S:U (scope unchanged).
Classification from the review: security, conditional, "a one-bit probe of a victim-only path" that "Linux protected symlinks block in the common sticky /tmp case, but not every shared directory". The scanner rated this medium. The maintainers score it low for the complexity and the one-bit yield.
Scope and preconditions
- The affected classes are
SoftFileLockand everything that reuses its_acquire:MarkerSoftFileLock,SoftFileLease, the async soft locks, andFileLockafter anENOSYSfallback to a soft lock.UnixFileLockitself does not call the helper.WindowsFileLock._acquire()does, but on Windowsos.accessreads the link's own read-only attribute and does not follow it; that branch did not run. - The other user must be able to create entries in the lock's directory. With Linux defaults (
fs.protected_symlinks=1) the kernel refuses the lock user's attempt to follow another user's symlink in a directory that is both sticky and world-writable./tmptherefore givesPermissionErrorfor every target and leaks nothing. A0777directory without the sticky bit, or a sticky group-writable one (1770with a shared group), has no such cover and leaks as described. macOS and the BSDs have nofs.protected_symlinks, and a symlink there has mode bits of its own, so one without the owner-write bit would reachos.accesswith no swap at all (not executed). - The swap is practical only with a second CPU for the other user.
- The other user needs to see how the lock user's acquire ended, for example the exception in a shared log, an exit status, or when the job stopped (
PermissionErrorends a blocking acquire within about a second; the other case runs to its timeout). The scanner also observed a variant that needs no output from the lock user. Hold the soft lock, set the marker (the lock file whose presence says a process holds the lock) to mode0o066, swap the symlink in and out for a few seconds, release, and see whether a marker owned by the other uid appears. A contender still waiting takes the lock; one that raised is gone. - The
O_NOFOLLOWopen that follows the check is not affected. The lock does not read, create or modify anything through the symlink.
Affected code
Scanned commit b831496b0273: in raise_on_not_writable_file, the os.lstat that states the invariant and the os.access call that follows symlinks; the call from SoftFileLock._acquire at the start of every poll.
Introduced
f2f7b86 "fix: respect ACL write access when the owner write bit is absent" (#728, 2026-09-08), first tag 3.32.6 (verified), appended the os.access call to the not S_IWUSR test. #567 (022394c, first tag 3.29.5) had changed the helper from os.stat to os.lstat so that a symlink planted at the lock path could not probe its target.
Mechanism
SoftFileLock._acquire calls the helper first, once per poll_interval (0.05 s by default) for as long as the lock user waits. The helper runs os.lstat(path). When the node has no S_IWUSR it runs os.access(path, os.W_OK, effective_ids=...) without follow_symlinks=False. On current Linux that is faccessat2(AT_FDCWD, path, W_OK, AT_EACCESS), which resolves a symlink. If that returns false, a second os.lstat confirms a node is still there and the helper raises PermissionError. The other user's planted file has mode 0466: no owner-write bit, which sends the helper on to os.access, and other-writable, so that os.access on the file itself says yes. The other user alternates the file and a symlink at the path (os.replace of a fresh symlink, then os.replace of a hard link to the marker; the lock would evict a symlink left for 2 s as a malformed marker).
One call of the helper then goes one of three ways. First, lstat sees the symlink (mode 0777 on Linux, S_IWUSR set), os.access is not called, the helper returns. Second, lstat sees the file and os.access sees the file: true, returns. Third, lstat sees the file and os.access sees the symlink, resolved to its target with the lock user's permissions: returns if the lock user may write the target, otherwise raises PermissionError. After a return, the O_CREAT | O_EXCL | O_NOFOLLOW open fails with EEXIST and the poll ends as "lock is held". PermissionError therefore comes only from the third way and only for a target the lock user cannot write, and it leaves acquire() at once instead of after the timeout.
The scanner measured what the outcome encodes with 4 000 non-blocking acquires per target as victim (uid 1000, 0700 private directory). An existing file or directory of victim: 0 PermissionError. A missing name there gives 311 to 339. A 0444 file of victim: 433 to 460. /etc/passwd or /etc/shadow: 237 to 422. With root taking the lock the answer is plain existence, 0 for /etc/shadow and /root/.bashrc, 366 for a missing name under /root. A symlink alone at the path, without the swap, tells nothing (2 000 Timeout of 2 000 for both targets, then evicted as malformed after 2 s).
Reproduction
The scanner's reproducer for ANT-2026-RQ91AXTW, quoted as received. It ran against commit b831496b0273.
repro
#!/usr/bin/env python3
import os
import shutil
import subprocess
import sys
import time
VICTIM_JOB = "/tmp/repro.d/victim_job.py"
ATTACKER = "/tmp/repro.d/attacker_swaps_lock_path.py"
private_dir = "/tmp/victim-private"
shared_dir = "/tmp/team-locks"
lock_path = shared_dir + "/app.lock"
as_victim = dict(user="victim", group="victim", extra_groups=[])
as_attacker = dict(user="attacker", group="attacker", extra_groups=[])
assert len(os.sched_getaffinity(0)) >= 2, "the attacker's swap needs a CPU of its own"
# set up: victim's 0700 directory holds "present" and no "absent"
shutil.rmtree(private_dir, ignore_errors=True)
os.mkdir(private_dir, 0o700)
open(private_dir + "/present", "w").close()
shutil.chown(private_dir + "/present", "victim", "victim")
shutil.chown(private_dir, "victim", "victim")
job_ended_with = {}
for name in ("present", "absent"):
probed_path = f"{private_dir}/{name}"
attackers_stat = subprocess.run(["stat", probed_path], capture_output=True, text=True, **as_attacker)
assert attackers_stat.returncode != 0, "attacker can stat the probed path directly"
print(f"CONTROL attacker's own look: {attackers_stat.stderr.strip()}")
# 0777 without the sticky bit: fs.protected_symlinks does not cover it
shutil.rmtree(shared_dir, ignore_errors=True)
os.mkdir(shared_dir)
os.chmod(shared_dir, 0o777)
# attack: the lock path keeps alternating between a held marker and a symlink to probed_path
attacker = subprocess.Popen([sys.executable, ATTACKER, lock_path, probed_path], **as_attacker)
deadline = time.monotonic() + 10
while not os.path.lexists(lock_path):
assert time.monotonic() < deadline, "attacker did not plant the lock path"
time.sleep(0.01)
started = time.monotonic()
job = subprocess.run([sys.executable, VICTIM_JOB, lock_path], capture_output=True, text=True, **as_victim)
waited = time.monotonic() - started
attacker.kill()
attacker.wait()
job_ended_with[name] = (job.stderr or job.stdout).strip().splitlines()[-1] # last line of the traceback
print(f"OBSERVED {probed_path} exists={os.path.exists(probed_path)} (read as root); "
f"victim's job ended after {waited:.1f} s with: {job_ended_with[name]}")
# check: a lock that ignores the symlink's target ends both jobs in Timeout; here the ending tells the two apart
timeout_where_present = job_ended_with["present"].startswith("filelock._error.Timeout:")
permission_error_where_absent = job_ended_with["absent"].startswith("PermissionError:")
print("BUG" if timeout_where_present and permission_error_where_absent else "OK")
repro.d/attacker_swaps_lock_path.py
#!/usr/bin/env python3
import os
import sys
import time
lock_path, probed_path = sys.argv[1], sys.argv[2]
held_marker = lock_path + ".held"
staged = lock_path + ".staged"
with open(held_marker, "w") as marker:
marker.write("1\nanother-host\n") # pid 1 on another host: never judged stale, so the victim keeps polling
# no u+w sends raise_on_not_writable_file() on to os.access(); o+w makes os.access() pass for this file itself
os.chmod(held_marker, 0o466)
give_up_at = time.monotonic() + 60
while time.monotonic() < give_up_at:
# a fresh symlink each round: one left unchanged for 2 s is evicted as a malformed marker
os.symlink(probed_path, staged)
os.replace(staged, lock_path)
os.link(held_marker, staged)
os.replace(staged, lock_path)
repro.d/victim_job.py
#!/usr/bin/env python3
import sys
from filelock import SoftFileLock
with SoftFileLock(sys.argv[1], timeout=5):
print("working under the lock")
Attack sequence
sequenceDiagram
participant A as other account (second CPU)
participant L as app.lock in a 0777 non-sticky directory
participant V as lock user: SoftFileLock(path, timeout=5)
participant P as /home/victim/private (0700)
A->>L: plant 0466 marker naming pid 1 on another host (not stale at any time)
loop every few microseconds
A->>L: os.replace(fresh symlink -> /home/victim/private/absent)
A->>L: os.replace(hard link to the 0466 marker)
end
loop every poll_interval (0.05 s)
V->>L: os.lstat -> regular file, no S_IWUSR
rect rgb(255, 214, 214)
V->>L: os.access(path, W_OK) lands on the symlink
L->>P: resolved to /home/victim/private/absent with the lock user's permissions
P-->>V: False (missing)
V->>L: os.lstat -> a node is there
V->>V: raise PermissionError after 0.4 s instead of Timeout after 5 s
end
end
A->>A: the lock user's job ended early: the name does not exist (or is not writable by the lock user)
Evidence
The scanner reproducer runs with victim uid 1000 owning /tmp/victim-private mode 0700 holding present and not absent; attacker uid 1001, no shared group; lock directory /tmp/team-locks root-owned 0777 without the sticky bit; fs.protected_symlinks=1; 2 CPUs; Linux 6.1, CPython 3.14.8. It printed CONTROL attacker's own look: stat: cannot statx '/tmp/victim-private/present': Permission denied and then OBSERVED /tmp/victim-private/present exists=True (read as root); victim's job ended after 5.1 s with: filelock._error.Timeout .... For the other target it printed CONTROL ... '/tmp/victim-private/absent': Permission denied and OBSERVED /tmp/victim-private/absent exists=False (read as root); victim's job ended after 0.4 s with: PermissionError: [Errno 13] Permission denied: '/tmp/team-locks/app.lock', then BUG. The verdict requires the job for present to end in Timeout and the job for absent in PermissionError. In 40 runs a blocking acquire met its first PermissionError after 0.1 to 0.7 s.
In the maintainers' triage the reproducer prints BUG on the scanned commit b831496 and on the 4.2.0 release image. The independent review (soft-open) confirmed the mechanism and checked on macOS that os.access there supports follow_symlinks, relevant to the platform note above.
Impact
A local user who can write the directory of a soft lock learns, for a path of its choosing, whether that path exists and is writable by the user taking the lock. That includes paths under directories the other user cannot search (a 0700 home or project tree; any path when root takes the lock), one bit per acquire it watches, repeatable with a different target each time. The reproducer shows the existence half; a read-only file of the lock user gives the same PermissionError as a missing name. The lock opens, creates and modifies nothing through the symlink, and the acquire itself is not redirected. The other user can already deny the lock by planting a marker, so the early PermissionError is not a new availability effect. This is the disclosure PR #567 closed, reachable again through the call PR #728 added.
Workarounds
- Keep soft-lock directories writable only by the lock's own account, or use a sticky world-writable directory on Linux with
fs.protected_symlinks=1(the default), where the kernel refuses to follow another user's symlink and the check leaks nothing. - Do not take soft locks as root in directories other users can write.
- Where a group-shared directory is unavoidable, give the marker an owner-write bit (the default mode does) and do not rely on ACL-granted access, so the
os.accessbranch is not reached for the lock user's own marker. The other user's planted0466file still reaches it, so this only narrows the window.
Patched version
4.2.1.
Fix: https://github.com/tox-dev/filelock/pull/835
Credits
Reported by Anthropic's OSS Scanner (automated analysis), 15 October 2026; reviewed by the maintainers.
- 2026-10-15 23:08 UTC: report received (36 findings; this one rated medium by the scanner)
- 2026-10-16 05:38 UTC: draft advisory created (first as part of GHSA-69hj-f68j-2879, then split out)
- 2026-10-16 01:16 UTC: fix PR #835 opened
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 4.2.0"
},
"package": {
"ecosystem": "PyPI",
"name": "filelock"
},
"ranges": [
{
"events": [
{
"introduced": "3.32.6"
},
{
"fixed": "4.2.1"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-112912"
],
"database_specific": {
"cwe_ids": [
"CWE-59"
],
"github_reviewed": true,
"github_reviewed_at": "2026-10-28T21:08:40Z",
"nvd_published_at": "2026-10-20T15:17:15Z",
"severity": "LOW"
},
"details": "`raise_on_not_writable_file()` is the check that `SoftFileLock` and the locks sharing its acquire path run before every attempt. It looks at the lock path with `os.lstat`, so that it judges a planted symlink (a file that points at another path) by itself. When the node has no owner-write bit, it then calls `os.access(filename, os.W_OK)`, which follows symlinks. A local user who can create entries in the lock\u0027s directory can swap the path between a mode-`0466` file and a symlink to a path of their choosing. The second call then reports on the symlink\u0027s target with the permissions of the user running the lock (below: the lock user). The lock user\u0027s `acquire()` ends in `PermissionError` within a fraction of a second when the target is missing or not writable by the lock user, and in the ordinary `Timeout` otherwise.\n\nThat yields one bit per watched acquire. The bit says whether a path exists and is writable by the lock taker. It covers paths under directories the other user cannot search, or any path when root takes the lock. The lock does not open, create or modify anything through the symlink. On Linux, `fs.protected_symlinks` (a kernel setting that refuses to follow another user\u0027s symlink in a sticky world-writable directory) blocks it in a directory such as `/tmp`. It does not block it in a `0777` directory without the sticky bit (a directory flag that lets only a file\u0027s owner remove or rename it) or in a sticky group-writable one. This reopens the leak PR #567 closed. Affected versions are filelock 3.32.6 through 4.2.0.\n\nAnthropic\u0027s OSS Scanner reported this in private. Finding covered by this advisory:\n\n- `ANT-2026-RQ91AXTW` [medium, CWE-59]: Symlink TOCTOU in raise_on_not_writable_file leaks file existence.\n\n## Severity\n\n**CVSS 3.1 `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N` scores 2.5 (Low).**\n\n`AV:L` (local): the other user needs an account on the same host. `PR:L` (low privileges): an ordinary account is enough. `UI:N` (no user interaction). `AC:H` (high attack complexity): the swap has to land between two system calls a few bytecodes apart (6 to 12 % of back-to-back acquires with the other user on a second CPU, 1 in 8 000 on one CPU), and the other user has to observe how the lock user\u0027s acquire ended. `C:L` (partial confidentiality impact): one bit per acquire (existence or writability of a chosen path), no content. `I:N` and `A:N` (no integrity or availability impact). `S:U` (scope unchanged).\n\nClassification from the review: **security, conditional**, \"a one-bit probe of a victim-only path\" that \"Linux protected symlinks block in the common sticky `/tmp` case, but not every shared directory\". The scanner rated this medium. The maintainers score it low for the complexity and the one-bit yield.\n\n## Scope and preconditions\n\n- The affected classes are `SoftFileLock` and everything that reuses its `_acquire`: `MarkerSoftFileLock`, `SoftFileLease`, the async soft locks, and `FileLock` after an `ENOSYS` fallback to a soft lock. `UnixFileLock` itself does not call the helper. `WindowsFileLock._acquire()` does, but on Windows `os.access` reads the link\u0027s own read-only attribute and does not follow it; that branch did not run.\n- The other user must be able to create entries in the lock\u0027s directory. With Linux defaults (`fs.protected_symlinks=1`) the kernel refuses the lock user\u0027s attempt to follow another user\u0027s symlink in a directory that is both sticky and world-writable. `/tmp` therefore gives `PermissionError` for every target and leaks nothing. A `0777` directory without the sticky bit, or a sticky group-writable one (`1770` with a shared group), has no such cover and leaks as described. macOS and the BSDs have no `fs.protected_symlinks`, and a symlink there has mode bits of its own, so one without the owner-write bit would reach `os.access` with no swap at all (not executed).\n- The swap is practical only with a second CPU for the other user.\n- The other user needs to see how the lock user\u0027s acquire ended, for example the exception in a shared log, an exit status, or when the job stopped (`PermissionError` ends a blocking acquire within about a second; the other case runs to its timeout). The scanner also observed a variant that needs no output from the lock user. Hold the soft lock, set the marker (the lock file whose presence says a process holds the lock) to mode `0o066`, swap the symlink in and out for a few seconds, release, and see whether a marker owned by the other uid appears. A contender still waiting takes the lock; one that raised is gone.\n- The `O_NOFOLLOW` open that follows the check is not affected. The lock does not read, create or modify anything through the symlink.\n\n## Affected code\n\nScanned commit `b831496b0273`: in `raise_on_not_writable_file`, the [`os.lstat` that states the invariant](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_util.py#L46-L50) and the [`os.access` call that follows symlinks](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_util.py#L63-L71); the [call from `SoftFileLock._acquire`](https://github.com/tox-dev/filelock/blob/b831496b0273ecd11bf02b8d080ca8b673a538c1/src/filelock/_soft.py#L63) at the start of every poll.\n\n## Introduced\n\n[f2f7b86](https://github.com/tox-dev/filelock/commit/f2f7b8696426) \"fix: respect ACL write access when the owner write bit is absent\" ([#728](https://github.com/tox-dev/filelock/pull/728), 2026-09-08), first tag 3.32.6 (verified), appended the `os.access` call to the `not S_IWUSR` test. [#567](https://github.com/tox-dev/filelock/pull/567) (022394c, first tag 3.29.5) had changed the helper from `os.stat` to `os.lstat` so that a symlink planted at the lock path could not probe its target.\n\n## Mechanism\n\n`SoftFileLock._acquire` calls the helper first, once per `poll_interval` (0.05 s by default) for as long as the lock user waits. The helper runs `os.lstat(path)`. When the node has no `S_IWUSR` it runs `os.access(path, os.W_OK, effective_ids=...)` without `follow_symlinks=False`. On current Linux that is `faccessat2(AT_FDCWD, path, W_OK, AT_EACCESS)`, which resolves a symlink. If that returns false, a second `os.lstat` confirms a node is still there and the helper raises `PermissionError`. The other user\u0027s planted file has mode `0466`: no owner-write bit, which sends the helper on to `os.access`, and other-writable, so that `os.access` on the file itself says yes. The other user alternates the file and a symlink at the path (`os.replace` of a fresh symlink, then `os.replace` of a hard link to the marker; the lock would evict a symlink left for 2 s as a malformed marker).\n\nOne call of the helper then goes one of three ways. First, `lstat` sees the symlink (mode `0777` on Linux, `S_IWUSR` set), `os.access` is not called, the helper returns. Second, `lstat` sees the file and `os.access` sees the file: true, returns. Third, `lstat` sees the file and `os.access` sees the symlink, resolved to its target with the lock user\u0027s permissions: returns if the lock user may write the target, otherwise raises `PermissionError`. After a return, the `O_CREAT | O_EXCL | O_NOFOLLOW` open fails with `EEXIST` and the poll ends as \"lock is held\". `PermissionError` therefore comes only from the third way and only for a target the lock user cannot write, and it leaves `acquire()` at once instead of after the timeout.\n\nThe scanner measured what the outcome encodes with 4 000 non-blocking acquires per target as `victim` (uid 1000, `0700` private directory). An existing file or directory of `victim`: 0 `PermissionError`. A missing name there gives 311 to 339. A `0444` file of `victim`: 433 to 460. `/etc/passwd` or `/etc/shadow`: 237 to 422. With root taking the lock the answer is plain existence, 0 for `/etc/shadow` and `/root/.bashrc`, 366 for a missing name under `/root`. A symlink alone at the path, without the swap, tells nothing (2 000 `Timeout` of 2 000 for both targets, then evicted as malformed after 2 s).\n\n## Reproduction\n\nThe scanner\u0027s reproducer for `ANT-2026-RQ91AXTW`, quoted as received. It ran against commit `b831496b0273`.\n\n**`repro`**\n\n```python\n#!/usr/bin/env python3\nimport os\nimport shutil\nimport subprocess\nimport sys\nimport time\n\nVICTIM_JOB = \"/tmp/repro.d/victim_job.py\"\nATTACKER = \"/tmp/repro.d/attacker_swaps_lock_path.py\"\nprivate_dir = \"/tmp/victim-private\"\nshared_dir = \"/tmp/team-locks\"\nlock_path = shared_dir + \"/app.lock\"\nas_victim = dict(user=\"victim\", group=\"victim\", extra_groups=[])\nas_attacker = dict(user=\"attacker\", group=\"attacker\", extra_groups=[])\n\nassert len(os.sched_getaffinity(0)) \u003e= 2, \"the attacker\u0027s swap needs a CPU of its own\"\n\n# set up: victim\u0027s 0700 directory holds \"present\" and no \"absent\"\nshutil.rmtree(private_dir, ignore_errors=True)\nos.mkdir(private_dir, 0o700)\nopen(private_dir + \"/present\", \"w\").close()\nshutil.chown(private_dir + \"/present\", \"victim\", \"victim\")\nshutil.chown(private_dir, \"victim\", \"victim\")\n\njob_ended_with = {}\nfor name in (\"present\", \"absent\"):\n probed_path = f\"{private_dir}/{name}\"\n attackers_stat = subprocess.run([\"stat\", probed_path], capture_output=True, text=True, **as_attacker)\n assert attackers_stat.returncode != 0, \"attacker can stat the probed path directly\"\n print(f\"CONTROL attacker\u0027s own look: {attackers_stat.stderr.strip()}\")\n\n # 0777 without the sticky bit: fs.protected_symlinks does not cover it\n shutil.rmtree(shared_dir, ignore_errors=True)\n os.mkdir(shared_dir)\n os.chmod(shared_dir, 0o777)\n\n # attack: the lock path keeps alternating between a held marker and a symlink to probed_path\n attacker = subprocess.Popen([sys.executable, ATTACKER, lock_path, probed_path], **as_attacker)\n deadline = time.monotonic() + 10\n while not os.path.lexists(lock_path):\n assert time.monotonic() \u003c deadline, \"attacker did not plant the lock path\"\n time.sleep(0.01)\n\n started = time.monotonic()\n job = subprocess.run([sys.executable, VICTIM_JOB, lock_path], capture_output=True, text=True, **as_victim)\n waited = time.monotonic() - started\n attacker.kill()\n attacker.wait()\n\n job_ended_with[name] = (job.stderr or job.stdout).strip().splitlines()[-1] # last line of the traceback\n print(f\"OBSERVED {probed_path} exists={os.path.exists(probed_path)} (read as root); \"\n f\"victim\u0027s job ended after {waited:.1f} s with: {job_ended_with[name]}\")\n\n# check: a lock that ignores the symlink\u0027s target ends both jobs in Timeout; here the ending tells the two apart\ntimeout_where_present = job_ended_with[\"present\"].startswith(\"filelock._error.Timeout:\")\npermission_error_where_absent = job_ended_with[\"absent\"].startswith(\"PermissionError:\")\nprint(\"BUG\" if timeout_where_present and permission_error_where_absent else \"OK\")\n```\n\n**`repro.d/attacker_swaps_lock_path.py`**\n\n```python\n#!/usr/bin/env python3\nimport os\nimport sys\nimport time\n\nlock_path, probed_path = sys.argv[1], sys.argv[2]\nheld_marker = lock_path + \".held\"\nstaged = lock_path + \".staged\"\n\nwith open(held_marker, \"w\") as marker:\n marker.write(\"1\\nanother-host\\n\") # pid 1 on another host: never judged stale, so the victim keeps polling\n# no u+w sends raise_on_not_writable_file() on to os.access(); o+w makes os.access() pass for this file itself\nos.chmod(held_marker, 0o466)\n\ngive_up_at = time.monotonic() + 60\nwhile time.monotonic() \u003c give_up_at:\n # a fresh symlink each round: one left unchanged for 2 s is evicted as a malformed marker\n os.symlink(probed_path, staged)\n os.replace(staged, lock_path)\n os.link(held_marker, staged)\n os.replace(staged, lock_path)\n```\n\n**`repro.d/victim_job.py`**\n\n```python\n#!/usr/bin/env python3\nimport sys\n\nfrom filelock import SoftFileLock\n\nwith SoftFileLock(sys.argv[1], timeout=5):\n print(\"working under the lock\")\n```\n\n## Attack sequence\n\n```mermaid\nsequenceDiagram\n participant A as other account (second CPU)\n participant L as app.lock in a 0777 non-sticky directory\n participant V as lock user: SoftFileLock(path, timeout=5)\n participant P as /home/victim/private (0700)\n A-\u003e\u003eL: plant 0466 marker naming pid 1 on another host (not stale at any time)\n loop every few microseconds\n A-\u003e\u003eL: os.replace(fresh symlink -\u003e /home/victim/private/absent)\n A-\u003e\u003eL: os.replace(hard link to the 0466 marker)\n end\n loop every poll_interval (0.05 s)\n V-\u003e\u003eL: os.lstat -\u003e regular file, no S_IWUSR\n rect rgb(255, 214, 214)\n V-\u003e\u003eL: os.access(path, W_OK) lands on the symlink\n L-\u003e\u003eP: resolved to /home/victim/private/absent with the lock user\u0027s permissions\n P--\u003e\u003eV: False (missing)\n V-\u003e\u003eL: os.lstat -\u003e a node is there\n V-\u003e\u003eV: raise PermissionError after 0.4 s instead of Timeout after 5 s\n end\n end\n A-\u003e\u003eA: the lock user\u0027s job ended early: the name does not exist (or is not writable by the lock user)\n```\n\n## Evidence\n\nThe scanner reproducer runs with `victim` uid 1000 owning `/tmp/victim-private` mode `0700` holding `present` and not `absent`; `attacker` uid 1001, no shared group; lock directory `/tmp/team-locks` root-owned `0777` without the sticky bit; `fs.protected_symlinks=1`; 2 CPUs; Linux 6.1, CPython 3.14.8. It printed `CONTROL attacker\u0027s own look: stat: cannot statx \u0027/tmp/victim-private/present\u0027: Permission denied` and then `OBSERVED /tmp/victim-private/present exists=True (read as root); victim\u0027s job ended after 5.1 s with: filelock._error.Timeout ...`. For the other target it printed `CONTROL ... \u0027/tmp/victim-private/absent\u0027: Permission denied` and `OBSERVED /tmp/victim-private/absent exists=False (read as root); victim\u0027s job ended after 0.4 s with: PermissionError: [Errno 13] Permission denied: \u0027/tmp/team-locks/app.lock\u0027`, then `BUG`. The verdict requires the job for `present` to end in `Timeout` and the job for `absent` in `PermissionError`. In 40 runs a blocking acquire met its first `PermissionError` after 0.1 to 0.7 s.\n\nIn the maintainers\u0027 triage the reproducer prints `BUG` on the scanned commit `b831496` and on the 4.2.0 release image. The independent review (`soft-open`) confirmed the mechanism and checked on macOS that `os.access` there supports `follow_symlinks`, relevant to the platform note above.\n\n## Impact\n\nA local user who can write the directory of a soft lock learns, for a path of its choosing, whether that path exists and is writable by the user taking the lock. That includes paths under directories the other user cannot search (a `0700` home or project tree; any path when root takes the lock), one bit per acquire it watches, repeatable with a different target each time. The reproducer shows the existence half; a read-only file of the lock user gives the same `PermissionError` as a missing name. The lock opens, creates and modifies nothing through the symlink, and the acquire itself is not redirected. The other user can already deny the lock by planting a marker, so the early `PermissionError` is not a new availability effect. This is the disclosure PR #567 closed, reachable again through the call PR #728 added.\n\n## Workarounds\n\n- Keep soft-lock directories writable only by the lock\u0027s own account, or use a sticky world-writable directory on Linux with `fs.protected_symlinks=1` (the default), where the kernel refuses to follow another user\u0027s symlink and the check leaks nothing.\n- Do not take soft locks as root in directories other users can write.\n- Where a group-shared directory is unavoidable, give the marker an owner-write bit (the default mode does) and do not rely on ACL-granted access, so the `os.access` branch is not reached for the lock user\u0027s own marker. The other user\u0027s planted `0466` file still reaches it, so this only narrows the window.\n\n## Patched version\n\n4.2.1.\n\nFix: https://github.com/tox-dev/filelock/pull/835\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 (36 findings; this one rated medium by the scanner)\n- 2026-10-16 05:38 UTC: draft advisory created (first as part of GHSA-69hj-f68j-2879, then split out)\n- 2026-10-16 01:16 UTC: fix PR #835 opened",
"id": "GHSA-9j6q-wvj5-jgjg",
"modified": "2026-10-28T21:08:40Z",
"published": "2026-10-28T21:08:40Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/tox-dev/filelock/security/advisories/GHSA-9j6q-wvj5-jgjg"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-112912"
},
{
"type": "WEB",
"url": "https://github.com/tox-dev/filelock/pull/835"
},
{
"type": "WEB",
"url": "https://github.com/tox-dev/filelock/commit/e1e825b1992f69fb6b346dc395d5ae4893536c0a"
},
{
"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:N/A:N",
"type": "CVSS_V3"
}
],
"summary": "filelock: Symlink swap during SoftFileLock\u0027s writability check leaks whether a path exists and is writable by the lock taker"
}
GHSA-9JPQ-JCJR-F4M4
Vulnerability from github – Published: 2024-10-08 18:33 – Updated: 2024-10-08 18:33Windows Common Log File System Driver Elevation of Privilege Vulnerability
{
"affected": [],
"aliases": [
"CVE-2024-43501"
],
"database_specific": {
"cwe_ids": [
"CWE-59"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-10-08T18:15:11Z",
"severity": "HIGH"
},
"details": "Windows Common Log File System Driver Elevation of Privilege Vulnerability",
"id": "GHSA-9jpq-jcjr-f4m4",
"modified": "2024-10-08T18:33:15Z",
"published": "2024-10-08T18:33:15Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-43501"
},
{
"type": "WEB",
"url": "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-43501"
}
],
"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-9JPV-XJWW-74VR
Vulnerability from github – Published: 2024-12-31 18:30 – Updated: 2024-12-31 18:30A LogServer arbitrary file creation vulnerability in Trend Micro Apex One could allow a local attacker to escalate privileges on affected installations.
Please note: an attacker must first obtain the ability to execute low-privileged code on the target system in order to exploit this vulnerability.
{
"affected": [],
"aliases": [
"CVE-2024-52050"
],
"database_specific": {
"cwe_ids": [
"CWE-59"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-12-31T16:15:26Z",
"severity": "HIGH"
},
"details": "A LogServer arbitrary file creation vulnerability in Trend Micro Apex One could allow a local attacker to escalate privileges on affected installations.\n\nPlease note: an attacker must first obtain the ability to execute low-privileged code on the target system in order to exploit this vulnerability.",
"id": "GHSA-9jpv-xjww-74vr",
"modified": "2024-12-31T18:30:51Z",
"published": "2024-12-31T18:30:51Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-52050"
},
{
"type": "WEB",
"url": "https://success.trendmicro.com/en-US/solution/KA-0018217"
}
],
"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-9JW4-HXM9-MF52
Vulnerability from github – Published: 2024-06-11 18:30 – Updated: 2024-06-11 18:30Azure Monitor Agent Elevation of Privilege Vulnerability
{
"affected": [],
"aliases": [
"CVE-2024-35254"
],
"database_specific": {
"cwe_ids": [
"CWE-59"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-06-11T17:16:03Z",
"severity": "HIGH"
},
"details": "Azure Monitor Agent Elevation of Privilege Vulnerability",
"id": "GHSA-9jw4-hxm9-mf52",
"modified": "2024-06-11T18:30:50Z",
"published": "2024-06-11T18:30:50Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-35254"
},
{
"type": "WEB",
"url": "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-35254"
}
],
"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:H",
"type": "CVSS_V3"
}
]
}
Mitigation MIT-48.1
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.