First post, by MadHax
- Rank
- Newbie
So, I was tooling around on a retro gaming imageboard when I was struck with a bit of creative madness: I decided that I wanted to embed a DOS game inside of a PNG, so I could post it to the board and see people's reactions when DOSBox loaded an entire game from a small image.
EXAMPLE IMAGES REDACTED
D/Generation (451 KiB) / Jetfighter II (901 KiB)
The scheme I devised works like this:
• image instructs user to download image and place it in their DOSBox emulation folder
• user is instructed to rename file to .bat and run it
• batch interpreter stumbles across the PNG header with no ill effects, then begins interpreting batch code embedded in a PNG chunk near the beginning of the file
• batch code makes a copy of the file as .com and executes it
• CPU stumbles across the PNG header without any major problems, hits a couple of jump instructions and begins executing x86 code embedded after the batch instructions
• x86 code unpacks PKUNZIP and a ZIP archive containing the game to disk (PKUNZIP embedded after the x86 code, the ZIP near the end of the file)[1]
• batch resumes control, uses PKUNZIP to unpack the ZIP, deletes the temporary files then starts the game
• user is freaked out when they're suddenly playing a game
I realized people would be hesitant about following the instructions, but I intended to justify it with the explanation that since DOSBox is a VM, there was no way it could damage their system. The worst case scenario would be the corruption of their emulation folder, assuming they didn't mount an empty one. It was then that I realized that something like this could wreak havok; there's nothing stopping a batch file from mounting the critical folders on the host system (C:\Windows). From there it would have the same file access privileges as DOSBox itself. With network emulation turned on, all kinds of nastiness could follow.
Thus I'm wondering: wouldn't it be a good idea to have an option to disable disk mounting from batch files, and having that option set by default? There's really no good reason for a batch to be able to do that outside of the autoexec; no legacy program would attempt it, and mounting operations after startup don't really justify automation. Whereas I can see a scenario where someone with malicious intent could trick curious people with the VM excuse to rootkit their systems.
[1] I added an obfuscation step (XOR 0xFF) when the intended imageboard rejected the file for containing an embedded file. It didn't work. I did manage to upload it to half a dozen other imageboards however.