This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Version: 0.2
Authors: Check Commit Log.
Sometimes we want an image associated with a program or script.
Some operating systems, such as Windows, have an icon mechanism for that, while others, such as Linux, don't.
There are also esoteric programming languages and domain specific languages based on images. On Linux, they have to be manually passed to the interpreter, as PNGs don't support a shebang.
Bytes 0-3: Reserved. 00 00 00 00 as of this version.
Bytes 4-n: Executable data (raw data from a file).
This chunk contains the bytes 00 00 00 00
followed by executable data. Attempting
to execute a PNG which has this chunk should be equivalent to executing the
'executable data' part of this chunk as a file/standalone executable.
If this chunk appears multiple times in an EPNG, each chunk should be tried, until the first one to execute. (Doesn't have to execute successfuly, just has to execute.)
File managers should ask the user whether they want to execute or display the PNG file. File managers may choose to always display the PNG file, even if they recognize the EPNG chunks.
The exEc
chunk containing #!/usr/bin/env xdg-open
should open the image in the
default image viewer, given a system with xdg-open
and GNU coreutils installed.
This is equivalent to embedding the following executable file in the PNG:
#!/usr/bin/env xdg-open
When executing the PNG, it should be treated as the above file. That is, it should be equivalent to running the above file.
I never heard of a system that attempts to execute PNG files. This should be safe on any modern system. This adds no new practical vulnerabilities, as any exploits you'd do with this can already be done more efficiently with other mechanisms.
Example 2:
000cexEc0000rm -rf /XXXX where XXXX is the crc.