Repository navigation
Add Anonymous Chat & Fun iOS parser - #2166
Conversation
abrignoni
left a comment
There was a problem hiding this comment.
Thanks for this, @darren33, and for fixing the lint warnings so quickly! There's a lot of careful work here. Finding the containers from the app's own metadata instead of a hard-coded UUID, refusing a database in a container it can't identify, scoping conversation keys to their database, and opening everything read-only are all good stuff. The SDImageCache link from the stored URL is a nice find too.
I went through the PR at ee28b2f9 and ran it against test trees built with your fixture builder, adding media files, an iTunes-style backup and a raw image. A few things need to change before we can merge.
Needs changes
1. Media linked to messages by size and time
_inferred_media_matches attaches a local file to a message when the byte size matches, the type is compatible and the file time is within 300 seconds. _media_table_message_matches does the same with a one-second window, and it's the only thing tying a Photos original to a message. The best candidate goes into the Messages Media column, so the picture shows up on the message.
In a test tree I saved an unrelated PNG of the right size 90 seconds after message-3, and it became message-3's picture. Nothing in the data tied the two together.
For chat media, a file should only go on a message when the app recorded the link: a stored path, the SDImageCache key from the stored URL, a join key or a hash. When there's no recorded link, please leave Media empty and say so in the notes. A size and time match can't tell the real attachment from another file of the same size, and once it's on the message it reads as the attachment. Does anything in messages (maybe message_info) record which media row a message used? That would be the recorded link for the Photos originals.
2. ZIP times read as UTC
_zip_datetime treats a ZIP entry's DOS date and time as UTC, but those fields hold the local time of the machine that wrote the zip. On one of the iOS full file system extractions I test with, the DOS time is 7 hours behind the UTC time in the entry's extended timestamp field on 1,997 of 2,000 sampled entries.
That makes the result depend on the input type. In my test, folder and tar input gave message-3 a red decoy saved 90 seconds after it. A zip of the same tree, written on a machine five hours behind UTC, gave it a blue decoy saved five hours after the message. If any time comparison stays, FileSeekerZip.decode_extended_timestamp already reads the UTC value.
3. iTunes backups return nothing
The iTunes seeker maps AppDomain-<bundle id> to Containers/Data/Application/<bundle id>, but _container_location needs a UUID there. I built a minimal unencrypted backup (Manifest.db) with the fixture's app files under AppDomain-com.anonimchat.app. anonimchat.db was staged, and all six artifacts reported "No data found" with no error. In that path shape the folder name after Data/Application/ is the bundle id itself, which is enough to identify the container.
4. Raw image input loses all media
_iter_source_entries reads seeker internals (zip_file, tar_file, _all_files, single_file_abs_path), and the raw image seeker added in #2165 has none of them. I ran -t raw on an APFS image of the same test tree. Messages parsed, but there were no filesystem media rows and no media links, including the valid SDImageCache one, and no error. seeker.search() works on every input type. If that's too slow, please say in the notes which input types get media.
5. The fixture test fails on macOS
test_published_samples_are_exact_subsets_of_a_fresh_synthetic_build fails for all six archives on macOS (Python 3.12, SQLite 3.43.1):
manifest.jsonin the committed zips has CRLF line endings, becausewrite_texttranslates newlines on Windows.write_bytes, ornewline='\n', fixes that part.anonimchat.dbandPhotos.sqlitestore the SQLite library version in the file header (bytes 96 to 99): 3.37.2 in the committed files, 3.43.1 here. That can't be pinned, so comparing the tables and rows would be steadier than comparing bytes.
CI doesn't catch it because the runtime-contract job checks out without admin/test/cases/data, so the comparison is skipped there.
6. Real data
Everything in the PR is tested on synthetic data. If you can run it on an extraction that has the app, please record the OS version and row counts in sample_data. We don't need the data itself.
Notes and descriptions
- The Messages notes say "In the observed schema, from_username is the local conversation account and to_username is the remote participant." Every direction label depends on that, and the notes don't say what it was observed on. What establishes it? If the app's AsyncStorage
manifest.jsonholds the signed-in username, that would settle it. It's inpaths, but nothing reads it right now. - I couldn't verify App Store ID 1483337394. Apple's lookup API returns no result for that ID or for
com.anonimchat.appin the storefronts I tried, and the App Store URL returns 404. Where did the ID come from? If it can't be confirmed, I'd keep only the bundle ID, which comes from the extraction. The appInfo notes also say the app is "listed by MWM". Is MWM the developer, or a site that lists apps? If it's a directory, I'd drop it so nobody reads it as the publisher. - The media notes say ZIP input "may" have blank created and access times. For zip and tar input they're always blank. For folder input they come from
os.staton the copy iLEAPP was pointed at, so they describe that copy, not the device. I'd say that in the notes, or leave those two columns out. conversation_timeis an integer in the fixture, but_human_timeparsesYYYY-MM-DD HH:MM:SSand marks it UTC. On the fixture the parse fails and the raw integer goes into the datetime column, so neither path is really tested. Which form does the app store? If it's text with no zone, it shouldn't be stamped as UTC.- The PR body says media rendering "was checked in LAVA with the parser running against the case", and the module comment says development validation "deliberately does not run that media path against case material". No need to share any data, but the two should say the same thing.
Smaller things
- The media inventory includes the app bundle's own images. All 40 PNGs I placed inside the
.appcame out as rows. On one test extraction, app bundles hold a median of 37.5 image, video or audio files each (up to 3,725). Those ship with the app, so I'd leave the bundle container out of the inventory. - App Group containers keep the group id in
MCMMetadataIdentifier(77 of the 80 I sampled start withgroup.), so the comparison with the bundle id won't find this app's group, and the AppGroup pattern stages every group's metadata for nothing. - The Photos original lookup (L1613, L1641) is an exact match on paths starting
private/var/orvar/. The same test tree zipped under afilesystem1/root lost the Photos link that the/private/root produced, and 7 of the 17 extractions I have with DCIM files use a different root like that. - The fixture puts the bundle container at
private/var/mobile/Containers/Bundle/Application. The iOS extractions I test with have it atprivate/var/containers/Bundle/Application, which your hardening test already uses. The fixture's app database also gets aZASSETtable. Does the app's database really have one, or is that left over from the Photos fixture? app_plists['bundle']andapp_plists['data']are set but never used.- In the tests, the fallbacks to
build_synthetic_fixture.pyandtestdata/anonymousChat_synthetic_extraction.zippoint at files that aren't in the repo, and one test asserts the author string, which will break if that field is ever reformatted. The README inadmin/test/cases/would fit better in the module notes or this PR. - Speed: the matching compares every media message with every candidate file, and it runs for both Messages and Media. On synthetic data it cost about 7 microseconds per pair, so 5,000 media messages against 10,000 cache files would take roughly 6 minutes per artifact. Indexing the files once by path, basename and cache key would avoid the pairwise scan.
Thanks again for putting this together. Happy to answer anything here, and once these are addressed I'll take another look.
|
Thanks for going through this. I’ve pushed the fixes and added the OS version and row counts to Latest commit is Thank you. |
3432d62 to
6602f80
Compare
Read every file through the artifact's own paths instead of walking seeker internals, and link message media only by the SDWebImage cache name of the stored URL. Drop the filesystem inventory, signature sniffing, Photos and message_info joins, and the files_found and lookup-cache edits. Folder input now links media, which the inventory walk lost. Skip AppleDouble sidecars. Replace the hardening, synthetic and CLI tests with one test that runs folder, zip and tar input over two app containers and a decoy, and regenerate the case data. Drop this PR's edits to the shared test scripts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Say how numeric times are scaled, name the SDWebImage 4 cache folder and search it, lead the Media artifact with its timestamps, and rename headers whose meaning is not established (Store Artist Name, Msg ID). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks again for all the work on this, @darren33. I pushed two commits to your branch and wanted to explain why. The module had grown to about 2,700 lines, and a lot of that was reading the seekers' internals for each input type. That breaks every time the core changes. When I ran it on a synthetic tree as folder, zip, tar and raw input, folder input linked no media at all, because the file filter compared absolute paths. What changed:
If you can re-run it on your extraction and share the row counts, plus the shape (not the values) of the manifest keys and Hope this helps. |
Adds six artifacts for the iOS app Anonymous Chat & Fun (com.anonimchat.app) by @darren33.
paths.message_infojoins are out until a real extraction shows how the app records them.The approach changed during review. The comments explain why.