SlideShare a Scribd company logo
1 of 30
http://belkasoft.com
SQLite Forensics
Yuri Gubanov, Belkasoft
Introducing myself
Yuri Gubanov
• CEO and Founder of Belkasoft
• Belkasoft – digital forensics software manufacturer
• Frequent speaker on industry-known conferences
• Senior lecturer in St-Petersburg State University, Russia
• Software developer by education, MSc
http://belkasoft.com
Today’s agenda
Digging deep about SQLite
• What is SQLite?
• Why is it important?
• Deleting data from SQLite: Freelists
• Unallocated: not only a hard drive
• SQLite WAL and journal files
• Some real stories
• A little practice
http://belkasoft.com
Before we start: my Skype profile
http://belkasoft.com
What is SQLite?
Popular database engine
• Relational SQL-based database
• Lightweight
• Does not require installation
• Just a file on disk
• Well, sometimes more than one
• Does not require system services
http://belkasoft.com
Why SQLite is important?
SQLite is massively used in modern apps
• Database of choice for 90+% of new apps
• Especially mobile ones
• Most of apps in Android/iOS
• E.g.: messengers Skype, WhatsApp, Viber
• E.g.: Major browsers such as Firefox, Chrome, Safari
• E.g. iPhone SMS database
http://belkasoft.com
Frequent approach to SQLite forensics
Often SQLite analysis is like following:
• Select free or open source tool
• E.g. DB Browse for SQLite (formerly SQLite Database Browser)
• E.g. SQLite viewer addon to Mozilla Firefox
• The price is reasonable! 
• Open database in the viewer
• Trust the results
• End of story
http://belkasoft.com
Drawbacks of using a non-forensic tool
“Free” does not equal “trustworthy”
• Does not show deleted records
• Does not even indicate presence of deleted records
• Does not show uncommitted records
• Does not show remnants in “unallocated”
• Does not carve database files
• Does not find SQLite files in RAM memory/dumps/hibernation/pagefile
Even single feature above can change investigation conclusions
dramatically (and we had real cases for that!)
http://belkasoft.com
Tool used for demos today
To demonstrate SQLite forensics today we will use
Belkasoft Evidence Center 2015 (Ultimate edition):
• Shows deleted records (“freelists”)
• Shows uncommitted records (WAL/journal files)
• Shows remnants in “unallocated”
• Carves SQLite files
• Find SQLite in RAM memory/dumps/hibernation/pagefile
• Has built-in SQLite Viewer
• Allows to review SQLite database in binary mode in built-in HexViewer
http://belkasoft.com
SQLite database structure
SQLite is a set of data pages of a fixed size
http://belkasoft.com
Freelist
Freelist: a list of free pages in a SQLite database
http://belkasoft.com
What is freelist
http://belkasoft.com
SQLite.org
“A database file might contain one or more pages that are not in active use.
Unused pages can come about, for example, when information is deleted from the
database. Unused pages are stored on the freelist and are reused when additional
pages are required.”
Is it true for every deleted record?
Freelists are only there if “auto_vacuum” option is not set
• Default: 0 (no autovacuum)
• 1 (Full) requires database rebuilding and implies
performance penalty
• Autovacuum makes database fragmentation worse
http://belkasoft.com
www.belkasoft.com
Do you see any records?
www.belkasoft.com
But in fact there are 38!
www.belkasoft.com
But why?!?
Why standard viewer does not show freelist information?
Because freelist is a technical trick to improve performance. It is not supposed
that regular user can see what’s inside.
What are you going to miss:
• Deleted SMSes on iPhone
• Deleted Chrome/Firefox browsing history
• Deleted Skype, WhatsApp, Kik chats
• and hundreds of other apps’ data stored in SQLite
Unallocated space: SQLite’s, not a hard drive’s
• Data pages: “leaf table B-tree”, filled from end to beginning
• Unallocated page space: Free space inside a SQLite page with
unstructured data
http://belkasoft.com
Unallocated space: SQLite’s, not a hard drive’s
• Unlike freelists, unallocated space is not formally referenced from
anywhere in the SQLite database
• Can’t determine, which page they originally belonged to
• Carving inside unallocated can give good results
http://belkasoft.com
SQLite Write-Ahead-Log file
Initial stage
Data changing
Commit
Since version 3.7.0, SQLite employs “Write Ahead Log”
Process of writing data to a SQLite database:
http://belkasoft.com
WAL journal
• Most actual data, which did not yet have a chance to merge to the
main database file
• “Checkpoint” event does actual commit
• Triggered by reaching a certain size
• By default, 1000 pages
• Awful lot for chat or browsing sessions
• What is the difference with Rollback Journal?
http://belkasoft.com
So, where data can hide in SQLite?
Deleted SQLite data can reside in one of the following:
• Freelist
• Unallocated space
Uncommitted data can reside in
• WAL journal (or, old records can reside in rollback journal)
http://belkasoft.com
Carving SQLite databases
SQLite has excellent header signature, what’s the difficulty?
• Indeed: “SQLite format 3”
• Easy to find, no false positives
• But… where’s the footer?
• There is no footer for SQLite database!
• There is also no data on DB size in DB header
http://belkasoft.com
Our solution
The only thing we know is a page size
• Read database header
• Find first page
• Read page size
• Read whole page and write to file
• Read next page header and validate it
• If valid, read page size and continue the process
Drawbacks
• Time-consuming
• Don’t work well with fragmentation
http://belkasoft.com
Case: Trade Secret Disclosed
• A big enterprise suspected an employee to disclose an important
know-how
• Employee’s computer was imaged and investigated
• Particularly, an Android backup and Skype account found
• Nothing interesting there, but
• WhatsApp history encrypted
• Skype history empty
The plot
Decrypting encrypted WhatsApp
• Skype stores its history in a SQLite database
• Belkasoft Evidence Center has a built-in SQLite Viewer
• Why do you need it?
• Damaged carved SQLite databases
• Freelist analysis
• Unnalocated space analysis
• Unnoticed WAL/journal files
Dealing with empty Skype database
• More than 100 deleted Skype chats recovered by Belkasoft
• Recovered Skype logs along with decrypted WhatApp history solved
the case
Result
• My Skype: journal
• Sample db+journal and SQLite Database Browser
• HexViewer and Skype
• Carving unallocated
• Carving SQLite in Live RAM
Practice
Before we say “goodbye”
Belkasoft article on SQLite:
http://belkasoft.com/sqlite-analysis
Would like to get this presentation?
• Contact me at yug@belkasoft.com!
• Leave me your card
• Add me in LinkedIn (search for Yuri Gubanov)
Free demo version
• Downloadable full 1-month trial for all conference attendees:
belkasoft.com/trial
Request today!
http://belkasoft.com

More Related Content

What's hot

CCNAv5 - S2: Chapter4 Routing Concepts
CCNAv5 - S2: Chapter4 Routing ConceptsCCNAv5 - S2: Chapter4 Routing Concepts
CCNAv5 - S2: Chapter4 Routing ConceptsVuz Dở Hơi
 
Introduction To Apache Camel
Introduction To Apache CamelIntroduction To Apache Camel
Introduction To Apache CamelKnoldus Inc.
 
SCSI Protocol
SCSI ProtocolSCSI Protocol
SCSI ProtocolRakesh T
 
Rhel cluster basics 1
Rhel cluster basics   1Rhel cluster basics   1
Rhel cluster basics 1Manoj Singh
 
High Availability Part 2 - pfSense Hangout July 2016
High Availability Part 2 - pfSense Hangout July 2016High Availability Part 2 - pfSense Hangout July 2016
High Availability Part 2 - pfSense Hangout July 2016Netgate
 
Curso de-asterisk-everano-2007-1204975330483842-4
Curso de-asterisk-everano-2007-1204975330483842-4Curso de-asterisk-everano-2007-1204975330483842-4
Curso de-asterisk-everano-2007-1204975330483842-4Newlink
 
Storage Virtualization
Storage VirtualizationStorage Virtualization
Storage Virtualizationrjain51
 
Switch configuration
Switch configurationSwitch configuration
Switch configurationMuuluu
 

What's hot (10)

CCNAv5 - S2: Chapter4 Routing Concepts
CCNAv5 - S2: Chapter4 Routing ConceptsCCNAv5 - S2: Chapter4 Routing Concepts
CCNAv5 - S2: Chapter4 Routing Concepts
 
Introduction To Apache Camel
Introduction To Apache CamelIntroduction To Apache Camel
Introduction To Apache Camel
 
SCSI Protocol
SCSI ProtocolSCSI Protocol
SCSI Protocol
 
Rhel cluster basics 1
Rhel cluster basics   1Rhel cluster basics   1
Rhel cluster basics 1
 
Zabbix Monitoring Platform
Zabbix Monitoring Platform Zabbix Monitoring Platform
Zabbix Monitoring Platform
 
High Availability Part 2 - pfSense Hangout July 2016
High Availability Part 2 - pfSense Hangout July 2016High Availability Part 2 - pfSense Hangout July 2016
High Availability Part 2 - pfSense Hangout July 2016
 
Curso de-asterisk-everano-2007-1204975330483842-4
Curso de-asterisk-everano-2007-1204975330483842-4Curso de-asterisk-everano-2007-1204975330483842-4
Curso de-asterisk-everano-2007-1204975330483842-4
 
Storage Virtualization
Storage VirtualizationStorage Virtualization
Storage Virtualization
 
Switch configuration
Switch configurationSwitch configuration
Switch configuration
 
CCNP ROUTE V7 CH4
CCNP ROUTE V7 CH4CCNP ROUTE V7 CH4
CCNP ROUTE V7 CH4
 

Similar to SQLite forensics - Free Lists, unallocated space, carving

SSIS Monitoring Deep Dive
SSIS Monitoring Deep Dive�SSIS Monitoring Deep Dive�
SSIS Monitoring Deep DiveSolidQIT
 
SSIS Monitoring Deep Dive
SSIS Monitoring Deep DiveSSIS Monitoring Deep Dive
SSIS Monitoring Deep DiveDavide Mauri
 
Sql data base
Sql data baseSql data base
Sql data baseAli Jafar
 
10 Things Learned Releasing Databricks Enterprise Wide
10 Things Learned Releasing Databricks Enterprise Wide10 Things Learned Releasing Databricks Enterprise Wide
10 Things Learned Releasing Databricks Enterprise WideDatabricks
 
Free Training: How to Build a Lakehouse
Free Training: How to Build a LakehouseFree Training: How to Build a Lakehouse
Free Training: How to Build a LakehouseDatabricks
 
Share point development 101
Share point development 101Share point development 101
Share point development 101Becky Bertram
 
Top 10 DBA Mistakes on Microsoft SQL Server
Top 10 DBA Mistakes on Microsoft SQL ServerTop 10 DBA Mistakes on Microsoft SQL Server
Top 10 DBA Mistakes on Microsoft SQL ServerKevin Kline
 
Optimizing Access with SQL Server
Optimizing Access with SQL ServerOptimizing Access with SQL Server
Optimizing Access with SQL ServerPRPASS Chapter
 
Introduction SQL Analytics on Lakehouse Architecture
Introduction SQL Analytics on Lakehouse ArchitectureIntroduction SQL Analytics on Lakehouse Architecture
Introduction SQL Analytics on Lakehouse ArchitectureDatabricks
 
SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!Ben Steinhauser
 
Designing and Building Next Generation Data Pipelines at Scale with Structure...
Designing and Building Next Generation Data Pipelines at Scale with Structure...Designing and Building Next Generation Data Pipelines at Scale with Structure...
Designing and Building Next Generation Data Pipelines at Scale with Structure...Databricks
 
Introduction to SQLite: The Most Popular Database in the World
Introduction to SQLite: The Most Popular Database in the WorldIntroduction to SQLite: The Most Popular Database in the World
Introduction to SQLite: The Most Popular Database in the Worldjkreibich
 
Data modeling trends for analytics
Data modeling trends for analyticsData modeling trends for analytics
Data modeling trends for analyticsIke Ellis
 
The databases in SSDT: A work with project and best practices
The databases in SSDT: A work with project and best practicesThe databases in SSDT: A work with project and best practices
The databases in SSDT: A work with project and best practicesKamil Nowinski
 
SQLSaturday 664 - Troubleshoot SQL Server performance problems like a Microso...
SQLSaturday 664 - Troubleshoot SQL Server performance problems like a Microso...SQLSaturday 664 - Troubleshoot SQL Server performance problems like a Microso...
SQLSaturday 664 - Troubleshoot SQL Server performance problems like a Microso...Marek Maśko
 
Uklug 2014 connections dev faq
Uklug 2014  connections dev faqUklug 2014  connections dev faq
Uklug 2014 connections dev faqMark Myers
 

Similar to SQLite forensics - Free Lists, unallocated space, carving (20)

SSIS Monitoring Deep Dive
SSIS Monitoring Deep Dive�SSIS Monitoring Deep Dive�
SSIS Monitoring Deep Dive
 
SSIS Monitoring Deep Dive
SSIS Monitoring Deep DiveSSIS Monitoring Deep Dive
SSIS Monitoring Deep Dive
 
Domino testing presentation
Domino testing presentationDomino testing presentation
Domino testing presentation
 
Sql data base
Sql data baseSql data base
Sql data base
 
10 Things Learned Releasing Databricks Enterprise Wide
10 Things Learned Releasing Databricks Enterprise Wide10 Things Learned Releasing Databricks Enterprise Wide
10 Things Learned Releasing Databricks Enterprise Wide
 
Free Training: How to Build a Lakehouse
Free Training: How to Build a LakehouseFree Training: How to Build a Lakehouse
Free Training: How to Build a Lakehouse
 
Share point development 101
Share point development 101Share point development 101
Share point development 101
 
Sq lite database
Sq lite databaseSq lite database
Sq lite database
 
Top 10 DBA Mistakes on Microsoft SQL Server
Top 10 DBA Mistakes on Microsoft SQL ServerTop 10 DBA Mistakes on Microsoft SQL Server
Top 10 DBA Mistakes on Microsoft SQL Server
 
Optimizing Access with SQL Server
Optimizing Access with SQL ServerOptimizing Access with SQL Server
Optimizing Access with SQL Server
 
Where to save my data, for devs!
Where to save my data, for devs!Where to save my data, for devs!
Where to save my data, for devs!
 
Version Control meets Database Control
Version Control meets Database ControlVersion Control meets Database Control
Version Control meets Database Control
 
Introduction SQL Analytics on Lakehouse Architecture
Introduction SQL Analytics on Lakehouse ArchitectureIntroduction SQL Analytics on Lakehouse Architecture
Introduction SQL Analytics on Lakehouse Architecture
 
SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!
 
Designing and Building Next Generation Data Pipelines at Scale with Structure...
Designing and Building Next Generation Data Pipelines at Scale with Structure...Designing and Building Next Generation Data Pipelines at Scale with Structure...
Designing and Building Next Generation Data Pipelines at Scale with Structure...
 
Introduction to SQLite: The Most Popular Database in the World
Introduction to SQLite: The Most Popular Database in the WorldIntroduction to SQLite: The Most Popular Database in the World
Introduction to SQLite: The Most Popular Database in the World
 
Data modeling trends for analytics
Data modeling trends for analyticsData modeling trends for analytics
Data modeling trends for analytics
 
The databases in SSDT: A work with project and best practices
The databases in SSDT: A work with project and best practicesThe databases in SSDT: A work with project and best practices
The databases in SSDT: A work with project and best practices
 
SQLSaturday 664 - Troubleshoot SQL Server performance problems like a Microso...
SQLSaturday 664 - Troubleshoot SQL Server performance problems like a Microso...SQLSaturday 664 - Troubleshoot SQL Server performance problems like a Microso...
SQLSaturday 664 - Troubleshoot SQL Server performance problems like a Microso...
 
Uklug 2014 connections dev faq
Uklug 2014  connections dev faqUklug 2014  connections dev faq
Uklug 2014 connections dev faq
 

Recently uploaded

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 

Recently uploaded (20)

What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 

SQLite forensics - Free Lists, unallocated space, carving

  • 2. Introducing myself Yuri Gubanov • CEO and Founder of Belkasoft • Belkasoft – digital forensics software manufacturer • Frequent speaker on industry-known conferences • Senior lecturer in St-Petersburg State University, Russia • Software developer by education, MSc http://belkasoft.com
  • 3. Today’s agenda Digging deep about SQLite • What is SQLite? • Why is it important? • Deleting data from SQLite: Freelists • Unallocated: not only a hard drive • SQLite WAL and journal files • Some real stories • A little practice http://belkasoft.com
  • 4. Before we start: my Skype profile http://belkasoft.com
  • 5. What is SQLite? Popular database engine • Relational SQL-based database • Lightweight • Does not require installation • Just a file on disk • Well, sometimes more than one • Does not require system services http://belkasoft.com
  • 6. Why SQLite is important? SQLite is massively used in modern apps • Database of choice for 90+% of new apps • Especially mobile ones • Most of apps in Android/iOS • E.g.: messengers Skype, WhatsApp, Viber • E.g.: Major browsers such as Firefox, Chrome, Safari • E.g. iPhone SMS database http://belkasoft.com
  • 7. Frequent approach to SQLite forensics Often SQLite analysis is like following: • Select free or open source tool • E.g. DB Browse for SQLite (formerly SQLite Database Browser) • E.g. SQLite viewer addon to Mozilla Firefox • The price is reasonable!  • Open database in the viewer • Trust the results • End of story http://belkasoft.com
  • 8. Drawbacks of using a non-forensic tool “Free” does not equal “trustworthy” • Does not show deleted records • Does not even indicate presence of deleted records • Does not show uncommitted records • Does not show remnants in “unallocated” • Does not carve database files • Does not find SQLite files in RAM memory/dumps/hibernation/pagefile Even single feature above can change investigation conclusions dramatically (and we had real cases for that!) http://belkasoft.com
  • 9. Tool used for demos today To demonstrate SQLite forensics today we will use Belkasoft Evidence Center 2015 (Ultimate edition): • Shows deleted records (“freelists”) • Shows uncommitted records (WAL/journal files) • Shows remnants in “unallocated” • Carves SQLite files • Find SQLite in RAM memory/dumps/hibernation/pagefile • Has built-in SQLite Viewer • Allows to review SQLite database in binary mode in built-in HexViewer http://belkasoft.com
  • 10. SQLite database structure SQLite is a set of data pages of a fixed size http://belkasoft.com
  • 11. Freelist Freelist: a list of free pages in a SQLite database http://belkasoft.com
  • 12. What is freelist http://belkasoft.com SQLite.org “A database file might contain one or more pages that are not in active use. Unused pages can come about, for example, when information is deleted from the database. Unused pages are stored on the freelist and are reused when additional pages are required.”
  • 13. Is it true for every deleted record? Freelists are only there if “auto_vacuum” option is not set • Default: 0 (no autovacuum) • 1 (Full) requires database rebuilding and implies performance penalty • Autovacuum makes database fragmentation worse http://belkasoft.com
  • 16. www.belkasoft.com But why?!? Why standard viewer does not show freelist information? Because freelist is a technical trick to improve performance. It is not supposed that regular user can see what’s inside. What are you going to miss: • Deleted SMSes on iPhone • Deleted Chrome/Firefox browsing history • Deleted Skype, WhatsApp, Kik chats • and hundreds of other apps’ data stored in SQLite
  • 17. Unallocated space: SQLite’s, not a hard drive’s • Data pages: “leaf table B-tree”, filled from end to beginning • Unallocated page space: Free space inside a SQLite page with unstructured data http://belkasoft.com
  • 18. Unallocated space: SQLite’s, not a hard drive’s • Unlike freelists, unallocated space is not formally referenced from anywhere in the SQLite database • Can’t determine, which page they originally belonged to • Carving inside unallocated can give good results http://belkasoft.com
  • 19. SQLite Write-Ahead-Log file Initial stage Data changing Commit Since version 3.7.0, SQLite employs “Write Ahead Log” Process of writing data to a SQLite database: http://belkasoft.com
  • 20. WAL journal • Most actual data, which did not yet have a chance to merge to the main database file • “Checkpoint” event does actual commit • Triggered by reaching a certain size • By default, 1000 pages • Awful lot for chat or browsing sessions • What is the difference with Rollback Journal? http://belkasoft.com
  • 21. So, where data can hide in SQLite? Deleted SQLite data can reside in one of the following: • Freelist • Unallocated space Uncommitted data can reside in • WAL journal (or, old records can reside in rollback journal) http://belkasoft.com
  • 22. Carving SQLite databases SQLite has excellent header signature, what’s the difficulty? • Indeed: “SQLite format 3” • Easy to find, no false positives • But… where’s the footer? • There is no footer for SQLite database! • There is also no data on DB size in DB header http://belkasoft.com
  • 23. Our solution The only thing we know is a page size • Read database header • Find first page • Read page size • Read whole page and write to file • Read next page header and validate it • If valid, read page size and continue the process Drawbacks • Time-consuming • Don’t work well with fragmentation http://belkasoft.com
  • 24. Case: Trade Secret Disclosed
  • 25. • A big enterprise suspected an employee to disclose an important know-how • Employee’s computer was imaged and investigated • Particularly, an Android backup and Skype account found • Nothing interesting there, but • WhatsApp history encrypted • Skype history empty The plot
  • 27. • Skype stores its history in a SQLite database • Belkasoft Evidence Center has a built-in SQLite Viewer • Why do you need it? • Damaged carved SQLite databases • Freelist analysis • Unnalocated space analysis • Unnoticed WAL/journal files Dealing with empty Skype database
  • 28. • More than 100 deleted Skype chats recovered by Belkasoft • Recovered Skype logs along with decrypted WhatApp history solved the case Result
  • 29. • My Skype: journal • Sample db+journal and SQLite Database Browser • HexViewer and Skype • Carving unallocated • Carving SQLite in Live RAM Practice
  • 30. Before we say “goodbye” Belkasoft article on SQLite: http://belkasoft.com/sqlite-analysis Would like to get this presentation? • Contact me at yug@belkasoft.com! • Leave me your card • Add me in LinkedIn (search for Yuri Gubanov) Free demo version • Downloadable full 1-month trial for all conference attendees: belkasoft.com/trial Request today! http://belkasoft.com