Skip to content
Memory corruption Write-up Advanced

Reverse Engineering a WhatsApp 0-Click Vulnerability: A Deep Dive

A malicious DNG image with mismatched metadata values (SamplesPerPixel=2 but NumOfComponents=1) triggers an out-of-bounds write in Apple's RawCamera library. When chained with a WhatsApp-specific bug, an attacker can send such an image to a victim and achieve remote code execution without any user interaction.

Krishna Kumar Follow

Published on infosecwriteups.com

Imagine opening a photo on your iPhone and instantly — without tapping anything, clicking any link, or even viewing the full image — your device is compromised. That’s exactly what makes zero-click vulnerabilities so terrifying.

Krishna Kumar, on infosecwriteups.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

The decoder checks SamplesPerPixel to enter a parsing path but then uses NumOfComponents as the loop increment, so a mismatch causes the inner loop to run longer than the output buffer allows.

Impact

The out-of-bounds write could lead to remote code execution on iOS 18 devices, and when chained with the WhatsApp bug it becomes a zero-click exploit; the proof of concept only demonstrated a crash, and real code execution would require heap shaping.

What the attacker needed

Victim uses iOS 18 before 18.6.2; attacker can send a DNG via WhatsApp; no user interaction required

The fix

Apple fixed the issue with improved bounds checking in iOS 18.6.2.

How it was found

  1. Craft a DNG file where SamplesPerPixel is set to 2 and NumOfComponents is set to 1.
  2. Deliver the file to the target through WhatsApp, which triggers automatic thumbnail generation.
  3. The RawCamera library parses the file and enters the decompression function because SamplesPerPixel equals 2.
  4. The nested loops run with the wrong increment, writing past the end of the output buffer.
  5. In the proof of concept the write hits a read-only page and crashes with EXC_BAD_ACCESS; a real exploit would use heap shaping to control adjacent memory.

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.

A DNG file is a raw photo format that stores extra information about the image, such as how many colour samples each pixel has. The phone's image decoder trusted two of these numbers to agree, but they did not, so it wrote more data than it had space for and corrupted memory. Because the image is processed automatically when it arrives in a messaging app, the victim does not need to tap or open anything.

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 Krishna Kumar

View all

10 more disclosed reports, best first.

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.