{"id":"CVE-2026-81726","kind":"vulnerability","aliases":["CVE-2026-81726","GHSA-8mgp-746c-j5xp"],"related":[],"title":"NLTK: Model-artifact APIs bypass pathsec and touch files outside allowed roots","description":"### Summary\n\nSeveral model-artifact APIs still treat caller-controlled model paths as ordinary filenames even when NLTK path security is enforced. The same outside-root paths are rejected by guarded helpers, but these public read and write flows still use raw file APIs.\n\n### Details\n\n- **Vulnerability type:** File sandbox bypass\n- **Affected component:** `TransitionParser.train`, `TransitionParser.parse`, `AveragedPerceptron.save`, `AveragedPerceptron.load`, `PerceptronTagger.save_to_json`, `save_maxent_params`\n- **Affected versions:** Published `3.9.4` and current source `v3.10.0-rc2` both reproduced.\n- **Patched versions:** Not yet patched\n- **Root cause:** Model import and export helpers use built-in `open()` on caller-controlled paths instead of pathsec-aware helpers.\n\n`TransitionParser.train()` writes outside allowed roots, `TransitionParser.parse()` reads outside allowed roots, `AveragedPerceptron` bypasses the sandbox in both directions, and adjacent read-side helpers in the same family already show the intended guarded behavior. I confirmed outside-root reads and writes while `pathsec.open()` or the guarded sibling helpers rejected the same paths.\n\n### PoC\n\n**Preconditions**\n- The application enables `pathsec` enforcement and lets untrusted workflows choose model import or export paths.\n\n**Steps**\n1. Enable `pathsec.ENFORCE=True` and restrict allowed roots to a dedicated sandbox directory.\n2. Use public model import or export APIs with paths that point outside that root.\n3. Observe the same paths are rejected by negative-control guarded helpers such as `pathsec.open()`, `PerceptronTagger.load_from_json()`, or `load_maxent_params()`.\n4. Observe the vulnerable APIs still read or write outside-root files successfully.\n\n**Minimal reproducible excerpt**\n\n```text\ntransition_train_exists True\ntransition_parse_loader_read_bytes 13\naveraged_load_keys ['bias']\nmaxent_save wrote ['alwayson.tab', 'labels.txt']\n```\n\n### Impact\n\nConsumers that rely on `pathsec` for local containment can be tricked into reading or overwriting files outside approved roots through normal model persistence and loading APIs.\n\n### Remediation\n\nRoute all model-path file access through `nltk.pathsec.open()` or existing pathsec-aware helpers, and add regression tests that pair each vulnerable API with a negative control on the same path.\n\n### References\n\n- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/parse/transitionparser.py#L551-L571\n- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/tag/perceptron.py#L106-L113\n- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/tag/perceptron.py#L262-L273\n- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/classify/maxent.py#L1583-L1602","summary":"NLTK's model import and export functions (perceptron tagger, transition parser, maxent) use plain file opens on caller-supplied paths, ignoring the pathsec restriction that other helpers enforce. An application that relies on pathsec to contain model file access can have files outside its allowed directories read or overwritten.","severity":"high","cvss":8.3,"epss":0.00339,"exploited":false,"exploited_at":null,"products":[{"name":"nltk","fixed":["3.10.4"],"affected":"<= 3.10.3","ecosystem":"pypi"},{"name":"nltk","fixed":["3.10.3"],"affected":"< 3.10.3","ecosystem":"vendor"}],"ecosystems":["pypi","vendor"],"tags":["cwe-22","cwe-59","cwe-73","nltk","package","pathsec","python"],"not_affected_if":["fixed-model-paths","nltk-not-used-for-model-io","no-pathsec-reliance"],"how_to_check":"- Check the installed NLTK version with `pip show nltk`; affected versions are `3.10.3` and below.\n- Search your code for calls to `TransitionParser.train`, `TransitionParser.parse`, `AveragedPerceptron.save`, `AveragedPerceptron.load`, `PerceptronTagger.save_to_json` or `save_maxent_params`, especially where the path comes from user input or a workflow.\n- Check whether `pathsec.ENFORCE` is set to True in your application.","fix":"- nltk: move to `3.10.4` (the fixed version named in the advisory data).","status":"open","published_at":"2026-08-27T17:21:03+00:00","first_seen_at":"2026-11-02T22:08:14+00:00","triaged_at":"2026-11-02T22:08:23+00:00","updated_at":"2026-11-02T22:35:43+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-11-02T22:08:23Z","model":"claude-haiku-5-5","output":{"fix":"- nltk: move to `3.10.4` (the fixed version named in the advisory data).","reach":"local","title":"NLTK: model save and load APIs skip path sandbox, touching outside files","impact":"medium","summary":"NLTK's model import and export functions (perceptron tagger, transition parser, maxent) use plain file opens on caller-supplied paths, ignoring the pathsec restriction that other helpers enforce. An application that relies on pathsec to contain model file access can have files outside its allowed directories read or overwritten.","audience":"developers","category":"package","nicknames":[],"who_cares":["python","nltk","pathsec"],"confidence":0.8,"fix_status":"available","needs_auth":"unknown","worst_case":"Attacker reads or overwrites files outside the approved directory","analyst_note":"","how_to_check":"- Check the installed NLTK version with `pip show nltk`; affected versions are `3.10.3` and below.\n- Search your code for calls to `TransitionParser.train`, `TransitionParser.parse`, `AveragedPerceptron.save`, `AveragedPerceptron.load`, `PerceptronTagger.save_to_json` or `save_maxent_params`, especially where the path comes from user input or a workflow.\n- Check whether `pathsec.ENFORCE` is set to True in your application.","plain_action":"","needs_analyst":false,"not_affected_if":["fixed-model-paths","no-pathsec-reliance","nltk-not-used-for-model-io"],"who_is_affected":"Applications that use NLTK model import or export functions and let untrusted input choose the file path, and that depend on NLTK's pathsec setting to keep those paths inside an approved directory. Code that only loads models from fixed, trusted paths is much less exposed. Projects that do not use these model APIs can skip it.","user_interaction":"no","needs_special_setup":"yes","severity_if_unknown":"high"},"cost_usd":0.000859,"input_tokens":5272,"output_tokens":664,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-2026':15A,23A '-22':28B '-59':30B '-73':32B '-81726':16A,24A '/nltk/nltk/blob/v3.10.0-rc2/nltk/classify/maxent.py#l1583-l1602':419C '/nltk/nltk/blob/v3.10.0-rc2/nltk/parse/transitionparser.py#l551-l571':410C '/nltk/nltk/blob/v3.10.0-rc2/nltk/tag/perceptron.py#l106-l113':413C '/nltk/nltk/blob/v3.10.0-rc2/nltk/tag/perceptron.py#l262-l273':416C '1':259C '13':337C '2':272C '3':287C '3.9.4':154C '4':310C '746c':20A '8mgp':19A 'access':76B,381C 'add':391C 'adjac':207C 'affect':139C,151C 'allow':12A,82B,192C,197C,265C 'alreadi':216C 'alwayson.tab':345C 'api':5A,92C,132C,279C,314C,373C,398C 'applic':67B,244C 'approv':365C 'artifact':4A,91C 'averag':338C 'averagedperceptron':199C 'averagedperceptron.load':144C 'averagedperceptron.save':143C 'awar':187C,388C 'behavior':221C 'bias':341C 'built':175C 'built-in':174C 'bypass':6A,138C,200C 'byte':336C 'caller':55B,96C,180C 'caller-control':95C,179C 'caller-suppli':54B 'caus':167C 'choos':252C 'compon':140C 'confirm':223C 'consum':348C 'contain':73B,355C 'control':97C,181C,297C,402C 'current':156C 'cve':14A,22A 'cwe':27B,29B,31B 'dedic':269C 'detail':133C 'direct':205C 'directori':83B,271C 'enabl':245C,260C 'enforc':65B,109C,247C 'even':103C 'excerpt':326C 'exist':330C,385C 'export':42B,171C,256C,278C 'famili':215C 'file':10A,51B,75B,79B,131C,136C,322C,363C,380C 'filenam':102C 'flow':127C 'function':43B 'ghsa':18A 'ghsa-8mgp-746c-j5xp':17A 'github.com':409C,412C,415C,418C 'github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/classify/maxent.py#l1583-l1602':417C 'github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/parse/transitionparser.py#l551-l571':408C 'github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/tag/perceptron.py#l106-l113':411C 'github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/tag/perceptron.py#l262-l273':414C 'guard':119C,220C,234C,298C 'helper':64B,120C,172C,188C,211C,236C,299C,389C 'ignor':58B 'impact':347C 'import':40B,169C,254C,276C 'instead':183C 'intend':219C 'j5xp':21A 'json':147C,305C 'key':340C 'labels.txt':346C 'let':249C 'load':307C,339C,372C 'loader':334C 'local':354C 'maxent':48B,149C,308C,342C 'minim':324C 'model':3A,39B,74B,90C,98C,168C,253C,275C,369C,378C 'model-artifact':2A,89C 'model-path':377C 'negat':296C,401C 'negative-control':295C 'nltk':1A,25A,26A,33B,37B,105C 'nltk.pathsec.open':383C 'normal':368C 'observ':288C,311C 'open':52B,177C 'ordinari':101C 'outsid':11A,80B,113C,191C,196C,225C,284C,320C,364C 'outside-root':112C,224C,319C 'overwrit':362C 'overwritten':86B 'packag':34B 'pair':395C 'param':150C,309C 'pars':333C 'parser':47B 'patch':161C,165C 'path':57B,99C,106C,115C,182C,240C,257C,281C,291C,379C,406C 'pathsec':7A,35B,60B,71B,186C,246C,352C,387C 'pathsec-awar':185C,386C 'pathsec.enforce':261C 'pathsec.open':231C,302C 'perceptron':44B 'perceptrontagger.load':303C 'perceptrontagger.save':145C 'persist':370C 'plain':50B 'poc':241C 'point':283C 'precondit':242C 'public':123C,274C 'publish':153C 'python':36B 'raw':130C 'read':84B,124C,195C,209C,227C,316C,335C,360C 'read-sid':208C 'refer':407C 'regress':392C 'reject':117C,237C,293C 'reli':69B,350C 'remedi':374C 'reproduc':160C,325C 'restrict':61B,264C 'root':13A,114C,166C,193C,198C,226C,266C,286C,321C,366C 'rout':375C 'sandbox':137C,202C,270C 'save':148C,343C 'secur':107C 'sever':88C 'show':217C 'sibl':235C 'side':210C 'sourc':157C 'step':258C 'still':93C,128C,315C 'success':323C 'summari':87C 'suppli':56B 'tagger':45B 'test':393C 'text':327C 'touch':9A 'train':329C 'transit':46B,328C,332C 'transitionparser.parse':142C,194C 'transitionparser.train':141C,189C 'treat':94C 'trick':358C 'true':262C,331C 'type':135C 'untrust':250C 'use':49B,129C,173C,273C 'v3.10.0-rc2':158C 'version':152C,162C 'vulner':134C,313C,397C 'workflow':251C 'write':126C,190C,229C,318C 'wrote':344C 'yet':164C","nicknames":[],"mitigations":[],"who_affected":"Applications that use NLTK model import or export functions and let untrusted input choose the file path, and that depend on NLTK's pathsec setting to keep those paths inside an approved directory. Code that only loads models from fixed, trusted paths is much less exposed. Projects that do not use these model APIs can skip it.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["nltk"],"ptokens":["nltk"],"labels":["cwe22","cwe59","cwe73","high","nltk","package","pathsec","pypi","python","vendor"],"first_public_at":"2026-08-12T16:21:41+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:L","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-8mgp-746c-j5xp","url":"https://github.com/advisories/GHSA-8mgp-746c-j5xp","severity":"high","published_at":"2026-09-02T14:35:04+00:00","modified_at":"2026-11-02T22:06:21+00:00","first_seen_at":"2026-11-02T22:08:14+00:00","fetched_at":"2026-11-02T22:13:21+00:00","note":null},{"source":"nvd","external_id":"CVE-2026-81726","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-81726","severity":null,"published_at":"2026-08-27T17:21:03+00:00","modified_at":"2026-10-30T11:17:33+00:00","first_seen_at":"2026-11-02T22:35:43+00:00","fetched_at":"2026-11-02T22:35:43+00:00","note":null}],"documents":[{"id":54095,"url":"https://api.github.com/repos/nltk/nltk/security-advisories/GHSA-8mgp-746c-j5xp","title":"Maintainer's advisory: api.github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Maintainer's advisory: api.github.com"},{"id":54096,"url":"https://github.com/nltk/nltk/security/advisories/GHSA-8mgp-746c-j5xp","title":"Maintainer's advisory: github.com","kind":"vendor","source":"ghsa","publisher":"vendor","text":null,"published_at":"2026-08-12T16:21:41+00:00","relation":"advisory","confidence":null,"note":"Maintainer's advisory: github.com"},{"id":54097,"url":"https://github.com/nltk/nltk/pull/3757","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":54098,"url":"https://github.com/nltk/nltk/pull/3759","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":54099,"url":"https://github.com/nltk/nltk/pull/3813","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":54100,"url":"https://github.com/nltk/nltk/commit/2a92b71827d754ae8920261e7ed0c4bb283ab2d7","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":54101,"url":"https://github.com/nltk/nltk/commit/a44a7af69bca87e92d9c4a701fcbbe4512e8d450","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":54102,"url":"https://github.com/nltk/nltk/commit/cbc98458b43de5f792f0382583c16df39e5c5117","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":54181,"url":"https://www.vulncheck.com/advisories/nltk-through-3.10.3-path-traversal-via-model-artifact-apis","title":"Third-party advisory: www.vulncheck.com","kind":"advisory","source":"nvd","publisher":"research","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Third-party advisory: www.vulncheck.com"}],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}