NLTK fixes XMLCorpusView flaw that could cause quadratic CPU denial of service
- NLTK
- XMLCorpusView
- denial of service
- XML parsing
- vulnerability

Inefficient parsing of XML comments and CDATA caused excessive CPU usage
The flaw affected NLTK versions 3.6 through 3.10.3
Users are advised to upgrade to version 3.10.4 to mitigate the issue
NLTK’s XMLCorpusView component has a vulnerability that can cause a quadratic CPU denial of service when it reads a well-formed XML corpus file containing a very large comment or CDATA section. The issue affects NLTK versions 3.6 through 3.10.3 and is fixed in version 3.10.4.
The flaw is in XMLCorpusView’s _read_xml_fragment function, which parses XML corpus data in blocks. While waiting for the end of a comment or CDATA section, it repeats a scan of the entire buffer after each 1 KiB block, so processing time can grow quadratically with the section’s size.
The issue applies when a victim is made to read a corpus file containing the relevant section. XMLCorpusView is NLTK’s streaming interface for XML corpora and is used by the NPSChatCorpusReader and FramenetCorpusReader readers.




