Monthly Archives: February 2014

Explorer File Hiding Bug/Quirk

I recently came across a fun ‘bug’ in Windows Explorer while pranking a co-worker. Well, it’s probably not actually considered a bug given the well-known limitations of explorer, but it’s quirky nevertheless… I was using the \? extended path syntax (which basically disables string parsing at the API level and sends the path straight to the underlying filesystem) in order to create folders on his desktop and system root which were difficult to delete (you have to use the same syntax to delete them), and noticed that if you create a directory called “foo..” and then one called “foo” you can trick Explorer into displaying the wrong folder contents (where foo is anything as long as they’re both the same)!

Example:

C:>md \\?\c:\foo..

C:>md \\?\c:\foo

C:>copy %windir%\notepad.exe \\?\c:\foo..

1 file(s) copied.

C:>copy %windir%\explorer.exe \\?\c:\foo

1 file(s) copied.

C:>dir \\?\c:\foo..

Volume in drive \\?\c:\ has no label.
Volume Serial Number is 8E2D-A4AD

Directory of \\?\c:\foo..

05/02/2014 10:55 AM <DIR> .
05/02/2014 10:55 AM <DIR> ..
22/08/2013 10:00 PM 217,600 notepad.exe
1 File(s) 217,600 bytes
2 Dir(s) 77,461,762,048 bytes free

C:>dir \\?\c:\foo

Volume in drive \\?\c:\ has no label.
Volume Serial Number is 8E2D-A4AD

Directory of \\?\c:\foo

05/02/2014 10:55 AM <DIR> .
05/02/2014 10:55 AM <DIR> ..
22/10/2013 06:55 PM 2,328,872 explorer.exe
1 File(s) 2,328,872 bytes
2 Dir(s) 77,461,762,048 bytes free

C:>

Everything looks normal so far… But what happens when you view these folders with Windows Explorer?  (Note: I’m using Windows 8.1 x64, I haven’t tried this on other versions so your mileage may vary.)

Everything looks normal so far.

Everything looks normal so far.

Oops! Displaying the contents of the other foo folder!

Oops! Displaying the contents of the other foo folder!

Totally useless except for messing with people (or hiding your pr0n from grandma), but amusing nevertheless.