Security Research: Behavioral forensic analysis revealing privacy vulnerabilities in Session Desktop messenger
This repository documents a forensic behavioral analysis of Session Desktop, a privacy-focused messaging application that claims to offer end-to-end encryption and metadata protection.
The research was conducted as part of a Digital Forensics course at a Cybersecurity program (CTeSP) and reveals several privacy vulnerabilities that may be of interest to:
- π Digital forensics investigators
- π Security researchers
- π€ Privacy-conscious users
- π Academic community
The SQLCipher database encryption key is stored in plain text in the config.json file, allowing anyone with file system access to decrypt the entire database.
%AppData%\Roaming\Session\config.json
Once decrypted, all message content is stored in clear text in the body field of the messages table, with no additional encryption layer.
When messages are deleted locally, the content remains recoverable in the messages_fts (Full-Text Search) table, even after physical deletion from the main table.
-- Recover deleted message content
SELECT rowid, body FROM messages_fts;When a sender uses "Clear for everyone", the message on the recipient's device is NOT deleted. Instead:
- The record is updated (not deleted)
- The
bodyfield is replaced with "This message was deleted" - Attachment files remain on disk
Files in the attachments.noindex folder are not removed when associated messages are deleted, remaining recoverable with the encryption key stored in the items table.
| Vulnerability | Impact | Forensic Value |
|---|---|---|
| Plain text encryption key | Critical | Full database access |
| Clear text message storage | High | Direct content recovery |
| FTS index persistence | High | Deleted message recovery |
| Remote deletion failure | High | Content recovery on recipient device |
| Attachment persistence | Medium | Media file recovery |
The analysis followed a systematic approach with 9 test scenarios:
| ID | Scenario | Description |
|---|---|---|
| C0 | Initial State | Baseline documentation |
| C1 | Conversation Creation | New conversation + message request |
| C2 | Message Reception | Incoming message analysis |
| C3a | Local Deletion (for me) | "Clear for me" behavior |
| C3b | Local Deletion (for everyone) | "Clear for everyone" behavior |
| C4 | Attachment Sending | Image upload analysis |
| C5 | Attachment Reception | Image + PDF download |
| C6a | Audio Reception | Voice message handling |
| C6b | Remote Deletion | Sender deletes "for everyone" |
Session Desktop uses a SQLCipher-encrypted SQLite database with:
- 19 tables
- 25 indexes
- 3 triggers (for FTS synchronization)
| Table | Purpose |
|---|---|
messages |
All sent/received messages |
conversations |
Contacts and conversation metadata |
messages_fts |
Full-text search index |
seenMessages |
Read receipts |
attachment_downloads |
Attachment download state |
| Type | hasAttachments | hasFileAttachments | hasVisualMediaAttachments |
|---|---|---|---|
| Image/Video | 1 | 0 | 1 |
| Document | 1 | 1 | 0 |
| Audio | 1 | 0 | 0 |
session-desktop-forensics/
βββ README.md # This file
βββ README.pt.md # Portuguese version
βββ LICENSE # MIT License
βββ docs/
β βββ Relatorio_AFD.pdf # Full academic report (Portuguese)
β βββ Relatorio_AFD.pdf.ots # OpenTimestamps proof file
βββ queries/
β βββ 01-count.sql # Record counting
β βββ 02-messages.sql # Message analysis
β βββ 03-conversations.sql # Conversation analysis
β βββ 04-fts-analysis.sql # FTS index analysis (deleted message recovery)
β βββ 05-triggers.sql # Trigger analysis
βββ findings/
β βββ encryption-key-exposure.md # Key storage vulnerability
β βββ fts-data-persistence.md # FTS data persistence
β βββ remote-deletion-failure.md # Remote deletion failure
β βββ attachment-persistence.md # Attachment persistence
βββ evidence/ # Forensic evidence screenshots
β βββ setup/ # Environment configuration
β βββ c0-initial/ # Initial state
β βββ c1-conversation/ # Conversation creation
β βββ c2-reception/ # Message reception
β βββ c3a-local-deletion/ # Local deletion evidence
β βββ c3b-global-deletion/ # Global deletion evidence
β βββ c4-attachment-send/ # Attachment sending
β βββ c5-attachment-receive/# Attachment reception
β βββ c6a-audio/ # Audio reception
β βββ c6b-remote-deletion/ # Remote deletion evidence
βββ methodology/
β βββ test-scenarios.md # Test methodology and scenarios
βββ latex-source/ # LaTeX source files (for academics)
βββ Relatorio/ # Full report source with images
- Windows 10/11
- Session Desktop installed
- DB Browser for SQLite (SQLCipher version)
-
Close Session Desktop completely
-
Locate the database:
%AppData%\Roaming\Session\sql\db.sqlite -
Get the encryption key from:
%AppData%\Roaming\Session\config.json -
Open DB Browser for SQLite (SQLCipher version)
-
Configure decryption:
- Select "SQLCipher 4 defaults"
- Change key type to "Raw key"
- Enter key with
0xprefix:0x[key_from_config.json]
-
Run the queries from the
/queriesfolder
This research report has been timestamped using OpenTimestamps, anchoring its existence to the Bitcoin blockchain. This provides:
- Proof of Existence: Cryptographic proof that the document existed at a specific date
- Immutability: The timestamp is permanently recorded on the Bitcoin blockchain
- Verification: Anyone can independently verify the timestamp
SHA256: 53b785ee2e1b9cfcfff17dee2feb4dad828665abb2fc8144dd6d72f1c52f1983
- Download the report PDF and its
.otsfile from thedocs/folder - Visit OpenTimestamps.org
- Upload both files to verify the timestamp
The .ots file contains the cryptographic proof linking the document's hash to a Bitcoin transaction.
- Session Official Documentation: https://getsession.org/
- Session Technical Whitepaper: https://arxiv.org/abs/2002.04609
- SQLCipher: https://www.zetetic.net/sqlcipher/
- DB Browser for SQLite: https://sqlitebrowser.org/
This research was conducted for educational purposes as part of an academic program. The findings are intended to:
- Inform users about privacy limitations
- Assist legitimate forensic investigations
- Contribute to security research
Do not use this information for unauthorized access to others' data.
| Author | GitHub |
|---|---|
| Ryan S. | @RyanTech00 |
| FK | @FK3570 |
| Hugo Correia | @hugocorreia2004 |
Cybersecurity Students | Digital Forensics Researchers
This project is licensed under the MIT License - see the LICENSE file for details.
- Academic supervisors at CTeSP Cybersecurity program
- Open source forensics community
- Claude (Anthropic) for documentation assistance
If you find this research useful, please β the repository!