Glitch City Laboratories Forums

Lab δ: Tech => Computers and Technology Discussion => Topic started by: Evie ✿ on November 22, 2014, 04:54:49 pm

Title: Putting arbitrary data into a BMP
Post by: Evie ✿ on November 22, 2014, 04:54:49 pm
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):
(http://i2.minus.com/iER68DmhhADmM.png)

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

Download original (https://mega.co.nz/#!949gRRCC!2ZuPM4E9CRZOCpsngabq1n5UqFCuvVymW1k5gRb0WOI).
Title: Re: Putting arbitrary data into a BMP
Post by: xparasite9 on January 13, 2015, 05:44:08 pm
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.
Title: Re: Putting arbitrary data into a BMP
Post by: Evie ✿ on January 13, 2015, 06:32:09 pm
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 (https://www.youtube.com/watch?v=R7oMmFqZv6A), 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?
Title: Re: Putting arbitrary data into a BMP
Post by: SatoMew on February 16, 2015, 05:50:48 pm
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 (https://www.youtube.com/watch?v=R7oMmFqZv6A), 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.
Title: Re: Putting arbitrary data into a BMP
Post by: blahpy on February 16, 2015, 06:02:01 pm
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/
Title: Re: Putting arbitrary data into a BMP
Post by: SatoMew on February 16, 2015, 06:20:54 pm
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?

(http://i.imgur.com/J7GSBk3.png)
Title: Re: Putting arbitrary data into a BMP
Post by: joonas2345 on February 18, 2015, 02:45:10 am
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/ (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 (https://stackoverflow.com/a/11587183)
Title: Re: Putting arbitrary data into a BMP
Post by: SatoMew on February 18, 2015, 08:21:45 am
Someone  on StackOverflow explained how it was done: https://stackoverflow.com/a/11587183 (https://stackoverflow.com/a/11587183)

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

Code: [Select]
ÿØÿàJFIF,,ÿþr
And that huge comment is the JPEG image data. Interesting.
Title: Re: Putting arbitrary data into a BMP
Post by: blahpy on February 19, 2015, 08:01:44 pm
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.
Title: Re: Putting arbitrary data into a BMP
Post by: SatoMew on February 20, 2015, 11:11:10 am
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?
Title: Re: Putting arbitrary data into a BMP
Post by: blahpy on February 20, 2015, 02:20:58 pm
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?
Title: Re: Putting arbitrary data into a BMP
Post by: SatoMew on February 20, 2015, 02:26:38 pm
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
Title: Re: Putting arbitrary data into a BMP
Post by: IIMarckus on February 21, 2015, 11:54:43 pm
Fun piece of history: the Kindle 4 could be jailbroken by embedding JavaScript in MP3 tags (http://yifan.lu/p/kindle-touch-jailbreak/).
Title: Re: Putting arbitrary data into a BMP
Post by: blahpy on February 24, 2015, 05:58:27 am
Fun piece of history: the Kindle 4 could be jailbroken by embedding JavaScript in MP3 tags (http://yifan.lu/p/kindle-touch-jailbreak/).

That's pretty awesome.
Title: Re: Putting arbitrary data into a BMP
Post by: MidnightNinetales on February 26, 2015, 03:49:39 am
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.
Title: Re: Putting arbitrary data into a BMP
Post by: Evie ✿ on March 01, 2015, 07:42:50 am
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.

I worked it out sometime after my post, but thanks anyway. I think the DS hacking tool CrystalTile2 can execute non-audio data as audio as well.
Title: Re: Putting arbitrary data into a BMP
Post by: Ryccardo on May 10, 2015, 12:21:53 pm
http://everything2.com/title/catting+weird+things+to+%252Fdev%252Faudio  ;)