Skip to content

Communications

WhatsApp ChatStorage.sqlite on iOS

WhatsApp on iOS: ChatStorage.sqlite in the app group container, backup domain, ZWAMESSAGE and ZWACHATSESSION, media paths, LIDs and Cocoa time.

Location
/private/var/mobile/Containers/Shared/AppGroup/<UUID>/ChatStorage.sqlite (group.net.whatsapp.WhatsApp.shared; backup: AppDomainGroup-group.net.whatsapp.WhatsApp.shared, fileID 7c7fba66680ef796b916b067077cc246adacf01d)
Evidence area
Proves
WhatsApp conversations and groups stored on the device: message text, direction, sender JID, sent and delivered times, media and location attachments, and group membership
Timestamps
Cocoa time in seconds (ZMESSAGEDATE, ZSENTDATE, ZLASTMESSAGEDATE), UTC
Acquisition
Unencrypted backup is enough (AppDomainGroup-group.net.whatsapp.WhatsApp.shared). A full file system extraction adds the -wal file, freelist pages and media the backup skipped
Retention
Until the user deletes messages or chats, or disappearing messages expire them. WhatsApp's own iCloud backup is separate and not part of the device database
Collection
idevicebackup2, iMazing, Full file system extraction

What it is

ChatStorage.sqlite is WhatsApp's main database on iOS, a Core Data SQLite store holding every conversation the device keeps locally: one-to-one chats, groups, broadcast lists, status updates and system messages. WhatsApp stores it in an app group container shared between the app and its extensions, not in the app's own data container.

Unlike Signal and Telegram, WhatsApp's database is plain SQLite and reaches a standard iTunes or Finder backup. That makes it one of the most accessible third-party messaging sources on an iPhone.

Where it lives

SourcePathNotes
Full file system/private/var/mobile/Containers/Shared/AppGroup/<UUID>/ChatStorage.sqlite (+ -wal, -shm)Group group.net.whatsapp.WhatsApp.shared; UUID differs per device
Media.../AppGroup/<UUID>/Message/Media/<chat JID>/...Paths referenced by ZWAMEDIAITEM.ZMEDIALOCALPATH
Contacts.../AppGroup/<UUID>/ContactsV2.sqliteWhatsApp's view of contacts
Identifier mappingLID.sqlite or table ZWAPHONENUMBERLIDPAIR in ChatStorageMaps LIDs to phone numbers, depending on version
BackupAppDomainGroup-group.net.whatsapp.WhatsApp.shared, ChatStorage.sqliteStored as 7c/7c7fba66680ef796b916b067077cc246adacf01d

Find the group UUID by searching for the group identifier in .com.apple.mobile_container_manager.metadata.plist files, or resolve backup paths through Manifest.db.

What it proves

  • Messages sent and received with the other party's JID (<number>@s.whatsapp.net or <id>@g.us for groups), direction and times.
  • Group names, members and admin changes through system messages.
  • Media, documents, voice notes, shared locations (latitude and longitude on the media item) and link previews.
  • Starred, forwarded and deleted-for-everyone messages, as flags or placeholders.

It does not prove who typed the message: WhatsApp can run as a linked device on a computer or tablet, and messages sent from a companion appear too.

Key fields

Table / columnMeaning
ZWAMESSAGE.ZTEXTMessage text
ZWAMESSAGE.ZISFROMME1 = sent by the device owner
ZWAMESSAGE.ZFROMJID, ZTOJIDSender and recipient JIDs
ZWAMESSAGE.ZMESSAGEDATE, ZSENTDATEMessage times
ZWAMESSAGE.ZMESSAGETYPEText, image, video, audio, contact, location, system... (values vary by version)
ZWAMESSAGE.ZCHATSESSION, ZGROUPMEMBER, ZMEDIAITEMLinks to chat, group member and media
ZWACHATSESSION.ZCONTACTJID, ZPARTNERNAME, ZSESSIONTYPEChat identity, name and type
ZWACHATSESSION.ZARCHIVED, ZREMOVEDArchived or removed chats
ZWAMEDIAITEM.ZMEDIALOCALPATH, ZMEDIAURL, ZLATITUDE, ZLONGITUDEMedia file, remote URL and location
ZWAGROUPMEMBER.ZMEMBERJID, ZCONTACTNAMEGroup participants

Message type codes and several columns change with app versions. Check .schema ZWAMESSAGE and validate type codes with known test messages.

Timestamps

WhatsApp dates are Cocoa time in seconds, UTC.

SELECT datetime(m.ZMESSAGEDATE + 978307200, 'unixepoch') AS msg_utc,
       s.ZPARTNERNAME AS chat, s.ZCONTACTJID,
       m.ZISFROMME, m.ZFROMJID, m.ZMESSAGETYPE, m.ZTEXT,
       mi.ZMEDIALOCALPATH, mi.ZLATITUDE, mi.ZLONGITUDE
FROM ZWAMESSAGE m
LEFT JOIN ZWACHATSESSION s ON m.ZCHATSESSION = s.Z_PK
LEFT JOIN ZWAMEDIAITEM mi ON mi.ZMESSAGE = m.Z_PK
ORDER BY m.ZMESSAGEDATE;

Retention

Messages remain until the user deletes them, clears or deletes the chat, or disappearing messages remove them after the chosen period. Deleted rows can survive in the WAL and freelist pages for a while. WhatsApp's chat backup to iCloud is a separate, end-to-end encryptable archive and is not the same as an iPhone backup.

Collection

  • A standard backup is enough for the database and much of the media. Encrypted backups are still preferable for everything else they add.
  • A full file system extraction adds the WAL and complete media folders. Copy the whole app group container.
  • Note the WhatsApp version (from the app bundle's Info.plist or installed apps) with the evidence.

Parsing

  • Messaging Forensics reads ChatStorage.sqlite in the browser and merges it with sms.db into one timeline.
  • iLEAPP parses messages, contacts and call logs from the container.
  • MVT extracts links from WhatsApp messages to check them against spyware indicators, and resolves LIDs to phone numbers.
  • sqlite3 with the query above for targeted review.

Investigator tips

  • Newer WhatsApp versions identify some participants by LID instead of phone number. Resolve them through ZWAPHONENUMBERLIDPAIR rather than reporting an opaque ID.
  • A "This message was deleted" placeholder proves a message existed. Look in the WAL and in interactionC.db for traces of it.
  • Media referenced in the database but missing on disk may have been offloaded, never downloaded, or deleted. Say which.
  • Resolve phone numbers with AddressBook and WhatsApp's own ContactsV2.sqlite, since names shown in WhatsApp can differ from the system contacts.

See also