Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. nltk
  4. ›
  5. CVE-2026-78681

CVE-2026-78681: NLTK: Entity-expansion DoS (billion laughs) via remaining raw ElementTree parses

September 8, 2026

Several XML parsing sites in NLTK still used xml.etree.ElementTree directly, which honours <!ENTITY> declarations in a document’s internal DTD subset. A crafted document a few hundred bytes long can expand to megabytes in memory (each nesting level multiplies by ten), a denial-of-service.

Affected call sites (<= 3.10.2):

  • nltk.chunk.named_entity.load_ace_file — parses ACE annotation XML
  • nltk.internals.ElementWrapper — converts any given string to an Element
  • nltk.downloader — Package.fromxml, Collection.fromxml, _find_collections, _find_packages

libexpat 2.6.0 added an input-amplification cap, but it only engages above an activation threshold (~8 MiB output) and depends on whichever libexpat the interpreter links; builds against older libexpat have no cap at all. External entities are not resolved by ElementTree, so this is a memory-amplification DoS (CWE-776), not XXE/file disclosure.

This completes the earlier defusedxml adoption that these sites were missed by. Fix routes all of them through a new nltk.xmlsec module that refuses entity declarations, preferring defusedxml and falling back to a standard-library xml.parsers.expat pre-scan when defusedxml is absent.


References

  • github.com/advisories/GHSA-97qj-x29f-37w7
  • github.com/nltk/nltk/commit/e91789c9a043296ad04912ce171c22776d45963b
  • github.com/nltk/nltk/releases/tag/v3.10.3
  • github.com/nltk/nltk/security/advisories/GHSA-97qj-x29f-37w7
  • github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3748.yaml
  • nvd.nist.gov/vuln/detail/CVE-2026-78681
  • www.vulncheck.com/advisories/nltk-before-entity-expansion-dos-via-elementtree

Code Behaviors & Features

Detect and mitigate CVE-2026-78681 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 3.10.3

Fixed versions

  • 3.10.3

Solution

Upgrade to version 3.10.3 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Learn more about CVSS

Weakness

  • CWE-776: Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion')

Source file

pypi/nltk/CVE-2026-78681.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:17:14 +0000.