With the mass migration away from the "bird site" it was time to dig into the new hotness that is Mastodon. Extinct no more (or should I say a bit more populated these days), Mastodon is a federated social network where instances are run independently of each other. I won't bore you with how it works (come join the infosec.exchange instance, it's run by an alpaca!).
For this blog post, I'm going to dive into the Android app and what we get pull back from a forensics perspective that may be useful for investigations. From a file system dump we can get to the Mastodon app path at:
data\data\org.joinmastodon.android
Contents of these folders are pretty bare at this point. There are three main files of interest, the accounts file, the instance details file, and the account database file. I'll break these three down and what I was able to find with my time spent analyzing them.
Account Database
The account database is what contains details about the app usage itself. This is where we will see timeline items, notifications, searches and more. The file can be found at:
data\data\org.joinmastodon.android\databases\*.db
The database file name will be in the format of <INSTANCE_NAME>_<ACCOUNT_ID>.db. For my test account it was "mstdn.social_109428923124491315.db". The file is just a SQLite database so we can open it in DB Browser. We get five tables total, four of which have usable data.
- home_timeline - a list of all toots/boosts from your followers and yourself
- notifications_all - all notifications including boosts, favorites, mentions and replies
- notifications_mentions - notifications that are only mentions or replies
- recent_searches - your recently searched hashtags or accounts
Home Timeline
The "home_timeline" only has a few columns including:- id - this appears to be the unique identifier of a specific toot
- json - contents and details about a specific toot, the meat of it all
- flags - TBD, these were always 0
The JSON can be easily read with a viewer, here is a snippet in NotePad++:
Notifications
Notifications take up two separate tables in the database because that's how they are broken out in the app itself. When you hit the bell icon you two tabs, one for All and one for Mentions, the difference being All includes favorites, follows, and mentions (including replies) where Mentions naturally only shows mentions/replies.- id - identifier of the notification entry
- json - contents of the notification itself including account details, timestamps and much more
- flags - TBD, always 0 again
- type - notification type (explained further below)
- 0 - follow
- 2 - reply
- 3 - boost
- 4 - favorite
- id - identifier for the searched item
- json - the meat of the table, search name along with some historical details
- time - timestamp in unixepoch of when the search was performed
For the hashtag search we see the JSON as such:
For ALEAPP I broke out account searches and hashtag searches into separate categories but generally this is what they look like:
Account JSON file
data\data\org.joinmastodon.android\files\accounts.json
Inside are details about the user account itself that is logged into the application. Some keys of interest are:
- username - name of the handle used
- created_at - timestamp of when the account was created
- followers_count/following_count - number of followers and following
- id - unique identifier of the account
- note - bio section of a profile
Instance Details
data\data\org.joinmastodon.android\files\instance_*.json
The file name will have be pretended by "instance_" followed by the instance name in all lowercase, replacing periods (".") with underscores ("_"). For my test account I join mstdn.social which leads to the file being named "instance_mstdn_social.json". Inside contains all information for all the custom emojis on the instance which can be a lot!
Items of interest though include the contact account details for the instance, description of the instance, stats such as user counts, URL, and versioning information. Here's what it looks like via ALEAPP: