Bernstein right? Maybe, but Theo is too, mostly
Bernstein right? Maybe, but Theo is too, mostly
Posted Nov 4, 2007 19:30 UTC (Sun) by tialaramex (subscriber, #21167)In reply to: Thanks for proving Bernstein right by man_ls
Parent article: Daniel Bernstein: ten years of qmail security
No, the OpenBSD people are so close to absolutely correct that it's not worth calling the difference. Bugs cause something unexpected to happen. If unexpected things happening was acceptable then you wouldn't bother with security, just say "That was unexpected" when anything bad happens. Here's a nice simple example. You have a program which examines NTFS formatted hard disks to check that everything on the disk is authorised by the company. The program is pretty simple, but it has a small bug. The bug is that it assumes all NTFS filenames are Unicode strings. This seems like a reasonable assumption, because most likely every NTFS filename you've ever seen was a Unicode string, and all the files you tested with have such names, there isn't any way to "type in" anything except Unicode strings as the name for a new file in Explorer or Word or similar software, so why would you assume anything else? But now you've created an incentive to construct files with non-Unicode names. Perhaps the code sequence 0xFFFF 0xFFFE 0xFEFF 0xFFFF would be a good name for a file. Your buggy software cannot convert this into a Unicode string, so it ends up in an exception handler that you never realised could be called under such circumstances. The exception handler normally fires when a file has been deleted before it can be examined, so it just tidies up and moves on to the next file. So now the magic file is invisible to your software and you have a security breach. There are billions of assumptions like this, regardless of whether you're programming in LISP or Fortran, and if any of them are wrong in a security sensitive application the security probably doesn't work. Worse, the only people likely to find out have an incentive not to tell you. That's why security is actually hard, although you wouldn't think it from all the Mickey Mouse security consultants and 3rd rate security software. Oh and yes, it turns out that although the Win32 APIs don't believe in files with non-Unicode names, the underlying NT kernel, like the Linux kernel, considers them all to just be opaque identifiers. Don't laugh too loud at the programmer who wrote one byte too many into an array, you'll have your own foot in your mouth soon enough.
