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

Nitro Pro PDF JavaScript document.flattenPages JSStackFrame stack-based use-after-free vulnerability

A specially crafted PDF document can cause a stack-allocated JavaScript stack frame to go out of scope while still referenced, leading to a use-after-free. An attacker could convince a user to open the document to potentially execute code under the application's context.

A member Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable return of stack variable address vulnerability exists in the JavaScript implementation of Nitro Pro PDF. A specially crafted document can cause a stack variable to go out of scope, resulting in the application dereferencing a stale pointer.

a member, 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 JavaScript engine's stack-allocated JSStackFrame is left linked in JSContext.fp after an exception unwinds the frame, so later code dereferences a stale pointer.

Impact

Could lead to code execution under the context of the application if a user opens a malicious document.

What the attacker needed

Victim opens a crafted PDF

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.

When a program runs JavaScript inside a PDF, it keeps track of where it is using a small record on the stack (a temporary memory area). If an error happens, the program may still point to that record after it has been removed, so it reads or writes memory that is no longer valid. An attacker who makes a malicious PDF can try to control that stale memory to run their own code.

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 A member

View all

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