NLTK flaw exposes metadata about files outside configured roots

  • NLTK
  • StreamBackedCorpusView
  • sandbox
  • metadata
  • filesystem

Constructor fails to apply sandbox validation to os.stat calls

Attackers can probe file existence, size and modification time beyond the configured root

Issue affects NLTK versions 3.10.0 through 3.10.3

NLTK developers identified a vulnerability in the StreamBackedCorpusView constructor, a public NLTK programming interface, that can expose metadata about files outside an application's configured file root. The issue affects NLTK versions 3.10.0 through 3.10.3.

The constructor calls os.stat, a system function that reads file metadata, on a plain-string file path without checking it against NLTK's pathsec sandbox. If an application passes a path controlled by an attacker, the call can reveal whether the file exists, its exact size and modification time, even when pathsec enforcement is enabled. Error messages can also distinguish some file-system errors, including missing files and permission denials.

The vulnerability does not expose file contents through this route: reading the view still uses the sandboxed file-opening process. The risk depends on application code passing an attacker-influenced string directly to the public constructor; the report says corpus readers that use validated PathPointer objects take a guarded path. The issue is a remaining metadata exposure after the fix for CVE-2026-63312, which addressed content access on the same code path. The report identifies no fixed release.

Key terms explained

StreamBackedCorpusView

StreamBackedCorpusView is a programming interface in NLTK that allows for memory-efficient access to corpus data by reading tokens only when they are needed. It acts as a lazy sequence, meaning it does not load the entire file into memory at once.

os.stat

os.stat is a system function in Python that retrieves metadata about a file, such as its size and modification time. It allows programs to inspect file properties without necessarily opening the file's contents.