SANS Digital Forensics and Incident Response Blog

Alternate Data Streams Overview

I'm sure it comes as no great shock that I am a member of a number of listserves on digital forensics. One question that seems to come up every few weeks is NTFS Alternate Data Streams. There have been many excellent articles on ADS, so I don't propose to go heavily into the details here. I will just include an overview and some of the better references. This is a basic overview. If you want more details, check out the links for some really good write-ups.

What are Alternate Data Streams?

Alternate Data Streams (ADS) have been around since the introduction of windows NTFS. They were designed to provide compatibility with the old Hierarchical File System (HFS) from Mac which uses something called resource forks. [http://www.securityfocus.com/infocus/1822, http://en.wikipedia.org/wiki/Alternate_Data_Streams]

Basically, ADS can be used to hide the presence of a secret or malicious file inside the file record of an innocent file. That is, when windows shows you a file, say "readme.txt", the metadata that tells your system where to get "readme.txt" may also contain information for "EvilSpyware.exe". Thus, malicious files may be on your system and you cannot see them using normal means.

How are ADS used?

A blackhat on your system can trojanize one of your regular, trusted files and use it to hide their toolkit so that your system will not see it. Or, a criminal may use the technique to hide something on their own system so that others will not readily find it.

To see how easy this is, try it yourself:

  1. Go to a temp directory and create a txt file
    Right Click, select New > Text document, enter the name "readme"
  2. Open the file in notepad and enter text "I am a harmless file". Save and close.
  3. Open a command prompt
    Start > Run? , enter "cmd", click OK
  4. In the command window, go to your temp directory.
  5. Type the following to confirm that you have a good victim file:
    notepad readme.txt
  6. A notepad window will pop up and show your harmless text.
  7. This has all been setup. Now we get to the ADS part.
  8. Type the following to save secret notes to a different text file and hide the reference to that text file inside of "readme.txt"
    echo this is my list of secret evil stuff > readme.txt:secret.txt
  9. Now if you type the following you will see only your original file...
    notepad readme.txt
  10. ? but if you type this, you will see your secret message
    notepad readme.txt:secret.txt
  11. Not only can you hide text, but you can hide executable as well. You also don't need to use a txt file as the host for hiding your file. Several other file formats, including directories can be used to hide files. For a great discussion of both of these techniques, check out http://www.irongeek.com/i.php?page=security/altds and http://www.windowsecurity.com/articles/alternate_data_streams.html

How can I detect ADS?

There are quite a number of ADS tools out there at the moment, here are a few to get you started.

Enjoy!

——-
Quinn Shamblin, GCFA Silver #2801, Investigator, University of Cincinnati Information Security — quinn.shamblin@uc.edu.

1 Comments

Posted October 24, 2008 at 6:43 PM | Permalink | Reply

keydet89

http://windowsir.blogspot.com/2008/06/ntfs-alternate-data-streams.html