What it is: Improper Handling of Windows ::DATA Alternate Data Stream (CWE-69) is a type of file system vulnerability that occurs when an application fails to properly prevent access to or detect usage of alternate data streams (ADS) in Windows files.
Why it matters: CWE-69 can lead to unauthorized data access and manipulation, bypassing protection mechanisms, and hiding activities. It is a critical vulnerability that requires immediate attention.
How to fix it: To prevent CWE-69, ensure that your application correctly parses file names and handles alternate data streams securely.
TL;DR: Improper Handling of Windows ::DATA Alternate Data Stream (CWE-69) is a critical vulnerability that allows attackers to access and manipulate alternate data streams in Windows files. To prevent CWE-69, ensure that your application correctly parses file names and handles alternate data streams securely.
At-a-Glance
| Field | Value |
|---|---|
| CWE ID | CWE-69 |
| OWASP Category | A0X:2025 - File System Vulnerabilities |
| CAPEC | CAPEC-168 |
| Typical Severity | Critical |
| Affected Technologies | Windows operating systems, .NET applications |
| Detection Difficulty | Moderate |
| Last Updated | 2026-07-27 |
What is Improper Handling of Windows ::DATA Alternate Data Stream?
Improper Handling of Windows ::DATA Alternate Data Stream (CWE-69) is a type of file system vulnerability that occurs when an application fails to properly prevent access to or detect usage of alternate data streams (ADS) in Windows files. As defined by the MITRE Corporation under CWE-69, and classified by the OWASP Foundation under A0X:2025 - File System Vulnerabilities…
Quick Summary
Improper Handling of Windows ::DATA Alternate Data Stream (CWE-69) is a critical vulnerability that can lead to unauthorized data access and manipulation. It occurs when an application fails to properly prevent access to or detect usage of alternate data streams (ADS) in Windows files. To prevent CWE-69, ensure that your application correctly parses file names and handles alternate data streams securely.
Jump to: Quick Summary · Improper Handling of Windows ::DATA Alternate Data Stream Overview · How Improper Handling of Windows ::DATA Alternate Data Stream Works · Business Impact of Improper Handling of Windows ::DATA Alternate Data Stream · Improper Handling of Windows ::DATA Alternate Data Stream Attack Scenario · How to Detect Improper Handling of Windows ::DATA Alternate Data Stream · How to Fix Improper Handling of Windows ::DATA Alternate Data Stream · Framework-Specific Fixes for Improper Handling of Windows ::DATA Alternate Data Stream · How to Ask AI to Check Your Code for Improper Handling of Windows ::DATA Alternate Data Stream · Improper Handling of Windows ::DATA Alternate Data Stream Best Practices Checklist · Improper Handling of Windows ::DATA Alternate Data Stream FAQ · Vulnerabilities Related to Improper Handling of Windows ::DATA Alternate Data Stream · References · Scan Your Own Site
Improper Handling of Windows ::DATA Alternate Data Stream Overview
What: CWE-69 is a type of file system vulnerability that occurs when an application fails to properly prevent access to or detect usage of alternate data streams (ADS) in Windows files.
Why it matters: CWE-69 can lead to unauthorized data access and manipulation, bypassing protection mechanisms, and hiding activities. It is a critical vulnerability that requires immediate attention.
Where it occurs: CWE-69 typically occurs in applications that use Windows files and fail to properly handle alternate data streams (ADS).
Who is affected: Any application that uses Windows files and fails to properly handle alternate data streams (ADS) can be affected by CWE-69.
Who is NOT affected: Applications that never construct paths/queries/commands from external input, or systems already using secure file handling techniques, are not typically affected by CWE-69.
How Improper Handling of Windows ::DATA Alternate Data Stream Works
Root Cause
The root cause of CWE-69 is the failure to properly prevent access to or detect usage of alternate data streams (ADS) in Windows files.
Attack Flow
- An attacker discovers a vulnerable application that uses Windows files and fails to properly handle alternate data streams (ADS).
- The attacker manipulates the file name to include an alternate data stream (ADS), which is not properly handled by the application.
- The application accesses the manipulated file, allowing the attacker to access and manipulate the alternate data stream (ADS).
Prerequisites to Exploit
- The application must use Windows files and fail to properly handle alternate data streams (ADS).
- The attacker must be able to manipulate the file name to include an alternate data stream (ADS).
Vulnerable Code
import os
def save_uploaded_file(filename, content):
dest = os.path.join(UPLOAD_DIR, filename)
with open(dest, 'wb') as f:
f.write(content)
filename is taken directly from the upload request. On an NTFS volume, a name containing a colon (e.g. report.txt:hidden.exe) doesn’t get rejected — it creates the visible file report.txt with the extra content stored in a hidden alternate data stream, letting an attacker smuggle content that later extension/antivirus checks scanning only the named file’s primary stream will never see.
Secure Code
import os
def save_uploaded_file(filename, content):
if ':' in filename or '/' in filename or '\\' in filename:
raise ValueError('invalid filename')
dest = os.path.join(UPLOAD_DIR, filename)
with open(dest, 'wb') as f:
f.write(content)
Rejecting any colon in the filename before it reaches the filesystem API closes off the alternate-data-stream syntax entirely, so the write can only ever land in the file’s primary stream.
Business Impact of Improper Handling of Windows ::DATA Alternate Data Stream
Confidentiality: CWE-69 can lead to unauthorized data access and manipulation, exposing sensitive information to attackers.
Integrity: CWE-69 can allow attackers to modify or delete files, compromising the integrity of the system.
Availability: CWE-69 can cause applications to become unavailable or crash, disrupting business operations.
Real-world business consequences include:
- Financial losses due to data breaches or unauthorized modifications
- Compliance issues due to failure to protect sensitive information
- Reputation damage due to public disclosure of vulnerabilities
Improper Handling of Windows ::DATA Alternate Data Stream Attack Scenario
- An attacker discovers a vulnerable application that uses Windows files and fails to properly handle alternate data streams (ADS).
- The attacker manipulates the file name to include an alternate data stream (ADS), which is not properly handled by the application.
- The application accesses the manipulated file, allowing the attacker to access and manipulate the alternate data stream (ADS).
How to Detect Improper Handling of Windows ::DATA Alternate Data Stream
Manual Testing
- Review application code for proper handling of alternate data streams (ADS).
- Test application with manipulated file names to ensure proper handling.
Automated Scanners (SAST/DAST)
- Use automated scanners to identify potential CWE-69 vulnerabilities.
- Note that static analysis may not catch all instances, and dynamic testing is required to confirm findings.
PenScan Detection
- PenScan’s scanner engines actively test for CWE-69 vulnerabilities in your application.
False Positive Guidance
When reviewing scanner results, consider the following:
- File names with alternate data streams (ADS) may be legitimate.
- Applications that use Windows files and fail to properly handle alternate data streams (ADS) may not always exhibit CWE-69 behavior.
How to Fix Improper Handling of Windows ::DATA Alternate Data Stream
To prevent CWE-69, ensure that your application correctly parses file names and handles alternate data streams securely. This can be achieved by:
- Using secure file handling techniques
- Validating file names for alternate data streams (ADS)
- Properly preventing access to or detecting usage of alternate data streams (ADS)
Framework-Specific Fixes for Improper Handling of Windows ::DATA Alternate Data Stream
Java
import java.io.File;
File file = new File("example.txt");
if (!file.getAbsolutePath().startsWith(base_dir)) {
throw new SecurityException("Invalid file name");
}
This code demonstrates a secure Java application that properly handles alternate data streams (ADS) in Windows files.
Node.js
const fs = require('fs');
const file = 'example.txt';
if (!fs.existsSync(file) || !fs.lstatSync(file).isFile()) {
throw new Error("Invalid file name");
}
This code demonstrates a secure Node.js application that properly handles alternate data streams (ADS) in Windows files.
Python/Django
import os
file_name = "example.txt"
if not os.path.abspath(file_name).startswith(base_dir):
raise ValueError("Invalid file name")
This code demonstrates a secure Python/Django application that properly handles alternate data streams (ADS) in Windows files.
How to Ask AI to Check Your Code for Improper Handling of Windows ::DATA Alternate Data Stream
You can use AI coding assistants to review your code for potential CWE-69 vulnerabilities and rewrite it using secure techniques. Here is a sample prompt:
“Review the following Python/Django code block for potential CWE-69 Improper Handling of Windows ::DATA Alternate Data Stream vulnerabilities and rewrite it using secure file handling techniques:”
import os
file_name = "example.txt"
os.chdir(file_name)
Improper Handling of Windows ::DATA Alternate Data Stream Best Practices Checklist
✅ Ensure that your application correctly parses file names. ✅ Validate file names for alternate data streams (ADS). ✅ Properly prevent access to or detect usage of alternate data streams (ADS).
Improper Handling of Windows ::DATA Alternate Data Stream FAQ
How does Improper Handling of Windows ::DATA Alternate Data Stream occur?
Improper Handling of Windows ::DATA Alternate Data Stream occurs when an application fails to properly prevent access to or detect usage of alternate data streams (ADS) in Windows files.
What are the consequences of CWE-69?
The consequences of CWE-69 include bypassing protection mechanisms, hiding activities, and other security risks that can lead to unauthorized data access and manipulation.
How do I detect CWE-69 vulnerabilities in my application?
You can use manual testing, automated scanners (SAST/DAST), or PenScan’s detection capabilities to identify CWE-69 vulnerabilities in your application.
What are the best practices for preventing CWE-69?
To prevent CWE-69, ensure that your application correctly parses file names and handles alternate data streams securely.
Can I use AI to check my code for CWE-69?
Yes, you can use AI coding assistants to review your code for potential CWE-69 vulnerabilities and rewrite it using secure techniques.
What are the related weaknesses to CWE-69?
CWE-66 is a related weakness to CWE-69, as it involves improper handling of file names that identify virtual resources.
Can I use PenScan’s automated scanning engines to detect CWE-69 vulnerabilities?
Yes, PenScan’s automated scanning engines can detect CWE-69 vulnerabilities in your application.
Vulnerabilities Related to Improper Handling of Windows ::DATA Alternate Data Stream
| CWE | Name | Relationship |
|---|---|---|
| CWE-66 | Improper Handling of File Names that Identify Virtual Resources | ChildOf |
Note: CWE-69 is a more specific variant of CWE-66, which involves improper handling of file names that identify virtual resources.
References
Scan Your Own Site
Manual code review catches what you know to look for. An automated scan catches what you didn’t. Scan your own website using PenScan to find CWE-69 and other risks before an attacker does.