May 18, 2017

How to Hide a Picture in a Text File

Alternative data streams were originally created to support Macintosh Hierarchical File System way back in the days of NTFS and Windows 2000. Today I will show you trick that allows you to hide plain text, images, and even videos inside a seemingly innocent text file.  I'll assume you are on a Windows machine and can open up a command prompt

  1. To start, open up a command prompt.
  2. cd into a directory that has a picture and rename that photo to pic.jpg (assuming it is a jpg).
  3. Next, type echo Here is some text > file.txt.
  4. Confirm that the file was created.
  5. To create a hidden text file, enter type echo Hidden stuff > file.txt:hidden.txt. Now if you type dir you will see file.txt but nothing about hidden.txt.
  6. To view your hidden text type notepad file.txt:hidden.txt. Now you are able to see the hidden text!
  7. You can follow the same pattern to hide an image. Enter type pic.jpg > file.txt:pic.jpg.
  8. Once you've executed the command, type mspaint file.txt:pic.jpg.
  9. Now you can see the "hidden" photo!

 Notice below that the file name is file.txt:pic.



Alternative data streams are a powerful way to manipulate a file.  If you want to learn more about ADS and their security implications you can read more here.