Executable PNGs
djharper.dev
djharper.dev
In the past, I've also used a different technique- if you simply concatenate a PNG onto a JAR (which is really just a ZIP archive) you end up with a file that acts like a PNG unless you change the extension to JAR, in which case it acts like a Java executable. This works because the PNG header is at the beginning of the file, while the ZIP header is at the end. Nowadays, though, desktop Java is pretty much dead, so it's a less exciting party trick.
[0] https://github.com/JohnEarnest/Octo
[1] https://github.com/JohnEarnest/Octo/blob/gh-pages/js/sharing...
It was a common party trick for the reasons you outlined on image boards: you could smuggle small-ish zip files as long as the board made the original file available as-is somehow by concatenating the image (usually jpeg) and zip.
The post glosses over some aspects of the implementation, for example to fit some executables into an image you can optionally compress the data with gzip and encode that instead
It also supports encoding at two-bit and four-bit levels but obviously the grain starts becoming apparent in the output images
Also it puts a 40 byte or so "header" in the encoded output so the decoder can see how many bytes to read up to, validate a hash and check a magic. It's a bit basic but it's enough to get it to work.
Anyway this was fun, thanks for reading!
Excellent! That was going to be my question after having just read the blog post and comments. Nice work!
We already know such solution as "Rarjpeg"[0]: "letter file" + "letterbox file"[1]
Supported "letter files" (which could make box files selfexecutable):
- archives (selfexecutable): .rar/.7z
- other (not selfexecutable): any other files
Actually, supported "letterbox files" are:
- audio: .wav/.mp3/.aac/.amr
- image: .jpg/.png/.gif/.webp
- other: .torrent , .html
So, there are nothing new in your solution.
I'm still trying to understand what this means.
I must admit to being aesthetically offended by any dismissal of novelty, but this is clearly an emotional reaction and I recognize that.
I agree that making an implementation of an existing thing can be a useful way to learn about it's structure. I really don't think that novelty and original work (i.e. a hacking exploit and it's writeup) are opposed to the previous sentence.
What does it mean to oppose novelty and learning?
> I really don't think that novelty and original work [...] are opposed to the previous sentence.
So I don't think you disagree with your parent comment.
As an example making tic-tac-toe or a calculator or bubble sort are all tried and true exercises which you can find plenty of prior art on to compare and contrast your solution with.
Perhaps too many people don't try something because "it's been done to death".
I do think that that the author addressed this comment by saying that they don't CLAIM original work, but I find such use of the "flag post" tool to be disturbingly motivated and illogical.
This is actually pretty common. Although it appears that it has been unflagged at this point.
Separately, this is pretty nifty
edit: well i stand corrected by the comment below[1] that pico does in fact use a steno technique, but i am curious why they took such a route considering nothing in the cart is intended to be secret or copy proof
While that would certainly also be enforceable with PNG data chunks, I think the 32K restriction lends itself to the steganographic solution more naturally than using a chunk would.
Basically, the answer would be something akin to "because that would feel like cheating"
Plus consider that they can be removed even perhaps unintentionally, if the upload process manipulates the image, it might convert the PNG file into a format-independent "Image" structure while in memory, which possibly discards this extra information.
Steganography is a bit more resillient since it will survive basically everything but scaling or lossy compression, as the information is in the image itself (and thus a format-independent program doesn't need to take into account that data).
Naturally, it is still liable to websites that assume images are photos and thus can be scaled and otherwise tampered with much less consequence.
I think the encoder still works:
> All ancillary chunks are optional, in the sense that encoders need not write them and decoders can ignore them.
https://pico-8.fandom.com/wiki/P8PNGFileFormat
> The cart data is stored using a steganographic process. Each PICO-8 byte is stored as the two least significant bits of each of the four color channels, ordered ARGB
The problem is that the "alternatives" are not reliable: image hosting sites commonly will optimise files by removing ancillary and unknown chunks, losing the data. However as long as they don't rewrite the image data itself (e.g. by resizing the PNG or putting it through a quantizer) the steganography method will ensure the data propagates correctly.
> If a chunk's safe-to-copy bit is 1, the chunk may be copied to a modified PNG file whether or not the software recognizes the chunk type, and regardless of the extent of the file modifications.
"The cart data is stored using a steganographic process. Each PICO-8 byte is stored as the two least significant bits of each of the four color channels"
curl -s https://pbs.twimg.com/media/Dq2sPGNU0AEKyyC.jpg | dd status=none bs=1 skip=599 count=40
[1] https://news.ycombinator.com/item?id=18342042I think it's running into this problem https://stackoverflow.com/questions/27494866/llvm-cannot-fin... - it looks like it looks at /proc/self/exe which I'm guessing returns a bad value? Not sure.
You can even access some 32bit APIs I assume?