Messaging and social apps · Lesson 2 of 5
WhatsApp on Android and iOS
12 min read
WhatsApp is the messaging app examiners meet most often. Its messages are end-to-end encrypted in transit, but on the phone they sit in ordinary SQLite databases that a full file system extraction can read. The Android and iOS versions differ in databases, folders and timestamp formats. This lesson covers where WhatsApp keeps messages, contacts, media and backups, how to read the key tables, and how deleted, view-once, edited and linked-device messages appear.
Identifiers you will see on both platforms
WhatsApp identifies every party with a JID (Jabber ID). The form tells you what the party is:
- number@s.whatsapp.net is an individual account, keyed by phone number in international format without the plus sign;
- id@g.us is a group;
- id@lid is an anonymized identifier (LID) that current versions use in place of a phone-number JID: for group and community members and, increasingly, as the key of one-to-one chats;
- status@broadcast holds Status updates, and id@newsletter holds Channels.
A chat or a sender may be keyed by an @lid identifier, so a search for a phone number alone can miss messages. On Android, open-source test data show one-to-one chats keyed by a LID, and contacts with two chat rows, one per identifier. Resolve LIDs first: on Android through the jid_map table of msgstore.db (lid_row_id to jid_row_id), on iOS through LID.sqlite (table ZWAPHONENUMBERLIDPAIR or, in newer versions, ZWAZACCOUNT). Report the identifier as stored and how you resolved it.
Each message also carries an ID: key_id on Android, ZSTANZAID on iOS. Published research on Android found that the sender sets it and the recipient stores the same value, so a match between two phones is strong evidence that two rows are the same message. WhatsApp does not document this; confirm it with test data.
WhatsApp on Android
The package name is com.whatsapp (WhatsApp Business is com.whatsapp.w4b, with the same structure). Private data sits in Credential Encrypted (CE) storage under /data/user/0/com.whatsapp/ (also reached as /data/data/com.whatsapp/), so it needs a full file system extraction of an unlocked or AFU phone (lesson 2.6).
msgstore.db and wa.db
The main database is /data/user/0/com.whatsapp/databases/msgstore.db, with its -wal and -shm files. Versions from about 2022 onward use a normalized schema (older databases had a single messages table); the key tables are:
| Table | Holds | Useful columns |
|---|---|---|
| message | One row per message | _id, chat_row_id, from_me, key_id, sender_jid_row_id, timestamp, received_timestamp, message_type, text_data |
| chat | One row per conversation | _id, jid_row_id, subject (group name) |
| jid | Every identifier | _id, raw_string (the JID) |
| message_media | Attachments | message_row_id, file_path, file_hash |
| call_log | WhatsApp calls | jid_row_id, timestamp, duration |
To rebuild a conversation, join message.chat_row_id to chat._id, chat.jid_row_id to jid._id, and message._id to message_media.message_row_id. from_me is 1 for outgoing; in groups, sender_jid_row_id identifies the sending member. message_type is a number: open-source parsers label 0 as text, 1 image, 2 audio, 3 video, 7 system message and 9 document (observed, not documented).
Timestamps in msgstore.db are Unix time in milliseconds (UTC). In the course case, the three incoming rows on Victor's phone hold the illustrative timestamp 1773222082000: 1,773,222,082 seconds after 1970-01-01, which is 2026-03-11 09:41:22 UTC, or 10:41:22 in the case's zone (UTC+01:00).
WhatsApp does not document which clock sets each column. Published research describes timestamp on an outgoing message, and received_timestamp on an incoming one, as taken from the phone's own clock, at sending and at receipt. For timestamp on an incoming message the sources disagree: older research says the phone's clock when the row was inserted, a current open-source parser says a server time. Older research also describes a receipt_server_timestamp column as the phone's clock when the server's acknowledgment arrived. Treat no column as a server time unless you have tested it between test phones with one clock set wrong, and state which column you used.
The second database, wa.db, holds the wa_contacts table: jid, display_name (from the address book), wa_name (the name the contact set in WhatsApp), number and status. Say which name field your report uses.
The key file and local backups
WhatsApp on Android writes an encrypted copy of msgstore.db to shared storage daily: /sdcard/Android/media/com.whatsapp/WhatsApp/Databases/ on Android 11 and later, /sdcard/WhatsApp/Databases/ on older installations. The current file is msgstore.db.crypt14 (or .crypt15); older dated copies are named msgstore-YYYY-MM-DD.1.db.crypt14 and can hold messages since deleted from the live database. The extension tells you how the backup is encrypted:
- crypt14 is a standard backup, decrypted with the key file at /data/user/0/com.whatsapp/files/key, which only a full file system extraction provides.
- crypt15 means the user turned on end-to-end encrypted backup. It is decrypted with encrypted_backup.key from the same folder, or with the 64-digit key the user wrote down. With a password, the key is held in WhatsApp's vault (lesson 5.1) and cannot be guessed offline.
Open-source tools such as wa-crypt-tools decrypt both formats with the key. Hash both first; the decrypted database is a derived file.
Google Drive backups and settings
The Google Drive backup is not on the phone, but a record of it is: gdrive_last_successful_backup_timestamp (Unix milliseconds) and the backup frequency are in shared_prefs (com.whatsapp_preferences_light.xml or, in newer versions, backup_prefs.xml). They tell the legal team which Google account to ask about, not that the backup still exists. The account itself is identified in com.whatsapp_preferences_light.xml or, in newer versions, startup_prefs.xml: cc (country code), ph (phone number) and push_name (display name).
Media
On Android 11 and later, media is in shared storage under /sdcard/Android/media/com.whatsapp/WhatsApp/Media/, in folders such as WhatsApp Images, WhatsApp Video and WhatsApp Documents. Sent files are in a Sent subfolder; received files are in the parent folder. Image files are usually named like IMG-20260311-WA0001.jpg, with a date and a counter assigned by WhatsApp; the date is not the capture date of the original photo. WhatsApp recompresses images sent as photos and removes most EXIF metadata; a file sent as a document keeps its original bytes.
Shared storage is visible to the gallery, so WhatsApp media is indexed by MediaStore (lesson 6.2) and can survive after the chat is deleted; equally, a file can be deleted while its message_media row remains. Compare file_path values with the files present, in both directions.
WhatsApp also records a hash of each media file: message_media.file_hash holds a Base64-encoded SHA-256 value (media_hash in the old schema). Research describes it as the hash of the transmitted file, that is, the file after WhatsApp's recompression; open-source implementations of the protocol show that each media message carries it, so that a receiving client can check the decrypted download against it. It should therefore be the same on both phones and equal the SHA-256 of an unaltered received file, not that of the camera original. To compare, decode the Base64 text to 32 bytes and write them in hexadecimal. Confirm the column on the version you examine.
WhatsApp on iOS
On iOS, WhatsApp (bundle ID net.whatsapp.WhatsApp) keeps its main data in the shared app group container group.net.whatsapp.WhatsApp.shared. It is at /private/var/mobile/Containers/Shared/AppGroup/<UUID>/; identify the UUID from the MCMMetadataIdentifier key in the .com.apple.mobile_container_manager.metadata.plist file inside it (lesson 4.1).
ChatStorage.sqlite
The main database is ChatStorage.sqlite at the root of that container. It is a Core Data store, so table and column names start with Z:
- ZWAMESSAGE: one row per message. ZMESSAGEDATE (time), ZISFROMME (1 outgoing), ZFROMJID and ZTOJID, ZTEXT, ZMESSAGETYPE, ZSTANZAID, ZCHATSESSION (link to the chat) and ZMEDIAITEM (link to media). In groups, ZGROUPMEMBER points to the sending member in ZWAGROUPMEMBER.
- ZWACHATSESSION: one row per conversation, with ZCONTACTJID and ZPARTNERNAME (contact or group name).
- ZWAMEDIAITEM: attachments, with ZMEDIALOCALPATH, ZXMPPTHUMBPATH (thumbnail), and ZLATITUDE and ZLONGITUDE for shared locations. Published research describes ZVCARDNAME as the hash of the media file in media messages (one 2026 open-source tool reports Base64 SHA-256); iLEAPP does not parse it, so confirm it on test data.
Join ZWAMESSAGE.ZCHATSESSION to ZWACHATSESSION.Z_PK, and ZWAMESSAGE.Z_PK to ZWAMEDIAITEM.ZMESSAGE. Contact names from the address book are in ContactsV2.sqlite (table ZWAADDRESSBOOKCONTACT).
Mac absolute time
ZMESSAGEDATE is Mac absolute time: seconds since 2001-01-01 00:00:00 UTC (lesson 4.2). Add 978,307,200 seconds to get Unix time. In the course case, the one row recovered from Lena's phone (lesson 5.5) holds the illustrative value 794914882:
- 794,914,882 + 978,307,200 = 1,773,222,082 Unix seconds
- 1,773,222,082 = 2026-03-11 09:41:22 UTC, which Victor's phone stores as 1773222082000 milliseconds
ZWAMESSAGE also has ZSENTDATE. Which clock sets either column is not established in published sources, so test before using one as a check on the phone's clock.
Media and backups
Media files are under Message/Media/ in the app group container, in subfolders named after the chat's JID; ZMEDIALOCALPATH holds the relative path.
WhatsApp on iOS backs up to the user's iCloud Drive, not to iCloud Backup; since 2021 that backup can be end-to-end encrypted. A computer backup of the iPhone normally includes the app group container, and so ChatStorage.sqlite (lesson 2.3), but WhatsApp states that once its end-to-end encrypted backup is on, chat history is excluded from the iPhone's device backups. Check this setting before drawing conclusions from a backup that lacks it.
Deleted, view-once, edited and disappearing messages
- Delete for me removes the message for the deleting user only (and, in current versions, on that account's linked devices); the other party's copy is untouched. Lesson 5.5 covers the remnants.
- Delete for everyone is possible for about 60 hours. The recipient's row remains as a placeholder ("This message was deleted") without the content. On Android, current versions add a row in a message_revoked table, and message_type changes (15 and 64 have been observed). A group admin can delete another member's message (the table has an admin_jid_row_id column), so do not assume that the sender deleted it. The text may survive in a notification (lesson 5.5).
- View once media can be opened once. The row exists on both devices, but the file is removed after viewing and not saved to the gallery; Android keeps related records in a message_view_once_media table.
- Edited messages can be changed for 15 minutes. On Android, a message_edit_info table records the edit time, while the message row holds only the current text, so the earlier text may not be recoverable.
- Disappearing messages (24 hours, 7 days or 90 days, per chat or as a default) are deleted like other deletions when they expire. If a timer was active, a missing message may have expired without any user action, so record the timer settings (on Android, open-source parsing reads the default from shared_prefs/disappearing_mode_prefs.xml).
These table names come from open-source parsers and research; confirm them on the version you examine.
Linked devices
A WhatsApp account can have up to four linked devices (computers, tablets or other phones), each with its own database. A message sent from a linked computer still appears as outgoing (from_me = 1 or ZISFROMME = 1) on the phone. Do not open the app on the evidence phone to read its Linked devices screen: that is a manual examination that changes app state and, with any connectivity, lets pending deletions synchronize. Use linked-device records found in the extraction, confirmed with test data, and the linked computer itself. If the sending device matters, find evidence on that device; do not infer it from the phone.
Applying this to the Corvane case
On Victor's Galaxy, msgstore.db holds three incoming rows with message_type 1 and timestamp 1773222082000, and his reply as an outgoing row. The file paths point to IMG-20260311-WA0001.jpg to IMG-20260311-WA0003.jpg under WhatsApp Images, where WhatsApp downloaded them and the gallery displays them; that is not proof of a deliberate save. Each file_hash is compared with the SHA-256 of its file. No message_revoked entry refers to the rows, so the deletion on Lena's phone was a "delete for me" or a chat clear, not a "delete for everyone": a finding from Victor's database, not an assumption.
On Lena's iPhone, the examiner resolves Victor's number and any LID linked to it in LID.sqlite, then searches ChatStorage.sqlite for chats with either ZCONTACTJID. The three ZWAMESSAGE rows of Day 2 are no longer in the main database. One earlier version of the page survives in a WAL frame and gives the ZSTANZAID, ZMESSAGEDATE and media reference of the first image; the other two are not recovered (lesson 5.5). If that ZSTANZAID equals a key_id on Victor's phone, the two records are very probably the same message. The send time in the timeline comes from Victor's message.timestamp and from that one recovered row, not from Lena's main database.
Exam focus: Know the main databases, tables and joins on both platforms (msgstore.db, wa.db, ChatStorage.sqlite, ZWAMESSAGE, ZWACHATSESSION, ZWAMEDIAITEM) and the timestamp formats (Unix milliseconds on Android, Mac absolute seconds on iOS). Know why LIDs are resolved before a search by phone number, what the media hash covers, what crypt14 and crypt15 backups need, and what delete for me, delete for everyone and linked devices mean for the evidence.
Practice questions
Check your understanding. These questions do not count towards the exam.
Sign in to save your progress and continue where you left off. It is free. Sign in