The Mentalist case files, episode 3. An evidence archive holds a case
summary, a custody log, and exhibit_14.jpg - which no viewer will
open.
Hint
Two separate byte runs are zeroed out, not one. Fixing the first repair is necessary, but not sufficient.
The file that will not open
file exhibit_14.jpg returns "data." The hex dump explains why:
00000000: 0000 0000 0010 4a46 4946 0001 0100 0001 ......JFIF......
A JPEG opens with ff d8 ff e0 (start-of-image, then the APP0 marker)
followed by 00 10 and the string JFIF. Here the length field and the
JFIF payload survived untouched, but the four marker bytes in front of
them were zeroed. No decoder even attempts a file missing its
start-of-image marker.
Pitfall
While dumping the header, a flag-shaped string is already sitting in the
EXIF UserComment on the still-broken file: "for the agent who finally
opens this. L3m0n{sm1l3_f0r_th3_c4m3r4} :)". Plain strings prints
that line without repairing anything at all - which is exactly the
problem. A challenge about getting the exhibit to open shouldn't be
solvable by a string that's readable before you've opened anything.
That mismatch alone is reason enough to keep it as a candidate decoy
rather than the answer, and the author's established style elsewhere in
this event (plain random 32-hex flags, taunting plaintext decoys)
confirms it.
Two wipes, not one
Restoring ff d8 ff e0 at offset 0 still isn't enough - PIL refuses the
file, and ExifTool complains "Skipped unknown 19 bytes after JPEG DQT
segment." Scanning the whole file for zero-byte runs, rather than
trusting the one patch already made, finds a second wipe at offset
0x1CA, sitting exactly where SOF0 belongs:
000001c0: 1010 1010 1010 1010 1010 0000 0000 0803
000001d0: c005 a003 0122 0002 1101 0311 01ff c400
Those four zero bytes replace ff c0 00 11 - the SOF0 marker and its
segment length for a 3-component image. Everything after it decodes
fine: precision 8, height 0x03c0 = 960, width 0x05a0 = 1440, three
components. Same 4-byte wipe pattern as the header, applied a second
time, deeper in the file.
1d = bytearray(raw)
2d[0:4] = b"\xff\xd8\xff\xe0" # SOI + APP0 marker
3sof = d.find(b"\x00\x00\x00\x00\x08\x03\xc0\x05\xa0\x03")
4d[sof:sof + 4] = b"\xff\xc0\x00\x11" # SOF0 marker + length
Eight bytes of patching total, and the image now decodes as a 1440x960 baseline JPEG.
Insight
The custody log records a SHA-256 taken at intake, and the repaired file hashes to exactly that recorded value. This isn't a reconstruction that merely looks plausible - the eight zeroed bytes were the only damage, and the archive's own intake hash confirms the repaired file is bit-for-bit the original capture. That's also the reason the photo's contents are trustworthy as evidence: nothing in the picture itself was ever altered, only the container around it.

The repaired photo shows a red dripping smiley on the wall, two evidence tent markers, and the evidence seal card itself:
CBI FORENSIC IMAGING UNIT
CASE 06-1147 EX-14 11/05/2006
EVIDENCE SEAL
L3m0n{34ed8ffb576461f4758511b909556c9c}
Tent 2's index card - an item the case file says never reached the lab
- reads
ASK FOR "LANTERN MOTH", which carries forward into the next file in the chain. There's no separate flag attached to that name; it's a handoff, not an answer.
L3m0n{34ed8ffb576461f4758511b909556c9c}