About the Author

Chris Shiflett

Hi, I'm Chris, a web developer and a founding member of Analog. I live and work in Brooklyn, NY.


Myspace CSRF and XSS Worm (Samy)

In the comments to my article on CSRF, someone questioned whether CSRF is really anything worth worrying about. Rather than give a hypothetical example, I can point to a real one that is getting some attention today:

This attack seems pretty harmless (I'd rather not discuss ethical concerns), but it demonstrates something very powerful - a combination of XSS and CSRF. If your site has XSS vulnerabilities, they can be used to launch much more effective CSRF attacks. Rather than only a small percentage of people being affected, everyone is, because the attacker is guaranteed that all victims have an established relationship with the target site, yours.

More information about XSS and CSRF can be found here:

About This Post

Myspace CSRF and XSS Worm (Samy) was posted on Thu, 13 Oct 2005 at 17:13:33 GMT.

13 Comments

1. Patrick Reilly's GravatarPatrick Reilly said:

I'd rather not discuss ethical concerns.... interesting.

Thu, 13 Oct 2005 at 18:19:06 GMT Link


2. Chris Shiflett's GravatarChris Shiflett said:

I just mean that it's a separate conversation. :-) I'm more interested in raising awareness of CSRF and considering the viral nature of this attack.

Thu, 13 Oct 2005 at 18:19:56 GMT Link


4. Brad's GravatarBrad said:

So, what would be the simplest way to prevent this kind of attack in a PHP app?

Fri, 14 Oct 2005 at 04:44:41 GMT Link


5. Andrew van der Stock's GravatarAndrew van der Stock said:

Chris's article on CSRF prevention is about as simple as it gets.

I implemented a slightly more complex class than that as I needed to protect against the user pressing "back" - something they do on a regular basis :)

Andrew

Fri, 14 Oct 2005 at 05:37:33 GMT Link


6. samual's Gravatarsamual said:

There is a whitepaper on XSS viruses at http://www.bindshell.net/papers/xssv.html

Sun, 16 Oct 2005 at 15:48:57 GMT Link


7. Kedrick's GravatarKedrick said:

hey i really need to know how to get into myspace or yahoo mail without passwords willing to pay $$$ kedricknelson@yahoo.com

Sat, 04 Feb 2006 at 09:05:07 GMT Link


8. wesley's Gravatarwesley said:

About CSRF as a protection mechanism:

Can't the attacker read the responseText (ajax request to the form page), parse out the token, and then construct his POST request, effectively bypassing CSRF?

Mon, 14 Aug 2006 at 09:16:58 GMT Link


9. Chris Shiflett's GravatarChris Shiflett said:

Hi Wesley,

That's exactly what Samy did. Because of the same-domain restrictions on Ajax, the XSS vulnerability is what made this possible. (Samy was able to get his JavaScript to execute within the myspace.com domain, so he could use Ajax to request any page also within that domain.)

This is also why I think cross-domain Ajax presents new risks that must be considered:

http://shiflett.org/archive/250

Mon, 14 Aug 2006 at 13:42:25 GMT Link


10. wesley's Gravatarwesley said:

Thanks for the quick response, followup:

Doesn't IE6 (< SP1) allow you to manipulate any iframe source you want:

http://www.greymagic.com/security/a...ories/gm011-ie/

which will also break CSRF attacks and allow for cookies to be stolen.

Mon, 14 Aug 2006 at 15:11:46 GMT Link


11. Dan's GravatarDan said:

Really interesting stuff, i never heard about it, but i`m also not so deep in the "story" myspace but i think on all great platforms/communities are many problems with worms/hacks and spam it a matter of the kind.

Thu, 08 Mar 2007 at 10:29:34 GMT Link


12. Michael's GravatarMichael said:

i`m from germany and i dunno what the hell is "myspace" but after reading your article i looked in the web and found its a really popular community and it seems that myspace will start in germany too ...

Sun, 11 Mar 2007 at 11:18:35 GMT Link


13. Sam Miller's GravatarSam Miller said:

The virus is harmless but Samy was sentenced to three months of community service and two years blocked internet access and two years of probation. It is ridiculous how ignorant the legal system is.

Mon, 09 Jul 2007 at 22:30:56 GMT Link


Post A Comment

Personal Details and Comment

Style Guide

Line breaks are converted to paragraphs. Also use:

  • <a href="" title="">text</a>1
  • <em>text</em>
  • <blockquote><p>text</p></blockquote>
  • <code>2  <?php  if ($foo) {      $foo = TRUE;  }  ?></code>
  1. Note: <code> can be used inline (e.g. in paragraphs) or in a block as shown. Include whitespace and newlines in blocks.

Please enter Chris (my first name) below. This is a primitive spam prevention technique, and I apologize for the inconvenience.

Preview and Submit

Upcoming Events

Brooklyn Beta

21 - 22 Oct 2010

At The Invisible Dog, Brooklyn, New York.

New Comments

Chris Shiflett wrote:

Hi John, How do you avoid race conditions with this? The findandmodify() command is atomic,...

Posted in Auto Increment with MongoDB
John Judy wrote:

How do you avoid race conditions with this? Once you get to a certain traffic volume two or more ...

Posted in Auto Increment with MongoDB
Chris Shiflett wrote:

Hey Ivo, Andrei is best suited to give a full response, since he's the one who researched this...

Posted in Auto Increment with MongoDB
Ivo wrote:

Although you did mention that you werent going to discuss the why, I can't think of a single vali...

Posted in Auto Increment with MongoDB
Stikkyfinger wrote:

Jon Gibbins plays a mean guitar? I'd be interested to know what he plays and what type of guitar ...

Posted in Hello, Analog

Browse Comments


Work and Books

Analog Essential PHP Security HTTP Developer's Handbook