Skip to content
Memory corruption Advisory Advanced CVE-2020-6458

Google Chrome PDFium Javascript Regexp Memory Corruption Vulnerability

PDFium, the PDF renderer inside Chrome, runs embedded JavaScript with V8 in a jitless configuration, and a crafted regular expression causes an out-of-bounds read of a fixed-size offsets array in the regexp interpreter. An attacker could potentially turn this memory corruption into arbitrary code execution if a victim opens a malicious PDF.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 8.8 View original

An exploitable memory corruption vulnerability exists in the way PDFium inside Google Chrome version 80.0.3987.158 executes Javascript regular expressions. The vulnerability could potentially be abused to achieve arbitrary code execution in the browser context.

Aleksandar Nikolic, 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 regexp interpreter writes match offsets into a fixed-size static offsets vector without checking that the number of capture positions fits, so a large pattern causes an out-of-bounds read.

Impact

The out-of-bounds read could potentially lead to further memory corruption and arbitrary code execution, but only when the script runs inside a PDF, because normal web pages and the default shell do not crash.

What the attacker needed

Victim opens a malicious PDF; JavaScript enabled in the PDF viewer

How it was found

  1. Create a very large regular expression string built from repeated '+' characters followed by repeated 'A' characters.
  2. Run a string search with that pattern against a single-character string, twice in a row.
  3. Embed the same script in a PDF document and open it in Chrome or run it with the pdfium test tool.
  4. Observe the crash in the regexp interpreter while reading the offsets array.

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 PDF can contain small scripts, and Chrome runs them with its JavaScript engine. A regular expression is a pattern used to search text; here a very long, specially shaped pattern makes the engine read past the end of a fixed-size list of numbers, which is a memory error. Memory errors like this can sometimes be steered into running an attacker's code, though the report only says this is potential.

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 Aleksandar Nikolic

View all

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