Junglewise Threat Intelligence

NLTK insecure default configuration in pathsec

Severity: high · CVSS 7.5 · Published 2026-08-22

Executive brief

NLTK is a popular Python library for natural language processing that includes a pathsec security module designed to prevent arbitrary code execution and unauthorized file access. Due to an insecure default configuration, these security protections are disabled by default and only emit warnings rather than blocking dangerous operations. Attackers can exploit this to read sensitive files or execute arbitrary code via pickle deserialization without setting an environment variable that most users are unaware of.

Technical details

The vulnerability is an insecure default configuration (CWE-1188) in NLTK's pathsec.py module. The ENFORCE flag defaults to False, causing eight security validation functions to emit RuntimeWarning instead of raising exceptions when violations are detected. The pathsec module was designed to remediate CVE-2024-39705 (pickle arbitrary code execution) and CVE-2026-0846 (path traversal), but with ENFORCE=False as the default, these protections are opt-in rather than opt-out. An unauthenticated attacker can read arbitrary files via pathsec.open() or bypass pickle deserialization safety checks via nltk.data.load() with untrusted sources—the module succeeds and only emits a warning. The security controls require manual activation by setting the NLTK_PATHSEC_ENFORCE environment variable to '1', 'true', or 'yes'. The fix is available in NLTK 3.10.0, which changes the default to ENFORCE=True.

Affected products

  • NLTK Project NLTK <= 3.9.4

Timeline

  • 2026-08-07: disclosed: Original advisory published
  • 2026-08-22: advisory: Published to GitHub Advisory Database and NVD as CVE-2026-62388
  • 2026-08-22: patched: Fix available in NLTK 3.10.0

References

Related threats