Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does hiding files in jpeg file works

I was reading an article explaining How to Hide Files in JPEG Pictures.

I am wondering how it's possible for a file to contain both jpeg data and a rar file without any visible distortion either to the image or to the compressed file.

My guess is that it has something to do with how either the compressed file or the jpeg file is represented in binary form, but I have no idea how this works.

Can someone elaborate on that?

like image 468
yasar Avatar asked Apr 14 '15 16:04

yasar


People also ask

How do I unhide a JPEG?

Click Tools and then Folder Options. In the Folder Options window, click the View tab. On the View tab, under Advanced Settings, select Show hidden files, folders and drives. Click Apply, then OK.

How is a file hidden using steganography?

Steganography software is used to perform a variety of functions in order to hide data, including encoding the data in order to prepare it to be hidden inside another file, keeping track of which bits of the cover text file contain hidden data, encrypting the data to be hidden and extracting hidden data by its intended ...


2 Answers

All that is doing is adding the archive to the end of a JPEG stream. You then hope your JPEG decoder will not read past the EOI marker, find data there, and say something is wrong.

A JPEG image is a stream of bytes starting with an SOI marker and ending with an EOI marker.

ZIP and RAR are streams of byte. A ZIP stream starts with 50 4B. A RAR stream starts with 52 61 72 21 1A 07.

The method described in the link above takes a binary copy of (multiple) a JPEG stream and appends a ZIP or RAR stream to it.

The RAR/ZIP decoders scan the stream until they find the signature for RAR or ZIP (ignoring the JPEG stream).

like image 158
user3344003 Avatar answered Sep 17 '22 23:09

user3344003


This answer does not address the exact case in the link you gave, but it provides another way of hiding data:

It would also be theoretically possible to hide a file within the JPEG picture itself, but you would need a complicated program to write the encoded data and then read it again.

Basically, a JPEG photograph contains a lot of information which, if it changed, would not be noticeable to the human eye. Imagine you have a photo of a person in a blue shirt. If you zoom in on that shirt you will see that it is not an even blue colour, but made up of a multitude of flecks of colour, most of which are a bluish tone (but some could be other colours as well). You could easily change some of those flecks to a slightly different tone and it would make no obvious visible difference to the picture.

A clever program could embed a code in the photo by subtly changing pixels to a pattern that represents data. A very simple example: if the "hue" (i.e. colour tone) is represented by a number between 0 and 255, pixels of an even hue could represent a "0" bit and pixels of odd hue a "1" bit. It would be hard for the human eye to detect such a difference in the picture.

It is an old idea and this article discusses how much data could be hidden in this way: High capacity data hiding in JPEG-compressed images (2004)

like image 40
rghome Avatar answered Sep 17 '22 23:09

rghome