💬 Part 5 of 6

Mobile Messaging Analysis

🕑 90-120 minutes 📖 Intermediate Level 📱 Module 2

Introduction

Messaging applications are among the most critical sources of evidence in mobile forensics. In India, WhatsApp alone has over 500 million users, making it the primary communication platform. Understanding how to extract and analyze data from messaging apps is essential for any forensic examiner.

📚 Learning Objectives

By the end of this part, you will understand the architecture and data storage of major messaging apps, locate and extract message databases, analyze WhatsApp, Telegram, and Signal forensically, and recover deleted messages where possible.

Messaging Apps Overview

Different messaging applications store data differently and implement varying levels of security. Understanding these differences is crucial for effective forensic analysis.

💬
WhatsApp
500M+ users in India
Most popular messaging app in India. End-to-end encrypted messages but local database is accessible with device access.
  • Local encrypted database (msgstore.db)
  • Backup to Google Drive / iCloud
  • Media stored separately
  • Deleted messages may be recoverable
Telegram
100M+ users in India
Cloud-based messaging with optional Secret Chats. Regular chats stored on servers; Secret Chats are E2E encrypted.
  • Cloud messages on Telegram servers
  • Local cache database
  • Secret Chats - device only
  • Self-destructing messages
🔒
Signal
Growing user base
Privacy-focused with strong E2E encryption. Minimal metadata stored. Most forensically challenging.
  • Strong local encryption
  • No cloud backup of messages
  • Disappearing messages
  • Minimal metadata
📩
SMS/MMS
Universal
Native messaging. No E2E encryption but consistently accessible through standard forensic methods.
  • Standard SQLite database
  • Carrier records available
  • Easy extraction
  • Deleted recovery possible

WhatsApp Forensics

WhatsApp is the most forensically important messaging app in India. While messages are end-to-end encrypted in transit, the local database can be accessed with proper device extraction.

WhatsApp Data Locations

Android:
  /data/data/com.whatsapp/
    /databases/msgstore.db -- Main message database
    /databases/wa.db -- Contacts database
    /databases/axolotl.db -- Encryption keys
    /shared_prefs/ -- Settings, registration info
  /sdcard/WhatsApp/
    /Media/ -- Photos, videos, voice notes
    /Databases/ -- Encrypted backups (.crypt14)
iOS:
  /private/var/mobile/Containers/Data/Application/[UUID]/
    /Documents/ChatStorage.sqlite -- Main database
    /Library/Media/ -- Media files

WhatsApp Database Schema (msgstore.db)

msgstore.db Key Tables
messages
_id INTEGER PRIMARY KEY
key_remote_jid TEXT -- Contact JID (phone@s.whatsapp.net)
key_from_me INTEGER -- 0=received, 1=sent
timestamp INTEGER -- Unix timestamp (milliseconds)
data TEXT -- Message content
media_wa_type INTEGER -- 0=text, 1=image, 2=audio, etc.
media_size INTEGER -- Size of media
media_name TEXT -- Media filename
media_mime_type TEXT -- MIME type
status INTEGER -- Message status
chat_list
_id INTEGER PRIMARY KEY
key_remote_jid TEXT -- Chat identifier
subject TEXT -- Group name (if group)
creation INTEGER -- Chat creation timestamp
last_read_message_table_id INTEGER

WhatsApp Analysis Queries

SQLite Queries for WhatsApp Analysis
-- Extract all messages with contact info
SELECT
  datetime(timestamp/1000, 'unixepoch', 'localtime') as time,
  key_remote_jid as contact,
  CASE key_from_me WHEN 0 THEN 'Received' ELSE 'Sent' END as direction,
  data as message
FROM messages
WHERE data IS NOT NULL
ORDER BY timestamp;
-- Find media messages
SELECT * FROM messages
WHERE media_wa_type > 0;
-- Extract deleted messages (if not vacuumed)
-- Use forensic tools to examine unallocated database space
💬 WhatsApp Backup Decryption

WhatsApp backup files (.crypt12, .crypt14) on Android are encrypted. Decryption requires the key file from /data/data/com.whatsapp/files/key. Tools like WhatsApp Viewer, Elcomsoft, or wa-crypt-tools can decrypt backups with the key. Google Drive backups can be acquired via Google Takeout with credentials.

Telegram Forensics

Telegram presents unique forensic challenges due to its cloud-based architecture. Regular chats are stored on Telegram servers, while Secret Chats are E2E encrypted and stored only locally.

Telegram Data Types

Type Storage Forensic Access
Regular Chats Telegram Cloud + Local cache Local cache accessible; cloud requires credentials/legal
Secret Chats Local device only (E2E encrypted) Very difficult - strong local encryption
Channels/Groups Cloud + Local cache Similar to regular chats
Media Cloud + Local cache Cached media accessible locally

Telegram Data Locations

Android:
  /data/data/org.telegram.messenger/
    /files/cache4.db -- Main database (encrypted)
    /shared_prefs/ -- Settings, user info
  /sdcard/Telegram/
    /Telegram Images/ -- Downloaded images
    /Telegram Video/ -- Downloaded videos
    /Telegram Documents/ -- Downloaded files
iOS:
  /private/var/mobile/Containers/Data/Application/[UUID]/
    /Documents/
Telegram Database Encryption

Telegram's cache4.db is encrypted with a key derived from the user's local passcode (if set) and device-specific information. Tools like Cellebrite and Oxygen can decrypt Telegram databases. Without the passcode, decryption may require advanced techniques or may be impossible.

Signal Forensics

Signal is designed with privacy as the primary goal, making it the most challenging messaging app for forensic examination. It stores minimal metadata and uses strong encryption.

Signal Security Features

  • Strong Local Encryption: Database encrypted with passphrase derived from device credentials
  • No Cloud Backup: Messages never leave the device (no iCloud/Google backup)
  • Disappearing Messages: Auto-delete feature destroys messages after set time
  • Minimal Metadata: Server stores almost no user data
  • Screen Security: Blocks screenshots by default

Signal Data Locations

Android:
  /data/data/org.thoughtcrime.securesms/
    /databases/signal.db -- Encrypted database
    /shared_prefs/ -- Some settings
iOS:
  /private/var/mobile/Containers/Data/Application/[UUID]/
    /Documents/Signal.sqlite -- Encrypted
🔒 Signal Forensic Reality

Signal forensics often yields limited results. The database is encrypted with SQLCipher using a key that's difficult to extract. Even with physical access, decryption may require the device passcode or advanced exploitation. Consider alternative evidence sources: screenshots on other devices, recipient's device, or network-level indicators of Signal usage.

SMS/MMS Analysis

Native SMS/MMS remains an important evidence source despite the rise of messaging apps. SMS is consistently accessible and often contains critical communications.

SMS Database Locations

Platform Database Key Tables
Android /data/data/com.android.providers.telephony/databases/mmssms.db sms, threads, canonical_addresses
iOS /private/var/mobile/Library/SMS/sms.db message, handle, chat

SMS Recovery Techniques

  • Database Recovery: Deleted SMS may exist in unallocated database pages until VACUUM
  • File System Carving: Physical acquisition allows carving for SMS database fragments
  • Carrier Records: CDRs (Call Detail Records) from telecom providers contain SMS metadata (not content)
  • Backup Analysis: iTunes/cloud backups contain SMS history
iOS SMS Database Query
-- Extract iMessage/SMS from iOS
SELECT
  datetime(message.date/1000000000 + 978307200, 'unixepoch', 'localtime') as time,
  handle.id as contact,
  CASE message.is_from_me WHEN 0 THEN 'Received' ELSE 'Sent' END as direction,
  message.text
FROM message
JOIN handle ON message.handle_id = handle.ROWID
ORDER BY message.date;

Deleted Message Recovery

Recovering deleted messages is often critical for investigations. Success depends on the app, time since deletion, and device activity.

Recovery Possibilities by App

Application Recovery Potential Method
SMS/MMS High SQLite unallocated pages, file carving, carrier records
WhatsApp Medium-High Database recovery, old backups, cloud backups
Telegram (Regular) Medium Local cache, cloud with credentials
Telegram (Secret) Low Limited to local unallocated if decryptable
Signal Very Low Strong encryption, secure deletion
Time-Critical Recovery

The sooner a device is acquired after message deletion, the higher the recovery chances. Continue device use overwrites deleted data. Isolate the device and acquire as quickly as possible.

📚 Key Takeaways
  • WhatsApp is most critical for Indian investigations - msgstore.db contains messages; media in /sdcard/WhatsApp/Media/
  • Telegram has cloud-based regular chats and E2E encrypted Secret Chats with different forensic approaches
  • Signal is highly privacy-focused with strong encryption - expect limited forensic results
  • SMS/MMS remains consistently accessible through standard SQLite databases
  • Deleted message recovery varies by app - act quickly for best results
  • WhatsApp backup decryption requires key file from /data/data/com.whatsapp/files/key
  • Consider cloud backups (Google Drive, iCloud) as alternative data sources
  • Document all extraction attempts for Section 63 BSA certificate