Skip to content
Memory corruption Write-up Advanced

CVE-2023-6345: Integer overflow in Skia MeshOp::onCombineIfPossible

An integer overflow in Skia's MeshOp::onCombineIfPossible allows a heap out-of-bounds write when combining multiple DRAW_VERTICES_OBJECT operations. An attacker could exploit this to corrupt memory and potentially escape the Chrome renderer sandbox.

googleprojectzero.github.io

Published on googleprojectzero.github.io

Compile Skia with ASAN. The following Python script gen.py will create a poc.skp in the current directory:

Google Project Zero, on googleprojectzero.github.io

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 lack of an overflow check when adding vertex counts in MeshOp::onCombineIfPossible, leading to an undersized buffer allocation and subsequent out-of-bounds write.

Impact

This could lead to a heap out-of-bounds write, potentially allowing an attacker to escape the Chrome renderer sandbox.

What the attacker needed

Victim opens a malicious .skp file; Chrome version older than 119.0.6045.199

The fix

The patch adds a check to ensure that the addition of vertex counts does not overflow.

How it was found

  1. Compile Skia with ASAN.
  2. Run the provided Python script to generate a malicious .skp file.
  3. Parse the .skp file with skpbench using the gles config.
  4. Observe the signed integer overflow error.

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.

When drawing many shapes, the code adds up their vertex counts without checking if the total exceeds the maximum integer value. This can wrap around to a small number, causing a buffer to be allocated too small, and then writing more data than fits, which corrupts memory. An attacker can craft a file to trigger this and potentially 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.