Skip to content

Artifact Analysis: NTFS Alternate Data Streams (ADS)

To understand ADS, analysts must look at how the New Technology File System (NTFS) manages data. Every file on an NTFS volume consists of a set of attributes stored within a Master File Table (MFT) record.

The actual content of a file is stored in the $DATA attribute. A standard file has a single, unnamed $DATA attribute. However, NTFS allows a single file to have multiple, named $DATA attributes. These are the Alternate Data Streams.

An ADS is accessed by appending a colon (:) to the primary file’s name: FileName.extension:StreamName.extension:$DATA

For example, if an attacker hides a payload named malware.exe inside a benign text file named readme.txt, the resulting stream is addressed as: readme.txt:malware.exe

Crucially, adding a 50MB executable to the ADS of a 1KB text file will not change the reported file size of the text file in Windows Explorer or standard dir commands, making the payload completely invisible to the casual observer.

2. Legitimate Usage: The Zone.Identifier (MoTW)

Section titled “2. Legitimate Usage: The Zone.Identifier (MoTW)”

Before hunting for malware, DFIR analysts must understand the most critical legitimate use of ADS: the Mark of the Web (MoTW).

When a user downloads a file from the internet via a web browser or email client, Windows automatically creates an ADS named Zone.Identifier. This stream contains metadata indicating the file’s origin zone (e.g., Internet, Intranet).

Forensic Value of MoTW

During a Suspicious Email Analysis or phishing investigation, reading the Zone.Identifier stream of a downloaded payload reveals the exact URL from which the file was downloaded (the HostUrl field). This provides immediate, high-fidelity IOCs for threat hunting.

Threat actors leverage ADS across multiple phases of the kill chain: staging payloads, establishing persistence, and evading detection.

Adversaries often use built-in Windows commands to pipe malicious binaries or scripts into the ADS of legitimate system files or mundane documents.

Terminal window
# Staging a malicious executable inside a standard text file
type evil.exe > C:\Users\Public\readme.txt:hidden.exe

Writing to an ADS is trivial; executing from it requires specific “Living off the Land” (LOLBAS) techniques. Since modern Windows versions restrict executing an .exe directly from an ADS via the command line, attackers use indirect execution methods.

  1. WMI Execution: Using Windows Management Instrumentation to launch the hidden executable. wmic process call create "C:\Users\Public\readme.txt:hidden.exe"
  2. Rundll32 Execution: If the hidden payload is a DLL, it can be executed using the native rundll32.exe utility. rundll32.exe C:\Users\Public\readme.txt:hidden.dll,EntryPoint
  3. Script Execution: Hiding PowerShell or VBScript code inside an ADS and executing it via Get-Content or wscript.

Because ADS payloads are invisible to standard dir or Windows Explorer checks, analysts must use specific utilities during live response or offline MFT parsing.

  • Command Prompt: The /R flag instructs the dir command to display alternate data streams. dir /R C:\Users\Public\
  • PowerShell: Native cmdlets can query and read streams directly. Get-Item -Path C:\Users\Public\readme.txt -Stream * Get-Content -Path C:\Users\Public\readme.txt -Stream hidden.exe

When analyzing a forensic image, analysts parse the $MFT file. Tools like Eric Zimmerman’s MFTECmd will explicitly list files containing named $DATA attributes, allowing analysts to extract the hidden payload directly from the raw disk image regardless of OS restrictions.

Detecting ADS abuse requires granular endpoint telemetry. Native Windows event logs are insufficient; organizations must rely on Sysmon or EDR solutions.

Sysmon Event 15 is specifically designed to log the creation of named file streams. It records the target file, the stream name, and crucially, the cryptographic hash of the stream’s contents, enabling immediate IOC correlation.

hunt_ads_creation.kql
// Detect the creation of executable streams attached to files
DeviceEvents
| where ActionType == "SysmonFileCreateStreamHash"
// Filter out legitimate Zone.Identifier creation
| where TargetFileName !endswith ":Zone.Identifier"
| where TargetFileName !endswith ":SmartScreen"
// Look for streams with executable extensions
| where TargetFileName contains ".exe" or TargetFileName contains ".dll" or TargetFileName contains ".vbs" or TargetFileName contains ".ps1"
| project TimeGenerated, DeviceName, InitiatingProcessFileName, TargetFileName, SHA256
| sort by TimeGenerated desc

Disabling Alternate Data Streams is not possible, as it is a fundamental architectural component of the NTFS file system required by legitimate Windows services. Mitigation relies entirely on strict Execution Prevention (blocking execution from unauthorized paths using WDAC/AppLocker) and robust Behavioral Monitoring (EDR/Sysmon) to detect the creation and execution of anomalous streams.