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: internet, explorer, javascript, vulnerability, security, crash, ie

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.

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>