Gameplay

3/Gameplay/grid-small

 Intro to Email Hacking by using javascript

The reason for this article isn't, I rehash, NOT to show somebody how to "hack an email account". It's actual intention is in reality MUCH more insidious. The motivation behind this and any remaining articles in the "An Exploit Explained: " arrangement is to show perusers different web advancements, and the rudiments of security and misusing. I will attempt to give you an active, learn as you go kind of schooling in PC security. Sound great??? At that point we should get in to it!!


security hole –
injecting JavaScript using “javasCript:”
Date: Wed Sep 22 1999 10:48:04
Author: Georgi Guninski
Message-ID: <37E8D004.EF848F34@nat.bg>

Yet another major Hotmail security hole – injecting
JavaScript using “javasCript:”

There is a major security flaw in Hotmail which allows
injecting and executing JavaScript code in an email
message using the javascript protocol. This exploit
works both on Internet Explorer 5.0 (guess IE 4.x)
and Netscape Communicator 4.x. Hotmail filters the
“javascript:” protocol for security reasons. But it
does not filter properly the following case:
“javasCript:” where “C” is the ASCII code

So the following HTML is executed SRC=”javasCript:alert(‘JavaScript is executed’);”>
if the user has enabled automatically loading of
images (most users have).

Probably this may be used in other HTML tags.

Executing JavaScript when the user opens Hotmail
email message allows for example displaying a fake
login screen where the user enters his password
which is then stolen. I don’t want to make a scary
demonstration, but I am sure it is also possible to
read user’s messages, to send messages from user’s
name and doing other mischief. Hotmail deliberately
escapes all JavaScript (it can escape) to prevent such
attacks, but obviously there are holes. It is much
easier to exploit this vulnerability if the user uses
Internet Explorer 5.0. AFAIK this is not a browser
problem, it is Hotmail’s problem.

Workaround: Disable JavaScript

The code is:

1
2
3
4
<IMG SRC="javasCript:alert('JavaScript is
executed');a=window.open(document.links[2]);setTimeout('alert(\'The
first message in your Inbox is from :
\'+a.document.links[26].text)',20000)">



 This important part of this posting to the Bugtraq(1) (http://www.securityfocus.com) mailing list is the actual exploit(2).

The email hacking exploit would be:

What does it do?

As this exploit, when put into an email message sent to a hotmail user, opens a little box using the “alert()”(3) function in javascript(4), and is also supposed to read who the first message in your inbox is from. However, this code does not work on its own. You see, the email also says that you need to use the ASCII(5) code for “C” in the message. If I get out my handy HTML reference book, I can see that the ASCII code is C. If we substitute this into our little exploit, minus the “read who the first message in your inbox” part, we get this:

How does it work?

Finding out how an exploit works is always the part that makes people a bit spindizzy. If we look at that gibberish we call code one more time we can see that it uses an IMG tag, which all you who took my HTML tutorial would know is to display an image onto the page. Because hotmail tries to be the “top dog” webmail provider, they allow you to set autoloading of images, so the image just shows up on the same page as the mail. When you open a new hotmail account, this option is already set (hurray!). The conflict happens because your normal browser allows you to put javascript tags into your IMG tags. Because JavaScript is a strong little language, and allows just about full control over someone’s browser, if the conditions are right. Naturally, people like you and me started exploiting hotmail’s allowing of javascript. Soon, the SCRIPT tag (the normal way to add javascript to a page) was banned from use in hotmail messages by way of filtering(6) (boo! hiss!). So normal guys like you and me had to “inject”, or put into other html tags, our javascript exploits. The IMG tag is perfect for this, when combined with it’s autoloading capabilities. This discovery led to the filtering, yet again, of javascript injected into IMG tags. Of course, hackers ALWAYS find a way, and today we combine IMG-injecting with ASCII tags to give you the current exploit.

What else can I do with this hole in Hotmail’s Security?

As is the case with many exploits, the sky is the limit. If you know javascript, you can pretty much have a field day with this exploit. If you don’t, here’s a few more snippets of code to get you started:

This code opens a window with Darknet’s main page in it when the hotmail user opens your mail:

Note that the above code could point to any page at all (even one that simulates hotmail’s “you have been logged out” screen. *wink* *wink* HINT HINT ;-) )

0 Comments:

Post a Comment