Hey, welcome to XAB version 2.0. XAB stands for Cross-Site Scripting Anonymous Browser, and essentially that is a tool and a framework that allows one to tunnel HTTP requests over sites that are vulnerable to cross-site scripting attacks. The prerequisites for this are, number one, you've got to understand what cross-site scripting already is. We're not going to explain it during this talk in the limited time we have. You need to know basic HTML and basic JavaScript. My name is Jeff Yastromskis. I'm in a CISO role for a SAS provider. This is my 10th DEF CON and first time presenting, so long-time listener, first-time caller. All right, and I'm Matt Flick, principal with Firm Associates, and we're an information assurance consulting company. I'm focusing on AppSec a little bit, which is pretty relevant, and I apologize for the sound of my voice. It's related to bullet point number three. So, what's the agenda for today? So first I'm going to go through a little bit of history. This is version 2.0. The initial one was back in February, or the initial release was back in February. I'll talk about what it is, what kind of high level, how the idea came about, and things like that. And then Jeff will get into it. I'll get into the details of it, as many details as we can fit into a 20-minute talk. And then, actually, we do have a live demo, which worked in the green room, had a little trouble, but it's up and running. So, assuming everything goes well, you get to see a live demo. Otherwise, we'll play a video of one and put some music to it or something. And then we'll just wrap it up. So how did the idea come about? Last year, I was just reading articles on Tor and an attacks against Tor. And then, luckily for us, one of my buddies hit me up with a question on cross-site scripting he was dealing with at his job. And so I just kind of put the ideas in my head. And so I started thinking about, okay, well, Tor is out there and it's a great tool, I love it, I use it all the time. What if we try and do something else, something different? The same idea, do anonymous browsing or anonymous things on the internet. But what if we try to use cross-site scripting in order to do that? that. So we threw a bunch of ideas around, actually threw together a presentation, submitted to Blackhead DC and presented it there back in February to a few people. It's a little bit more crowded today, thank God. But we actually did have a working demo there too and then released the code. Proof of concept code is out there. It's at the firm site. So, what is XAB? As we've said a bunch of times, cross-site scripting, anonymous browser. Basically the idea, the basic framework is we've got proxies set up that, or you can set up either sites that you've, you know, do a stored cross-site scripting, just store your JavaScript there, and then when people come and visit the site it runs in their browser. Same old thing about how cross-site scripting works. But basically that can be used to do cross-site scripting. It kicks things off. You've got these two proxies on the outside and then you have your victims or participants that hit one of those sites, run the JavaScript code which forces their browser to pull the next request off of your queue, goes off, makes the request, sends it through, the response comes back, they package it up, the victim, the participant packages it up and sends it back to you, the attacker. It's fairly simple architecture. It's a little bit similar to Tor. A little bit different. But what's cool about it, or what we thought was really cool about it, is that instead of actually having the, your participants in your anonymous network install something on purpose and, and, you know, willingly load up the tool, you're actually just, you know, forcing people to be, be a part of this network. And it's pretty dynamic. The JavaScript runs in the browser, or runs by the browser, and then they do something for you and then they leave. So it's pretty cool. It's pretty dynamic. Rather than being static. Although we, we came up with some other ideas that we were wanting to implement. Some things have. Some other things haven't yet been implemented. But things like doing encryption and trying to tie together, string together multiple participants. So it's actually pretty difficult to do that. Haven't gotten that yet, working yet. But it's on the to-do list. But things like that that we presented at Black Hat DC. Subtitles by the Amara.org community Other ideas. We've been wanting to try and find other people to help join us and, and fight the good fight. But one of the things that we mentioned that we brought up and discussed at Black Hat DC was the use of HTML5. So if you can store your JavaScript long-term in the clients, then that becomes a lot more reliable. One of the problems with doing things with cross-site scripting is that, you know, if the, if the JavaScript doesn't, doesn't finish executing, then it's, it's not going to work. It's going to, it's going to, it's going to fail. Then you're going to miss part of your data that you're requesting. But if you can have it resident in the browser and, and run, basically, whenever the, you know, user loads up their offline Gmail and things like that, assuming they're connected, then, you know, that becomes a much more static, less dynamic, much more reliable thing. And I don't know if anyone went to Black Hat and saw the veiled talk, but it seems like they kind of took that idea and ran with it. So we thought that was pretty cool. So, so now let's get into the nitty-gritty as to how all of this works. There's three primary components. The first is XAB attacker. This is the core of everything. This is what handles receiving new requests for data. This is what delivers the JavaScript payload and, and the commands that we wish to execute and the requests that we wish to execute on the victims or participants. HTTP Prox AB is a simple HTTP proxy. It's a simple HTTP proxy. This is used by the attacker to seamlessly browse the web through the XAB framework anonymously. All requests, if one chooses to participate in the framework, would be going through this HTTP Prox AB proxy. It's a seamless proxy. It'll seem like it's a standard, you know, browsing experience for the user, albeit a little bit slower. And CD proxy is a cross-domain proxy that allows us to get around the, the cross-domain sandbox of the inability to make an XML HTTP request to another site. So the cross-domain proxy is what allows us to be able to do that. So let's just go through this process flow. It's, there's a lot of steps here, a lot of things at play. And we do have a limited amount of time, so if you have any questions about any of these, please hit me up afterwards. Every step here is important and is necessary for a request to go from beginning to the end. So the first step here is to go from the beginning to the end. So the first step here is to go from the beginning to the end. So the first thing we're gonna do is we're gonna run the proxy on a predefined IP address and port. That proxy's then, then going to listen for incoming traffic from the attacker. The attacker simply sets his web server, web browser to the, the IP import of this proxy. And when the attacker makes a request, so say, for example, they go to www.target.xab, the HTTP Prox AB is then going to insert that request into a queue, which is then, which is then going to be picked up by the XAB attacker, which I'll get to in a second. So, but actually, before that, we've gotta go back to the human process flow here is the attacker needs to actually put that payload of XAB attacker on a site that's vulnerable to HTML injection. Ideally that would be stored, so multiple users can hit it. However, it does work in a reflected HTML injection attack as well. But stored works a little bit better for forums, because you're gonna have more users hitting it. Every time a user hits that payload, they're gonna download one more, they're gonna make one more HTTP request for you and send it through the network to the attacker. So the XAB attacker, this, this is that core piece. It receives that payload request from the participant. It's simply a JavaScript source equals and then the location of the XAB attacker script. Very simple. What's gonna happen is, you're gonna have a request because it's gonna look at its internal queue file that HTTP proxy B has updated, and it's gonna look to see what needs to be executed. It's gonna remove that request from the queue and then respond to that, to the client, aka the, the victim, or participant, with some JavaScript that sets some other things that makes the actual request to the cross domain proxy. So now we've got the client, or the, or excuse me, the, the victim or participant making that request to the cross domain proxy. It's also gonna set some other JavaScript functions to handle the data coming in. Don't need to know about that too much, but if you really want to, you could look at the code. And once the, once the participant makes that request to the cross domain proxy, we're gonna hit this, we're gonna hit step four now. So step four is really simple. They make the request to the cross domain proxy. The cross domain proxy makes the request to the target site that the attacker all the way to the top of the chain wants to browse. And then it goes all the way back to the cross domain proxy, to the participant who's is going to make image requests with that data in it, because remember we could change image requests with, and we can append whatever we want to those image requests, and make those calls to the XAB attacker Perl script, or CGI. All that data is going to be Base64 encoded, and it's going to be split up based on how much, based on how you configure it. So, I mean, you can only send, what, 2,000-something characters in an IE URL, so you want to set that a little bit below that, and the max data size that the cross domain proxy, or, excuse me, the participant sends to the XAB attacker to receive this data is always going to be under, it's going to be in chunks under the maximum for that browser. So once XAB attacker receives all this data, it's going to write it to a file, and it's going to send, so for each of these image requests, it's going to send them back a one-by-one GIF image, it's transparent, so there's nothing funny in their browser, and once it receives all of those segments, it's going to combine all that, and Base64 will decode that and place it on the server. Finally, the HTTP proxy B is going to scan that dump directory, if it sees the file request it's looking for, it's going to send it back to the attacker, the attacker's going to view the web page. So, before we get into the live demo, this is what the setup looks like. I don't know if you could read the little boxes, but vulnsite.xab, this is simply the site that is vulnerable to HTML injection with the attacker's payload. Target.xab is the site that the attacker wishes to browse through this anonymous network. Attacker.xab is the site that the attacker wishes to browse through this anonymous network. Freehost.xab is the site that is owned by the attacker that runs that XAB attacker tool that's the core of everything, and freehost.xab is where we're hosting the cross-domain proxy. On the client side, this is on the host OS on the actual laptop outside of the VM, we have two web browser instances. We have the victim, who has no proxy, he's going to browse to vulnerable site, vulnsite.xab, with that payload on there. And then we've got the attacker client. The attacker client is going to go to target.xab, and then we're going to go to target.xab. And then we're going to go to target.xab, through the HTTP prox.ab proxy. So I'm going to launch one Firefox instance for the victim user. So I'm going to launch one Firefox instance for the victim user. Okay? Sure. So this guy's going to go to vulnsite.xab. You can see that, eh, there's not too much time but I'll, if there's time I'll show you what the payload actually looks like. And this is the attacker browser instance. This is the one that is going to be retrieving the files that are on target.xab. So I'm going to minimize this a little bit so you can kind of see multiple things going on at the same time here. Over here, we're going to run the HTTP prox.ab, and that's going to listen on 8293. You can see this guy is reloading over here. I'm going to minimize him. Right here, I'm going to go to www.target.xab, and I'm going to go here and reload. This guy is reloading. He's parsing it. And now we got the text part of the page. He's going to hit that site again. Now this could be another user hitting that vulnsite.xab. What's left? We've got three images here. So there's one more image. He just hit it again. Let's get this last one. But wait, there's more. We've got the favicon.ico up here. Let's see if it'll grab that one for us too. Sure enough, it did. So what's new since February? Well, we ran into this big issue with the HTTP referrer problem. And smart folks in here may have already figured out that we're passing the referrer from the vulnerable site to the cross-domain proxy. So by doing that, the owner of the cross-domain proxy can look at the vulnerable site, and if they look at that source code, they could see the location of the XAB attacker payload and machine. So that's kind of an issue. So there's a couple ways around this. One is to find sites that are vulnerable to HTML injection that are always SSL. The RFC 2616 says that browsers should not pass the referrer when the connection is secure to the SSL. That is the case for IE and Firefox, the most recent ones. So that's one option. That will get rid of the referrer. And another option is to use local files. Local files will also not pass the referrer. So it's another possibility. Thirdly, there's using iframes. What if we use, created an iframe that has its source set to another site that's vulnerable to HTML injection, but from a reflected standpoint? So it reflects back the parameters, the URL parameters. And then we put our payload in there to the request across the main proxy in there. So then the referrer's from the site. site that has the reflected cross-site scripting attack capable on it. And so now we're, what, three subpoenas away from the attacker. So, you know, the more people you add in there, the more anonymous it can get. And then finally, the last way around the refer problem is random browser bugs that pop up and get fixed pretty quickly. So, least favorable approach, but there are approaches to it. Since then, we've also added improved content handling. The content handling, instead of using file magic to figure out what type of file it was and then send the appropriate content type to the attacker, we just take the content type coming straight from the cross-domain proxy and pass that all the way with the string, with the data that's going in. So, we're always going to have the right content type. So, in theory, you should be able to hit, you know, movies. You should be able to hit MP3s, PDFs, any type of content. We actually didn't get any applause or anything at Black Hat DC, so I appreciate that. Worked beautifully then, too. So, anyways, our time is close to being up. It was pretty quick. So, basically, again, the idea is that we want to build something that allows anonymity or some level of anonymity. There are problems like the refer header and other things that may limit the ability to have it anonymous, but as we keep working on it and building in new things and more functionality and stuff like that, you know, it seems like an exciting thing that we want to keep working on. We could probably make it better and better. So, anyways, if you want to learn more about it, you can download the code from pharmaassociates.com. Feel free to hit us up after the talk, of course. And if you want a beer or anything like that, I'm all drunk out today. So, I'll get by you. 1 Any questions? We actually have a few minutes. No technical questions. Way too tired for that. Yeah, in the back? 1 Incorporating URL redirection? Did we think about that? 2 1 We did? 2 I can't remember. 2 So, are you talking about to get rid of the referrer issue? 1 Yeah. 2 Yeah. 3 4 5 12 14 15 16 19 26 27 28 29 30 31 32 33 33 34 36 42 44 46 47 48 49 50 51 54 05 07