I was watching a web-show(Mr-Robot
) on a weekend. It's a story of how a guy hacks into data servers of big conglomerate, and encrypts all data with a cryptographic keys. After the hack was successful he stores the RSA keys to decrypt this data inside an image
.
This got me interested in the fact that we can store secret messages and keys. So I researched on this topic and got some basic methods of how it is practically achieved.
Steganography is a very ancient method, It is the practice of concealing a message within another message or a physical object.
The ancient form was like, sending messages on paper with invisible ink.
Over years its evolved and now used digitally with various forms of media like
Text - hide data inside another text, ex. embed a word every 5th word of paragraph.
Image - hide data inside image, replace pixels info with secret data in such a way there is minimal/un-noticable changes to image.
Audio - hide data in audio file, ex. add hidden data by modify audio in imperceptible way.
Video - hide data in video file. As videos have large size, its is very easy to hide any data/file type inside it.
Network - hide data in network protocols ex. hide secret in header or payload or mixing it in both.
There are many methods used in image steganography, I have listed very basic and simple ones.
LSB (Least significant bit)
It is a technique in which least significant bit of pixel data is replaced with data bit. It's very simple method and difference in images are undetected by naked eye.
DCT
This technique involves changing values of quantized DCT coefficients.
Read more on DCT here.
JSTEG
It is a steganography algorithm based on LSB replacement method for hiding data in DCT coefficients of JPEG images. The algorithm replaces the LSB of DCT coefficients by bits of the secret message to be hidden
I am using python library (cryptosteganography) for demonstrating this.
pip3 install cryptosteganography
from cryptosteganography import CryptoSteganography
# Initialise package with password key
crypto_steganography = CryptoSteganography('password key')
message = 'Super secret message. That I want to send secretly to someone. No one in middle should be able to read this'
# Hide message inside output image(`output_stego_image.png`).
crypto_steganography.hide(
'cover_image.png', 'output_stego_image.png', message)
# retrieve_message.py
from cryptosteganography import CryptoSteganography
# Initialise package with password key
crypto_steganography = CryptoSteganography('password key')
# Extract the message from stego image.
secret = crypto_steganography.retrieve('output_stego_image.png')
print(secret)
$ python3 retrieve_message.py
Super secret message. That I want to send secretly to someone. No one in middle should be able to read this
Openstego
Steghide
SSuite Piscel
Xiao Steganography
Hide’N’Send
embed copyright messages in media files
send secret info to someone
It's very popular in cyber crimes, Hence very important for white hat hackers.