📜 ⬆️ ⬇️

WhatsApp in the palm of your hand: where and how can you detect forensic artifacts?



Want to find out what types of forensic artifacts WhatsApp exist in different operating systems and where exactly they can be detected - then you should be here. With this article, Igor Mikhailov, a specialist in the Laboratory of Computer Forensics at Group-IB, opens a series of publications on WhatsApp forensic research and on what information can be obtained from analyzing the device.

Immediately, we note that different types of WhatsApp artifacts are stored in different operating systems, and if a researcher can extract certain types of WhatsApp data from one device, this does not mean that these types of data can be extracted from another device. For example, if a Windows system block is removed, then WhatsApp chats will probably not be found on its disks (with the exception of backup copies of iOS devices that can be detected on the same drives). With the withdrawal of laptops and mobile devices will have its own characteristics. Let's talk about this in more detail.
')

WhatsApp artifacts in the Android device


In order to extract WhatsApp artifacts from a device running Android OS, a researcher must have superuser rights ( 'root' ) on the device under study or be able to extract the physical memory dump of the device or its file system by other means (for example, using software vulnerabilities of a specific mobile device). devices).

Application files are located in the phone’s memory in the section in which user data is stored. As a rule, this section is named 'userdata' . Subdirectories and program files are located on the path: '/data/data/com.whatsapp/' .

image alt

The main files that contain forensic artifacts of WhatsApp in Android OS are the databases 'wa.db' and 'msgstore.db' .

The 'wa.db' database contains a full list of WhatsApp user’s contacts, including a phone number, a display name, timestamps, and any other information provided when registering with WhatsApp. The file 'wa.db' is located along the path: '/data/data/com.whatsapp/databases/' and has the following structure:

image alt

The most interesting tables in the 'wa.db' database for the researcher are:


The database 'msgstore.db' contains information about sent messages, such as contact number, message text, message status, timestamps, information about sent files included in messages, etc. The file 'msgstore.db' is located along the path: '/data/data/com.whatsapp/databases/' and has the following structure:

image alt

The most interesting tables in the 'msgstore.db' file for the researcher are:


Also, when examining WhatsApp in a mobile device running Android, pay attention to the following files:


You also need to pay attention to the following directories:


WhatsApp log files:

image alt

Fragment of the magazine
2017-01-10 09: 37: 09.757 LL_I D [524: WhatsApp Worker # 1] missedcallnotification / init count: 0 timestamp: 0
2017-01-10 09: 37: 09.758 LL_I D [524: WhatsApp Worker # 1] missedcallnotification / update cancel true
2017-01-10 09: 37: 09.768 LL_I D [1: main] app-init / load-me
2017-01-10 09: 37: 09.772 LL_I D [1: main] password file missing or unreadable
2017-01-10 09: 37: 09.782 LL_I D [1: main] statistics Text Messages: 59 sent, 82 received / Media Messages: 1 sent (0 bytes), 0 received (9850158 bytes) / Offline Messages: 81 received ( 19522 msec average delay) / Message Service: 116075 bytes sent, 211729 bytes received / Voip Calls: 1 outgoing calls, 0 incoming calls, 2492 bytes sent, 1530 bytes received / Google Drive: 0 bytes sent, 0 bytes received / Roaming: 1524 bytes sent, 1826 bytes received / Total Data: 118567 bytes sent, 10063417 bytes received
2017-01-10 09: 37: 09.785 LL_I D [1: main] media-state-manager / refresh-media-state / writable-media
2017-01-10 09: 37: 09.806 LL_I D [1: main] app-init / initialize / timer / stop: 24
2017-01-10 09: 37: 09.811 LL_I D [1: main] msgstore / checkhealth
2017-01-10 09: 37: 09.817 LL_I D [1: main] msgstore / checkhealth / journal / delete false
2017-01-10 09: 37: 09.818 LL_I D [1: main] msgstore / checkhealth / back / delete false
2017-01-10 09: 37: 09.818 LL_I D [1: main] msgstore / checkdb / data / data / com.whatsapp / databases / msgstore.db
2017-01-10 09: 37: 09.819 LL_I D [1: main] msgstore / checkdb / list _jobqueue-WhatsAppJobManager 16384 drw = 011
2017-01-10 09: 37: 09.820 LL_I D [1: main] msgstore / checkdb / list _jobqueue-WhatsAppJobManager-journal 21032 drw = 011
2017-01-10 09: 37: 09.820 LL_I D [1: main] msgstore / checkdb / list axolotl.db 184320 drw = 011
2017-01-10 09: 37: 09.821 LL_I D [1: main] msgstore / checkdb / list axolotl.db-wal 436752 drw = 011
2017-01-10 09: 37: 09.821 LL_I D [1: main] msgstore / checkdb / list axolotl.db-shm 32768 drw = 011
2017-01-10 09: 37: 09.822 LL_I D [1: main] msgstore / checkdb / list msgstore.db 540672 drw = 011
2017-01-10 09: 37: 09.823 LL_I D [1: main] msgstore / checkdb / list msgstore.db-wal 0 drw = 011
2017-01-10 09: 37: 09.823 LL_I D [1: main] msgstore / checkdb / list msgstore.db-shm 32768 drw = 011
2017-01-10 09: 37: 09.824 LL_I D [1: main] msgstore / checkdb / list wa.db 69632 drw = 011
2017-01-10 09: 37: 09.825 LL_I D [1: main] msgstore / checkdb / list wa.db-wal 428512 drw = 011
2017-01-10 09: 37: 09.825 LL_I D [1: main] msgstore / checkdb / list wa.db-shm 32768 drw = 011
2017-01-10 09: 37: 09.826 LL_I D [1: main] msgstore / checkdb / list chatsettings.db 4096 drw = 011
2017-01-10 09: 37: 09.826 LL_I D [1: main] msgstore / checkdb / list chatsettings.db-wal 70072 drw = 011
2017-01-10 09: 37: 09.827 LL_I D [1: main] msgstore / checkdb / list chatsettings.db-shm 32768 drw = 011
2017-01-10 09: 37: 09.838 LL_I D [1: main] msgstore / checkdb / version 1
2017-01-10 09: 37: 09.839 LL_I D [1: main] msgstore / canquery
2017-01-10 09: 37: 09.846 LL_I D [1: main] msgstore / canquery / count 1
2017-01-10 09: 37: 09.847 LL_I D [1: main] msgstore / canquery / timer / stop: 8
2017-01-10 09: 37: 09.847 LL_I D [1: main] msgstore / canquery 517 | time spent: 8
2017-01-10 09: 37: 09.848 LL_I D [529: WhatsApp Worker # 3] media-state-manager / refresh-media-state / internal-storage available: 1,345,622,016 total: 5,687,922,688


Features of data storage in some models of mobile devices


In some models of mobile devices running Android, it is possible to store WhatsApp artifacts in another place. This is due to changes in the storage space of application data by the system software of the mobile device. For example, in Xiaomi mobile devices there is a function to create a second workspace (“SecondSpace”). When this function is activated, the location of the data changes. So, if in a conventional mobile device running the Android OS, user data is stored in the directory '/ data / user / 0 /' (which is a link to the usual '/ data / data /' ), then in the second workspace, application data is stored in the directory '/ data / user / 10 /' . That is, on the example of the location of the file 'wa.db' :


WhatsApp artifacts in the iOS device


Unlike Android OS, in iOS, the data of the WhatsApp application is transferred to a backup copy (iTunes backup). Therefore, the extraction of data from this application does not require the extraction of the file system or the creation of a physical memory dump of the device under investigation. Most of the relevant information is contained in the database 'ChatStorage.sqlite' , which is located along the path: '/private/var/mobile/Applications/group.net.whatsapp.WhatsApp.shared/' (in some programs this path is displayed as ' AppDomainGroup -group.net.whatsapp.WhatsApp.shared ' ).

Structure 'ChatStorage.sqlite' :

image alt

The most informative in the database 'ChatStorage.sqlite' are the tables 'ZWAMESSAGE' and 'ZWAMEDIAITEM' .

Appearance of the table 'ZWAMESSAGE' :

image alt

Table structure 'ZWAMESSAGE'
Field nameValue
Z_PKrecord sequence number (in SQL table)
Z_ENTtable identifier is '9'
Z_OPTunknown, usually contains values ​​from '1' to '6'
ZCHILDMESSAGESDELIVEREDCOUNTunknown, usually contains the value '0'
ZCHILDMESSAGESPLAYEDCOUNTunknown, usually contains the value '0'
ZCHILDMESSAGESREADCOUNTunknown, usually contains the value '0'
ZDATAITEMVERSIONunknown, usually contains the value '3' is probably a text message pointer
ZDOCIDunknown
ZENCRETRYCOUNTunknown, usually contains the value '0'
ZFILTEREDRECIPIENTCOUNTunknown, usually contains the values ​​'0', '2', '256'
ZISFROMMEmessage direction: '0' is incoming, '1' is outgoing
ZMESSAGEERRORSTATUSmessage transfer status If the message is sent / received, it is '0'
ZMESSAGETYPEmessage type
ZSORTunknown
ZSPOTLIGHSTATUSunknown
ZSTARREDunknown, not used
ZCHATSESSIONunknown
ZGROUPMEMBERunknown, not used
ZLASTSESSIONunknown
ZMEDIAITEMunknown
ZMESSAGEINFOunknown
ZPARENTMESSAGEunknown, not used
ZMESSAGEDATEOS X Epoch Time Timestamp
ZSENTDATEmessage sending time in OS X Epoch Time format
ZFROMJIDWhatsApp sender ID
ZMEDIASECTIONIDcontains the year and month of the media file sending
ZPHASHunknown, not used
ZPUSHPAMEthe name of the contact who sent the media file in UTF-8 format
ZSTANZIDunique message identifier
ZTEXTMessage text
ZTOJIDWhatsapp recipient id
OFFSETbias

Appearance of the table 'ZWAMEDIAITEM' :

image alt

Table structure 'ZWAMEDIAITEM'
Field nameValue
Z_PKrecord sequence number (in SQL table)
Z_ENTtable identifier is '8'
Z_OPTunknown, usually contains values ​​from '1' to '3'.
ZCLOUDSTATUScontains the value '4' if the file is loaded.
ZFILESIZEcontains the length of the file (in bytes) for the downloaded files
ZMEDIAORIGINunknown, usually '0'
ZMOVIEDURATIONmedia file length, for pdf files may contain the number of document pages
ZMESSAGEcontains a sequence number (the number is different from the one specified in the 'Z_PK' column)
ZASPECTRATIOaspect ratio, not used, usually has the value '0'
ZHACCURACYunknown, usually '0'
ZLATTITUDEpixel width
ZLONGTITUDEpixel height
ZMEDIAURLDATEtimestamp in OS X Epoch Time format
ZAUTHORNAMEauthor (for documents, may contain file name)
ZCOLLECTIONNAMEnot used
ZMEDIALOCALPATHfile name (with path) in the device file system
ZMEDIAURLThe URL where the media file was located. If the file was transferred from one subscriber to another, it was encrypted and its extension will be indicated as the extension of the file being transferred - .enc
ZTHUMBNAILLOCALPATHPath to file thumbnail in device file system
ZTITLEfile header
ZVCARDNAMEmedia file hash, when transferring a file to a group, may contain the sender's identifier
ZVCARDSTRINGcontains information about the type of the file being transferred (for example, image / jpeg); when transferring a file to a group it may contain the recipient's identifier
ZXMPPTHUMBPATHPath to file thumbnail in device file system
ZMEDIAKEYunknown, probably contains a key to decrypt the encrypted file.
ZMETADATAmessage metadata
Offsetbias

Other interesting database tables for 'ChatStorage.sqlite' are:


Also, when examining WhatsApp in a mobile device running iOS, pay attention to the following files:


Content of the file 'group.net.whatsapp.WhatsApp.shared.plist'
image alt

You also need to pay attention to the following directories:


WhatsApp artifacts in Windows


WhatsApp artifacts in Windows can be found in several places. First of all, these are directories containing executable and auxiliary program files (for Windows 8/10):

In the 'C: \ Users \% User profile% \ AppData \ Local \ WhatsApp \' directory is located the log file 'SquirrelSetup.log' , which contains information on checking for updates and installing the program.

In the 'C: \ Users \% User profile% \ AppData \ Roaming \ WhatsApp \' directory there are several subdirectories:

image alt

The file 'main-process.log' contains information about the operation of the WhatsApp program.

The 'databases' subdirectory contains the 'Databases.db' file, but this file does not contain any information about chats or contacts.

The most interesting from a forensic point of view are the files in the 'Cache' directory. These are mainly files with the name 'f _ *******' (where * is a number from 0 to 9) containing encrypted multimedia files and documents, but among them there are also unencrypted files. Of particular interest are the 'data_0' , 'data_1' , 'data_2' , 'data_3' files located in the same subdirectory. The 'data_0' , 'data_1' , 'data_3' files contain external links to the transmitted encrypted multimedia files and documents.

An example of the information contained in the 'data_1' file
image alt

Also, the 'data_3' file may contain graphic files.

The 'data_2' file contains contact avatars (can be restored by searching for file headers).

Avatars contained in the 'data_2' file:

image alt

Thus, it is impossible to find chat rooms in the computer’s memory, but you can find:


WhatsApp artifacts in MacOS


In MacOS, you can find types of artifacts of WhatsApp, similar to those found in Windows.

Program files are directories:


Sources
  1. Forensic analysis of WhatsApp Messenger on Android smartphones, by Cosimo Anglano, 2014.
  2. Whatsapp Forensics: Eksplorasi sistem berkas dan basis data pada aplikasi Android dan iOS by Ahmad Pratama, 2014.



In the following articles in this series:

Decryption of encrypted WhatsApp databases
An article that will provide information on how the WhatsApp encryption key is generated and gives practical examples showing how to decrypt the encrypted databases of this application.

Extract WhatsApp data from cloud storage
An article in which we will tell you what kind of WhatsApp data is stored in the clouds, and we will describe methods for extracting this data from cloud storage.

Extracting WhatsApp data: practical examples
An article that will be step by step described by what programs and how to extract WhatsApp data from various devices.

Source: https://habr.com/ru/post/447592/


All Articles