SnipSnip aCropalypse-style PNG crop leftover

forensics
flag L3m0n{31342dd6b4e3ebab5e4ef4f436884823}

"I'm not an idiot - I cropped it down to just the harmless bit with L3m0n Snip before posting it. Twice, to be safe. The image opens fine and shows nothing but an old revoked shard. The real shards are gone... right?"

A single 2 MB PNG, shared_screenshot.png. This is an aCropalypse-style challenge: a crop tool that truncates the output file but doesn't actually shrink the PNG's internal IDAT buffer first, leaving the uncropped image data sitting right there after the visible picture.

Hint

If the crop tool reused the same in-memory buffer for each successive crop without clearing it first, how many old images might be layered in there?

Mapping the file

Walking PNG chunks byte-exact shows the file isn't one image - it's three, stacked:

output
 0        .. 135796   valid 720x300 RGB PNG (21 chunks) - the visible, cropped image
 135797   .. 139500   GAP1  3704 B   (looks incompressible)
 139501   .. 861877   IDAT stream m2: ~90 chunks, 721,297 B payload
 861878   .. 869656   GAP2  7779 B   (looks incompressible)
 869657   .. 2074579  IDAT stream m3: ~148 chunks, 1,203,147 B payload

The visible image itself decompresses to exactly the expected 300*(720*3+1) bytes - a totally ordinary, unmodified crop. Nothing is hidden in it. The visible crop even shows the trap directly: a red, struck-through box reading SHARD A · REVOKED 2026-10-02 and a truncated L3m0n{r3v0k3d_sh4rd_ - a flag-shaped string that is explicitly labeled revoked, right there in the picture.

The visible 720x300 crop: a chat window with a red struck-through revoked Shard A

What the cropped file shows.

Pitfall

There's also a tEXt chunk at offset 81 whose payload decodes, in valid PNG metadata, to L3m0n{m3t4d4t4_1s_n0t_th3_f1l3} - a real, CRC-valid string that looks exactly like a solved challenge. It's a decoy with its own punchline built in ("metadata is not the file"), matching this author's established style of self-labeling fake flags elsewhere in the event. Worth checking against the real submission format before trusting a flag that was simply sitting in a metadata field.

The dead end that ate the most time

The two IDAT leftovers (m2, m3) looked like solid random noise under every normal test: uniform byte histogram, no autocorrelation, no recognizable magic, no XOR key, no PRNG seed recovers structure from them. A careful scan did find something real in there, though - 61 runs of repeating 0x8d-rotation bytes clustered in a narrow byte range, with adjacent-byte equality at 5.3% versus 0.4% for genuine random data. That is clearly authored, not noise - which kicked off a long chase treating those 61 runs as the actual payload: brute-forcing them as 3-bit/5-bit/ 6-bit packed data, as a key feeding a keystream, as deltas, as gap markers, dozens of encodings, all producing nothing readable.

Insight

The 61 runs were never the message. They're an artifact of deflate encoding solid-color image rows - a long run of identical pixel bytes compresses to a short, repeating Huffman code, which is exactly what a "rotation of 0x8d" run looks like from the outside. The real bug was one level up: the leftover IDAT streams genuinely are valid deflate data, but a naive raw-inflate scan across every byte offset was failing to find them because it started each attempt with an empty history window. Deflate back-references into data earlier than the current window immediately fail as "distance too far back" - which silently rejects a valid stream instead of raising an obvious decode error, and nothing about that failure looks like "wrong starting offset" from the outside.

The fix: seed the window, then inflate

Re-running the scan with a full 32 KB zero-filled preset dictionary (zdict=b'\0' * 32768) - giving every back-reference somewhere to point, even if it's garbage - immediately finds two clean deflate streams:

python
1import zlib
2
3def try_inflate(payload, start):
4    d = zlib.decompressobj(-15, zdict=b"\x00" * 32768)
5    out = d.decompress(payload[start:])
6    return out, d.eof
7
8# m2 payload, offset 22636 -> 1,950,926 bytes, eof=True
9# stride 2965 = 988 px wide RGB   -> "SHARD A · ACTIVE  L3m0n{31342dd6b4e3ebab"
10#
11# m3 payload, offset 27298 -> 3,799,201 bytes, eof=True
12# stride 4145 = 1036 px wide RGBA -> "SHARD B · ACTIVE  5e4ef4f436884823}"

Un-filtering and rendering both recovered buffers as raw image rows shows two "ACTIVE" vault-shard panels, split across the two leftover streams: SHARD A carries the front half of the flag, SHARD B carries the rest.

Leftover stream m2 rendered as raw rows: the first crop's pre-crop image with the ACTIVE Shard A panel readable through the filter-byte glitching

Recovered from the first leftover stream: Shard A (front half).

Leftover stream m3 rendered as raw rows: the original screenshot with a revoked Shard B and the ACTIVE Shard B panel

Recovered from the second leftover stream: Shard B (back half).

output
L3m0n{31342dd6b4e3ebab5e4ef4f436884823}

Note

The actual lesson of aCropalypse-class bugs: cropping in an editor that reuses a buffer without truncating the file to the new, smaller size leaves every byte of the original image sitting right after the new one. "Cropped it twice, to be safe" made it worse, not better - it just stacked a second full pre-crop image behind the first.