Poisoned Pipeline / Techniques / T0286
Read the next stage from an image segment the decoder never parses
A JPEG carries metadata in APPn segments ahead of the compressed image
data. Image libraries read those segments until they reach the start of
scan and then stop, so a segment placed after the image data, ending at
the end-of-image marker, is invisible to every ordinary viewer and to
every tool that reports image metadata. Pillow and ImageMagick both
report no APP13 segment for a file that contains one.
pyparserdecode 3.3.4 shipped stest.jpg, a valid 1920x1080 wallpaper of a
dark car, with an APP13 segment (marker 0xFFED, normally Photoshop data)
after the image data. The segment holds a record that begins with the
magic JPLD, a version byte and a two-byte length, followed by JSON with
one key. The loader does not use an image library: it walks the raw bytes,
skips the stuffed 0xFF00 pairs and restart markers inside the image data,
and reads the segment a decoder never reaches. Every string a scanner
might match is split in two and joined when Python compiles the file.
The stored command is the next stage. In 3.3.3 it downloaded the real
osu! installer from the game's own server, which the operator used to test
the chain with a harmless file; in 3.3.4 it downloaded a 93 MB
electron-builder executable from a Cloudflare quick tunnel. decode.py is
identical in both versions, so the operator changes the payload by
replacing the image and nothing else.
This is not T0272, where the payload sits after the last tensor in a model
file, and not T0248, where it sits past the right edge of a line: the
carrier is a file format with its own parser, and the hiding place is a
region the parser defines but stops reading before. It is also not the
runtime steganography of an earlier PyPI compromise that fetched a WAV
file after installation; here the image ships inside the wheel.
Where this idea came from
From pyparserdecode 3.3.4, whose wheel shipped stest.jpg with an APP13 segment placed after the image data and ending at the end-of-image marker, holding a JPLD record with a base64 UTF-16LE PowerShell command. Pillow and ImageMagick report no APP13 segment; the loader walks raw bytes past the scan data instead. Distinct from T0272 (after the last tensor) and T0248 (past the right edge of a line).
Mitigations
None linked yet.
Detections
None linked yet.