back to article Google Project Zero reverse-engineers Windows path hacks for better security

If you're tearing your hair out trying to make sure your Windows 8 / 8.1 /10 application isn't attackable through the filename structure, a Google security engineer has penned a long look at the API to try and help. The reason behind the long explanation is simple, from Google's point of view: “path'ological reverse engineer” …

  1. Anonymous Coward
    Anonymous Coward

    win32? in 2016? really???

    How stupid do you have to be to be using win32 crap in 2016 when 64bit is where everyone is at?

    1. Voland's right hand Silver badge

      Re: win32? in 2016? really???

      The path API containing the sorry mix of VMS and MSDOS semantics is still in there too.

      This is one thing which Unix got right early on - mounting volumes at a filesystem point. It provides for a clean and flexible path API. Compared to that the MACHINE::VOLUME::PATH VMS and offspring convention is a complete and utter dogs breakfast.

      1. Anonymous Coward
        Anonymous Coward

        Re: win32? in 2016? really???

        Sure, Unix had very little to mount back then. Also, it has sillyness like case sensitive file names (for lack of proper collations, and an English-centric mindset) and horror of spaces. A file system designed for computers and not human beings.

        Also, you'll never know where your devices get mounted - and you can't access a path if you don't mount if first. The UNC convention is much more useful.

        1. Charlie Clark Silver badge
          Facepalm

          Re: win32? in 2016? really???

          Also, it has sillyness like case sensitive file names (for lack of proper collations, and an English-centric mindset) and horror of spaces

          Sigh.

          Case-sensitivity is the default for computers because chars map to hex values, or didn't you watch The Martian?. Case-insensitivity is slower and requires more memory. But, of course, speed and memory have never mattered, particularly not in the early days of unix.

          Whitespace can be a real problem on terminals and printouts. Much better to make it explicit.

          1. Anonymous Coward
            Anonymous Coward

            Re: win32? in 2016? really???

            Characters doesn't map to hex values in a 1:1 relationship. Unluckily (for programmers), the human languages and their representations are a bit more complex.

            It's just too many developers never learnt how to manage text properly. Unix brother, C, didn't implement a string type either believing array of bytes would have been enough. Classic programmer mistake who couldn't understand how the real world works outside the CPU.

            If Unix and C developers had knowledge of other languages beyond English, would have known about synoglyph and other languages "nuisances", and would have developed a better system. Unluckily, they couldn't look beyond assembler, their noses, and their mother tongue.

            The bad thing is there are still people that believe they did the right thing, while they were only too limited.

        2. BinkyTheMagicPaperclip Silver badge

          Re: win32? in 2016? really???

          The UNC path is not applicable because here we're talking about filesystems - you know, the storage areas that aren't accessed directly before mounting them to a drive letter or relative path.

          Where you thinking about networked resources instead, perhaps? That doesn't apply either - true, it's possible to seamlessly access previously shared resources, but you don't get access to all of the filesystem unless there's a root level share, or you're an administrator and administrative shares haven't been disabled.

          1. Anonymous Coward
            Anonymous Coward

            Re: win32? in 2016? really???

            Windows doesn't make much difference between local files and remote ones, unlike the old Unix when the nearest computer was probably several hundred miles away on connected through a telephone cable. Windows has a nice thing called network redirector that makes accessing remote resources transparent as much as local ones - because Windows was designed when distributed systems became much more common, and resources were more spread across different systems that in monolithic Unix mainframes....

            1. Graham Dawson Silver badge

              Re: win32? in 2016? really???

              It's amazing how you can manage to be more and more wrong with every sentence you write.

        3. Steve Graham
          Linux

          Re: win32? in 2016? really???

          "horror of spaces"

          Is is still impossible to have a Windows executable called "C:\Program"?

        4. enormous c word

          Re: win32? in 2016? really???

          Really? I am very happy for my file names and paths to be case-sensitive.

          Unix/Linux also handles spaces perfectly well. No problem identifying which are FileSystems or directories either - maybe you should spend 5 minutes reading a manual - you'll find it really useful.

          Look at the use of apostrophes `, ' & " in filenames and variables. Also the 'mount' or 'df' commands.

      2. Anonymous Coward
        Anonymous Coward

        Re: win32? in 2016? really???

        Just <protocol>://<host>/<path> is exactly how URLs work too - or you would like the truly outdated Unix semantic there too? Mount a web server before accessing it? C'mon, the '70s has been over for almost forty years...

        1. Graham Dawson Silver badge

          Re: win32? in 2016? really???

          Very nice, LDS, but we're talking about file paths and mounted filesystems, not protocols. For the record, the file protocol that every os recognises is file://. A windows file url would resemble file:///c|/foo/bar

    2. Thought About IT

      Re: win32? in 2016? really???

      "How stupid do you have to be to be using win32 crap in 2016 when 64bit is where everyone is at?"

      How stupid is it to sound off about something you don't understand?

      1. Anonymous Coward
        Anonymous Coward

        Re: How stupid is it to sound off about something you don't understand?

        Posting stupid? Post anonymous.

    3. Paul Crawford Silver badge

      Re: win32? in 2016? really???

      Stupid enough to want your software to run on W2K - XP - Vista (cough) - Win7 - etc rather than the latest privacy slurping version only?

      And not finding your latest API is pulled from below you if MS decides to change again (how is that Silverlight project going)?

      MS has a lot of stupid past decisions to support, and practically the only real argument for choosing Windows has been compatibility with the vast range of so-called legacy software, so sad though it may be, this is still important work. Of course, MS could just open-source the legacy path code so we can see for sure and save this reverse engineering trouble and uncertainty...

    4. Anonymous Coward
      Anonymous Coward

      Re: win32? in 2016? really???

      How stupid do you have to be to be using win32 crap in 2016 when 64bit is where everyone is at?

      Stop it with the anti-Windows posts.

    5. patrickstar

      Re: win32? in 2016? really???

      The name "Win32" has nothing to do with whether the OS is 32 or 64 bit. Historical reasons; what came before it was Win16, which used a segmented memory model and thus required significant changes going to the 32-bit flat model of NT. No major changes needed to go from there to 64 bit, therefore no change of name.

      You still have win32k.sys, kernel32.dll, user32.dll, gdi32.dll et al. on 64 bit Windows, and they are shiny new 64 bit files despite the names (the DLLs also exist in 32 bit versions in the SysWoW64 directory for use by 32 bit applications).

      1. Anonymous Coward
        Anonymous Coward

        Re: win32? in 2016? really???

        That's the naming convention that really messes with me. Let's recap:

        The Win16 subsystem is there to handle the "old" stuff (pre-NT). New was 32-bit. Now we have the funny named directory with "64" in its name, which exists to handle the old 32-bit stuff. The files with 32 in there name are the 64-bit version. Because THAT makes sense!

        1. Anonymous Coward
          Anonymous Coward

          Re: win32? in 2016? really???

          Yes. Because had they renamed it system64, a lot of badly written stuff would have ceased to work.

          And unluckily, a lot of that badly written crap runs a lot of big and rich companies - which may be among Windows best customers....

          I would have really liked Microsoft had decided to kill all that crappy code and its crappy developers, just it may not afford it, especially now.

    6. breakfast Silver badge
      Thumb Up

      Re: win32? in 2016? really???

      Recompiles application as 64 bit. Application immediately doubles its memory footprint for no perceptible performance benefit. Yup, this is the future.

      1. Stefan 2

        Re: win32? in 2016? really???

        That... isn't how 64-bit works.

  2. Pascal Monett Silver badge
    WTF?

    : in a path name ?

    Really guys ? How drunk were you when you included that in the kernel ?

    And it still needs to be allowed today ? In the name of all that is holy, WHY ?

    The sooner Windows is consigned to the dustbin of History, the better off we'll all be.

    1. Anonymous Coward
      Anonymous Coward

      Re: : in a path name ?

      Think ":" is also used in URLs... try to remove it from there - and it was a Unix guy to use it...

      1. Graham Dawson Silver badge

        Re: : in a path name ?

        It's use in uris is to delineate protocol, username and password. These are not part of the path, where the colon is a reserved character.

        1. Paul Crawford Silver badge

          Re: : in a path name ?

          Actually most *nix systems allow any character in directories or file names except '/' (the directory separator) and the NUL 0x00 used for C end-of-string.

          It is the command shell like bash, etc, that treats ':' and '*' and so on as special, and also it is the shell that treats a space as a command delimiter as well, unless you quote or escape-sequence the name. E.g. this wont work

          cd my directory

          As it treats 'my' and 'directory' as separate inputs, but these do work:

          cd "my directory"

          cd my\ directory

          Since they tell the command shell to treat the space as part of a single string passed to the 'cd' command. Windows has similar problems with command-line use, it is just that few people use it or write scripts for it to complain as much.

          1. Graham Dawson Silver badge

            Re: : in a path name ?

            Sorry, should have been clearer. It's a reserved character in URI paths specifically. The post I was answering was blathering about how URIs contain a colon after the protocol and seemed to be comparing that to the colon after the drive letter in windows.

            Never mind that : can be a drive letter...

    2. Uplink

      Re: : in a path name ?

      If they start allowing colon in filenames, then Windows will get dotted with files called C:\npddf32Log\debuglog.txt like my Linux box is. It appears it's Firefox/XULRunner that does leaves these files all over the place - although, right now, 'locate' can't find any for some reason; maybe they fixed it.

  3. James 51

    Presumably MS will get round to removing this 'service' from (Unlocked) Window 10.

  4. David Roberts
    WTF?

    Sniping apart..

    ..does this mean that you can have drive IDs apart from A-Z which are invisible to most if not all utilities?

    The suggestion is there but not much detail.

    1. Malcolm 1

      Re: Sniping apart..

      I suspect most utilities will actually crash (although I've not tested this hypothesis). The other good ones are (non-ascii) unicode characters in paths or recursive junction points.

    2. James Haley 2

      Re: Sniping apart..

      You can definitely have drive IDs apart from A-Z. Just do this:

      Start up CMD.exe and type in this:

      subst [: C:\Users

      dir [:

      It works under Windows 7 and probably every MS operating system since DOS 3.1.

      I recall the old Novell map command assigning drive letters above Z.

  5. Anonymous Coward
    Anonymous Coward

    Pointer - offset - length.

    How many complicated and different ways are there to resolve a physical implementation from a logical one? Local file, remote file, memory, cache.....

  6. Anonymous Coward
    Anonymous Coward

    And who says proprietary software can't be security audited?

    1. nijam Silver badge

      > And who says proprietary software can't be security audited?

      Pretty well everybody except the proprietors and the companies who claim to be able to do the audit (for a generous fee, no doubt).

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like