Steganography in Linux from the command line

By | 2014/08/12

Cryptographically hiding data in another file such as an image is extremely easy in Linux. Check it out!

On Debian or Ubuntu, install the package steghide:

$ sudo apt-get install steghide

To embed a file into a jpeg image, use a command like the following. You will be prompted to set a passphrase.

$ steghide embed -cf tux.jpg -ef mytext.txt 
Enter passphrase: 
Re-Enter passphrase: 
embedding "mytext.txt" in "tux.jpg"... done

To extract the embedded file, use a command like the following:

$ steghide extract -sf tux.jpg
Enter passphrase: 
wrote extracted data to "mytext.txt".

This is the tux.jpg which contains the hidden text file. The passphrase is scottlinux. Feel free to download this jpg and extract away!

There are also various flag to specify the encryption algorithm and options. –help has more info:

$ steghide --help
steghide version 0.5.1

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        display information about 
 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         embed the file                               
 -cf, --coverfile        select cover-file                                      
   -cf         embed into the file                          
 -p, --passphrase        specify passphrase                                     
   -p        use  to embed data                         
 -sf, --stegofile        select stego file                                      
   -sf         write result to  instead of cover-file       
 -e, --encryption        select encryption parameters                           
   -e []|[]  specify an encryption algorithm and/or mode            
   -e none               do not encrypt data before embedding                   
 -z, --compress          compress data before embedding (default)               
   -z                  using level  (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         extract data from 
 -p, --passphrase        specify passphrase
   -p        use  to extract data
 -xf, --extractfile      select file name for extracted data
   -xf         write the extracted data to 
 -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        use  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

6 thoughts on “Steganography in Linux from the command line

  1. Jan Kvapil

    Thanks a bunch, even though I’ve used it only once (for one school project) it has done the work. I have tried first 5 or six sites which I got after googling “steganography decoding” (or similiar) and none of them worked for me.. This is neat and from the terminal, as I like it.

  2. Max

    Is there a way to install it on OS X? I keep trying to install it, but it gives me an error that libmhash isn’t installed on my system, even though I definitely have mhash on my machine.

    1. jock

      there is no need for this in OS X. the mac terminal has the builtin feature of steganography, google it.

  3. Joerge

    Seems interesting. Anyone have luck using this on CentOS 7?

  4. preetha

    I am getting the below error when trying to install steghide
    dpkg: error processing package libqt5network5:amd64 (–configure):
    package libqt5network5:amd64 is not ready for configuration
    cannot configure (current status ‘half-installed’)
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)


Leave a Reply

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

Notify me of followup comments via e-mail. You can also subscribe without commenting.