4 months ago

How to Hide Secret Data Inside an Image or Audio File in Seconds « Null Byte :: WonderHowTo

Steganography will be the art of hiding information in plain sight, in addition to in This particular tutorial, I’ll show you how to use Steghide — a very simple command line tool to do just of which. In addition, I’ll go over a bit of conceptual background to help you understand what’s going on behind the scenes. This particular will be a tool of which’s simple, configurable, in addition to only takes a few seconds to hide information in many file types.

What will be Steganography?

Unlike encryption, where the item’s obvious of which a message will be being hidden, steganography hides data in plain view, inside a file such as a picture. As far as images are concerned, to anyone who isn’t aware of which the item contains hidden data, the item looks like just a normal, innocent picture.

Steganography will be useful in situations where sending encrypted messages might raise suspicion, such as in countries where free speech will be suppressed. the item’s also frequently used as a digital watermark to find when images or audio files are stolen. in addition to on a less practical note — the item’s just cool.

More Info: A Beginner’s Guide to Steganography

How will be Steganography Implemented?

There are several different techniques for concealing data inside of normal files. One of the most widely used in addition to perhaps simplest to understand will be the least significant bit technique, known commonly as LSB.

This particular technique alterations the last few bits in a byte to encode a message, which will be especially useful in something like an image, where the red, green, in addition to blue values of each pixel are represented by eight bits (one byte) ranging coming from 0 to 255 in decimal or 00000000 to 11111111 in binary.

Changing the last two bits in a completely red pixel coming from 11111111 to 11111101 only alterations the red value coming from 255 to 253, which to the naked eye creates a nearly imperceptible change in colour yet still allows us to encode data inside of the picture.

This particular diagram shows two 4-pixel images in both colour in addition to binary values. Each block of binary represents the value of the corresponding pixel.

The least significant bit technique works well for media files, where slightly changing byte values creates only slight imperceptible alterations, yet not so well for things like ASCII text, where an individual bit out of place will completely change the character. of which’s not to mention the fact of which data hidden using LSB steganography will be also easy to detect if someone will be looking for the item.

because of This particular reason, there are a plethora of additional steganography techniques out there, each with their own benefits in addition to drawbacks. Another far less detectable one will be called the discrete cosine transform coefficient technique (I know, the item’s a mouthful), which slightly alterations the weights (coefficients) of the cosine waves of which are used to reconstruct a JPEG image.

Using Steganography Effectively

Keeping in mind of which certain digital steganography techniques are better than others, generally, the item’s best to avoid the LSB technique in addition to go for something a bit more sophisticated. In fact, designing your own steganography algorithm isn’t terribly difficult if you already have not bad coding in addition to math foundations. yet to get a feel for how steganography works, LSB, which Steghide uses, will do just fine here.

Two additional things to consider are encryption in addition to compression. Encrypting data before embedding the item adds an extra layer of security while compressing your data will obviously allow you to fit more into your cover file. Both encryption in addition to compressions schemes can be included as optional parameters in Steghide, in addition to we’ll cover these below.

Step 1: Embed Hidden Data into a File

Using Steghide will be very easy. To install the item coming from the terminal in Linux, just use apt.

apt-get install steghide

Once the item’s installed, in order to embed data in a file, type the command below.

steghide embed -ef secretFile -cf coverFile -sf outputFile -z compressionLevel -e scheme

The arguments are broken down as follows:

  • -ef specifies the path of the file of which you want to hide. You can embed any kind of file inside of the cover file, including Python scripts or shell files.
  • -cf will be the file of which the data will be embedded into. This particular will be restricted to BMP, JPEG, WAV, in addition to AU files.
  • -sf will be an optional argument of which specifies the output file. If This particular will be omitted, the original cover file will be overwritten by your brand new steganographic file.
  • -z specifies the compression level, between 1 in addition to 9. If you prefer not to compress your file, use the argument -Z instead.
  • -e specifies the type of encryption. Steghide supports a multitude of encryption schemes, in addition to if This particular argument will be omitted by default, Steghide will use 128-bit AES encryption. If you prefer not use encryption, simply type -e none.

In my example, I’m hiding secret text inside an image of a cat. I’m not overwriting the original image or compressing the item, nor do I care about encryption right at This particular point.

steghide embed -ef secret.txt -cf StegoCat.jpg -e none -Z

Don’t Miss: How to Hide Data in Audio Files (Just Like Elliot in Mr. Robot)

This particular will be an example of how to use Steghide coming from the terminal.

Once you have executed the Steghide command, you will be prompted to set a password of which will allow you to extract the embedded data later. So enter your passphrase in addition to re-enter the item to confirm. Once you get used to This particular process, the item’ll only take seconds to hide your data inside an image or audio file with Steghide.

Here will be a side-by-side comparison of the original image in addition to the steganographic image. Can you detect any difference? Image by Hisashi/Flickr

Step 2: Extract Hidden Data coming from the File

Extracting hidden data coming from a steganographic image will be even easier. The command uses the syntax below.

$ steghide extract -sf stegoFile -xf outputFile

Once you run This particular command, you’ll be prompted to enter the same password you created above in order to create the extracted file. the item’s of which simple!

I’ve extracted the stego data coming from the image to a file in addition to displayed its contents from the terminal.

Hiding Data in Images will be Just Too Easy

The advantage of steganography will be of which you can hide data in plain sight, yet you can genuinely blow the item if you don’t follow some common sense rules. First, the little differences steganography introduces are hard to detect — unless you develop the original.

Using an image you found off the internet without modifying the item significantly makes the item easy to detect of which an image has hidden information. To check This particular, try a reverse Google Image search to make sure the original isn’t floating around somewhere.

I desire you enjoyed This particular tutorial in addition to realized just how easy the item will be to use steganography. the item literally only takes a moment to hide secret messages inside media files, in addition to whether you’re doing the item for copyright protection or just to be cool, steganography includes a multitude of applications.

Thanks for reading, in addition to if you have any questions, feel free to ask me from the comments below or on Twitter @blackslash6.

Don’t Miss: How to Hack Forum Accounts with Password-Stealing Pictures

Cover photo by Black Slash/Null Byte (in addition to Hisashi/Flickr); Screenshots by Black Slash/Null Byte

Leave a Comment

Your email address will not be published. Required fields are marked *

2 × one =