How to Crash Internet Explorer 30 August, 2006 — Stuart Brown

With only one line of code - 61 bytes, to be precise.

Posted in Security & Hacking
Tagged with: , , , , , ,

Ever wish you could make your friends and family switch away from Internet Explorer? Perhaps the ability to make it spontaneously crash (and I mean totally crash) just by sending them a link might sway them...

I spend a lot of time working with both JavaScript and Internet explorer, and a while back (probably about a year ago now) I was trying to debug a script to make it work in both Firefox and Internet Explorer. As part of the diagnostics, I wrote a script to iterate through objects and print their properties. As it happens, I tried this on the 'document.write' method, used to output text to the document. I forget the exact reason, but I do remember the outcome.

Firefox handles the code perfectly - but Internet Explorer, on the other hand, throws an exception and unceremoniously quits. Considering the script in question is one line long, or 61 bytes (about 0.06Kb), and that it can be embedded into any webpage, it's rather worrying.

Internet Explorer crash

I was surprised to see that, even a year later, the problem persists - so I figured I'd share this little code snippet.

<script>for (x in document.write) { document.write(x);}</script>

That's it. For your entertainment, you can find the code here, ready to run. Be warned, if you are running Internet Explorer, your browser will most likely crash, taking all your currently open windows with it, and possibly rendering your system unstable. I'd advise you to save your work.

If you're using Firefox (or anything other than IE), have no fear- you won't be affected. If your browser crashes with just 61 bytes of code, however - perhaps it's time to switch?