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

2738 vulnerabilities reference this CWE, most recent first.

GHSA-WPHQ-4XG8-Q6M6

Vulnerability from github – Published: 2023-11-16 09:30 – Updated: 2023-11-16 09:30
VLAI
Details

Dell Encryption, Dell Endpoint Security Suite Enterprise, and Dell Security Management Server version prior to 11.8.1 contain an Insecure Operation on Windows Junction Vulnerability during installation. A local malicious user could potentially exploit this vulnerability to create an arbitrary folder inside a restricted directory, leading to Privilege Escalation

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2023-39246"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59",
      "CWE-61"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2023-11-16T09:15:07Z",
    "severity": "MODERATE"
  },
  "details": "\nDell Encryption, Dell Endpoint Security Suite Enterprise, and Dell Security Management Server version prior to 11.8.1 contain an Insecure Operation on Windows Junction Vulnerability during installation. A local malicious user could potentially exploit this vulnerability to create an arbitrary folder inside a restricted directory, leading to Privilege Escalation\n\n",
  "id": "GHSA-wphq-4xg8-q6m6",
  "modified": "2023-11-16T09:30:24Z",
  "published": "2023-11-16T09:30:24Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-39246"
    },
    {
      "type": "WEB",
      "url": "https://www.dell.com/support/kbdoc/en-us/000217572/dsa-2023-271"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:N/I:L/A:L",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-WPW2-359H-43FC

Vulnerability from github – Published: 2022-05-17 05:53 – Updated: 2022-05-17 05:53
VLAI
Details

tkusr in tkusr 0.82 allows local users to overwrite arbitrary files via a symlink attack on the /tmp/tkusr.pgm temporary file.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2008-5136"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2008-11-18T16:00:00Z",
    "severity": "MODERATE"
  },
  "details": "tkusr in tkusr 0.82 allows local users to overwrite arbitrary files via a symlink attack on the /tmp/tkusr.pgm temporary file.",
  "id": "GHSA-wpw2-359h-43fc",
  "modified": "2022-05-17T05:53:11Z",
  "published": "2022-05-17T05:53:11Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2008-5136"
    },
    {
      "type": "WEB",
      "url": "http://lists.debian.org/debian-devel/2008/08/msg00285.html"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/32406"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-WPXX-M2RJ-6JQQ

Vulnerability from github – Published: 2026-08-11 18:31 – Updated: 2026-08-11 18:31
VLAI
Details

Improper link resolution before file access ('link following') in Windows DHCP Server allows an authorized attacker to elevate privileges locally.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-62807"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-08-11T17:18:34Z",
    "severity": "HIGH"
  },
  "details": "Improper link resolution before file access (\u0027link following\u0027) in Windows DHCP Server allows an authorized attacker to elevate privileges locally.",
  "id": "GHSA-wpxx-m2rj-6jqq",
  "modified": "2026-08-11T18:31:24Z",
  "published": "2026-08-11T18:31:24Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-62807"
    },
    {
      "type": "WEB",
      "url": "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2026-62807"
    }
  ],
  "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-WQ7M-77GQ-FF44

Vulnerability from github – Published: 2022-05-17 05:06 – Updated: 2022-05-17 05:06
VLAI
Details

bin/rt in Request Tracker (RT) 3.8.x before 3.8.17 and 4.0.x before 4.0.13 allows local users to overwrite arbitrary files via a symlink attack on a temporary file with predictable name.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2013-3368"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2013-08-23T16:55:00Z",
    "severity": "LOW"
  },
  "details": "bin/rt in Request Tracker (RT) 3.8.x before 3.8.17 and 4.0.x before 4.0.13 allows local users to overwrite arbitrary files via a symlink attack on a temporary file with predictable name.",
  "id": "GHSA-wq7m-77gq-ff44",
  "modified": "2022-05-17T05:06:04Z",
  "published": "2022-05-17T05:06:04Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2013-3368"
    },
    {
      "type": "WEB",
      "url": "http://lists.bestpractical.com/pipermail/rt-announce/2013-May/000226.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.bestpractical.com/pipermail/rt-announce/2013-May/000227.html"
    },
    {
      "type": "WEB",
      "url": "http://lists.bestpractical.com/pipermail/rt-announce/2013-May/000228.html"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/53505"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/53522"
    },
    {
      "type": "WEB",
      "url": "http://www.debian.org/security/2012/dsa-2670"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/93612"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-WQQ2-J7VF-7RW9

Vulnerability from github – Published: 2022-05-13 01:21 – Updated: 2025-10-22 00:31
VLAI
Details

An elevation of privilege vulnerability exists when Windows AppX Deployment Service (AppXSVC) improperly handles hard links, aka 'Windows Elevation of Privilege Vulnerability'. This CVE ID is unique from CVE-2019-0730, CVE-2019-0731, CVE-2019-0796, CVE-2019-0805, CVE-2019-0836.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2019-0841"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2019-04-09T21:29:00Z",
    "severity": "HIGH"
  },
  "details": "An elevation of privilege vulnerability exists when Windows AppX Deployment Service (AppXSVC) improperly handles hard links, aka \u0027Windows Elevation of Privilege Vulnerability\u0027. This CVE ID is unique from CVE-2019-0730, CVE-2019-0731, CVE-2019-0796, CVE-2019-0805, CVE-2019-0836.",
  "id": "GHSA-wqq2-j7vf-7rw9",
  "modified": "2025-10-22T00:31:38Z",
  "published": "2022-05-13T01:21:38Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2019-0841"
    },
    {
      "type": "WEB",
      "url": "https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2019-0841"
    },
    {
      "type": "WEB",
      "url": "https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2019-0841"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/46683"
    },
    {
      "type": "WEB",
      "url": "https://www.zerodayinitiative.com/advisories/ZDI-19-360"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.com/files/152463/Microsoft-Windows-AppX-Deployment-Service-Privilege-Escalation.html"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.com/files/153009/Internet-Explorer-JavaScript-Privilege-Escalation.html"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.com/files/153114/Microsoft-Windows-AppX-Deployment-Service-Local-Privilege-Escalation.html"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.com/files/153215/Microsoft-Windows-AppX-Deployment-Service-Local-Privilege-Escalation.html"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.com/files/153642/AppXSvc-Hard-Link-Privilege-Escalation.html"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-WQWC-X3RC-2XW6

Vulnerability from github – Published: 2026-05-12 21:31 – Updated: 2026-05-19 15:39
VLAI
Summary
HashiCorp Nomad’s exec2 task driver vulnerable to a symlink attack
Details

HashiCorp Nomad’s exec2 task driver prior to 0.1.2 is vulnerable to arbitrary file read and write on the client host as the Nomad process user through a symlink attack. This vulnerability (CVE-2026-8052) is fixed in version 0.1.2 of the exec2 task driver.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/hashicorp/nomad-driver-exec2"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.1.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-8052"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-05-19T15:39:35Z",
    "nvd_published_at": "2026-05-12T20:16:46Z",
    "severity": "MODERATE"
  },
  "details": "HashiCorp Nomad\u2019s exec2 task driver prior to 0.1.2 is vulnerable to arbitrary file read and write on the client host as the Nomad process user through a symlink attack. This vulnerability (CVE-2026-8052) is fixed in version 0.1.2 of the exec2 task driver.",
  "id": "GHSA-wqwc-x3rc-2xw6",
  "modified": "2026-05-19T15:39:35Z",
  "published": "2026-05-12T21:31:35Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-8052"
    },
    {
      "type": "WEB",
      "url": "https://discuss.hashicorp.com/t/hcsec-2026-13-nomads-exec2-task-driver-vulnerable-to-arbitrary-file-read-write-on-client-host-through-symlink-attack/77415"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/hashicorp/nomad-driver-exec2"
    },
    {
      "type": "WEB",
      "url": "https://github.com/hashicorp/nomad-driver-exec2/releases/tag/v0.1.2"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:C/C:N/I:H/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "HashiCorp Nomad\u2019s exec2 task driver vulnerable to a symlink attack"
}

GHSA-WR3G-J6QJ-XPGH

Vulnerability from github – Published: 2026-11-19 23:59 – Updated: 2026-11-19 23:59
VLAI
Summary
NLTK: ZIP package extraction follows in-root hardlinks and overwrites files outside the NLTK data root
Details

Summary

NLTK ships a security wrapper, nltk.pathsec.ZipFile, that is meant to confine archive extraction to trusted data roots and to block link-based escapes. When nltk.download() installs a package, the extraction write opens each member's target path without checking whether that path is a hardlink to a file located outside the data root. A local actor who can write inside a shared or predictable NLTK data root (for example ~/nltk_data, a group-writable /usr/share/nltk_data, or a shared container volume) can pre-plant an in-root hardlink at a member path that a soon-to-be-installed package will write. When the victim later runs the download, extraction truncates and overwrites the outside-root target through that hardlink. This is the same weakness class as the previously fixed downloader hardlink issue, but the fix did not reach the package-extraction write sink, so the latest published release remains exploitable through this path.

Root Cause

The prior fix added an st_nlink > 1 refusal to the file-open helpers (nltk.pathsec.open / _hardened_open) and routed the downloader temporary-file write through that hardened opener, so a multiply-linked inode is refused on those paths. The extraction write sink was never given the same check. On published releases, nltk.pathsec.ZipFile.extract validates member names with validate_zip_archive and then delegates to the standard library extractor, whose plain open(targetpath, "wb") opens and truncates a pre-existing hardlink. The containment guard validate_zip_archive relies on Path.resolve() and name checks; resolve() follows symlinks (so a symlinked member is correctly refused) but a hardlink has a legitimate in-root name and in-root resolved path, so it passes. No code on the extraction path performs the st_nlink fstat that the sibling open helper performs.

Affected component: nltk.pathsec (archive extraction), driven by nltk.downloader
Released sink (<= 3.10.3): nltk/pathsec.py ZipFile.extract -> stdlib zipfile._extract_member -> open(targetpath, "wb")
Containment guard that fails open for hardlinks: nltk/pathsec.py validate_zip_archive (name checks + Path.resolve())
Development-branch sink: nltk/pathsec.py ZipFile._extract_member leaf reopen with O_WRONLY|O_TRUNC|O_NOFOLLOW (no st_nlink fstat)

Impact

An unprivileged local user who can create a file inside a data root that the victim's NLTK installation will extract into can cause the victim's process to truncate and overwrite a file outside that root. The attacker chooses which outside file is destroyed by selecting the hardlink target, so the integrity impact is complete for the chosen path (arbitrary outside-root file destruction). Where the victim resolves packages through an attacker-influenced mirror or index, the overwritten bytes are also attacker-chosen, which plausibly enables targeted file replacement and later code execution if the victim subsequently consumes the replaced file; that escalation is plausible rather than demonstrated here. Practical exploitation requires either that kernel hardlink protection (fs.protected_hardlinks) is disabled, or that the outside target is one the planting actor is permitted to hardlink (owned, writable, or group-shared), which is the same precondition carried by the previously accepted advisory for this weakness class.

Proof of Concept

Dependencies: a released nltk (3.10.3) installed from PyPI. The demonstration creates a data root, a victim file outside it, and a package archive whose member path is pre-planted as a hardlink to the victim file, then extracts through the security wrapper. It runs as a single user and succeeds even with fs.protected_hardlinks=1.

Steps: 1. Register a data root with nltk.data.path and create an extraction subtree inside it. 2. Create a victim file outside the data root. 3. Pre-plant an in-root hardlink at the member path the archive will write. 4. Extract the archive through nltk.pathsec.ZipFile.extract.

import os, sys, tempfile, zipfile
import nltk
import nltk.pathsec as ps

work = tempfile.mkdtemp()
data_root = os.path.join(work, "nltk_data")
extract_root = os.path.join(data_root, "corpora")
os.makedirs(os.path.join(extract_root, "pkgid"))
nltk.data.path.insert(0, data_root)

outside = os.path.join(work, "victim.txt")
open(outside, "w").write("ORIGINAL-VICTIM-CONTENT")

zippath = os.path.join(data_root, "pkg.zip")
with zipfile.ZipFile(zippath, "w") as z:
    z.writestr("pkgid/target", "PWNED-BY-EXTRACTION")

member_abs = os.path.join(extract_root, "pkgid/target")
os.link(outside, member_abs)  # pre-planted in-root hardlink

with ps.ZipFile(zippath, "r") as z:
    z.extract("pkgid/target", path=extract_root)

print("victim now:", open(outside).read())
victim now: PWNED-BY-EXTRACTION

The equivalent test using a symlink instead of a hardlink is refused by validate_zip_archive with a Security Violation, isolating the missing guard to hardlinks on the extraction write.

Attack Chain

  1. Exposure: nltk.download() (and python -m nltk.downloader) is the shipped, default entry point; extraction of .zip packages into a data root is default behavior and is reachable by a local actor who can write inside a shared or predictable data root.
  2. Control: the attacker controls the target inode by pre-planting an in-root hardlink at <download_dir>/<subdir>/<pkg_id>/<member>, and (under an attacker-influenced mirror) the written bytes; the member name stays <pkg_id>/... so it satisfies every name guard.
  3. Path: the install path does not wipe the destination before extraction (the tree is only removed on a STALE status, and that cleanup unlinks names rather than truncating the victim inode), so the planted hardlink survives to the write. The value flows through the downloader expected_root check and _validate_member (which uses realpath, so a hardlink stays in-root), then through validate_zip_archive (which uses resolve()), to the extraction write.
  4. Guard: every guard on the path inspects names or resolved paths; none performs the st_nlink > 1 fstat. resolve(), realpath(), and O_NOFOLLOW all fail to detect a hardlink because a hardlink is an ordinary regular file with a legitimate in-root name.
  5. Primitive: the member write opens the pre-existing hardlink and truncates plus overwrites the outside-root inode.
  6. Result: the victim-owned file chosen by the planting actor is destroyed and replaced with the extracted member's bytes, crossing from the managed data root out to the general filesystem.

Bypass Evidence

The prior remediation for this weakness is the canonical reference here: it added st_nlink > 1 refusals to nltk.pathsec.open / _hardened_open and routed the downloader temporary-file write through that opener. The new evidence is that the extraction write sink was never covered by that fix. On the released 3.10.3 wheel obtained from PyPI, the only st_nlink occurrences are inside the open helper; ZipFile.extract validates names and then calls the standard library extractor with no st_nlink check. Attempts to disprove the finding were made and failed:

  • Hypothesis that the released 3.10.3 routes extraction through a hardened or st_nlink path: refuted by inspecting the released wheel (ZipFile.extract delegates to the standard library, no override, no st_nlink on the extraction path) and by dynamic reproduction (hardlink overwrote the outside file; symlink refused).
  • Hypothesis that validate_zip_archive or _validate_member catch the hardlink: refuted because both use resolve() / realpath(), which cannot reveal a hardlink; the symlink-refused versus hardlink-overwritten asymmetry was reproduced.
  • Hypothesis that the download flow wipes the destination before extraction: refuted because the wipe runs only on a STALE status and uses name unlink, which does not truncate the victim inode.
  • Hypothesis that O_NOFOLLOW / O_EXCL on the development branch block it: refuted because O_NOFOLLOW guards only against a symlink final component and O_EXCL merely diverts to the truncate reopen branch; neither performs the st_nlink fstat.
  • Hypothesis that kernel hardlink protection makes it a non-issue: retained as a severity bound, not a disqualifier, because the same precondition applies to the previously accepted advisory for this weakness class.

Affected Versions

  • Ecosystem: pip
  • Package: nltk
  • Confirmed affected range: >= 3.9.4, <= 3.10.3
  • Latest release checked: 3.10.3 (PyPI, nltk-3.10.3-py3-none-any.whl)
  • Fix status: not fixed (latest published release is affected; no fixed version exists)

The latest published release (3.10.3) carries the open-helper fix for the related downloader issue yet remains exploitable through the extraction sink, so the upper bound is the current release and no fixed version exists. Releases 3.9.4 through 3.10.2 have no st_nlink guard at all and follow the hardlink through the same extraction path (confirmed by wheel inspection); the range floor 3.9.4 is the earliest release carrying this nltk.pathsec extraction path. The development branch adds a hardened extraction override that still omits the st_nlink check, so the same vector persists there through a different sink symbol; a fixed release should not be inferred from that development-branch change.

Suggested Fix

Enforce the invariant that an extraction write must never land on a multiply-linked inode. Extend the existing st_nlink > 1 refusal (as implemented in the hardened open helper) to the extraction write descriptor: after opening or creating the leaf target, fstat the descriptor and refuse an inode with st_nlink > 1 before truncating or writing. Apply this on both the released delegation path and the development-branch _extract_member override, or alternatively have validate_zip_archive / the downloader member validator fstat each existing target and refuse a multiply-linked inode. As an interim mitigation, operators should ensure fs.protected_hardlinks=1 is enabled and avoid shared, group-writable, or predictable data roots for accounts that run untrusted downloads.

Reported by zx (GitHub: @manus-pi).

Fix status (2026-09-28)

Status: IN PROGRESS (fix on an open pull request, not yet on develop).

PR: #3753 "[Do not merge yet] Fix GHSA-8mgp-746c-j5xp: URL-scheme bypass of pathsec.validate_path", open; head da55cab0e at the time of this note (a develop merge on top of 238f81500, the head on which the verdicts below were measured).

Fix commit: cf12a5e6a (pathsec.ZipFile._extract_member resolves member names to ZipInfo so the hardened extraction path actually runs, refuses a target with st_nlink greater than 1, and replaces through unlink plus O_EXCL; the downloader adds an lstat pre-check).

Probe: nltk/test/unit/security_probes/ghsa_wr3g_j6qj_xpgh.py (on the PR). Verdict on the PR head: FIXED (hardlinked member target refused with PermissionError). The same probe run against develop 2fa3f48fe: VULNERABLE (extraction wrote through the hardlink to the outside secret).

Release: none.

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 3.10.3"
      },
      "package": {
        "ecosystem": "PyPI",
        "name": "nltk"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.9.4"
            },
            {
              "fixed": "3.10.4"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-128135"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59",
      "CWE-73"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-19T23:59:15Z",
    "nvd_published_at": "2026-11-19T18:18:05Z",
    "severity": "HIGH"
  },
  "details": "## Summary\n\nNLTK ships a security wrapper, `nltk.pathsec.ZipFile`, that is meant to confine archive extraction to trusted data roots and to block link-based escapes. When `nltk.download()` installs a package, the extraction write opens each member\u0027s target path without checking whether that path is a hardlink to a file located outside the data root. A local actor who can write inside a shared or predictable NLTK data root (for example `~/nltk_data`, a group-writable `/usr/share/nltk_data`, or a shared container volume) can pre-plant an in-root hardlink at a member path that a soon-to-be-installed package will write. When the victim later runs the download, extraction truncates and overwrites the outside-root target through that hardlink. This is the same weakness class as the previously fixed downloader hardlink issue, but the fix did not reach the package-extraction write sink, so the latest published release remains exploitable through this path.\n\n## Root Cause\n\nThe prior fix added an `st_nlink \u003e 1` refusal to the file-open helpers (`nltk.pathsec.open` / `_hardened_open`) and routed the downloader temporary-file write through that hardened opener, so a multiply-linked inode is refused on those paths. The extraction write sink was never given the same check. On published releases, `nltk.pathsec.ZipFile.extract` validates member names with `validate_zip_archive` and then delegates to the standard library extractor, whose plain `open(targetpath, \"wb\")` opens and truncates a pre-existing hardlink. The containment guard `validate_zip_archive` relies on `Path.resolve()` and name checks; `resolve()` follows symlinks (so a symlinked member is correctly refused) but a hardlink has a legitimate in-root name and in-root resolved path, so it passes. No code on the extraction path performs the `st_nlink` fstat that the sibling open helper performs.\n\n```text\nAffected component: nltk.pathsec (archive extraction), driven by nltk.downloader\nReleased sink (\u003c= 3.10.3): nltk/pathsec.py ZipFile.extract -\u003e stdlib zipfile._extract_member -\u003e open(targetpath, \"wb\")\nContainment guard that fails open for hardlinks: nltk/pathsec.py validate_zip_archive (name checks + Path.resolve())\nDevelopment-branch sink: nltk/pathsec.py ZipFile._extract_member leaf reopen with O_WRONLY|O_TRUNC|O_NOFOLLOW (no st_nlink fstat)\n```\n\n## Impact\n\nAn unprivileged local user who can create a file inside a data root that the victim\u0027s NLTK installation will extract into can cause the victim\u0027s process to truncate and overwrite a file outside that root. The attacker chooses which outside file is destroyed by selecting the hardlink target, so the integrity impact is complete for the chosen path (arbitrary outside-root file destruction). Where the victim resolves packages through an attacker-influenced mirror or index, the overwritten bytes are also attacker-chosen, which plausibly enables targeted file replacement and later code execution if the victim subsequently consumes the replaced file; that escalation is plausible rather than demonstrated here. Practical exploitation requires either that kernel hardlink protection (`fs.protected_hardlinks`) is disabled, or that the outside target is one the planting actor is permitted to hardlink (owned, writable, or group-shared), which is the same precondition carried by the previously accepted advisory for this weakness class.\n\n## Proof of Concept\n\n`Dependencies: a released nltk (3.10.3) installed from PyPI. The demonstration creates a data root, a victim file outside it, and a package archive whose member path is pre-planted as a hardlink to the victim file, then extracts through the security wrapper. It runs as a single user and succeeds even with fs.protected_hardlinks=1.`\n\nSteps:\n1. Register a data root with `nltk.data.path` and create an extraction subtree inside it.\n2. Create a victim file outside the data root.\n3. Pre-plant an in-root hardlink at the member path the archive will write.\n4. Extract the archive through `nltk.pathsec.ZipFile.extract`.\n\n```python\nimport os, sys, tempfile, zipfile\nimport nltk\nimport nltk.pathsec as ps\n\nwork = tempfile.mkdtemp()\ndata_root = os.path.join(work, \"nltk_data\")\nextract_root = os.path.join(data_root, \"corpora\")\nos.makedirs(os.path.join(extract_root, \"pkgid\"))\nnltk.data.path.insert(0, data_root)\n\noutside = os.path.join(work, \"victim.txt\")\nopen(outside, \"w\").write(\"ORIGINAL-VICTIM-CONTENT\")\n\nzippath = os.path.join(data_root, \"pkg.zip\")\nwith zipfile.ZipFile(zippath, \"w\") as z:\n    z.writestr(\"pkgid/target\", \"PWNED-BY-EXTRACTION\")\n\nmember_abs = os.path.join(extract_root, \"pkgid/target\")\nos.link(outside, member_abs)  # pre-planted in-root hardlink\n\nwith ps.ZipFile(zippath, \"r\") as z:\n    z.extract(\"pkgid/target\", path=extract_root)\n\nprint(\"victim now:\", open(outside).read())\n```\n\n```text\nvictim now: PWNED-BY-EXTRACTION\n```\n\nThe equivalent test using a symlink instead of a hardlink is refused by `validate_zip_archive` with a Security Violation, isolating the missing guard to hardlinks on the extraction write.\n\n## Attack Chain\n\n1. **Exposure:** `nltk.download()` (and `python -m nltk.downloader`) is the shipped, default entry point; extraction of `.zip` packages into a data root is default behavior and is reachable by a local actor who can write inside a shared or predictable data root.\n2. **Control:** the attacker controls the target inode by pre-planting an in-root hardlink at `\u003cdownload_dir\u003e/\u003csubdir\u003e/\u003cpkg_id\u003e/\u003cmember\u003e`, and (under an attacker-influenced mirror) the written bytes; the member name stays `\u003cpkg_id\u003e/...` so it satisfies every name guard.\n3. **Path:** the install path does not wipe the destination before extraction (the tree is only removed on a STALE status, and that cleanup unlinks names rather than truncating the victim inode), so the planted hardlink survives to the write. The value flows through the downloader `expected_root` check and `_validate_member` (which uses `realpath`, so a hardlink stays in-root), then through `validate_zip_archive` (which uses `resolve()`), to the extraction write.\n4. **Guard:** every guard on the path inspects names or resolved paths; none performs the `st_nlink \u003e 1` fstat. `resolve()`, `realpath()`, and `O_NOFOLLOW` all fail to detect a hardlink because a hardlink is an ordinary regular file with a legitimate in-root name.\n5. **Primitive:** the member write opens the pre-existing hardlink and truncates plus overwrites the outside-root inode.\n6. **Result:** the victim-owned file chosen by the planting actor is destroyed and replaced with the extracted member\u0027s bytes, crossing from the managed data root out to the general filesystem.\n\n## Bypass Evidence\n\nThe prior remediation for this weakness is the canonical reference here: it added `st_nlink \u003e 1` refusals to `nltk.pathsec.open` / `_hardened_open` and routed the downloader temporary-file write through that opener. The new evidence is that the extraction write sink was never covered by that fix. On the released 3.10.3 wheel obtained from PyPI, the only `st_nlink` occurrences are inside the open helper; `ZipFile.extract` validates names and then calls the standard library extractor with no `st_nlink` check. Attempts to disprove the finding were made and failed:\n\n- Hypothesis that the released 3.10.3 routes extraction through a hardened or `st_nlink` path: refuted by inspecting the released wheel (`ZipFile.extract` delegates to the standard library, no override, no `st_nlink` on the extraction path) and by dynamic reproduction (hardlink overwrote the outside file; symlink refused).\n- Hypothesis that `validate_zip_archive` or `_validate_member` catch the hardlink: refuted because both use `resolve()` / `realpath()`, which cannot reveal a hardlink; the symlink-refused versus hardlink-overwritten asymmetry was reproduced.\n- Hypothesis that the download flow wipes the destination before extraction: refuted because the wipe runs only on a STALE status and uses name unlink, which does not truncate the victim inode.\n- Hypothesis that `O_NOFOLLOW` / `O_EXCL` on the development branch block it: refuted because `O_NOFOLLOW` guards only against a symlink final component and `O_EXCL` merely diverts to the truncate reopen branch; neither performs the `st_nlink` fstat.\n- Hypothesis that kernel hardlink protection makes it a non-issue: retained as a severity bound, not a disqualifier, because the same precondition applies to the previously accepted advisory for this weakness class.\n\n## Affected Versions\n\n- `Ecosystem: pip`\n- `Package: nltk`\n- `Confirmed affected range: \u003e= 3.9.4, \u003c= 3.10.3`\n- `Latest release checked: 3.10.3 (PyPI, nltk-3.10.3-py3-none-any.whl)`\n- `Fix status: not fixed (latest published release is affected; no fixed version exists)`\n\nThe latest published release (3.10.3) carries the open-helper fix for the related downloader issue yet remains exploitable through the extraction sink, so the upper bound is the current release and no fixed version exists. Releases 3.9.4 through 3.10.2 have no `st_nlink` guard at all and follow the hardlink through the same extraction path (confirmed by wheel inspection); the range floor 3.9.4 is the earliest release carrying this `nltk.pathsec` extraction path. The development branch adds a hardened extraction override that still omits the `st_nlink` check, so the same vector persists there through a different sink symbol; a fixed release should not be inferred from that development-branch change.\n\n## Suggested Fix\n\nEnforce the invariant that an extraction write must never land on a multiply-linked inode. Extend the existing `st_nlink \u003e 1` refusal (as implemented in the hardened open helper) to the extraction write descriptor: after opening or creating the leaf target, `fstat` the descriptor and refuse an inode with `st_nlink \u003e 1` before truncating or writing. Apply this on both the released delegation path and the development-branch `_extract_member` override, or alternatively have `validate_zip_archive` / the downloader member validator `fstat` each existing target and refuse a multiply-linked inode. As an interim mitigation, operators should ensure `fs.protected_hardlinks=1` is enabled and avoid shared, group-writable, or predictable data roots for accounts that run untrusted downloads.\n\nReported by zx (GitHub: @manus-pi).\n\n## Fix status (2026-09-28)\n\nStatus: IN PROGRESS (fix on an open pull request, not yet on develop).\n\nPR: #3753 \"[Do not merge yet] Fix GHSA-8mgp-746c-j5xp: URL-scheme bypass of pathsec.validate_path\", open; head da55cab0e at the time of this note (a develop merge on top of 238f81500, the head on which the verdicts below were measured).\n\nFix commit: cf12a5e6a (pathsec.ZipFile._extract_member resolves member names to ZipInfo so the hardened extraction path actually runs, refuses a target with st_nlink greater than 1, and replaces through unlink plus O_EXCL; the downloader adds an lstat pre-check).\n\nProbe: nltk/test/unit/security_probes/ghsa_wr3g_j6qj_xpgh.py (on the PR). Verdict on the PR head: FIXED (hardlinked member target refused with PermissionError). The same probe run against develop 2fa3f48fe: VULNERABLE (extraction wrote through the hardlink to the outside secret).\n\nRelease: none.",
  "id": "GHSA-wr3g-j6qj-xpgh",
  "modified": "2026-11-19T23:59:15Z",
  "published": "2026-11-19T23:59:15Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/nltk/nltk/security/advisories/GHSA-wr3g-j6qj-xpgh"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-128135"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nltk/nltk/pull/3753"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nltk/nltk/commit/0e9898b7615b4ab3b023e868212316a489ece4f0"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nltk/nltk/commit/cf12a5e6a439fe1d722acd53d4309911faaaaf78"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/nltk/nltk"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nltk/nltk/releases/tag/v3.10.4"
    }
  ],
  "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"
    }
  ],
  "summary": "NLTK: ZIP package extraction follows in-root hardlinks and overwrites files outside the NLTK data root"
}

GHSA-WR7G-5V93-63R2

Vulnerability from github – Published: 2022-05-17 02:18 – Updated: 2022-05-17 02:18
VLAI
Details

inmail-show in mh-book 200605 allows local users to overwrite arbitrary files via a symlink attack on a (1) /tmp/inmail#####.log or (2) /tmp/inmail#####.stdin temporary file.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2008-5152"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2008-11-18T16:00:00Z",
    "severity": "MODERATE"
  },
  "details": "inmail-show in mh-book 200605 allows local users to overwrite arbitrary files via a symlink attack on a (1) /tmp/inmail#####.log or (2) /tmp/inmail#####.stdin temporary file.",
  "id": "GHSA-wr7g-5v93-63r2",
  "modified": "2022-05-17T02:18:02Z",
  "published": "2022-05-17T02:18:02Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2008-5152"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/46709"
    },
    {
      "type": "WEB",
      "url": "http://lists.debian.org/debian-devel/2008/08/msg00347.html"
    },
    {
      "type": "WEB",
      "url": "http://uvw.ru/report.sid.txt"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/32399"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-WR8V-PMCM-77GW

Vulnerability from github – Published: 2022-05-24 19:05 – Updated: 2022-05-24 19:05
VLAI
Details

It was discovered that read_file() in apport/hookutils.py would follow symbolic links or open FIFOs. When this function is used by the openjdk-15 package apport hooks, it could expose private data to other local users.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2021-32551"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2021-06-12T04:15:00Z",
    "severity": "MODERATE"
  },
  "details": "It was discovered that read_file() in apport/hookutils.py would follow symbolic links or open FIFOs. When this function is used by the openjdk-15 package apport hooks, it could expose private data to other local users.",
  "id": "GHSA-wr8v-pmcm-77gw",
  "modified": "2022-05-24T19:05:16Z",
  "published": "2022-05-24T19:05:16Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2021-32551"
    },
    {
      "type": "WEB",
      "url": "https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1917904"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-WRMV-W7W7-JXC9

Vulnerability from github – Published: 2026-10-30 18:32 – Updated: 2026-10-30 18:32
VLAI
Details

Bastille through 1.4.4 contains a symlink following vulnerability in the cp.sh, rcp.sh and jcp.sh subcommands that allows jailed users to escape jail isolation. Attackers inside a jail can plant symlinks pointing to host paths or other jail roots, so administrator-run copies overwrite or read host files with root privileges.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-119704"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-10-30T16:17:51Z",
    "severity": "MODERATE"
  },
  "details": "Bastille through 1.4.4 contains a symlink following vulnerability in the cp.sh, rcp.sh and jcp.sh subcommands that allows jailed users to escape jail isolation. Attackers inside a jail can plant symlinks pointing to host paths or other jail roots, so administrator-run copies overwrite or read host files with root privileges.",
  "id": "GHSA-wrmv-w7w7-jxc9",
  "modified": "2026-10-30T18:32:38Z",
  "published": "2026-10-30T18:32:38Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-119704"
    },
    {
      "type": "WEB",
      "url": "https://github.com/BastilleBSD/bastille/issues/1673"
    },
    {
      "type": "WEB",
      "url": "https://github.com/BastilleBSD/bastille/commit/accc246ba92602c355afc66d0d8b9d43277532e1"
    },
    {
      "type": "WEB",
      "url": "https://github.com/BastilleBSD/bastille"
    },
    {
      "type": "WEB",
      "url": "https://github.com/BastilleBSD/bastille/blob/1.4.4/usr/local/share/bastille/cp.sh#L98-L110"
    },
    {
      "type": "WEB",
      "url": "https://www.vulncheck.com/advisories/bastille-through-1.4.4-jail-escape-via-symlink-following-in-cp-rcp-jcp"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:L/I:H/A:H",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:P/VC:L/VI:H/VA:H/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"
    }
  ]
}

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.