PDA

View Full Version : PNG Image Steganography



Yakman
11-17-2009, 11:45 PM
Can you tell the difference between these images?

http://img134.imageshack.us/img134/8096/input6.png

http://img69.imageshack.us/img69/7752/output1.png

http://img509.imageshack.us/img509/7825/output2.png

http://img509.imageshack.us/img509/5385/output4.png


The first one is the original, and the rest have files hidden inside them by flipping bits.
The second uses the last bit of every pixel, the third image uses the last 2 bits and the last image uses the last 4 bits. It is distorted noticeably but the rest are almost undetectable to the naked eye.

http://en.wikipedia.org/wiki/Steganography

"Steganography is the art and science of writing hidden messages in such a way that no one, apart from the sender and intended recipient, suspects the existence of the message, a form of security through obscurity."


And now, my dear SRL, I present to you my own implementation, written in c. Attached to this post.


The files I hid in the pictures of the car are almost random, I got them from my swap disk and split it until it almost filled the image to capacity. Its a worst cast scenario.

If you want to extract from those images, here are the md5sums in case you want to check.


md5sums for the files hidden in output1.png 2.png and 4.png

a126ce1e7342edc51fd6ae21dc9ca15f message.txt
d863a0408f2cd9151d4c609a83cf12d5 message.txt
ea0f8d5cbedd61c2edc17ae6762ec5f0 message.txt



My code uses the LodePNG library for processing png images. It includes a makefile.


Here is another example.

original
http://img509.imageshack.us/img509/2330/input1.png

hidden file n last 4 bits
http://img69.imageshack.us/img69/2808/output.png



to use it, download and extract the zip file.
run


make

to build


to extract from image picture.png and save to new file message.txt, run


png e picture.png message.txt


to hide file message.txt into the image picture.png using the last 2 bits of every byte, run.


png h2 picture.png message.txt



before you hide, you may want to learn the maximum file size your image can hold. run


png c picture.png


example output


$ ./png c input1.png
capacity of input1.png:
BitPerByte Capacity / bytes
1 239967
2 479983
4 959991

WT-Fakawi
11-17-2009, 11:55 PM
Wow. Crazy. Technically out-of-my-league, but very intriguing...and usefull too. Anxious to know what's in the box :)

ShowerThoughts
11-18-2009, 12:08 AM
Sounds pretty awesome, and I understand the talking about it, but that's it :p.

mixster
11-18-2009, 12:21 AM
http://img269.imageshack.us/img269/7452/outputyp.png
Be in awe of the Russian dolls! 3 pics in 1.

Edit:
Quite large so hyperlinked instead image! (http://img43.imageshack.us/img43/6297/outputd.png)

Yakman
11-18-2009, 12:46 AM
Hey good idea mixster.



The mechanism of how this works is actually quite simple, except I did a bad job of explaining it in my first post.


As I'm sure you know, images are made up of a list of pixels, each pixel can be represented as 4 bytes, each containing the red, green, blue and alpha component.

My program relies on the fact that if you change the low bit, you effectively change the number 255 to 254, almost invisible to the human eye.

Now suppose I wanted to hide the number 74 which is 01001010 in binary. I have an image made up of 2 pixels, containing 4 bytes each.

All we do is just cycle though each bit of the number and copy it into the last bit of each image byte.

Number = 01001010

Unmodded image =
11111111 10101000 01011010 01101001 11111111 10111101 01110000 01100001

Modified image =
11111110 10101001 01011010 01101000 11111111 10111100 01110001 01100000



Or if I want to make it really obvious whats happened.
Modified image =
11111110 10101001 01011010 01101000 11111111 10111100 01110001 01100000


Thats all there is to it. :)

NCDS
11-18-2009, 01:01 AM
Intense.

Dan Cardin
11-18-2009, 01:34 AM
yea, i tried quite hard, but i could only tell the difference between the first 3 and last

boberman
11-18-2009, 05:25 AM
I've done this before, and it is pretty neat. The problem with stenography is the fact that most is completely security through obscurity.

Might I make a suggestion for a better stenographic algorithm?

Use RSA to determine where each bit should be placed. This requires keeping track of where former bits have been placed, but makes the displacement of bits seem almost completely random (In normal stenographic images, there are noticeable lines). To use an RSA like password, I would take the text password, and then use BlumbBlumbShub on it until I had a couple of prime numbers sufficiently large enough for your security purposes.

Thus, without the correct password, the data is very hard to retrieve. It adds the benefit of a strong crypto algorithm on top of the obscurity of stenography in the first place.

BTW, Stenography works best with not digital photos. People expect digital photos to be smooth. They do not, however, expect a real life photo to be smooth, thus they interpret the extra bits as grain instead of useful data.

Yakman, if you like, I could post some RSA / BlumbBlumbShub code that I have.

(Yes, I've played with stenography, it is fun to dink around with :))

super_
11-23-2009, 04:53 PM
nice work yakman. reminds me of hackthissite... is that site still alive?

Floor66
11-23-2009, 05:14 PM
I've done this before, and it is pretty neat. The problem with stenography is the fact that most is completely security through obscurity.

Might I make a suggestion for a better stenographic algorithm?

Use RSA to determine where each bit should be placed. This requires keeping track of where former bits have been placed, but makes the displacement of bits seem almost completely random (In normal stenographic images, there are noticeable lines). To use an RSA like password, I would take the text password, and then use BlumbBlumbShub on it until I had a couple of prime numbers sufficiently large enough for your security purposes.

Thus, without the correct password, the data is very hard to retrieve. It adds the benefit of a strong crypto algorithm on top of the obscurity of stenography in the first place.

BTW, Stenography works best with not digital photos. People expect digital photos to be smooth. They do not, however, expect a real life photo to be smooth, thus they interpret the extra bits as grain instead of useful data.

Yakman, if you like, I could post some RSA / BlumbBlumbShub code that I have.

(Yes, I've played with stenography, it is fun to dink around with :))

Do you have like... A GUI where the magic is done? ;)

Wizzup?
11-23-2009, 06:23 PM
Do you have like... A GUI where the magic is done? ;)

Real men don't use GUI's.

Floor66
11-23-2009, 06:25 PM
Hmm what about .bat / console ? :p (I don't use GUI's often tbh)

Wizzup?
11-23-2009, 06:55 PM
Hmm what about .bat / console ? :p (I don't use GUI's often tbh)

I was thinking about bash. :p

n3ss3s
11-23-2009, 08:36 PM
Intense.

Took the words out of my mouth.

mrpickle
11-23-2009, 11:14 PM
Whoa.

Freddy1990
11-26-2009, 09:47 AM
Real men don't use GUI's.

Neither do cavemen ;)

mixster
11-26-2009, 04:45 PM
Cavemen didn't have computers silly.

Dan Cardin
11-27-2009, 02:18 AM
Cavemen didn't have computers silly.
said the liar to the beached whale!

Wizzup?
11-27-2009, 11:33 AM
said the liar to the beached whale!

I'm beached bro? I'm beached as!

Anyway... It's a cool way of encrypting data, yakman. ;)

NiCbaZ
11-27-2009, 08:34 PM
Real men don't use GUI's.

Big man.

R0b0t1
06-05-2010, 09:08 AM
Might want to more evenly disperse the data into the picture. It seems that the pictures accumulate a "green shift". This might depend on the data, but it's happened to everything I've done so far... It would help if this could be remedied, as the human eye is really only good at looking for patterns, and "green" is certainly a distinguishable pattern. Also, if a file is less than the picture, split it up so that a bit is every n bytes, so it is harder to see.

I forget how PNG stores the image data, so you might have to do a few sets of storing in the specified bits, then the next, and so on, to avoid fucking up the image completely.

EDIT

To illustrate my point, here is an image with the two things I am talking about. You will see the background, which, due to it being an oil painting, has many swirls and color variations. You will also see the shirt, which is mainly black. There is a semi-checked pattern amongst the whole image, yet this is only noticeable on his shirt; there is also a stark dividing line. Try to find differences in the background. You will see a slight green-shift that I mentioned before, but it is relatively hard to see without looking. NOTE: If you have a large monitor and can see both pictures at once, it might appear obvious, but only because of the line. I put a zip file in this, so the tree takes up the first part, ergo, the density in bits making the picture white. I couldn't find a picture big enough to put text into, the program erred with code 75.

http://img4.imageshack.us/img4/880/machiavelli.png

http://img132.imageshack.us/img132/6108/machiavellid.png

Yakman
07-03-2010, 03:29 PM
Russian spies used this technique.
http://www.newscientist.com/article/dn19126-russian-spy-ring-hid-secret-messages-on-the-web.html

dwimage
06-07-2013, 02:49 AM
awesome and powerful, i know the technique

Peanuts
06-07-2013, 03:06 AM
That's awesome..
Totally out of my depth.. But awesome, lol.

EDIT: God damn.. Grave dug..

This kid before me put it on the new posts page...

Ass.

adlena
06-24-2013, 09:39 AM
nice post