← Resources

NTFS Alternate Data Streams: Hidden Data, Attack Techniques & Detection

· Konstantinos Xanthopoulos

How a legitimate NTFS feature can conceal data, and what security teams can observe, investigate and control.

Technical Deep Dive · Windows Security · Detection Engineering · Digital Forensics

What standard file inspection can miss

When we inspect a file in Windows Explorer, its name, extension, and reported size give us only a partial view of its contents. On NTFS volumes, a file can carry more than one data stream. The content we normally see is stored in the default, unnamed stream. Alternate Data Streams (ADS) allow other data to be stored within the same file.

This capability is legitimate and widely used. It can also be abused to conceal scripts, payloads, or configuration data from checks that look only at a file's primary content. ADS are not inherently malicious, and storing data in an ADS does not execute it or automatically bypass security controls.

In this article, we look at how ADS work, demonstrate the concept with PowerShell and explore how Sysmon and Sigma can help with detection and investigation.

1. How NTFS data streams work

An NTFS file can contain a default unnamed $DATA attribute and one or more named $DATA attributes. The following path examples illustrate the distinction:

Text
examplefile.txt                 # Default, unnamed stream
examplefile.txt::$DATA          # Explicit default-stream notation
examplefile.txt:hiddenstream    # Named alternate data stream
examplefile.txt:hiddenstream:$DATA

A named stream has its own content and size. Writing to it does not modify the bytes of the default stream. Standard file-size displays generally reflect the unnamed stream rather than the sum of every stream, although the named stream still occupies storage space. How streams are stored and preserved depends on the file system and the operation performed.

One NTFS file, multiple data streams

File examplefile.txt
  • Default (unnamed) streamexamplefile.txt::$DATA“Visible file content.”
  • Named stream (ADS)examplefile.txt:hiddenstream:$DATA“Additional data stored in the ADS.”
Legitimate example: Zone.Identifier (Mark of the Web)Another possible named stream, often added to downloaded files. It is not the content of hiddenstream and not a sign of compromise.
  • Independent data. Each named stream has its own content and size.
  • Default stream unchanged. Adding a named stream does not modify the bytes of the default stream.
  • Size displays. Conventional size displays generally reflect the default stream, while named streams still occupy storage.
Figure 1. Conceptual view of one NTFS file containing a default stream and a separate named stream. The diagram is illustrative, not a raw Master File Table (MFT) layout.

Legitimate example: Mark of the Web

A common example is Zone.Identifier, which is used to store Mark of the Web (MOTW) information. Supported applications may attach it to files originating from untrusted zones, for example:

Text
report.docm:Zone.Identifier

The stream may contain:

INI
[ZoneTransfer]
ZoneId=3

ZoneId=3 identifies the Internet zone. Windows and supported applications can use this information when applying security controls. For example, Office uses MOTW to determine whether to block macros in files originating from the Internet. Not every downloaded file receives or retains this stream, and its absence is not proof that a file is trustworthy. Its presence alone is not an indicator of malware.

Deleting all ADS as a security measure is therefore not advisable, as it may remove information used by security features.

2. How attackers can abuse ADS

An adversary may use a named stream attached to an otherwise ordinary file to store scripts, executable components or configuration data. Conventional file inspection or evidence collection that preserves only the default stream may miss this data.

Attackers may use ADS to stage payloads, conceal supporting data or complicate an investigation. A stream is a storage mechanism, however. A separate process, script or loader must access its content for it to become part of an execution chain. An HTML file does not automatically execute JavaScript merely because that script was placed in an ADS attached to the file.

MITRE ATT&CK tracks this under T1564.004 (Hide Artifacts: NTFS File Attributes). Its related detection strategy, DET0432 / AN1206, recommends analysing suspicious stream activity together with process lineage and file-related telemetry rather than treating a stream name as a sufficient indicator.

3. Safe demonstration with PowerShell

On a Windows computer, use a temporary test directory on an NTFS volume. The following commands store harmless text only; they do not execute any payload.

Use a fresh test directory for each run, particularly when validating named-stream creation events in Sysmon.

PowerShell
$lab = Join-Path $env:TEMP 'ADS-Lab'
New-Item -ItemType Directory -Path $lab -Force | Out-Null
$file = Join-Path $lab 'examplefile.txt'

# Write the regular file content.
Set-Content -LiteralPath $file -Value 'Visible file content.'

# Add an independent named data stream.
Set-Content -LiteralPath $file -Stream 'hiddenstream' `
    -Value 'Additional data stored in the ADS.'

# Enumerate the file's streams and their lengths.
Get-Item -LiteralPath $file -Stream * |
    Select-Object FileName, Stream, Length

# Read only the named stream.
Get-Content -LiteralPath $file -Stream 'hiddenstream'

The stream enumeration should identify the default stream (:$DATA) and hiddenstream. The final command reads the named stream without modifying the default stream.

You can also navigate to the test directory in Command Prompt and run:

CMD
dir /r

Microsoft Sysinternals Streams can also enumerate named streams and their sizes. The PowerShell -Stream parameter is specific to the Windows FileSystem provider; do not assume that it will work on other file systems.

4. Detection engineering: from creation event to investigation

The most useful starting point is Sysmon Event ID 15 (FileCreateStreamHash). When Sysmon is installed and configured to collect this event, it can record named-stream creation, including the creating process (Image), target path (TargetFilename), process GUID and hash information for the default stream. The event may also contain the named stream's text content.

Limitations: Event ID 15 indicates named-stream creation. It is not a complete audit trail of every subsequent read, modification, or execution involving an ADS. Collection coverage and retention depend on Sysmon configuration and the logging pipeline.

Finding the test event in Sysmon

If Sysmon Event ID 15 was enabled before running the PowerShell demonstration, the following command retrieves matching events collected over the past 24 hours:

PowerShell
Get-WinEvent -FilterHashtable @{
    LogName   = 'Microsoft-Windows-Sysmon/Operational'
    Id        = 15
    StartTime = (Get-Date).AddHours(-24)
} -ErrorAction Stop |
    Where-Object { $_.Message -like '*examplefile.txt:hiddenstream*' } |
    Select-Object TimeCreated, Id, Message

An empty result or a “No events were found” error does not prove that no stream was created. Verify that Sysmon is installed, Event ID 15 collection is enabled, the activity is not excluded by filtering rules, and the relevant events are still retained. Also verify that you have sufficient permissions to read the event log.

A Sigma rule for targeted hunting

The following example rule highlights non-MOTW streams created by selected command and script interpreters. It should be tuned and validated before being deployed in production.

YAML
title: Non-MOTW ADS Created by a Script or Command Interpreter
status: test
description: Highlights named-stream creation by selected interpreters.
author: PanoptesOne editorial example
date: 2026-11-04
logsource:
  product: windows
  category: create_stream_hash
detection:
  selection:
    Image|endswith:
      - '\powershell.exe'
      - '\pwsh.exe'
      - '\cmd.exe'
      - '\wscript.exe'
      - '\cscript.exe'
  filter_motw:
    TargetFilename|endswith: ':Zone.Identifier'
  condition: selection and not filter_motw
falsepositives:
  - Legitimate administrative scripts or software installers using ADS
level: medium
tags:
  - attack.t1564.004

The rule covers only the specified processes and depends on the availability of the relevant telemetry. It will miss stream creation by other applications. Excluding Zone.Identifier reduces alerts on legitimate activity but also excludes events that may be useful when investigating MOTW. If you need to investigate the origin of downloaded files, retain that telemetry separately.

SigmaHQ also maintains the rule “Hidden Executable In NTFS Alternate Data Stream” (rule ID b69888d4-380c-45ce-9cf9-d9ce46e67821), which looks for executable-related import-hash evidence in stream-creation telemetry. Its repository status is test, and false positives are documented. This rule requires Sysmon or equivalent telemetry configured to collect import hashes (IMPHASH). Evaluate its coverage and suitability for your environment before deployment.

What to investigate when a rule matches

  • Process context: Which executable created the stream? Is its parent process or command line expected for this host?
  • Target: Which file contains the stream, where is it located, and does the stream name resemble a legitimate application convention?
  • Content and sequence: Does the stream contain text, data resembling executable code or another type of content? Was there a related process execution or script event shortly afterwards?
  • Environment: Is this a known backup, browser, installer, or security-product workflow? Does the same activity occur normally on comparable systems?
  • Evidence: Can the stream be preserved and examined without modifying it? Do the acquisition and transfer methods preserve named streams?

Correlating Event ID 15 with Sysmon Event ID 1 (process creation), relevant Event ID 11 file-creation records, PowerShell logging where enabled, and available EDR telemetry generally provides more useful context than alerting on every named stream.

5. Defensive controls and practical limits

Application control. Properly configured Windows App Control for Business or equivalent controls can constrain unauthorised code execution. These controls do not remove ADS or eliminate the need to monitor named-stream activity.

Attack Surface Reduction (ASR). Defender ASR rules targeting potentially obfuscated scripts, email-delivered executable content, or selected child-process behaviour may interrupt particular attack chains. These rules do not provide universal protection against ADS abuse. Evaluate which rules apply to the attack path in question.

EDR and event collection. Verify what telemetry your EDR collects on representative systems, rather than simply checking that the agent is installed. Confirm that the necessary stream telemetry is collected, that detections are tuned and that alerts can be investigated.

Forensic preservation. When collecting evidence from NTFS systems, verify whether the acquisition tool, archive format, or destination file system preserves named streams. A copy of the default stream alone may omit relevant evidence. Two files with identical default-stream hashes may contain different alternate data streams. Forensic integrity verification should therefore account for named streams separately.

Security posture management. Configuration assessment and drift monitoring can help teams verify that supported logging, application control and endpoint protection settings remain configured as intended. These capabilities complement behavioural detection and incident response; they do not by themselves detect hidden payloads in ADS.

6. Key takeaways

NTFS Alternate Data Streams illustrate why file-system knowledge still matters in endpoint security. A single file may contain multiple independent data streams, and standard file inspection often shows only the default stream. Some streams, particularly Zone.Identifier, are legitimate and security-relevant. Others may be used to conceal attacker-controlled data.

Rather than classifying every ADS as malicious, we need to understand how streams work, collect the relevant telemetry, correlate unusual activity with process behaviour and preserve the evidence.

Installing a security tool is not enough. We also need to know what it can observe and verify that coverage over time.

Technical references

  1. Microsoft Learn: File streams (local file systems)
  2. Microsoft Learn: Using streams
  3. Microsoft Learn: PowerShell Get-Item (-Stream)
  4. Microsoft Learn: PowerShell Set-Content (-Stream)
  5. Microsoft Learn: Microsoft Sysinternals Streams
  6. Microsoft Learn: Sysmon, including Event ID 15
  7. Microsoft Learn: Macros from the Internet are blocked by default in Office
  8. MITRE ATT&CK: T1564.004
  9. MITRE ATT&CK: DET0432
  10. SigmaHQ: Hidden Executable In NTFS Alternate Data Stream
  11. Microsoft Learn: ASR rules reference

Editorial note: The PowerShell example and the Sigma rule were reviewed against the relevant documentation but were not tested in a Windows lab for this revision. Rule deployment requires local validation.

Originally published by cyb3rint3l on 23 June 2023; updated on 17 September 2025; substantially revised for PanoptesOne Resources in November 2026.