
What Is an Alternate Data Stream? NTFS, Malware Hiding and How to Detect It
A file on a Windows computer can contain far more than you can see. Open a text file, read its contents, check its size — and you may still be looking at only part of what is stored under that file’s name. Hidden behind it, attached to the same file but invisible to File Explorer, to most file managers and to a casual check of the file’s size, there can be an alternate data stream: extra data that Windows will happily store, and that malware has been using to hide for decades.
This guide explains what an alternate data stream is, how it works in NTFS, which uses are legitimate, how attackers abuse it, and — most importantly — how to find, inspect and remove alternate data streams on your own systems.
What Is an Alternate Data Stream?
An alternate data stream (ADS) is additional data attached to a file on an NTFS-formatted drive, stored in a named stream alongside the file’s main contents. Every NTFS file has at least one data stream: the default, unnamed stream, which holds the file’s ordinary contents — the text you read, the image you view, the program you run. An alternate data stream is a second (or third, or fourth) stream with a name, holding extra data that is part of the same file, but is not shown as part of the file’s size or contents by most tools.
The syntax for referring to a stream is filename:streamname. For example, a file called report.txt might have a stream called hidden, addressed as report.txt:hidden. That stream can contain anything — text, code, an executable, even another file’s contents — and it travels with the file when the file is copied to another NTFS drive, but it is lost when the file is copied to a file system that does not support streams, such as FAT32 or most non-Windows systems. Streams also do not show up in a directory listing’s size column: the file’s reported size is the size of the main stream only.
The concept is not unique to Windows. Apple’s older HFS+ file system had resource forks that served a similar purpose, and other systems have extended attributes. NTFS alternate data streams are simply the Windows version of the idea — and because they are built into the file system itself, they are available to any program, and to any attacker, that knows how to use them.
How Alternate Data Streams Work in NTFS
NTFS stores a file as a set of attributes, and the file’s data is one of those attributes — specifically, the $DATA attribute. A normal file has one $DATA attribute, unnamed. An alternate data stream is simply an additional $DATA attribute with a name. The file system does not care what is in it, and it does not restrict the size: a stream can be many megabytes, bigger than the file it is attached to.
Because streams are a file-system feature, ordinary tools behave in ways that make them easy to miss:
- File Explorer shows nothing. It displays the file, its main size and its main contents, and gives no indication that streams exist.
- Most copy tools preserve them silently when the destination is NTFS, and drop them silently when it is not. A backup that restores to a FAT32 drive simply loses the streams.
- Many antivirus products scan them — modern security software does inspect streams — but older or poorly configured tools historically did not, which is part of the reason ADS hiding worked so well.
- The file’s icon and extension stay the same. A harmless-looking
.txtfile can carry a hidden executable in a stream, and nothing about the file’s appearance gives it away.
Legitimate Uses of Alternate Data Streams
Alternate data streams are not inherently malicious. Windows itself uses them every day, and you have probably benefited from them without knowing. The most common legitimate use is the Zone.Identifier stream.
When you download a file from the internet, or receive one as an email attachment, Windows writes a small stream named Zone.Identifier to the file, recording where the file came from — usually “this file came from the internet” (zone 3). That is why, when you open a downloaded file, Windows sometimes asks “do you want to run this file?” or shows a warning, while a file you created yourself opens without one. The warning comes from the stream, not from the file itself. When you click “Unblock” in a file’s properties, Windows is deleting that stream.
Other legitimate uses include:
- Metadata: some applications store tags, comments, thumbnails or summary information in streams attached to a file.
- Software installers and browsers: programs that download files add Zone.Identifier streams as part of Windows’ attachment security.
- macOS compatibility: files copied from a Mac may use streams to store resource-fork data.
- Backup and security software: some security tools store hashes or policy information in streams.
If you look at the streams on an ordinary Windows system, most of what you find will be a Zone.Identifier stream on downloaded files. That is normal, and it is not a reason to panic — but it is a good way to confirm that the detection techniques below work.
How Malware Uses Alternate Data Streams
The same properties that make streams useful make them attractive for hiding malware: they are invisible to Explorer, they do not change the host file’s size, and they can contain executable code.
The classic technique works like this. An attacker places a small, harmless-looking host file on the system — often a text file, an image or a shortcut. The malicious payload is stored in a stream attached to that file, so a scan of the file system by name and size finds nothing unusual. A small launcher, a scheduled task, a registry entry or a script then executes the payload from the stream, using a command such as wscript or a direct execution of file.txt:payload.exe — or more often, by using the stream as a storage location and copying the payload out or loading it from memory.
Real malware families have used this technique repeatedly. The Poweliks click-fraud malware, for example, was notorious for hiding in a stream and in the registry, with no executable file of its own on disk — making it extremely difficult to remove with conventional tools. Other malware uses streams to hide stolen data, to store configuration files, or to persist across reboots by keeping a copy of itself in a stream attached to a system file.
Streams are also used as a persistence and evasion technique in targeted attacks: a small payload can sit in a stream for weeks, doing nothing, until a trigger runs it. Because the host file looks legitimate, and because a responder searching for the malware by file name will not find it, ADS is one of the hiding places that incident responders are trained to check.
It is important to keep this in perspective. Not every file with a stream is malicious, and ADS hiding is a well-known technique that modern security software is designed to catch. It is, however, one of the reasons that simply “looking for suspicious files” is not enough — and why the detection methods below matter.
How to Detect Alternate Data Streams
Finding streams is easy once you know the tools. Use the method that fits the situation, and test it first on a downloaded file — you should find its Zone.Identifier stream.
1. Command Prompt: dir /r
Open Command Prompt and run dir /r in the folder you want to check. The /r switch lists each file’s streams beneath it, with their sizes. A file with only its main contents shows nothing extra; a file with streams shows lines such as report.txt:Zone.Identifier:$DATA. It is quick, built in, and good for checking one folder at a time.
2. PowerShell: Get-Item -Stream
PowerShell gives you more control. Get-Item -Path .\report.txt -Stream * lists all streams of a file, including the default :$DATA stream. To read a stream’s contents, use Get-Content -Path .\report.txt -Stream Zone.Identifier — you will see the small text of the zone information. To check a whole folder, you can loop over its files with Get-ChildItem and list streams for each one. This is the method used most often in scripts and incident response, because it is fast and it can be automated.
3. Sysinternals Streams
Microsoft’s free Sysinternals tool streams.exe is the classic ADS scanner. Running streams -s <folder> recursively lists every stream in a folder tree. It is the tool most incident responders reach for, and it is small, free and does not need installation. It also has a -d switch for deleting streams, discussed below.
4. Network and endpoint detection
At an organisational level, a network intrusion detection system, and modern endpoint detection and response (EDR) products, can detect the suspicious behaviour around streams — a process launching code from a stream, or a stream being created by an unusual process — even if no one manually scans the files. Vulnerability scanning does not usually look for streams directly, but regular scanning plus EDR coverage closes most of the gap for a defender.
What to look for
When you find a stream, ask three questions. What is the stream’s name — Zone.Identifier is normal, an unknown name is not. How big is it — a Zone.Identifier stream is a few dozen bytes, while a hidden payload will be much larger. And what is the host file — a stream attached to a downloaded document is worth checking, while the same stream on a system file deserves a careful look before you remove anything.
How to Remove an Alternate Data Stream
If a stream is unwanted, you have several safe options — but be careful: removing the wrong stream can break a file or, in the case of a system file, cause problems. When in doubt, quarantine the file first and check it with security software.
- Sysinternals Streams:
streams -d <file>deletes all streams from a file. Usestreams -s -d <folder>to clean a whole folder tree. - PowerShell:
Remove-Item -Path .\report.txt -Stream hiddenremoves a named stream. You can also remove the Zone.Identifier stream this way. - Copy the file: copying a file to a FAT32 drive, a USB stick formatted as FAT32, or a non-NTFS system strips the streams automatically. Copying it back to NTFS gives you a clean copy — an old but effective trick.
- “Unblock” in File Explorer: right-click a downloaded file, click Properties, then Unblock; this deletes only the Zone.Identifier stream.
- Delete the file: if the file itself is malicious, delete the whole file and the streams go with it. For a confirmed infection, follow your organisation’s incident response process rather than deleting evidence.
How to Protect Your Systems from ADS Abuse
Prevention is mostly the same as preventing malware generally, with a few ADS-specific additions:
- Keep security software current: modern antivirus and EDR products scan streams and monitor stream-based execution. This is the single most effective control. See our guide on how to prevent viruses and malicious code for the full checklist.
- Use least privilege: users and software that cannot write to sensitive folders, or execute from unexpected locations, cannot easily plant a hidden payload.
- Block suspicious execution: application allowlisting, and blocking script hosts such as wscript from running files with unusual paths, closes the usual route from a stored stream to running code.
- Monitor for new streams: include an ADS check in your regular host checks — a scheduled script that reports files with unexpected streams is cheap to run and catches the technique early.
- Train users: the payload still has to get onto the system, usually through phishing or a malicious download. A stream is a hiding place, not an infection vector on its own.
Alternate Data Streams vs Other Hiding Techniques
ADS is one of several ways data can be hidden in plain sight. Hidden files and folders are the simplest — a file whose hidden attribute is set — but they are trivially revealed by showing hidden files. Steganography hides data inside the visible content of an image or audio file, rather than alongside it, and is a different technique with different detection methods. Rootkits hide by subverting the operating system itself, so the hiding is at a deeper level. What makes ADS distinctive is that it uses a documented, built-in file-system feature, it is invisible to the tools most people use every day, and it is easy to check once you know how — which is why it is both a common attacker technique and a common first check for responders.
Frequently Asked Questions
What is an alternate data stream in Windows?
An alternate data stream is extra data attached to a file on an NTFS drive, stored in a named stream alongside the file’s main contents. It does not show in File Explorer and does not count towards the file’s reported size, so it is easy to miss — which is why it is used both by Windows itself, for information such as Zone.Identifier, and by malware, for hiding payloads.
How do I see alternate data streams?
Use dir /r in Command Prompt to list streams in a folder, Get-Item -Stream * in PowerShell for a single file, or Microsoft’s free Sysinternals streams.exe with streams -s <folder> to scan a whole folder tree. A first test on a downloaded file should show its Zone.Identifier stream.
Are alternate data streams dangerous?
Not on their own — the Zone.Identifier stream on a downloaded file is normal and even useful. Streams become dangerous when they contain executable code or stolen data placed there by malware. A large, unusually named stream on a file that should not have one is the warning sign.
How do I delete an alternate data stream?
Use streams -d <file> from Sysinternals, Remove-Item -Path <file> -Stream <name> in PowerShell, or copy the file to a FAT32 drive and back, which strips the streams. To remove only the Zone.Identifier stream, right-click the file, choose Properties, and click Unblock.
Do alternate data streams still work on Windows 11?
Yes. NTFS alternate data streams still exist on Windows 11 and are used by the system exactly as before. Modern Windows Defender and other security products scan and monitor them, so the technique is much less effective against a protected system than it was twenty years ago — but it is still a technique worth checking for.
Conclusion
An alternate data stream is a good example of how a useful, everyday feature of a file system can also become a hiding place. The data is not secret, it is not encrypted and it is not difficult to find — it is simply not shown by the tools most people use. The defence is therefore simple, too: know that streams exist, check for them with dir /r, PowerShell or Sysinternals Streams, treat an unexpected stream as a clue rather than a curiosity, and keep your security software, your privileges and your user training in order. Once you can see the streams, the hiding place stops working.


