Skip to content
Memory corruption Write-up Advanced

Exploiting the Magellan Bug on 64-bit Chrome Desktop

The fts3 full-text search extension in SQLite had an integer overflow in a size check, so a crafted term prefix and suffix could bypass a reallocation and cause an out-of-bounds write during a memory copy. An attacker able to run arbitrary SQL against a vulnerable SQLite build, such as through Chrome's WebSQL support, could corrupt memory and potentially achieve code execution.

blog.exodusintel.com

Published on blog.exodusintel.com

JANUARY 22, 2019 Exploit Techniques

Exodus Intel VRT, on blog.exodusintel.com

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 write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the size check added two signed 32-bit integers without widening them, so a large prefix plus suffix overflowed to a negative value, skipped the reallocation, and the later memory copy wrote out of bounds.

Impact

On a 32-bit platform the out-of-bounds copy could crash or corrupt memory, and the authors set out to see whether it could be turned into code execution on 64-bit desktop Chrome; the text does not claim a completed 64-bit exploit.

What the attacker needed

Ability to run arbitrary SQL; vulnerable SQLite before 3.25.3; crafted shadow table content

The fix

The bug was fixed by casting the prefix and suffix lengths to 64-bit integers before the addition, and SQLite later added a defensive flag that makes shadow tables read-only to user SQL.

How it was found

  1. Create an fts3 virtual table and insert content so the shadow tables and segment B-tree are built.
  2. Modify the root blob in the segdir shadow table so a later term has a very large prefix length and a small suffix length.
  3. Run a query that makes the engine parse the crafted node, triggering the overflow and the out-of-bounds copy.

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 write-up has not been written yet. The Original tab links to the source.

SQLite is a small database engine built into many programs, including older versions of Chrome. A part of it that indexes words for search miscalculated how much memory it needed when a word was split into a shared prefix and a new ending, so a specially crafted database entry made it write past the end of a buffer. Writing past a buffer can let an attacker take control of the program.

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.

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.