Описание
NLTK: Default ENFORCE=False Disables All pathsec Security Controls
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:
- pathsec.open('/etc/passwd') succeeds (reads the file, emits warning)
- pathsec.validate_network_url('http://169.254.169.254/...') succeeds (warning only)
- pickle.loads() via nltk.data.load() proceeds despite unsafe source (warning only)
Every security gate follows the same pattern:
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:
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.
Ссылки
- https://github.com/nltk/nltk/security/advisories/GHSA-p3m8-78j2-g5p3
- https://nvd.nist.gov/vuln/detail/CVE-2026-62388
- https://github.com/nltk/nltk/pull/3593
- https://github.com/nltk/nltk/commit/155e40343cff0bf50d233e274a12e04d1428b1d9
- https://github.com/nltk/nltk/releases/tag/v3.10.0
- https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3722.yaml
- https://www.vulncheck.com/advisories/nltk-before-insecure-default-configuration-pathsec
Пакеты
nltk
<= 3.9.4
3.10.0
Связанные уязвимости
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.
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.
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.
NLTK versions before 3.10.0 default to ENFORCE=False in pathsec.py, ca ...