# LastPass Vulnerability Exposes Account Details
[LastPass](https://lastpass.com/) is a password manager that stores your website
login details in an encrypted container, protected by a master password, and
synced between your various browsers and machines. They provide browser plugins,
and also provide a web interface for you to access and manage your credentials.
They have both free and premium accounts, and they [recently
claimed](https://blog.lastpass.com/2011/01/lastpass-one-million-user-giveaway.html)
to have hit one million users. I found a serious vulnerability in their website.
I reported this vulnerability responsibly, and they fixed it within three hours.
If you're a LastPass user you should still be very concerned though; I believe
this is ultimately a problem with their architecture and something which could
easily happen again in future. Merely by visiting my website at the same time as
being logged in to LastPass (using the plugin or website), I could retrieve your
email address, your password reminder, the list of sites you log into and the
history of your logins, including which sites you logged into, the time and
dates you logged into them, and the IP addresses you logged in from.
And the cause of all this? A simple XSS flaw. If you are logged into lastpass.com or have the
browser plugin installed and logged in, visiting the following URL:
```text
https://lastpass.com/index.php?email=test@example.com
```
Causes a page to be dynamically generated, containing the email address passed
in the URL parameters. The email address is embedded inside a piece of
[jQuery](https://jquery.com/) JavaScript like so:
```javascript
$("#email").val("test@example.com");
```
To test if they properly escaped the email address, I tried passing a double
quotation mark along with it. They did properly escape it with a backslash and
it looked like this:
```javascript
$("#email").val("test@exa\"mple.com");
```
What they didn't properly handle though, were carriage returns. So by passing
test@exa%0Dmple.com in the email parameter, it gave this:
```javascript
$("#email").val("test@exa
mple.com");
```
This generated a JavaScript error on the page, because you're not allowed to
jump to a new line there. The trick which ultimately worked was to pass a
carriage return, followed by a closing and opening script tag. This closed off
the broken script, and started a new block of script. For example:
```text
https://lastpass.com/index.php?email=%0D%3C%2Fscript%3E%3Cscript%3Ealert(/XSS/.source);%3C%2Fscript%3E%3Cscript%3E
```
Created this:
```javascript
$("#email").val("