NLTK: Default ENFORCE=False Disables All pathsec Security Controls
CVE-2026-62388 · GHSA-p3m8-78j2-g5p3 · published 2 Sept 2026
How serious is it
- Severity: high, CVSS score 8.7 out of 10.
- No exploit prediction (EPSS) score yet.
- Not on the CISA list of exploited vulnerabilities.
- No public exploit in Exploit-DB.
Is your app affected by CVE-2026-62388?
Paste this prompt into Claude Code, Cursor or any AI coding tool: it runs a free Shippable scan of your project and fixes what it finds. Built with Lovable, Bolt or v0? Scan your live app. Or upload your package file.
Who is affected
nltk(PyPI) <= 3.9.4
How to check
- Run
pip show nltkin your project to see the installed version, including copies pulled in by other packages. - Or paste your lockfile into the checker: it lists every package with a known vulnerability, this one included.
- Or run
npx shippable-dev scan localhost:3000in your project folder. It reads your lockfile and flags this vulnerability along with every other known one.
How to fix
Copies a prompt for Claude Code, Cursor or Codex: it checks your lockfiles for this and upgrades it.
- Upgrade
nltkto 3.10.0 or later, commit the lockfile and redeploy. - If a vulnerable version was live, check your logs and rotate the secrets that server could read.
The advisory
NLTK's pathsec.py security module defaults to ENFORCE=False (line 24), which means all 8 security validation functions only emit RuntimeWarning instead of raising exceptions when violations are detected.
The pathsec module was introduced as the fix for CVE-2024-39705 (arbitrary code execution via pickle) and CVE-2026-0846 (path traversal). However, with ENFORCE=False as the default:
1. pathsec.open('/etc/passwd') succeeds (reads the file, emits warning)
2. pathsec.validate_network_url('http://169.254.169.254/...') succeeds (warning only)
3. pickle.loads() via nltk.data.load() proceeds despite unsafe source (warning only)
Every security gate follows the same pattern:
```python
ENFORCE = os.environ.get('NLTK_PATHSEC_ENFORCE', '').lower() in ('1', 'true', 'yes')
def validate_something(path):
if is_violation(path):
if ENFORCE:
raise SecurityError('...') # Only raised when env var is set
else:
warnings.warn('...', RuntimeWarning) # Default: warning only
# Execution continues regardless
```
This means the security remediations for CVE-2024-39705 and CVE-2026-0846 are effectively disabled by default. Any user who installed NLTK 3.9.x expecting the security fixes to be active is still vulnerable unless they manually set NLTK_PATHSEC_ENFORCE=1.
PoC:
```python
import nltk.pathsec
import warnings
# Show that ENFORCE is False by default
print(f'ENFORCE = {nltk.pathsec.ENFORCE}') # False
# Attempt to read /etc/passwd through pathsec -- should be blocked
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
result = nltk.pathsec.open('/etc/passwd', 'r')
print(f'File opened: {result.name}') # /etc/passwd
print(f'Warning emitted: {w[0].message}') # RuntimeWarning (not an exception)
# Attack succeeds -- file is readable
```
The correct default is fail-secure: ENFORCE should be True unless explicitly disabled. The current default makes the security module opt-in rather than opt-out, defeating its purpose.
Suggested fix: Change default to ENFORCE=True. Users who need backwards compatibility can set NLTK_PATHSEC_ENFORCE=0 to explicitly disable.
Check your whole app
Dependencies are only half of it. Free and read-only: before you push, run npx shippable-dev scan localhost:3000 in your project folder, no account needed. For your live app, you prove it's yours with a one-line tag first.
References
- github.com/nltk/nltk/security/advisories/GHSA-p3m8-78j2-g5p3
- nvd.nist.gov/vuln/detail/CVE-2026-62388
- github.com/nltk/nltk/pull/3593
- github.com/nltk/nltk/commit/155e40343cff0bf50d233e274a12e04d1428b1d9
- github.com/nltk/nltk/releases/tag/v3.10.0
- github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3722.yaml
- www.vulncheck.com/advisories/nltk-before-insecure-default-configuration-pathsec
- github.com/advisories/GHSA-p3m8-78j2-g5p3
Merged from GitHub Advisory Database. Last updated 28 Oct 2026. All vulnerabilities · RSS · JSON