NLTK: Default ENFORCE=False Disables All pathsec Security Controls
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
30일 내 악용 확률 예측
실측 악용 기록 없음
계획된 패치 주기 내 조치(60일 이내)
CVSS 벡터 · 메트릭
CVSS 벡터 정보 없음
상세 설명
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:
1ENFORCE = os.environ.get('NLTK_PATHSEC_ENFORCE', '').lower() in ('1', 'true', 'yes') 2 3def validate_something(path): 4 if is_violation(path): 5 if ENFORCE: 6 raise SecurityError('...') # Only raised when env var is set 7 else: 8 warnings.warn('...', RuntimeWarning) # Default: warning only 9 # Execution continues regardlessThis 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:
1import nltk.pathsec 2import warnings 3 4# Show that ENFORCE is False by default 5print(f'ENFORCE = {nltk.pathsec.ENFORCE}') # False 6 7# Attempt to read /etc/passwd through pathsec -- should be blocked 8with warnings.catch_warnings(record=True) as w: 9 warnings.simplefilter('always')10 result = nltk.pathsec.open('/etc/passwd', 'r')11 print(f'File opened: {result.name}') # /etc/passwd12 print(f'Warning emitted: {w[0].message}') # RuntimeWarning (not an exception)13 # Attack succeeds -- file is readableThe 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.
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.
참고 자료 8
링크 내용 불러오는 중…