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

Accusoft ImageGear PDF process_fontname stack-based buffer overflow vulnerability

A malformed PDF file with an overly long font name causes a fixed-size stack buffer in the process_fontname function to overflow when the name is copied into it. An attacker could supply such a file to trigger the overflow, which the report says can lead to code execution.

Emmanuel Tacheau Follow

Originally disclosed on Cisco Talos

Critical 9.8 View original

A stack-based buffer overflow vulnerability exists in the PDF processfontname functionality of Accusoft ImageGear 19.9. A specially crafted malformed file can lead to code execution.

Emmanuel Tacheau, 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

The code copies a font name read from the PDF into a 256-byte stack buffer using sprintf without checking the length of the source string.

Impact

A crafted PDF could cause a stack-based buffer overflow that may result in code execution; the observed crash is a stack cookie check failure.

What the attacker needed

Victim opens a crafted PDF; PDF object has FontDescriptor flag; font name longer than 256 bytes

The fix

The vendor patched the issue according to the timeline, though the text does not describe the code change.

How it was found

  1. Open a specially crafted malformed PDF file with the vulnerable library
  2. The PDF contains an object with a FontDescriptor flag and an overly long font name
  3. The font name is passed to process_fontname and copied into the fixed 256-byte buffer
  4. The overflow corrupts the stack and the stack cookie check fails, crashing the process

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.

A program keeps a small fixed-size box in memory for a short message about a missing font. If the font name taken from a PDF file is much longer than that box, the extra text spills over into nearby memory and can crash the program or let an attacker control what it does next. This is called a buffer overflow.

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 Emmanuel Tacheau

View all

58 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.