Steganography is a technique used to hide files and sensitive data inside an image so that it can be transported without arousing any suspicion. It is mostly used for Blackhat Hacking. It is generally encrypted so that data remains secure.
This method is one of the basics of cryptography. In this tutorial, we will show you how you can hide files in an image using steghide and Kali Linux.
Table of contents
So what is steganography?
Steganography is the technique that uses data manipulation to hide secret data inside an image and encrypts it with a secret passkey. In this process of encryption, we hide files and data inside an image, we encrypt the data with a passkey which needs another key on the receiver side to decrypt it. The receiver needs the decryption key in order to view the data.
How to Encrypt Files using Steganography in Kali Linux
We know that Kali Linux is the most used hacking OS in the world. So with that in mind, we will perform this tutorial in Kali Linux just because of its convenience. We will be using Steghide for this tutorial. So without further ado lets begin:
Features of steghide:
- compression of embedded data
- encryption of embedded data
- embedding of a checksum to verify the integrity of the extracted data
- support for JPEG, BMP, WAV, and AU files (Yes it supports even audio files).
Step 1: Open a Kali Linux Terminal and clone the steghide repository
apt-get install steghide
Step 2: Download an image file in which we will hide out text files inside of it.
Step 3: In the Kali Linux terminal. Change the working directory to Desktop using the following command:
Step 4: Make sure that both the files i.e JPG Image file and the text file in the same working directory. In this tutorial, the directory used is Desktop. You can choose any.
I have downloaded an image of a girl. The file is named girl.jpg. The text file is secret.txt
Step 5: Type steghide or steghide -h to show all the option of steghide.
The output will be the following :
the first argument must be one of the following: embed, --embed embed data extract, --extract extract data info, --info display information about a cover- or stego-file info <filename> display information about <filename> encinfo, --encinfo display a list of supported encryption algorithms version, --version display version information license, --license display steghide's license help, --help display this usage information embedding options: -ef, --embedfile select file to be embedded -ef <filename> embed the file <filename> -cf, --coverfile select cover-file -cf <filename> embed into the file <filename> -p, --passphrase specify passphrase -p <passphrase> use <passphrase> to embed data -sf, --stegofile select stego file -sf <filename> write result to <filename> instead of cover-file -e, --encryption select encryption parameters -e <a>[<m>]|<m>[<a>] specify an encryption algorithm and/or mode -e none do not encrypt data before embedding -z, --compress compress data before embedding (default) -z <l> using level <l> (1 best speed...9 best compression) -Z, --dontcompress do not compress data before embedding -K, --nochecksum do not embed crc32 checksum of embedded data -N, --dontembedname do not embed the name of the original file -f, --force overwrite existing files -q, --quiet suppress information messages -v, --verbose display detailed information extracting options: -sf, --stegofile select stego file -sf <filename> extract data from <filename> -p, --passphrase specify passphrase -p <passphrase> use <passphrase> to extract data -xf, --extractfile select file name for extracted data -xf <filename> write the extracted data to <filename> -f, --force overwrite existing files -q, --quiet suppress information messages -v, --verbose display detailed information options for the info command: -p, --passphrase specify passphrase -p <passphrase> use <passphrase> to get info about embedded data To embed emb.txt in cvr.jpg: steghide embed -cf cvr.jpg -ef emb.txt To extract embedded data from stg.jpg: steghide extract -sf stg.jpg
Step 6: Now type the following commands to embed the text File into the Image File with a password
steghide embed -cf girl.jpg -ef secret.txt
The help section describes each command you can use in steghide.
Step 7: Now Steghide will you for a Passphrase/password. So you can enter any password you like, then re-enter the same passphrase to confirm and hit enter.
You will get the following output on your terminal.
Step 8: Viola you have successfully hidden the text file within the image.
How to Decrypt the Encrypted File using Kali Linux :
Step 1: To decrypt the Encrypted file, go to your Kali Linux terminal and type the following command
steghide extract -sf girl.jpg
Step 2: Now enter the password/passphrase to unlock the file.
You need the correct password otherwise the file will not open.
Congratulations you have learned the basics of steganography and using steghide on Kali Linux. Now you can hide files in images and audio files using steghide.
Must read: How QR Code hacking works