NLTK: Entity-expansion DoS (billion laughs) via remaining raw ElementTree parses
概要
NLTK: Entity-expansion DoS (billion laughs) via remaining raw ElementTree parses
原文の説明
取得元が公開している説明をそのまま載せています (多くは英語)。
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 XMLnltk.internals.ElementWrapper— converts any given string to an Elementnltk.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.
Attack demonstration
Reproducible PoC against a real affected entry point (nltk.internals.ElementWrapper). Every number below is captured output, not illustrative.
1. The amplification (vulnerable path: raw xml.etree.ElementTree)
A payload of a few hundred bytes ex…
出典: NIST National Vulnerability Database NVD GitHub Advisory
AI要約
外部の AI が作成した要約です。誤りを含むことがあります。重要な判断の前に、下の原文と参照URLを確認してください。
NLTKのバージョン3.10.3未満では、XMLのパースにxml.etree.ElementTreeを使用しています。これにより、攻撃者は特別に構築されたXMLペイロードを使用してメモリを過剰に消費させることができ、サービスを拒否状態に陥らせる可能性があります。
NLTKにおけるXML解析の脆弱性。
NLTKの3.10.3未満のバージョン。
攻撃者がXMLドキュメントの構造を悪用し、メモリを消費させることでDoS攻撃を引き起こせる。
NLTKをバージョン3.10.3以降にアップグレードする。
情報なし
xml.etree.ElementTreeを使用してXMLを解析しているか確認する。
影響パッケージ
参照URL
- advisory disclosure@vulncheck.com
- exploit disclosure@vulncheck.com
- web nvd.nist.gov
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com