bobbystacksmash / Construct

A cross-platform Windows Script Host emulator for dynamically analysing malicious JScript programs.
GNU General Public License v3.0
8 stars 2 forks source link

VFS is returning lower-case values for mixed-case paths #1

Open bobbystacksmash opened 6 years ago

bobbystacksmash commented 6 years ago

The VFS should perform case-insensitive actions, which it seems to do. However, when querying the file system using methods which return string-paths for file/folder names, the names are returned in lower-case only, even for mixed-case file/folders. For example:

We add the folder FooBar: vfs.AddFolder("C:\\Hello\\FooBar");

When fetching this file, FooBar becomes foobar: vfs.FindFiles("C:\\Hello", "FooBar"); // => ["foobar"]

While this isn't technically a problem because Windows' FS handling is case-insensitive by default, it's conceivable that usercode may expect the case to be returned correctly (such as string comparisons for file/folder paths).

bobbystacksmash commented 6 years ago

A technique which may be applicable here was done in runtime/virtreg.js. See the resolve_path method which uses a dictionary to map original keys to their normalised values.