FlagYard CTFForensics
Residual Context
An analyst used a local RAG setup (GPT4All LocalDocs) to draft customer "review covers", and a tool called BriefSync sealed each cover as a CMS envelope.
- Competition
FlagYard CTF
- Category
- ForensicsMedium
- Source status
- Source-documented · not platform-verified
- Document
- PDF edition7 min read
Brief
The challenge
- Category
- Forensics
- Difficulty
- Medium
- File
Link.txt→ Google Drive →casework.7z→casework.vhdx
An assurance team's review was followed by a support exception its customer says it never authorized. The analyst's work volume was preserved. Reconstruct what reached production and recover the receipt for the review responsible.
Flag format:
FlagY{32 lowercase hexadecimal characters}

TL;DR
An analyst used a local RAG setup (GPT4All LocalDocs) to draft customer "review covers", and a tool called BriefSync sealed each cover as a CMS envelope. On 14 Sep the LocalDocs index was rebuilt from altered handover documents, so twelve of them suddenly said a support exception was "covered by allowance" when the originals required a named approver. BriefSync then pruned every conversation after export. The pruned rows still sit in the SQLite WAL, and the older index generations survive in Volume Shadow Copies.
Joining the recovered conversations with the portal's closed service returns leaves exactly one tainted cover that was applied in production: Westhaven Systems, booking BD-4119, CR-92083, sent 18 Sep. Its envelope is sealed to recipient A. A's private key is gone from the live volume but still present in the 18 Sep shadow copy. Decrypting the envelope gives a receipt whose UUID equals the export job ID, and its token is the flag.
WAL replay → 128 pruned conversations → chunk IDsVSS index generations → 12 tainted handovers (14 Sep index)service-returns-closed.csv → single production/applied tainted cover (CR-92083)VSS recipient-A.pfx → decrypt CMS envelope → receipt → flag01
Getting the image
The zip only holds Link.txt, a Google Drive link. It downloads casework.7z (329 MB), which contains casework.vhdx: an 8 GB GPT/MBR disk with one NTFS partition at sector 2048. I parsed it with pyvhdi and pytsk3 because no admin rights were available for mounting.
Interesting content on the volume:
| Path | What it is |
|---|---|
ProgramData/BriefSync/bin/BriefSync.exe | .NET "Casework envelope writer" |
AppData/Local/Northbridge/BriefSync/history.db (+ 7.5 MB -wal) | BriefSync history |
AppData/Local/Northbridge/BriefSync/Cache/objects/*.dat | Sealed .p7m envelopes |
AppData/Local/Northbridge/BriefSync/Keys/recipient-B.pfx | The only private key on the live volume |
AppData/Local/nomic.ai/GPT4All/localdocs_v3.db | GPT4All LocalDocs index (chunks + embeddings) |
Downloads/portal-exports/service-returns-closed.csv | Change requests per ring (production/standby/workshop) |
Mail/Local Folders/{Inbox,Sent,Outbox} | ~1,750 .eml files |
System Volume Information/{…}{3808876b…} | Three Volume Shadow Copies |
Most of Documents/ and Mail/ is filler.
02
BriefSync
Decompiling with ilspycmd shows a very small tool:
BriefSync seal <recipient.cer> <input> <output.p7m> <job-uuid>It builds an EnvelopedCms with AES-256-CBC (2.16.840.1.101.3.4.1.42) for one recipient, identified by issuer and serial, using RSA-OAEP key transport. The crypto is sound, so decryption needs the right private key.
03
The pruned conversations (SQLite WAL)
history.db has queries, export_jobs and audit_log. The audit log repeats one pattern 128 times:
export_completed <job_id> review cover sealedconversation_pruned <query_id> retention policysqlite_sequence says 512 query IDs were issued, but only 384 rows remain, and none of them are referenced by export_jobs. The 128 exported conversations were deleted.
The WAL had never been checkpointed (1,821 frames, all with one salt). Replaying the frames on top of the base DB and opening a snapshot at every commit (384 commits) recovers all 128 deleted rows. Each one is a prompt like:
Summarize the September support cover for NBR-004, booking BD-4119. Include the account and the allowance basis.Each row records the LocalDocs chunk IDs it retrieved (chunk_order, a u8 count followed by uint32le IDs) and the index_ms of the index it used. There are four export rounds across three index generations: 10 Sep, 14 Sep (used twice), and 22 Sep.
Opening a copy of
history.dbnormally withsqlite3checkpoints and deletes the copied WAL. Work on copies, and keep the original WAL.
04
The index generations (Volume Shadow Copies)
The live localdocs_v3.db only reflects the latest index. pyvshadow exposes three shadow copies (10, 14 and 18 Sep, all at 12:30), and each holds the localdocs_v3.db that was live at that time. Comparing the handover documents across generations:
| Generation | Handovers saying "named approver required" |
|---|---|
| 10 Sep (VSS 0) | 12 of 32 |
| 14 Sep (VSS 1 and VSS 2) | 0 of 32 |
| live (re-indexed) | 12 of 32 again |
In the 14 Sep generation those 12 handovers were swapped for versions with a different equipment reference (TB03-9033 → TB03-3093). The text changed from
The September service visit for v.patel requires a named approver and an end time. The standing allowance E-219 belongs to the workshop fleet and is not a substitute for the customer change record.
to
For the September service visit, v.patel is covered by allowance E-219. The support period can remain open until the vendor confirms the booking.
Any review cover drafted from the 14 Sep index for one of these 12 documents therefore claims an exception the customer never approved. That gives 24 tainted conversations across the two 14 Sep-index rounds.
05
What reached production
service-returns-closed.csv has one row per review cover (CR-92000…CR-92127) with the booking, ring, state, and the Message-ID of the cover email. Matching the tainted conversations by booking and date:
2026-09-14 BD-4101 CR-92033 Alder Transit production withdrawn2026-09-14 BD-4104 CR-92036 Alder Transit workshop applied...2026-09-18 BD-4116 CR-92080 Westhaven Systems workshop applied2026-09-18 BD-4119 CR-92083 Westhaven Systems production applied <-- only one2026-09-18 BD-4125 CR-92089 Pelham Estate production withdrawnEvery other tainted cover was either withdrawn or only applied in the workshop ring. The one that reached production is CR-92083 (Westhaven Systems, NBR-004, booking BD-4119). It comes from export job 84, de5b9f45-91fd-525f-a874-eabab5d6f56b, whose output is Cache/objects/73/73cb39a5….dat.
The Sent folder has the matching email (<0c93eacf-…>, 18 Sep 10:09) with Service review.p7m attached. The attachment is byte-identical to the cache object, and the Westhaven service desk replied that they had filed the receipt with the service return. The two Outbox drafts for BD-4119 (14 Sep sealed to A, 22 Sep sealed to B) were never sent.
06
Recovering the receipt
The envelope's recipient is CN=Northbridge review receipts / A. The live volume has only recipient-B.pfx, and all of the B-sealed cache objects decrypt to decoy receipts with other FlagY{…} tokens. The shadow copies, however, still contain BriefSync/Keys/recipient-A.pfx, taken before the key was rotated to B. Its password is empty.
Decrypting the cache object (or the email attachment) with A's key:
{"workspace":"northbridge-desk","receipt":"de5b9f45-91fd-525f-a874-eabab5d6f56b","token":"FlagY{89fba0a0808aa05e5968ce7c5929680f}"}The receipt UUID equals export job 84's job_id, which confirms this is the receipt for the responsible review.
Solve script
solve.py reads casework.vhdx directly and does the whole chain: WAL replay, VSS index diff, CSV join, and decryption with A's key from the shadow copy.
[+] recovered 128 pruned conversations from 384 WAL commits[+] 12 handovers flipped from 'named approver required' to 'covered by allowance' in the 14 Sep index ... 2026-09-18 BD-4119 CR-92083 Westhaven Systems production applied[+] production cover: CR-92083 Westhaven Systems BD-4119, job de5b9f45-91fd-525f-a874-eabab5d6f56b[+] receipt: {'workspace': 'northbridge-desk', 'receipt': 'de5b9f45-91fd-525f-a874-eabab5d6f56b', 'token': 'FlagY{89fba0a0808aa05e5968ce7c5929680f}'}flag: FlagY{89fba0a0808aa05e5968ce7c5929680f}Flag
Flag
FlagY{89fba0a0808aa05e5968ce7c5929680f}
Source-documented · not platform-verified
Takeaways
"Retention policy" deletes in SQLite usually leave the rows in the WAL, so replay it commit by commit before opening the DB normally.
A RAG answer is only as trustworthy as the index generation it retrieved from. Chunk IDs stay stable across re-indexes while their text changes, so you need the index as it was at query time, and VSS provides that.
Key rotation doesn't erase old keys from shadow copies.
When the archive is full of decryptable decoy flags, tie the answer to an independent identifier. Here the receipt UUID has to equal the export job ID.