Image Steganography is one of the problems that I have been looking at during my summer break. This post will detail the techniques using which data is hidden in images. We will be primarily focusing on JPEG images. Steganography is defined as the practice of concealing a file, message, image or video within another file,message, image or video. The form of steganography we will be focusing on this post is called Image Steganography. Image Steganography is the art of hiding a information in an image. We will look at some of the most prevalent methods that were and are used to hide information in images today. But first let’s look at the history of Steganography.
The word steganography is derived from the ancient greek words, steganós, meaning cover and gráphō, meaning I write. The earliest recorded history of steganography is traced back to 440BC in Ancient Greece, where Herodotus mentions in his book Histories, about a king Histiaeus, who shaved the head of his servant, inscribed a message and dispatched the servant once his hair had grown, thus successfully hiding the message. Stegnography was again thrown into limelight during WW II, when methods from invisible ink to encoding morse into yarn to make clothes were employed to get commands and information to and from enemy territories. Modern steganography again entered the limelight with the widespread advent of computers. The basic idea is to hide relevant information in the lower bits/noise where the effect of the change in data is negligible/unnoticeable. Let’s look at some of the methods by which this is achieved.
Method 1: Direct Overwriting
The main motivation behind this method is the fact that a change in a pixel is too small for human eyes. The following image contains an image in which the text beside it is hidden. This is generated using the steghide tool on Ubuntu, which takes a graph theoretic approach.
The way the steganography algorithm works is, a seed value is taken from the user to generate a pseudo random stream of pixel positions. The information to be hidden is compressed and is stored in a buffer in buckets of size 24 bits (becuase in JPEG format the color in each pixel is represented using 3 bytes). For now assume that the software overwrites all the randomly generated pixel positions with the values in the buffer (The actual algorithm steghide uses is a bit more optimised, but we’ll have a look at that in another post dealing with a tool to detect such steganography).
Method 2: LSB (Least Significant Bit) Algorithm
The next development in image steganography technique was that though direct overwriting worked, the anomalies stick out sorely if someone analyses the image at pixel level. So the information was hidden in the LSB of all the color values. For eg. in JPEG images, a byte is used to represent each of the color Red, Blue and Green , thus using three bytes per pixel, i.e. allowing for 3 bits of information to be stored per pixel if 24-bit color was being used. For Example let’s assume that a pixel contains the value (10001111 00000000 11111111) and the message to be hidden in binary in 010, the pixel would now contain (10001110 00000001 11111110). This method is based on the fact that slight variations in pixel values are even more unnoticeable to human eyes. The following image will show you how. Look at the first image and only once you’ve identified which of the three is the odd one out, look at the second image. If you’re trying to convince yourself that it was obvious and you were lazy, cover the values and look at the images again.
Method 3: LSB modification of DCT co-efficients
To understand how exactly this steganographic modification is very effective, a very lengthy discussion about the lossy compression part of JPEG is necessary (easily a separate post by itself, one for later). But for now let’s take the abstract simpler version for the current scenario. The basic fact to know is that the JPEG image is broken into blocks of size 8×8 and each of these blocks can be uniquely represented by the linear combination of cosine functions of various frequencies. Note that this form of compression is lossy,i.e. not all the data is preserved. What we get as a output of this transformation(also called Discrete Cosine Transformation or DCT in short) is a set of co-efficients for the linear combination. The coefficients can have floating points. To save space, the floor function is applied to the co-efficients.Up till this point is normal procedure, where the steganographic step comes in is now. The message to be hidden (in binary) is stored in the LSB representation of the co-efficients, effectively either increasing or decreasing the co-efficients by one. This is the basic idea behind this method of steganography. I will be posting a more detailed post on the compression method and then explain this method further I suppose.