My name is Rick Deacon. I'm going to be talking about hacking social lives in MySpace. Apparently a lot of you people care about that and I didn't expect the turnout that's here right now. So excuse me if I'm a little nervous. A little bit about me. Me and my buddies came up here. We're from right around Cleveland. We lived a little west of it. Yeah, exactly. Cleveland. Really crappy. Awesome. I'm an IT specialist at a CPA firm. I'm still in college. I just turned 21. Sorry, I'm straight edge. It's basically just a job I have right now between college and a real job at a security firm or something like that. It's a great job. But I work in Beechwood. It's in the east side of Cleveland. I also go to college. I just attend a community college for a networking degree. I've been doing IT stuff for seven years and security for like four. Obviously, it means I was pretty young when I did it so I wasn't real serious about it, but I've still been doing it for a while. I had an article published in 2600 talking sort of about the same thing that I'm going to be talking about today. Not exactly because it didn't give the details and the exploit that I'm going to be talking about isn't actually... Anywhere near what I posted there. That one was patched. This one is not. All the other stuff I'm into is cars and music. Not that you guys care. What I'm basically going to be talking about is if anyone doesn't know what MySpace is, I know it's a really small site and everything. I'll be talking about a little what MySpace is. I'll be talking about what cross-site scripting is, how to evade the filters on MySpace for cross-site scripting, session information, the tools, the current zero day and a demonstration with my friend Dan over there. Ways to prevent cross-site scripting attacks and then I'll take your questions in closing and obviously I'll be at the Q&A room for anybody else who wants to ask me questions that I won't be able to answer. Basically if you don't know anything about MySpace, it's one of the largest social networking sites. I believe it actually may be the largest. It's driven by a lot, a lot of dynamic web applications and that's what gives it its popularity and that's what gives it its security holes. Obviously it has a major impact on today's society. It has a major impact on today's society. I mean obviously you guys are all here to see it. A lot of the press is interested in this story. It's been in movies. It's on the radio. It's on TV shows. It's mentioned everywhere now. It got pretty huge. The other thing about it, I mean there's things that go on MySpace. Obviously a lot of your personal information. It's a good source of social interaction. Like I said, it shows up everywhere. It's also in this presentation if you guys didn't know. The security vault of MySpace. It's vulnerable to a lot of things. I'll only be talking about one but just to mention a few. It's vulnerable to social engineering obviously. Phishing is the biggest one right now. I'm sure if you have a MySpace you've seen the phishing links with ads and they take you to a page that looks like a fake log in. You type in your information and then someone has it. You can do packet capture over a network of course. I mean there's been viruses that have spread via cross site scripting and whatnot. A couple of well known ones. The Sammy virus I'm sure everyone knows about that infected a few million I believe that changed their profiles, had it advertised. Sammy got famous for it. The QuickTime virus which was relatively recent used cross site scripting and QuickTime to add the QuickTime movie to your page which propagated it to all your friends. That was a rather large virus too. It was subject to the Windows Meta file vulnerability which I'm sure everyone's aware of. And the phishing links that I just talked about. That's some of the well known stuff at this point. My water disappeared. Oh, it's down there. Cross site scripting in case someone didn't know. I'm not going to talk too much into it. If you really don't know all that much about it, you want to do some Google and you will find plenty of it. It's a vulnerability that's found in many web applications and many websites. Some of the biggest websites have had it. Hotmail had it for awhile. Google had it. Tons of sites. Anything you can find it. Some of them are really kind of useless because you can't really do too much with them. But other ones like the one I will be talking about you can do a lot with. What basically it does is it allows code injection into the URL or into a link or anything like that to basically malform the URL with HTML or JavaScript to do whatever you want to do. you so choose. It could be used for phishing or browser exploitation. As far as phishing goes, you can use it to pass along phishing links. In browser exploitation you can actually, sometimes you can work things into it to actually crash browsers and do session hijacking, which is what I will be talking about, and cookie stealing. It can be identified very easily. You can find cross-site scripting holes with minimal effort, just a little bit of time wasted. This is the easiest way that I found. There are many other ways, and I'm sure I don't even know of them all, but this is the easiest way. I'd like to state also that I'm not a programmer by any means. Anything that I do I basically just learn, but I'm not a programmer. I absolutely hate it. It drives me crazy. Everything that I do here is basically just me learning things. I don't really know any languages backward and forward. If you have questions, about that, I'm not the guy to ask. What you want to do to try to find XSS holes is just to insert code into the application, like the link I have below. I just made up trustedsite.org and then the search CGI and the criteria. Normally the criteria would be whatever you're searching for that you may type into a text box, but in this case, you can see what I put in there, the script, and what that would do would pop up the alert that said LOL internets. That would obviously mean that it's open to cross-site scripting because you injected JavaScript right into the URL, which should not be able to happen. The link structure above can be used to do anything also. I mean, you can do that same where it's bolded there. You can do that and put anything you want in there. You could have it run a malicious script. You could display a cookie by doing it. Instead of saying alert in the word I put there in quotes, you could have it document.cookie and it would display the cookie in Firefox anyway. Like I said, if you really don't know too much about cross-site scripting, you want to just go on Google. There are plenty of sites. There's Wikipedia. The wiki on it isn't too bad. So, I mean, you could take a look at that and learn a good bit. A lot of forms and what not. The most widely used purpose for XSS whole exploits is for, in my opinion, it's for cookie stealing and session information. That's basically what the point of what I'm talking about is. On Myspace, that's the best use for. Basically, in a nutshell, the attacker sends an authenticated user a link that contains cross-site scripting. The link takes the authenticated user to a site that will log their cookie. The attacker reviews the log file and steals information as necessary. That's basically just in a nutshell of what you can do with the exploits. Obviously, I'm going to go into depth with that. Myspace obviously uses cookies. The way it works is once you log in, you get the cookie, so you don't have to re-authenticate every time you go to a different portion of the site. Without the cookies, you would have to re-authenticate every time you click the link to go to the music pages or a forum or something like that. Obviously, everyone knows that. It contains the session information and log in information. It also contains sometimes – it's not 100% that it even contains session information, depending on what browser the person is using. For some reason, I've seen it happen actually where they could be using the same platform as someone else, but they don't have the session information in their cookie. It's sort of random, but for the most part, it works perfectly fine. Also, the email address is posted in there and past search criteria, like for some reason it shows the things you've searched for last and the last time you clicked, the time and date time stamp. It may contain an encrypted password. I've never actually delved into that, so don't quote me on it, but I'm pretty sure I've heard somewhere that you can decrypt the password out of the cookie. I never really cared to do that, so I never did. The session information can be used for a form of session hijacking. Obviously, session hijacking, when you usually hear the word, you think of like spoofing over a network, so you obtain the information via that way and you take over their session, like on a network. I use it in this example because it sounds good, basically, and you can do it on the web just as easily as you could on a network. It's the same sort of idea, just a different implementation. And MySpace contains hundreds of undetected and undiscovered XSS vulnerabilities. The one I'm going to be talking about is one I think is kind of a good one. We're going to be talking about one of my other� one of many, and there are thousands that have already been patched. They're fairly decent at patching them, in my opinion. I mean, some people will disagree, but for the most part, they patch them relatively quickly when they're reported. I've known about 30 personally that were up, and then a week later, I would go see if they're still there, and they weren't there anymore. MySpace deployed cross-site scripting filters to try to limit the amount of information that can be stolen using cross-site scripting, and it keeps you from finding them. It looks for embed tags, so for a while, you could embed Flash right onto your page, and you can't do it anymore. I mean, you still can in some manners, but other times, it kind of scans for it in script tags. What it does, it just sends a message to your page, and it filters these tags into period, period. Instead of writing script, it just takes the word script and turns it into two periods, and that's the filter they have. It has closed and hindered many attacks, and it gets kind of annoying. The filter isn't consistent, though. It changes per page for some reason. They don't patch every single page. From what I found, every single page doesn't have the exact filtering, depending on, I guess, how new it is or how it was designed. I'm not real sure. Some portions of the site are more liberal than others. With the way you can type in, sometimes you can do embeds into certain areas. Other times, you can't. Just the way it's set up, I'm sure it's because it's so huge. Luckily for us, though, the filters are easily avoided using encoding of some sort. Obviously, what I have the example is ASCII to Hex or Unicode, and actually, you can take what it says, like there, the simple coding of the caret script caret, it decodes to that, and that would evade the filter. Because it doesn't see the carets, it doesn't turn the word script into two periods, because the carets is what it's looking for. At the same time, sometimes it does actually filter, even though you can encode the carets. It depends on the page, like I said. Other ways to avoid it are... simple things like actually putting line breaks in between, like, say, the SC and the RIPT. That would be like if you SC and then you would hit enter a few times in the code and actually would evade the filter in that manner too. There's so many of those, it's another thing to Google and find. There's a couple good pages that show literally like 50 to 100 with explanations, and you can try them. The evasions have been patched on certain pages, though, with, like I said, with alignment. The line breaks and with the encoding, sometimes the encoding doesn't work. It's basically just a crapshoot when you think about it, because there's chances it could work, chances it could not. The best way to do it is just trial and error. You can go through and try whatever filters you can come up with in your head or on a web page and see if they work. And there's the site, that's the site I was talking about that has a really good list. I'm sure many of you, if you've talked about, ever looked up this before, then you know that site. I'm going to talk about a previous exploit to lead into the exploit that I'll be talking about. This one was in the browse function of MySpace, which basically is a user search. You can search by your area, you can search within 20 miles and whatnot. It was found using trial and error. The exploit was used by me and by others to steal cookies and to hijack current user sessions, like I talked about, take full control of the user. And it has been patched, this one. This is the encoded URL for that exploit. Obviously you can see I encoded the carrots and various other things into hex, but basically it says document.location is your web server, your cookie stealer, and then it adds the document.cookie to your log file, basically is what that says. And that's basically what I said here too. It's encoded using hex. The XSS actually begins after search request equals. The JavaScript points to a PHP file. The PHP file records document.cookie to a log file. And it could be easily replaced with a redirect to malicious code on a foreign domain or anything like that. Anything you'd want to, you could run a malicious script right through it. You don't even need to redirect if you didn't want to. That's the way it worked. This was an early cross-site scripting hole. It was found and it was exploited majorly for a while and then MySpace patched it. But it was a while ago, probably maybe even a year. This is kind of hard to see on the page, but this is actually very difficult to see. But this is basically my log file. That's all lists of cookies. The blank space are just smaller cookies. But I mean, if you can see the scroll bar, it goes up and down rather long. All it takes is some time to get people to click it and you get their cookie, which I'll be talking about. It's broken down into various parts. MySpace broke down the cookie for us and makes it kind of easy. And like I said, it contains last display name, last logged in email, last search page and various other things depending on what the user just did on MySpace. It contains the current user session, which is called My User Info. And that made it kind of easy for us because My User Info is generally the cookie of choice for session information and it happens to be in this. But within the limitations of MySpace, it's pretty easy to get people to click it. So, what happens with this overall is that it's only valid while the person is logged in. Once the person logs out, the cookie dies. I never tried to actually extend the life of the cookie to see if it would last longer. But as far as I've never really delved into that either, but I know just if they log out, the session information died. So, if you try to use the My User Info, it just fails. It doesn't work. There is an example of My User Info. I know all of you guys want to write that down. So, go ahead and do it real quick. I'll give you a minute. And then that's actually the user session right there. That's usually what it looks like. It ends with a semicolon. I didn't put that in there, but usually you can tell the end by a semicolon. It absolutely means nothing to me. I have no idea what that says. Actually, it's funny. I just read a couple of days ago that you can decode that and it actually turns into something. I don't remember where I read it or what I was searching for when I found it, but I heard that actually is encoded into something. Don't ask me what. Okay. Obviously, like I said, it can be used to hijack. You must have a MySpace account to use this. So, for all the people that don't have one because they think it's too lame, you're right. But you need to have one in order to do this, obviously. Once the user has clicked through the encoded link that I showed earlier, that's how we get their cookie. And obviously, like I said, it adds it to a log file. So, once they click it, all you have to do is review the log file. Simply copy and paste the stolen My User Info into your current MySpace cookie using a cookie editor of your choice. I mean, this actually, I think, only worked in Firefox. I haven't used Internet Explorer in a while, so I haven't even tested it. But this one worked in Firefox, and that's what I use. I use add and edit cookies. I'm sure many people have heard of it before, but that's what I use for Firefox. And you now are the user. Once you refresh your browser, all you have to do is refresh and you're taken to their homepage and you are greeted as them. It's really as simple as that. Now, I'll be talking about the zero day. I don't want to get too ahead here, because I talk quickly and I obviously haven't killed that much time yet. It has been reported before I get started here, because I know there's legality issues here with MySpace and other things like that. But this has been reported and it has been for a few months. They haven't patched it. I'm not sure why. Obviously, this is the main point of this presentation and why many of you are probably here. But I wanted to let everyone know that this has not been patched, but it has been reported. And anyone that says it hasn't been is lying. It's been reported by multiple people and I know it. So, let's get started. It involves domain generalization. It doesn't perform any sort of filtering if you cross domain link. It's kind of a weird concept to talk about just by saying it, but you'll see it in the next few slides. For some reason it passes any JavaScript that you put on your web server to their web server and it can use cross site scripting just to do it like that. What you need to do is put a page with an iframe. containing MySpace on your web server of choice and use cross site scripting to steal the cookie. All they need to do is click the link and since it is on your domain, it can be easily hidden as anything. You could call the page, you know, slideshow or my pictures or Goatsey if anyone likes Goatsey. And if they're like, oh, wow, I like Goatsey a lot. And then they're like, oh, wow, I just clicked that. Where's my cookie? You know, stuff happens. This is the code that you need to put in your iframe. Okay. You can take a look at it. It just basically is, like I said, I'm not a programmer, but I know what that says. Basically it takes the iframe, the cookie from the iframe and logs it to the PHP file. I just used a random example for the server. This all I believe is included in the CD that everyone has gotten when they paid their $100. So if you want to use that, it's on the CD. I didn't, I did not hide it. I'm not hiding anything in this presentation. You guys can see everything that I've used and everything I will use. I also want to mention that the exploit that I'm talking about right now was not exactly found just by me. So I don't want anyone to get anyone the wrong idea that I'm taking credit for this by saying it. There was a group of people that found it and I sort of just expanded on what they found and it was a group effort type of thing on a forum that I won't mention. But basically, yeah. It was just found by multiple people. So I'm not trying to steal credit from anyone where it deserves credit. I just kind of expanded on it and took what I knew previously and added to it. That will steal the user's cookie right there because obviously you saw it stole the cookie using taking the frame, taking document.cookie and logging it to a file. It's more of a general vulnerability because it doesn't directly involve putting the cross-site scripting in a MySpace link and staying just in MySpace. Obviously, you have to go to this other web server to find it, to actually use it. But the fundamentals of cross-site scripting are there and anyone can learn tons from just that. The PHP file calls a text file and just writes the cookie to it. It just opens it, writes the cookie. You can actually, obviously, if you didn't want to make the page look so conspicuous because I never cared because I don't send these things out to people. You can actually, obviously, if you didn't want to make the page look so conspicuous because I never cared because I don't send these things out to people. When I find this stuff, I don't use it for any, I mean, it's just, I don't have any reason to hack anyone. They're MySpace. I mean, it's MySpace. What do I want with that? I have my own. I just know how to do it, you know. But I, so mine is plain and simple. It just has a little iframe, MySpace in it and then it redirects to my cookie logger and you get a blank page. But if you wanted to, after the cookie logger, you could have it redirect to, back to MySpace home page and they wouldn't even know like anything happened. They couldn't even know like anything happened. They couldn't see the iframe for a moment and then it would disappear. Or you could even make the iframe so little you could make it like two by two pixels and then you would, you wouldn't even see it and then it would go to the next page. It's really up to you. I never messed with how it looked. I don't really care. This is the PHP file. I basically took it from the internet. I just kind of Googled it and added whatever I needed to to it because like I said, I'm not a programmer. I know some PHP but not that much. I know what that says though. It just opens cookie log and writes the cookie. This is the URL that would need to be sent to the authenticated MySpace user and it may look simple to you but if you notice, after the dot com, there's a dot and that's basically the entire exploit and why it works. Without the dot, it doesn't work. That's part of the domain generalization. I believe the reason it's like that is because they had ads that used that. In order to pass JavaScript to their server and obviously they're not going to tell their ad people that pay them that they're not going to be able to do that and someone found that and another site and not just MySpace and you can use that to exploit this. That's basically the only reason it works. Without the dot, none of this works. So make sure if you're going to try this, you have the dot. But don't try it because it's bad. You shouldn't be doing that anyway. Don't ever try this, ever. Just know it. That's all. And it's Caturday, so you need to post more cats. It's actually Sunday, but every day is Caturday. Like I said, the dot at the end of dot com is the reason why this works and Caturday LOL is the HTML page which contains the iframe. All you have to do to exploit the vulnerability once you've stolen the cookie is log in, review the log, copy the my user info into your user info. Obviously, I stated this, but refresh the browser. I just wanted to reiterate that it's no harder than what I talked about earlier. It's the same sort of thing. No big deal. And you now are the user that clicked your finally crafted hidden link that looks like crap anyway. The limitations to this. Like I said, the user must be logged in. But other than that, the user must use Mozilla Firefox. And I will talk in a second. The person will know what the link is there recently. They clicked and that's a limitation. If you don't have it, look hidden and they know. Like say you posted in a bulletin and, you know, my name is Rick and they saw Rick's bulletin and they clicked it and then they noticed that their page now has Goatsy on it. They might suspect something because they clicked your link last. So they may know and then they'll come after you and beat you with baseball bats. Because MySpace is really important. That's where everyone's friends are at, you know, internet friends. Obviously, you can hurt your friend's feelings also by putting Goatsy on their page. They may not, they may be offended by Goatsy. I know I'm not. I like Goatsy. I'm not a fan. I like it. It's my background. So, you know. Depending on what you do also with their page, you can change it to be funny. You can change it to do whatever. But obviously don't because that's bad. Don't be doing none of that stuff. But and I found out just a couple days ago and I didn't even notice until I tried to test this again after I updated my Firefox, that Firefox 2005 finally implemented HTTP only cookies, which doesn't let you get the user session anymore, which is bad for me because I tried to do this presentation. I'm like, oh wait, it doesn't work anymore. And then I realized that's a problem. So what you need to do is, I mean, not everyone updates their Firefox. And this, as far as I know, it never worked on IE, not for a while anyway because I'm pretty sure they've used HTTP only in a while. Like I said, I haven't used IE in forever. So if I'm wrong, don't throw things at me. If you use the older version, it works perfectly fine. But also I've never messed with this yet because I didn't have time. I, like I said, it's 8-2. That's like the day before I left to come to Las Vegas and it was like midnight when I was looking at this so I didn't feel like doing it again. But you can, I was reading you can use XML HTTP request to obtain the cookie. It just is a lot more difficult than just using document.cookie. But I mean, if you know the language, then it shouldn't be, it should be no problem. It's just as easy. You just need to use that instead because that doesn't block, doesn't block HTTP only cookies, which my user info is part of the cookie, but it's actually the only part that's blocked because it's HTTP only. It keeps cross-site scripting from happening. And that's why it's been implemented. It's, people have apparently wanted it in Firefox for a while. And now I'm going to do the demonstration here and hope everything goes well. We'll start by, this is my MySpace. See, there's me. And we're going to call Dan up here in a minute. But we're going to go to Dan's page. Oh, no we're not. Just kidding. Oh, getting an IP address. Hold on. All right. So for this example, we're going to send Dan a message containing my exploit for this. There's my server hosting that. And Dan will click it because he always wants a cheeseburger. And it says I can't have his cheeseburger. So I mean, come on. I'm his friend, just so he knows, just in case he doesn't realize it. So I just sent him the link here. And now I'm going to log out. So you guys stop looking at my messages. And then Dan is going to come up here. Come on up, Dan. Doesn't it suck Bob Barker's off prices right now? I love Bob Barker. Speaker 4, inaudible Speaker 5, inaudible 00-6. Speaker 2, inaudible 00-8. Speaker 4, inaudible 00-3. There, you guys like that? There you go. Better? No? Well, then get new glasses. Hey, I got glasses. Oh, I'll change that later. Nah, it's all right. Now Dan is going to read the message I sent him and change his password. What's that? I told you he wanted a cheeseburger. Oh, and now it's not forwarding. Of course. Of course. Why would it work when I'm not on it, too? Let's try again. I had some catastrophic failure. He was actually supposed to be in the audience using my second laptop, but the master boot record got messed up 20 minutes before my speech. So this actually isn't going to work exactly the way it should. What he should be doing is clicking this link. I should be using it up here, and then I should review the cookie log, and he should have his cookie in my cookie log, and I was going to refresh my browser and become him. But since we're logged in as him, I'm going to basically show you exactly what you need to do, but it actually isn't going to work the perfect way. Sorry, guys. I apologize. My laptop is older than me. And of course, it's not forwarding. Okay, well, we're going to go to the cookie log. Thanks, Dan. Thanks for giving everyone your password. We tested this a couple days ago, and for whatever reason, my script file isn't deciding not to work right now. But this is an older log. Like I said, I can't show you guys exactly how it worked anyway, because he doesn't have the laptop out there, so we'll just use this. But here's the My User Info. So what you do is you scroll for a year. ... ... ... ... ... ... ... ... ... I know. You guys are all perfect, and I just suck. It sucks. So that is the portion of the cookie we need. I'm sure you guys loved how it took an hour. So now, from this point, I'm going to go into my Cookie Editor. Don't look at all the porn, please. ... My User Info. I'm using ANEC cookie editor for this one. I usually use Add and Edit. I'm using this right now because it was quicker to find. So there's the cookie, the My User Info cookie right there. I'm editing it. I'm taking what I just copied and I'm just going to paste it. Saving it. Closing it. Going back to MySpace. Going home off my page. Obviously the cookie was old, so it's not going to actually work right now, but usually all you have to do is click home and you would be Dan Hammon. And that was basically it. I'm sorry that it couldn't work perfectly the way I wanted it to, but it will work if you guys try it at home. Unless, of course, MySpace patched the vulnerability overnight, which would make me very upset. But basically, that is it. And it will work once you don't ... If you're not on a stage, it'll work perfectly fine. Trust me. And I'm not embarrassed by it, so. So that was the demonstration. I'm glad you guys watched it. Obviously, like I said, it would have worked perfectly fine. The tools I used, Firefox, Notepad, and Brain or Lack Thereof, depending on who you're hacking and what network you're on and whether you like to be sued. Add and edit cookies, like I said. That's basically the tools used. These are some penetration testing tools that you can also be used. It's probably really small up there, but I copied it from a previous presentation I did. Basically, just some good stuff for use for hiding cross-site scripting. Tamper data, add and edit cookies, Firebug, Firekeeper, Hackbar, switch proxy, and Tor for anonymous purposes, obviously. I think there was a couple speeches I didn't get to catch about Tor. I'm sorry about that, but I would have loved to. Paros, which is a web vulnerability scanning proxy, and that's good for finding cross-site scripting. Akinetics. Akinetics. Another one. And Nikto and Wicto for Linux and Windows web pen testing. I do have time here. I have another 15 minutes, I believe, up here. If anyone has any questions, we can ask them here or you can ask them in the Q&A room where I'll be next. I wanted to thank everybody for coming. Thank you for filling the room. I didn't expect it at all. Hopefully, everybody enjoyed watching it not work. It will work, I promise you that. Thank you. Thank you.