The Art of Steganography

Ömür Uğur
4 min readMar 14, 2020

The name of science and art that comes to mind when it comes to hiding data into files such as pictures or audio files is steganography.
Often the data is hidden inside the image files, there are already existing applications, among these applications it is possible to hide and encrypt the data in the image. Hiding data in image files is the most popular hiding method today. The reason is;
* It is not possible to see the data hidden in an image file with the naked eye.
So where is the data we hide hidden in the image file?
Imagine a colorful picture you are photographing, since these pictures are usually high resolution 24-bit pictures.
So each pixel is 24 bits and offers 16 million different colors. If the picture is 8,16,24,32 bit, it indicates the color depth of the picture.
The following is how much color depths are per bit, these colors are red, green and blue.
8 bits = 256 colors
16 bits = 65,536 colors
24 bits = 16,777,215 colors
32-bit = 4,294,967,296 colors
The bits represent 0 and 1 in the computer language. (00010001)
00010001 = 1 byte (8 bits are 1 byte.)
Changing the last 2 bits of every 1 byte of the picture taken is inconspicuous for the picture. For this reason, confidential data is stored in the last 2 bits of the picture.
Benefits
It is possible to use this art in a way that works for us.
For example, if we assume that malicious people access our files in response to the risk of theft of our computer or an external attack, and if we keep our important data on our computer (important information such as password, credit card, etc.), malicious people can easily read this information, and our data will be important with steganography art. we can hide and ensure the confidentiality of our important data, only because the size of the image we hide our data will increase, it is likely that the malicious person is skilled in these works and if the pixel of the image is low and the size is high, it is likely to cause suspicion.
Now let’s hide a txt document which we see hidden in an image file by application.
For this, we will use steghide application in Kali Linux system.
In our Kali Linux system, if our Steghide application is not installed, we install it by saying apt-get install steghide.
After installing the application, you can see the explanations about its parameters by typing steghide from the terminal.

I hid my SocialMediaAccount.txt file inside my cat.jpg file by typing Steghide embed –cf pussy.jpg –ef SocialMediaAccounts.txt,
A password is set as a precaution against anyone reading the hidden data in the file during hiding and the hiding process is completed.

cf — cover file: The file we will hide inside
ef — embed file: The file we want to hide
The pictures before and after hiding are as follows and there is no difference as it seems.
Let’s examine the files inside the jpg file by typing the steghide info command.

When asking to show the hidden data in the content of the picture by saying ‘y’, it asks us for the password.
As we have seen, we have hidden data such as SocialMediaAccounts.txt.
Let’s extract this data.

With the Steghide extract –sf command, we extract the file we have hidden in the picture with the password we created while hiding it.

When we read our confidential data that we issued with the cat command, we saw that social media accounts have a txt document containing user information and password.

--

--

Ömür Uğur

Pentest Manager at Turk Telekom | Sr.Penetration Tester | Bug Bounty Hunter | OSCP | OSWP |AWS |CRTO | eMAPT | eWPTX | CEH Master | ISO 27001 LA | ICS | @Synack