Alternate data streams, or streams, are a feature of the NTFS file system. They are not available on FAT file systems or any other file system.

According to the Microsoft article, the original data stream is the file data itself, which is the data stream with no name. All other streams have a name. Alternate Data Streams can be used to store file meta data and any other type of data.

To explain this concept, we can type the following into the command prompt

echo "This is not ADS" > file.txt

echo "This is ADS" > file.txt:stream1 

We can also create streams programmatically. In the CreateFile Windows API, just append ":stream_name" to the file name, where "stream_name" is the name of the data stream. We could also use the WriteFile Windows API function to write data.

Example program that writes to an alternate data stream is presented below.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2976396a-bb71-4f44-b7d7-49d08f920770/Untitled.png

you can use the dir command with /r to see the data streams.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b1229093-8403-4ea9-b3c7-5f318034696b/Untitled.png

Here, we can attempt to view the contents of the txt file and ADS using type and more.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d8c8994b-9731-417b-9160-8e15fbf5696f/Untitled.png

Another tool to view alternate data streams is the Streams tool bundled with Sysinternals.

streams.exe "file.txt"

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0886a179-b08a-416d-82ad-5e631402a1c2/Untitled.png

This tool was useful prior to the Windows PowerShell days. PowerShell's cmdlet Get-Item has the capability to retrieve alternate data stream information.

We'll need to use the "-Stream" parameter in order to do so.

Get-Item -Path .\\file.txt -Stream *

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ffc52e78-81fc-4526-9d71-0700995b30c7/Untitled.png

Note that Microsoft uses ADS for non-nefarious reasons. For instance, via the Zone.Identifer (Zone 3) ADS, we can tell if a file or binary was downloaded from the internet (Internet Zone).