Slashdot Mirror


IE Shines On Broken Code

mschaef writes "While reading Larry Osterman'a blog (He's a long time Microsoftie, having worked on products dating back to DOS 4.0), I ran across this BugTraq entry on web browser security. Basically, the story is that Michael Zalewski started feeding randomly malformed HTML into Microsoft Internet Explorer, Mozilla, Opera, Lynx, and Links and watching what happened. Bottom line: 'All browsers but Microsoft Internet Explorer kept crashing on a regular basis due to NULL pointer references, memory corruption, buffer overflows, sometimes memory exhaustion; taking several minutes on average to encounter a tag they couldn't parse.' If you want to try this at home, he's also provided the tools he used in the BugTraq entry."

22 of 900 comments (clear)

  1. which version of IE was it? by jonwil · · Score: 4, Informative

    Aparently, XPSP2 (including the new IE) was recompiled with the latest visual studio and with all the options turned on to better catch issues.

  2. Tried with Safari on OS X ... by Anonymous Coward · · Score: 5, Informative

    Nothing crashed. I got blank pages, all the weird HTML and all, but no errors and nothing crashed. w00t.

  3. Konqueror and bugs by Anonymous Coward · · Score: 3, Informative

    Konqueror has a neat bug symbol on the lower right corner when displaying buhhy html code.
    I think this is a nice feature.
    I wish that konqueror would have been tested. It's a good browser.

  4. Tested Konqueror by unixmaster · · Score: 4, Informative

    None of the samples in http://lcamtuf.coredump.cx/mangleme/gallery/ was able to crash Konqueror from KDE CVS Head. Heheh time to praise Khtml developers again!

    --
    Never learn by your mistakes, if you do you may never dare to try again
  5. Re:Conspiracy Theory time... by Ann+Elk · · Score: 3, Informative

    RTFA. Larry didn't find the broken HTML, he just referenced an article which did.

  6. Re:What about VALID html? by tomstdenis · · Score: 5, Informative

    This isn' insightful at all. First, you'll be the first person to bitch when a mozilla virus comes out.

    Second, "crashing when invalid" as you and many others are alluding to is NOT a good idea. What if you had another tab open with email/urls/info you needed?

    What if other software took this route? Invalid operands to open()? Time to crash. Invalid socket used in send()? Time to crash. Segfault in application? Kill the kernel processes!

    It's a problem, it has to be fixed and there aren't two ways about it.

    Tom

    --
    Someday, I'll have a real sig.
  7. Re:Coding to Standards by Jedi+Alec · · Score: 4, Informative

    I'd really prefer it to just refuse to parse the page mentioning that the code is bad instead of crash. As much as I like Firefox/Moz, when a piece of software is fed bad data, it should say so, not die on the spot, ever.

    --

    People replying to my sig annoy me. That's why I change it all the time.
  8. Re:Excellent! by metlin · · Score: 5, Informative
    Actually, the code does not seem that great.

    Here's the mozilla_die1.html code
    <HTML><INPUT AAAAAAAAAA>
    And the mozilla_die2.html code
    <HTML>
    <HEAD>
    <MARQUEE>
    <TABLE>
    <MARQUEE HEIGHT=100000000>
    <MARQUEE HEIGHT=100000000>
    <MARQUEE HEIGHT=100000000>
    <MARQUEE HEIGHT=100000000>
    <MARQUEE HEIGHT=100000000>
    <MARQUEE HEIGHT=100000000>
    <MARQUEE HEIGHT=100000000>
    <MARQUEE HEIGHT=100000000>
    <MARQUEE HEIGHT=100000000>
    <MARQUEE HEIGHT=100000000>
    <MARQUEE HEIGHT=100000000>
    <TBODY>
    Attack of the marquees!
    It looks like he came across places where either boundary checks or type checks are not in place.

    Besides, he's had access to almost all the browswer code, hasn't he?

    I mean, these bugs are bad, but I'm sure if I had access to IE's code I could come up with a zillion bugs.
  9. Re:Security Issues by say · · Score: 3, Informative

    I'm not sure what the behaviour of 4.0 Transitional and 4.0 Strict is supposed to be

    It's kind of in the name. Transitional should best-guess. Strict should not.

    --
    Roses are #FF0000, violets are #0000FF, all my base are belong to you
  10. Who's Who by Effugas · · Score: 5, Informative

    Ugh. Not the best written Slashdot entry.

    Larry Osterman -- former Microsoft guy; someone forwarded him a post to Bugtraq.

    Michael Zalewski -- absurdly brilliant security engineer out of Poland. Did the pioneering work on visualizing randomness of network stacks, passively identifying operating systems on networks, and way way more.

    Nothing bad against Larry. But this is all Zalewski :-)

    --Dan

  11. IE Crashes On Valid HTML! by Diplo · · Score: 5, Informative

    Nevermind using random garbage to crash a browser, you can make IE6 crash with perfectly valid strict HTML.

    Try this page in IE6 and then hover your pointer over the link. Crash!!!

    1. Re:IE Crashes On Valid HTML! by Grey+Ninja · · Score: 4, Informative

      Don't forget this one either. (Mind you, this one has been fixed in XP SP2)

  12. Re:Excellent! by EMN13 · · Score: 4, Informative

    As he stated in the article; the crashes are sometimes platform-specific.

    I've tried this in 1.0PR firefox on win32, and the crashes do occur there.

    I've gotta say - this really looks like a great tool; a simple and effective way of finding some bugs!

    --Eamon

  13. Re:An important security sidenote by Anonymous Coward · · Score: 5, Informative
    *crashing* on malicious code is *GOOD*, while *running* malicious code is *BAD*.
    Holy crap! How absolutely untrue. If your program is crashing, you've lost all control. If you still had control, it wouldn't have crashed: it would have printed an error message.

    Once you've lost control of your program, all bets are off. The only difference between crashing and taking control is exactly WHAT bad data you feed into the program. These browsers simply crashed because RANDOM data was being fed in. That random data could be changed to carefully-crafted executable code, and BAM, your harmless "crash" is a security exploit.
  14. Re:An important security sidenote by murdocj · · Score: 3, Informative
    You aren't a security expert, are you? Now, your first lesson in computer security is, write this a hundred times: *crashing* on malicious code is *GOOD*, while *running* malicious code is *BAD*.

    It's true that *catching* bad input and deliberately aborting (hopefully with a somewhat reasonable error message) is good. According to the article, that's not what's going on... the browsers are NOT checking input, e.g. scanning into uninitialized buffer areas because they aren't finding an expected end marker, or a length is incorrect. So parent is exactly right... that kind of "buffer overrun" bug is exactly what can be exploited.

  15. Re:An important security sidenote by UberGeeb · · Score: 4, Informative
    I've come across plenty of sites that either don't work at all or are broken unless you use IE. Generally, it's because the site looks at the browser's identification tag and sends crippled pages to non-IE browsers. I can only think of one site I use regularly (a web app at work) that actually doesn't work in Opera if I set it to report itself as IE.

    You might make sure that the sites you're having trouble with in Firefox are actually providing the same data they're giving IE before you assume it's a problem with the browser.

  16. Re:An important security sidenote by peterhoeg · · Score: 5, Informative

    Go the "gallery" he mentionds is his entry and try the mozilla_die?.htm files. With Firefox 1.0PR the first one did the trick for me and crashed firefox.

  17. Re:This is a blessing in disguise by pohl · · Score: 4, Informative

    I remember crashme, and I just checked the debian packages and anybody can "apt-get install crashme" to give it a whirl.

    I'd like to second the AC's suggesting of taking these HTML test cases and constructing an apache module that creates garbage HTML like this. The result would be a great contribution all browsers.

    The mozilla project did have a test that sent the browser to random pages accross the web, which exposed it to all sorts of garbaged HTML, I'm sure, but generating randomly garbaged HTML would probably be a more strenuous test.

    --

    The "cue the foo posts in 3, 2, 1..." posts will commence with no subsequent foo posts in 3, 2, 1...

  18. Re:An important security sidenote by sqlrob · · Score: 4, Informative

    Executed by another process? What are you talking about? Processes in windows cannot mess with each other address space.

    They can intentionally, just not accidentially.

    ReadProcessMemory
    WriteProcessMemory
    CreateRem oteThread

    (NX bit works only at AMD64 processors and above last time I checked)

    Celeron D is now shipping with NX enabled. I don't know whether XP will take advantage of it.

  19. Re:His examples do not really crash Firefox by SmilingBoy · · Score: 4, Informative
    Weird! I checked this in detail again. It seems that there is a difference whether other Firefox Windows with several tabs are open or not. If I have other open windows and tabs (like I normally have when surfing around), mozilla_die1 just slows down the computer, but you can actually close the tab again and you are back to normal. mozilla_die2 also slows down the computer, you can select other tabs, but you can't close the offending tab or load new pages in other tabs.

    If I only open mozilla_die 1 or 2 in a single tab in a single window and no other tabs are open, Firefox crashes immediately.

    mozilla_die3 never crashes Firefox.

  20. OSS does not automatically mean secure by TheLink · · Score: 5, Informative

    Netscape used to crash very often. Looks like the Mozilla people didn't learn much from it.

    Mozilla is just as sucky security-wise as the old non-mozilla Netscape (3.x 4.x). Whether it is OSS or not doesn't make it secure/insecure, it's the programmers that count. Look at Sendmail and Bind (and many other ISC software), security problems year after year for many years. Look at PHPNuke - security problems month after month for years. Look at OpenSSL and OpenSSH and Apache 2.x - not very good track records. Compare with Postfix and qmail, djbdns.

    Most programmers should stick to writing their programs in languages where the equivalent of "spelling and grammar" errors don't cause execution of arbitrary attacker-code. Sure after a while some writers learn how to spell and their grammar improves but it sometimes takes years. For security you need _perfection_ in critical areas, and you need to be able to identify and isolate the critical areas _perfectly_ in your architecture.

    To the ignorant people who don't get it. Crashing is bad. A crash occurs when the (browser) process write/read data from areas where it shouldn't be touching, or tries to execute code where it shouldn't be executing. This often occurs when the process somehow mistakenly executes _data_ supplied by the attacker/bug finder, or returns to addresses supplied by the attacker...

    This sort of thing is what allows people to take over your browser, and screw up your data (and possibly take over your computer if you run the browser using an account with too many privileges).

    So while the FireFox people get their code up to scratch maybe people should reconsider IE - IE isn't so dangerous when configured correctly. Unfortunately it's not that simple to do that.

    To make even unpatched IE browsers invulnerable to 95% of the IE problems just turn off Active Scripting and ActiveX for all zones except very trusted zones which will never have malicious data. Since I don't trust Microsoft's trusted zone (XP has *.microsoft.com as trusted even though it doesn't show up in the menus), I create a custom zone and make that MY trusted zone.

    By all zones I mean you must turn those stuff off for the My Computer zone as well - but that screws up Windows Explorer in the default view mode (which is unsafe anyway).

    For more info read this: <a href="http://support.microsoft.com/default.aspx?kb id=182569">Description of Internet Explorer security zones registry entries</a>

    To make the My Computer zone visible change:
    (for computer wide policy)
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Win dows\Curr entVersion\Internet Settings\Zones\0\Flags

    To: 0x00000001

    (for just a particular user)
    HKEY_CURRENT_USER\SOFTWARE\Microsoft\Window s\Curre ntVersion\Internet Settings\Zones\0\Flags

    To: 0x00000001

    If you don't want to edit the registry and make the My Computer zone visible, you can still control the My Computer Zone settings from the group policy editor (gpedit.msc) or the active directory policy editor.

    You just have to know some Microsoft stuff. But hey, securing an OSS O/S and _keeping_ it secure (esp when u need to run lots of 3rd party software) also requires some in-depth knowledge.

    --
  21. Re:An important security sidenote by CTachyon · · Score: 5, Informative

    A stack canary is a form of protection against stack overflows. And yes, the idea is named after the canaries used in coal mines. To put it in simple terms, a normal stack during a function call might look like this:

    Buffer: XXXX XXXX XXXX XXXX ...
    Saved registers: YYYY YYYY
    Return address: ZZZZ

    When the buffer is overflowed, the attacker fills it with more data than it can hold. The extra data first fills the saved registers, then overwrites the return address. The attacker can simply point the return address back into the buffer, or find more diabolical means ("return into libc", a few others), to run his own code.

    If a recent OS (first Linux, now Windows) is running on, say, an AMD64 system, then the entire stack is flagged with the NX (no execute) bit. If the attacker uses the normal technique of returning into the buffer, the processor will halt the program because it's trying to treat data as code without asking first. (This doesn't protect against return into libc attacks.)

    However, on ordinary x86 processors like Pentium 4 or Athlon XP, there is no NX bit. So, Microsoft altered their compiler to insert stack canaries into every function. The previous stack diagram is changed to something similar to this:

    Buffer: XXXX XXXX XXXX XXXX ...
    Canary: CCCC
    Saved registers: YYYY YYYY
    Return address: ZZZZ

    Ideally, the canaries are chosen randomly each time a function is called. However, this is too slow in practice, since functions get called *a lot*, so a program will randomly choose a single canary number once at startup and reuse it.

    Now the attacker can still overflow the buffer, but this time he has to overwrite the canary. If he already knows the canary, or guesses it correctly, everything works the same as in the case of an unprotected overflow. However, if he guesses wrong, the canary kicks in. To maintain the canary, there is some code inserted by the compiler at the start and end of every function. The start code inserts the canary into the stack, and the end code checks that the canary has not changed. If the canary changed, an error is triggered, and the program is halted before the function ever returns. This prevents the attacker's code from running if he doesn't know the canary number.

    There are still some scenarios that aren't protected by a stack canary, but it is rather effective overall, and actually protects against a few scenarios that the NX bit doesn't cover. It doesn't help protect against heap overflows, though, although there's no reason heap canaries can't be used also. (The heap is a lot harder to explain than the stack, but a lot of programs put some or all of their buffers in heap memory instead, and the heap can be attacked as well.)

    --
    Range Voting: preference intensity matters