CVE-2026-62388: NLTK before 3.10.0 Insecure Default Configuration in pathsec.py

Published Aug 22, 2026
·
Updated

NLTK versions before 3.10.0 default to ENFORCE=False in pathsec.py, causing all security validation functions to emit warnings instead of raising exceptions. Attackers can bypass path traversal and pickle deserialization protections by exploiting the disabled security controls that are only active when manually enabled.

Other sources

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.validatenetworkurl('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('NLTKPATHSECENFORCE', '').lower() in ('1', 'true', 'yes')

def validatesomething(path): if isviolation(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 NLTKPATHSECENFORCE=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.catchwarnings(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 NLTKPATHSECENFORCE=0 to explicitly disable.

— GitHub

Affected Software

3 affected componentsFixes available
NLTK Project NLTK<3.10.0
nltk nltk<3.10.0
pip/nltk<=3.9.4
3.10.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/nltk to a version that resolves this vulnerability.

    Fixed in 3.10.0
  2. Configuration

    Change pathsec.py default behavior to fail-secure: make ENFORCE default to True (i.e., security validation functions raise exceptions on violations by default). Current behavior is ENFORCE=False unless NLTK_PATHSEC_ENFORCE is set to '1'/'true'/'yes'.

    NLTK pathsec.py (nltk.pathsec) NLTK_PATHSEC_ENFORCE / ENFORCE default = True
  3. Configuration

    If you must keep backwards compatibility, explicitly disable protections only by setting NLTK_PATHSEC_ENFORCE=0; otherwise do not rely on the insecure default.

    NLTK pathsec.py (nltk.pathsec) NLTK_PATHSEC_ENFORCE = 0

Event History

Aug 22, 2026
CVE Published
via MITRE·02:12 PM
Data Sourced
via MITRE·02:12 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:16 PM
DescriptionSeverityWeaknessAffected Software
Sep 2, 2026
Advisory Published
via GitHub·03:40 PM
Data Sourced
via GitHub·03:40 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed by default?

NLTK versions before 3.10.0 are exposed when using the default pathsec.py configuration, because ENFORCE defaults to False. In that state, security validation functions warn instead of raising exceptions.

2

What does an attacker need to exploit this issue?

An attacker needs an opportunity to trigger code paths that rely on NLTK's path traversal or pickle deserialization protections. No authentication or user interaction is required according to the supplied severity vector.

3

Is there a mitigation if upgrading is not immediately possible?

Manually enable the pathsec security controls by setting ENFORCE to True. This changes validation failures from warnings to exceptions and activates the described protections.

4

How can I determine whether an installation is affected?

Check whether the installed NLTK version is earlier than 3.10.0 and inspect pathsec.py configuration. An installation is affected by this default-configuration issue if ENFORCE is set to False or left at its default value.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203