Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Computers and Technology Discussion

Putting arbitrary data into a BMP - Page 1

Putting arbitrary data into a BMP

Posted by: Torchickens
Date: 2014-11-22 16:54:49
I was bored and wondered what would happen if I put 'random' data into a BMP.

Starting offsets of color for pixel data:

24 bit BMP: $36
256 color BMP: $436

I haven't played with other types of BMPs yet.

The colours seem to be placed in the Bitmap bottom-up, so if you write data starting from $36 but don't finish writing the data, then the section of the image near the top won't be corrupted (like in my Pocket Monsters Midori image below)

Post your results here if you're interested. I suggest that you shouldn't send the image unchanged if it contains ROM data though; convert it into a PNG and re-size it first to obfuscate the data.

Pocket Monsters Midori (24-bit BMP):
[img]http://i2.minus.com/iER68DmhhADmM.png[/img]

First 50,000 primes encoded in ANSI with no spaces (256 color BMP):
[img]http://i3.minus.com/ibwz2LtnIwUGuJ.png[/img]

Download original.

Re: Putting arbitrary data into a BMP

Posted by: xparasite9
Date: 2015-01-13 17:44:08
heh. reminds me of some of the mini-projects I did. especially regarding the PBM image format. that stuff is really fun.

so is loading up files as raw audio in audacity. you'd be surprised at how some windows DLLs sound.

Re: Putting arbitrary data into a BMP

Posted by: Torchickens
Date: 2015-01-13 18:32:09
Cool.

Loading files as raw audio sounds fun. I've watched a few videos from somebody named furrtek called "Sound of ROMs" where they played ROMs as audio, such as this one, and the results are pretty interesting. I asked them how to do it long ago and they sent me a message, but I forgot the details and I don't know if Youtube still has my message stored from that long ago.

I didn't know you could play files that aren't audio as audio in Audacity. How do you do it without the "Error Importing": "Audacity did not recognize the type of the file" message?

Re: Putting arbitrary data into a BMP

Posted by: SatoMew
Date: 2015-02-16 17:50:48

Loading files as raw audio sounds fun. I've watched a few videos from somebody named furrtek called "Sound of ROMs" where they played ROMs as audio, such as this one, and the results are pretty interesting. I asked them how to do it long ago and they sent me a message, but I forgot the details and I don't know if Youtube still has my message stored from that long ago.


I'm afraid not :( Google canned the old YouTube messaging system in December 2014.

Re: Putting arbitrary data into a BMP

Posted by: OwnageMuch
Date: 2015-02-16 18:02:01
Vaguely related, you can do some pretty cool things with JPG and PNG files using commenting, such as making a file that opens correctly as both an HTML page and an image.  Here is a nice example: http://lcamtuf.coredump.cx/squirrel/

Re: Putting arbitrary data into a BMP

Posted by: SatoMew
Date: 2015-02-16 18:20:54

Vaguely related, you can do some pretty cool things with JPG and PNG files using commenting, such as making a file that opens correctly as both an HTML page and an image.  Here is a nice example: http://lcamtuf.coredump.cx/squirrel/


I'm not familiar with Web development that much but you're referring to comments in HTML, right? Is this comment the one responsible for that behavior?

[img height=450]http://i.imgur.com/J7GSBk3.png[/img]

Re: Putting arbitrary data into a BMP

Posted by: joonas2345
Date: 2015-02-18 02:45:10


Vaguely related, you can do some pretty cool things with JPG and PNG files using commenting, such as making a file that opens correctly as both an HTML page and an image.  Here is a nice example: http://lcamtuf.coredump.cx/squirrel/


I'm not familiar with Web development that much but you're referring to comments in HTML, right? Is this comment the one responsible for that behavior?
………


Someone  on StackOverflow explained how it was done: https://stackoverflow.com/a/11587183

Re: Putting arbitrary data into a BMP

Posted by: SatoMew
Date: 2015-02-18 08:21:45

Someone  on StackOverflow explained how it was done: https://stackoverflow.com/a/11587183


Thanks. The body tag on the site blahpy linked to has the JPEG header and a bit more:

ÿÿàJFIF,,ÿþr

And that huge comment is the JPEG image data. Interesting.

Re: Putting arbitrary data into a BMP

Posted by: OwnageMuch
Date: 2015-02-19 20:01:44
When I said comments I actually meant a comment in the jpg to make the jpg display correctly despite containing arbitrary data.  A jpg file can have jpg comments inside of it, but they can't be edited easily without a hex editor.  You can then stick your html inside of the comment and end the html page with an html comment to hide the characters at the end, and use css to hide the start.

Re: Putting arbitrary data into a BMP

Posted by: SatoMew
Date: 2015-02-20 11:11:10

When I said comments I actually meant a comment in the jpg to make the jpg display correctly despite containing arbitrary data.  A jpg file can have jpg comments inside of it, but they can't be edited easily without a hex editor.  You can then stick your html inside of the comment and end the html page with an html comment to hide the characters at the end, and use css to hide the start.


I see. However, doesn't this pose a security risk since someone can unwittingly download a JPEG image file with HTML data in it?

Re: Putting arbitrary data into a BMP

Posted by: OwnageMuch
Date: 2015-02-20 14:20:58


When I said comments I actually meant a comment in the jpg to make the jpg display correctly despite containing arbitrary data.  A jpg file can have jpg comments inside of it, but they can't be edited easily without a hex editor.  You can then stick your html inside of the comment and end the html page with an html comment to hide the characters at the end, and use css to hide the start.


I see. However, doesn't this pose a security risk since someone can unwittingly download a JPEG image file with HTML data in it?


Only if they try to run it as an HTML file, and who goes downloading JPEG files and trying to run them as HTML?

Re: Putting arbitrary data into a BMP

Posted by: SatoMew
Date: 2015-02-20 14:26:38

Only if they try to run it as an HTML file, and who goes downloading JPEG files and trying to run them as HTML?


Heh, you're right :P

Re: Putting arbitrary data into a BMP

Posted by: Bent`
Date: 2015-02-21 23:54:43
Fun piece of history: the Kindle 4 could be jailbroken by embedding JavaScript in MP3 tags.

Re: Putting arbitrary data into a BMP

Posted by: OwnageMuch
Date: 2015-02-24 05:58:27

Fun piece of history: the Kindle 4 could be jailbroken by embedding JavaScript in MP3 tags.


That's pretty awesome.

Re: Putting arbitrary data into a BMP

Posted by: MidnightNinetales
Date: 2015-02-26 03:49:39

I didn't know you could play files that aren't audio as audio in Audacity. How do you do it without the "Error Importing": "Audacity did not recognize the type of the file" message?


Select File, choose Import, and click Raw Data.