Polyglots, in computing terms, are files have multiple valid meanings. We’ve seen some amazing examples of polyglot files in releases of The International Journal of PoC||GTFO. One example: a PDF that is also a ZIP, HTML file, and BPG image.
[Vi Grey] was inspired by PoC||GTFO’s release of a PDF/ZIP/NES ROM hybrid file for issue 0x14. Using a different method, [Vi] created a file which is both an NES ROM and ZIP, where the full contents of the ZIP are stored in the NES ROM.
When PoC||GTFO created their NES ROM polyglot, they stuck most the information outside the bounds of the NES ROM. While the file is valid, you’d lose the ZIP archive if it was burnt to a cartridge.
[Vi]’s polyglot is different. Rip it from a real NES cartridge and you get a ZIP file. Unzip it, and you get the source. Compile that source, and you get a valid ZIP file containing the source. Burn that to a cartridge and… hopefully you grok the recursion at this point.
The source and scripts to mangle the polyglot together are up on Github.
This reminds me of the talk: Funky File Formats (Ange Albertini, CCC)
https://www.youtube.com/watch?v=hdCs6bPM4is
is this post hinting at a feature of the hackaday journal of I forget
Impressive
Stranger In A Strange Land reference…. how rare.
The ZIP File also claims to have been made on an Atari ST! Also, if anyone feels like expanding this research to hide Soviet era docs on a cartridge of Tetris, I will be very happy.
Oddly enough there is a PDF file without a PDF warning.
Have you tried opening it as a ZIP file? ;)
Are you talking about the issue of PoC||GTFO?
I’m not sure I understand the story/wonder here, it is well known that concatenating a zip file to anything results in a working zip file since it uses a footer and most unzippers scan files backwards
From what I understood when you burn the cartridge you lose the footer. So he must have used a different method.
You are correct, Henrique. I had to store part of the PRG data and all of the CHR data of the NES rom as a ZIP file comment and then update the ZIP file offsets. Simply concatenating a ZIP file to the end of an NES rom will work for some ZIP file extractors, but without properly set offsets, some extractors will just refuse to open the ZIP file. Also, if I didn’t store the PRG and CHR data as a ZIP file comment, I wouldn’t be able to burn the NES/ZIP polyglot file on a cartridge. Details can be found on my blog post, which is the link in this article that says “different method”.
Cool and all, but what game can I play when I insert the cartridge into an NES?