Want to learn to hide private files secretly within other files and images, then this is the perfect article for you. But why is it important?
Why hide private files in Windows and Linux?
As a student or a cyber enthusiasts who are exploring the the domains of cybersecurity and ethical hacking, hiding private files is very important. In case of the device falling in some other person so that our personal, secret files would not be compromised. Sometimes we may hide the private files within other files or sometime we may also hide then within images. It is good practice to hide confidential documents and details hidden from the plain sight.
Hiding A File in Another File in Windows
Alternate Data Streams(ADS)
Alternate Data Streams or ADS are available on the Windows New Technology File System (NTFS). This feature which is allowed by all versions of Windows contains the metadata for locating a particular file from the location or the title. In terms of security, the ADS does not alter the any worthy characteristics of the file to which they are attached. We will be using ADS in this process to hide our files.
Step 1 :
Open Command Prompt on your Windows and change the directory where we want to save the files.
Step 2 :
Make a new folder in the main folder selected where the new files will be saved and go to that directory.
The selected folder is totally empty and the command dir will be used every time we want to check the content of the folder and the files inside.
Step 3 :
We create two text files. One that will be hidden or rather the file that contains the private confidential data and second the file that will be used to hide the private file.
Here the private file is named Confidential.txt and the other file which will be used to hide the private file is named Picnic.txt.
Step 4 :
Now that both the files are saved we will hide the Confidential.txt file within the Picnic.txt. We will use ADS in this command to hide the file.
Now when we do a dir we see that both the files are present in the folder.
Step 5 :
We do not want the private file Confidential.txt to stay in plain sight so we delete the file from the folder. Now when we check the folder using the dir command we see that only the file Picnic.txt is present.
Step 6 :
Our private file has already been hidden. When we open the folder SecretFiles we see just one single text file Picnic.txt. Our file Confidential.txt is hidden inside Picnic.txt. Now when the latter file we only see the contents of the Picnic.txt file which is the optimum result.
But how do we see the hidden file that was within this file? We just use the hidden file name after the file is normal sight i.e. in this case we use Picnic.txt : Confidential.txt and there is our hidden file.
How to Find a Hidden File on Windows
We saw previously on how we can hide any file within a file and therefore hide all our private confidential files from the plain sight. But what if someone hid one of your file without you knowing. How do we find the file in that case? How do we get to find a hidden file without knowing the file name? While we were hiding the file we saw that we use the dir command on the command prompt to see the contents of the file but the hidden files are not visible in that case.
In order to check all the files we need to view the alternate data streams to see that we will use the command dir /r.
And Voila!!! There is the file confidential.txt. Now once we have the name of the file we can views the contents of the file as we did earlier in Step 6. This kind of file retrieval can also result useful when solving CTFs as there maybe some hidden file within the file provided.
This is how we hide a file within a file and check whether any hidden files are present inside a folder or a directory on Windows.
How to Hide a File inside a Photograph in Linux.
Steganography is the practice of hiding a secret file within a not so secret file or image. While hiding a file inside another file we used ADS that was also another form of steganography. When a file is embedded inside a photograph that seems completely innocent while being shared to the outside world but may contain a lot of important confidential data.
Let’s see how we can do it :
Step 1 :
We open our Linux Terminal Emulator and make a new directory SecretFiles in our Documents folder and redirect to it.
Step 2 :
Next we install a tool called stag hide and use the command sudo apt install staghide -y.
Step 3 :
Here inside the directory SecretFiles we have a jpg file or an image, this is the image that we will use as the not-so-important file to hide our important file. We open the file just to check the image.
Step 4 :
Now we create the secret text file Confidential.txt that is to be hidden inside the jpg file.
Step 5 :
Now when we ls we see both the image file and the text file are ready to perform our actions.
Here in the command steghide embed -cf [image file name] -ef [text file name] , cf signifies the cover file or in this case the image file that will hide our text file or ef, the embedded file. When the file is embedded we remove the file Confidential.txt.
Step 6 :
Now that our file Confidential.txt is embedded we will see how we can extract it back.
And there are file is extracted and we can view its contents.
This is how we see that files can be hidden inside other files and images.