Alternate data stream

Also known as: ADS

On this page 7

An alternate data stream (ADS) is an additional named stream of data attached to a file or folder on NTFS, stored alongside the file’s main content but invisible to ordinary directory listings and to the file size shown in Explorer. Within Windows storage & file systems, ADS is a core NTFS capability that Windows itself relies on, most visibly to record where a downloaded file came from.

Every NTFS file has at least one stream, the unnamed default data stream that holds what users think of as the file’s contents. An alternate data stream is any further stream with its own name, addressed with the syntax file.ext:streamname. The feature dates back to Windows NT, where it was added partly to store Macintosh resource forks for file sharing with Apple clients.

How NTFS stores alternate data streams

NTFS stores each stream as a separate $DATA attribute in the file’s Master File Table record, and an alternate data stream is simply a $DATA attribute that carries a name. Small streams can be resident, living inside the MFT record itself, while larger ones are non-resident and occupy their own clusters on the volume, exactly like a normal file body.

The full path of a stream has three parts: the file name, the stream name and the attribute type, as in report.docx:notes:$DATA. When the type is omitted, $DATA is assumed. Streams share the file’s security descriptor and timestamps, so permissions cannot be set per stream, and deleting the file deletes all of its streams.

The table below breaks down the parts of the stream naming syntax.

PartExampleMeaning
File namesetup.exeThe file that owns the stream
Stream nameZone.IdentifierName of the alternate stream
Attribute type$DATANTFS attribute holding the bytes
Default streamsetup.exe::$DATAUnnamed stream with main content
Full alternate pathsetup.exe:Zone.Identifier:$DATAComplete reference to one stream
Parts of an NTFS stream path

Legitimate uses of alternate data streams

The best-known use of alternate data streams is the Mark of the Web, a stream named Zone.Identifier that browsers and mail clients attach to downloaded files. It records a security zone, where ZoneId=3 means the Internet zone, and often the source URL. Microsoft Defender SmartScreen, Office Protected View and the PowerShell execution policy read this stream to decide how cautiously to treat the file.

Other components and applications store metadata that should travel with a file without changing its contents. The table lists representative examples.

Stream nameCreated byPurpose
Zone.IdentifierBrowsers, mail clients, archiversMark of the Web origin data
SmartScreenMicrosoft Defender SmartScreenReputation check results
WofCompressedDataCompact OS and compact.exeCompressed file contents
AFP_AfpInfoServices for Macintosh, SMB serversMac Finder information
com.dropbox.attrsSync clientsSync state for cloud storage
Custom namesBackup and indexing toolsChecksums or tags
Common legitimate alternate data streams

Removing the Zone.Identifier stream is exactly what the Unblock option in a file’s Properties dialog and the Unblock-File cmdlet do. This is why an extracted script stops prompting after it has been unblocked.

Viewing and managing streams

Alternate data streams are hidden from Explorer and from a plain dir listing, so dedicated switches or cmdlets are needed to see them. Explorer reports only the size of the default stream, which means a 1 KB text file can carry megabytes of hidden data.

The table summarizes the built-in tools for working with streams.

TaskCommandNotes
List streamsdir /rShows stream names and sizes in Command Prompt
List streams in PowerShellGet-Item file -Stream *Returns each stream with its length
Read a streamGet-Content file -Stream nameOutputs stream content as text
Write a streamSet-Content file -Stream nameCreates or replaces a named stream
Delete a streamRemove-Item file -Stream nameLeaves the main content untouched
Unblock a downloadUnblock-File fileRemoves the Zone.Identifier stream
Tools for inspecting and editing alternate data streams

Sysinternals Streams utility can also enumerate and delete streams recursively across a folder tree, which is useful when auditing a large share.

When streams survive and when they are lost

Alternate data streams exist only on file systems that support them, so they disappear whenever a file leaves NTFS or a compatible system. Windows usually warns that properties will be lost when copying to such a destination, but many tools drop streams silently.

  • Kept: copies and moves between NTFS volumes in Explorer, robocopy and most backup tools that use Windows backup APIs.
  • Kept with limits: ReFS supports named streams, with size limits that depend on the version.
  • Lost: copies to FAT32 or exFAT media such as many USB drives and memory cards.
  • Lost: email attachments, most web uploads and many archive formats, although some extractors propagate the Mark of the Web to extracted files.
  • Variable: SMB shares on non-Windows servers, depending on how the server maps named streams.

Security risks and common misconceptions

Because streams are invisible in normal views, attackers have long used them to hide payloads and tools on compromised systems, and security monitoring treats unexpected streams as a signal worth investigating. Modern Windows prevents launching an executable from a stream by double-clicking, but several living-off-the-land binaries can still execute stream content.

Attackers also abuse the opposite effect: delivering files in containers that strip the Mark of the Web so that SmartScreen and Protected View never trigger. Security teams therefore check both for hidden streams and for missing ones. The table pairs common misconceptions with the accurate picture.

MisconceptionReality
Streams are a hacking featureWindows uses them routinely for metadata
File size shows all dataExplorer shows only the default stream size
Streams need separate permissionsThey share the file’s access control list
Copying always preserves streamsNon-NTFS destinations discard them
Antivirus ignores streamsModern scanners inspect alternate streams
Misconceptions about alternate data streams

Explained without jargon

An alternate data stream is like a hidden pocket sewn inside a file. The file still shows its normal contents, but the pocket can hold extra notes that most programs never look at.

Windows uses this pocket to remember where a file came from. That is why a program downloaded from the Internet triggers a warning, while the same program copied from a colleague’s NTFS drive may not. The key idea is simple: a file on NTFS can carry more than it shows.

A typical use case

A help desk technician receives a ticket from an accountant whose spreadsheet macros refuse to run. The workbook came from an email attachment, and Excel keeps opening it in Protected View with macros blocked.

Running Get-Item budget.xlsm -Stream * in PowerShell shows a Zone.Identifier stream with ZoneId=3, confirming that Windows treats the file as coming from the Internet. After checking that the file was sent by a known internal colleague, the technician removes the stream with Unblock-File. The workbook then opens normally, and the technician notes in the ticket that unblocking should follow a verified sender check, not become a routine reflex.