Skip to content
Memory corruption Advisory Advanced CVE-2021-21810

AT&T Labs Xmill XML parsing ParseAttribs memory corruption vulnerability

A heap buffer overflow exists in Xmill's XML attribute parsing: when an attribute lacks a following equals sign and the current label block pointer has been set to NULL by a mismatched end label, writes go out of bounds two bytes at a time. An attacker could supply a crafted XML file to corrupt memory, potentially leading to code execution.

Carl Hurd Follow

Originally disclosed on Cisco Talos

High 8.1 View original

A memory corruption vulnerability exists in the XML-parsing ParseAttribs functionality of AT&T Labs’ Xmill 0.7. A specially crafted XML file can lead to a heap buffer overflow.

Carl Hurd, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the label stack's RemoveLabel sets curblock to NULL on a mismatched end label without the caller checking, and ParseAttribs then loops calling AddLabel which dereferences the NULL block and writes past the buffer.

Impact

An attacker could corrupt heap memory, which may lead to code execution, though the CVSS score reflects high attack complexity.

What the attacker needed

Attacker supplies a crafted XML file; victim opens or processes the file

How it was found

  1. Provide an XML file whose first start label and end label do not match, so RemoveLabel pops the only label and sets curblock to NULL.
  2. Include a new label with an attribute that has no equals sign after it, so ParseAttribs keeps calling HandleAttribName.
  3. HandleAttribName calls AddLabel repeatedly, writing past the buffer two bytes at a time and corrupting memory.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Xmill is a program that compresses XML files. A bug in how it reads XML tags lets a malicious file make the program write data past the end of its memory buffer, which can crash it or let an attacker take control. The trigger is a malformed tag where an attribute has no equals sign after it.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Carl Hurd

View all

49 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.