All right. How's it going, everybody? Last talk for the day at DEF CON. You guys having fun? Drunk yet? Psychoholics. Fuck yeah. All right. So, I'm Adam Baldwin. No, thank you. I am definitely not this Adam Baldwin. If you were here to see that Adam Baldwin, it is at the pool on the roof. So, I'm this Adam Baldwin. I'm the Chief Security Officer at AndYet. I'm the security lead for SideBrand, LiveSecurity, and I'm on Twitter at Adam underscore Baldwin. And we're going to blow through a lot of slides. I think I've got 59 slides in 20 minutes plus two demos. So, let's go fast. We're going to talk about what blind cross-site scripting is, how I'm using it in penetration tests, some challenges with blind cross-site scripting, the introduction of the tool. XSS.io and I'll make it public after the talk and some special surprises if I don't run over. So, what the fuck is blind cross-site scripting? Right? It seems like something I made up. I did. Actually, I've seen it mentioned before, but it's really just a variant of cross-site scripting. So, let's talk about cross-site scripting first just to give people in the crowd, if you're not familiar with cross-site scripting, a little overview. It comes in three variants, right? Reflected, persistent, stored, or... DOM. So, reflected is, part of your query parameter is reflected back into the HTML and rendered in your browser. It's reflected basically back, the client's sending it, it's getting, the document's getting manipulated and sent back and rendered. Persistent, that payload is getting stored somewhere, getting rendered back into the client and then getting sent back to the client and rendered at a future point in time. And then DOM, where all of that is basically happening at the same time. The actual client side, the actual, it's being manipulated client side rather than the actual document or anything being stored. If you want to know more, there's plenty of information out there. That's not what we're going to talk about. We're talking about a specific variant of persistent or stored cross-site scripting, right? And where I saw blind cross-site scripting mentioned first was an Acunetics blog post from years back. But it's also known as, like, authenticated XSS. Basically, what we're doing with blind cross-site scripting... is we're throwing a bunch of payloads out there into various points in the application and we are looking to see if we get any response back. So blind cross hits, I'm just going to stop saying that. Blind cross hits. Blind. It's a different challenge. It's not like blind SQL injection where you actually get some type of immediate feedback, timing or response, alerts, whatever. You have no idea where your payload is going to end up. You don't know whether your payload is going to execute or when. So you have to think ahead about what you want to accomplish with basically store cross hit scripting. What do you actually want to get out of what you're doing? And the key piece here, and this is what XSS.io provides, is you have to be listening. You have to listen and listen forever. Because that input is going to persist someplace else. You have to listen to the database and some database and at some point in time some developer is going to screw up and render that in some browser someplace not properly encoded. It's going to happen. It happens all the time. So what I like to think about blind cross hit scripting is the Carly Rae Jepsen of cross hit scripting attacks. It's call me maybe, right? You might get a call back. It's throwing stuff against the wall and thinking that it might actually call you back. So let's take an example from a recent penetration test that I did that was completely black box. I only had access to the public facing interfaces of all of their web applications. And I wanted to see basically how I could cross that barrier, that trust boundary between the private admin customer service portal and the public facing chat application. So that's me. And basically what I've done is I've done a couple of things. I what I did was I set up a chat session with customer service rep and included in that customer in that chat and every single payload in my name and the description and the body. I put uniquely tagged basically script payloads, right? Script source equals some unique identifier. And that's all I did. I did it very simple, straightforward. And I went to see if it called back. It didn't. So the chat rep got this and it was also stored into the database. I had no idea if they kept track of this stuff or not. It's just what I did. I threw this stuff out there and I left XSS.io listening. And time passed. Actually a couple of days. And time passed. And our chat representative, this is what I surmised based on talking to the client, is they've got a little search interface for their chats. And the little customer service rep searched for something. And it pulled up, I think it was a link, the payload out of the database and rendered it in her browser. Little evil payload there. And bazinga, right? We got a call back. So it rendered in her browser and sent me back information about that application. Not that exciting, but the fact that I now had a connection to her session, right? I was, for all intents and purposes, her. Right? I knew where I could put input into the application. I knew it was a description field of that particular chat. None of the other fields triggered, just the description. And I knew exactly where I could put it to then get, send some other payload. Happy me. So steps to sort of a successful XSS exploit with, you know, blind cross-site scripting, it's you have to carefully choose the right payload for the right situation. And you have to really, really get lucky. It's, you know, basically magic. You throw crap against the wall until, you know, it might stick. And the reason I say you have to pick the right payload is because, if you go to, say, like, HTML5Sec, you know, Mario and those guys have just piles of payloads that you can use in different variants. There's just, literally, just hundreds and thousands of different variants you can use. But if you think about it, why would I use, like, a CSS-type variant injection attack in a first name or a description field? I wouldn't. So that narrows down your payloads even more. What I found is the most basic of payloads, just basically script source is really, really effective in most situations. I tried a variant of like a Peros or a bird proxy plug-in that basically rendered all these different, for every request I got, it enumerated all the different injection points and then did thousands of payloads. And the ones that came back were always the really, really simple ones. So I just stopped doing it and I just used basically a few manual payloads and it's really, really effective for me. So you plan out your payload will be used in your application. Think about it. Where's your user agent being stored? Where are these various headers that your client, that you're sending to the application, where is it going to be stored? How are they going to use it? How is it used in a reporting interface? If you think about those things, you'll think about and you'll know, you'll be able to kind of plan what you want to do. What do you want to actually inject? Will you be getting a context of a user that might have access to useful information? Is it an application you actually care about? Those are some things to think about. Here's just some nice targets that I found. Log viewers, the log headers, exception handlers, things like that, that log your request, your post body, things like that. Customer service, apps, chats, tickets, forums, anything moderated. Anything that you've got that cross, that trust boundary where you've got the, any user that's going to be able to access that, that's going to be rendering in a different context. And I don't know how that slide got in there, but I'll let you take it in. And if you want to play around, there might be something with this particular application. Got it? Okay. So blind XSS management is a giant pain in the ass to deal with generating unique identifiers for all these different payloads and keeping track of them. And so I basically wrote a tool. I was lazy. I wrote a tool. It's counterintuitive. So XSS.io can help. So what is the XSS.io tool? It's basically a tool to deal with cross-site scripting exploits. So sometimes you need all the space you can get. I'm going to make XSS.io public so that anyone can create and have available payloads online at that domain and use them. 24 hours a day. It doesn't, I mean, basically it will be up all the time, I hope. But it's a tool you can use. You don't need a short URL. And I'll demonstrate this. You don't actually need like XSS.io slash some unique identifier. Like if you're using, you know, bit.ly in your payloads, you have an extra like five characters there for the GUID. You don't have to have that because we do some basically refer based redirects, which I'm sure somebody here will find a way to break and ruin that, but whatever. Exploit, the exploit creator, it's snippets for common tasks and you can quickly sort of just create snippets for common tasks. Stacked up exploits, weaponize your, once you've found a vulnerability, you can weaponize it very quickly. And we've got the dead drop or blind XSS manager. It's a simple API. You say I'm dropping this type of payload at this location and it gives you an ID back. And that's all you need. And it's a quick, super fast API. It's built on top of Node and Redis. You know, we can talk about architecture after the talk or whatever if you're interested. So let's do a demo of the demo. If this works. We're going to demo a vulnerability in Nagios Enterprise. Basically, okay. What the hell is that? Okay. So here's this quick tour. As fast as we can go. Here's snippets. Snippets are basically a way for you to reuseable code blocks. They're literally just functions. That's all they are. They're a JavaScript function that does a thing and calls a callback. And that way we can stack them. We can just say do this really small thing and do the next thing and the next thing and the next thing and you can chain them together. Load value by selector as an example is really useful for, say, finding a CSRF token from some page. Here's our exploit list. There's nothing there because I dumped the database before I came up here. And here's the exploit actually creator. And we'll get into that in a second. Here's the redirect view and the dead drop. So let's actually drop something in Nagios XI. So there's a configuration manager that you can access if it's public. Normally you have to be logged in to access it. What we'll do, I've got actually just a little Firefox plug-in that I'll make public, too. I don't have it. I'm going to go ahead and do a test. I don't have it quite polished yet. But let's say we want to get a drop for a user name. Type user name. Get ID. Paste it in there. It's the first one, right? It's one. Just increments up. Please don't drop a bunch of shit in access. Oh, I have to be a jerk. And we're just going to log in. Log in failed, right? Great. But that got stored someplace. That got put into a log. So let's log in to Nagios and actually trigger that. So if we look at dead drop, we got one. We got one dropped. We don't care about anything that doesn't call back. So I don't bother showing anything or storing anything or whatever. Let's log in to Nagios, configuration manager, blah, blah, blah. Okay. So if we happen to go to config manager log, user happens to go in there, we've got obviously we got some injection happening here. If we go back to the explorer, please work, we actually got a call back. So we got it says that at Nagios.example.com slash this URL, we put it in the user name field. We actually get a bunch of data back. And this is horribly ugly. I'm trying to find a good way of representing this. I'm trying to find a good way of representing this data. But it's difficult. I'm actually logging the entire HTML contents of the page, the source IP that called back, the window.location, the session cookies, all that stuff. It gets loaded, right? So let's sort of weaponize this particular thing. So this is the page that called back, the window.location. And let's quickly, first thing we want to do is we want to create an exploit and say, okay, we want to, we're just going to do a simple thing of finding the CSRF token of one of the pages. Just because that's what we've got planned. So we can load a value by selector at a particular URL. This particular URL we want is, we'll load that URL. Our selector is our input and that returns value. And let's just alert that value. And so this one snippet returns a value. And we can just say, okay, I want to drag, you know, basically the return value of that into the input of this other snippet. And it goes. That's blah. Okay. It generated it right there. Now let's go and let's say we have limited space. So let's say we have a function that we actually need every single character for exorcist.io and we can't have any trailing anything. Let's show the refer basically working in action as well. And so we're going to add a redirect from that particular URL that gets loaded. And we're going to redirect that to, of course, I didn't copy the freaking. Inter-exploit list. We'll copy the, you know, the, you know, the, you know, the, you know, the unique identifier for that. And so we'll go to. So we're going to say if anything comes into exorcist.io, from this refer, load this, redirect them to this page, basically. Load our payload, right? And that could be a BFOC. That doesn't have to be something from exorcist.io. It could be whatever. You could load up exorcist chef, you know, from Codo. You can load up whatever you want. You can redirect it to whatever you want to. So let's save it. Pray this works. If it doesn't work, there's a space after that. So now that we have that, let's go back and redrop. Let's just drop script source equals. And let's just do. Is that right? All right. All right. All right. So you can do a pretty. Jesus Christ. A pretty small payload. And I'm actually logged in, but it still dumps it in. There's a failed log in. So we load up the log. We should get another. Well, cool. It's not going to work. Son of a bitch. You're such a bitch. That's what I get for doing a live demo. What's that? In when I dropped it. So it did a post back. Let's see. Right here. That's bracket. That's bracket and bracket. Oh, man. Demo gods are pissed off at me. Maybe if I just keep reloading the page, right? No, it doesn't work. So let's look just quick. Aha. You don't need it. You don't need it. Backslash, backslash. We'll use whatever the current protocol is. So you can make it even shorter. But. No. I know what freaking happened. This thing right here, it's a bug. I knew it was going to bite me. It basically, it doesn't strip spaces. So I break things. I don't build them. Eh, whatever. Okay. So that's the failed demo. It should run. There's some bugs. I love contributions. I'm going to make the code base public on GitHub and people can contribute. It needs some polish, but it's there. Like I said, whenever we were refreshing that log, too, these dead drops were calling back. So we got 18 events. In each individual time, it actually is called back. We've got more events, more sessions, more whatever. How much time? All right. So that's blind crosshead scripting. That's XSS.IO. Again, some bugs. I'm not going to debug the demo anymore. I have a special treat, however, that maybe will actually work. And if they both fail, that's great. I've got another tool to announce CSRF.IO to basically deal with CSRF attacks. It's kind of, you know, I got to show my slide because. But wait, there's more. Okay. So let's do this quick. I'm going to show you how to do this. CSRF.IO is basically you can create little scripts of CSRF style attacks, submitting forms, loading content, whatever. Here's just a few that are out there. And you can make them public, whatever. We are going to try. Does anyone here have a ZTE 890? One of these? Anybody? Don't be shy. Raise your hand, please. You have one? It's not. Yeah. ZTE 890 Verizon. Don't click on any link I send you. So let's just show the tool quick. Basically this particular vulnerability is puck locking out the SIM. So you have to go get a new one. If you do it too many times. Let's look at it. So what I did was it submits the form to VZ.Hotspot, which this thing conveniently gives you. So even if you change the internal IP address, it, you can reliably hit the device every single time from the outside. Pause for X seconds. And let's redirect back to the URL. So all we're going to do is hit the form. Hit the form. Hit the form. What I was going to try to do is connect to it and see if it would actually connect to the device. It's not going to kill it. But who knows if this thing will actually even work. An 890. Just bear with me. I've never fully tried this out because I didn't want to break the device before I had to. Two. Two. 2F924A5. Oh, don't join that. Okay. So here we are online. Apparently that's the test. All right. So let's hit the exploit URL and see what actually happens. Let's see if it actually does it. Incorrect pod code. Cool. If you get the timing down right, that doesn't pop up. So if you get, if you short it out, yeah, see it's connecting to it. Keeps refreshing. Timing might not be right, but it will keep repeating the form over and over and over again. If I could actually connect to it, it would check the count. Anyway, it's a useful tool that could quickly do a lot of things. So basically copy, you can literally copy the request response right from like fire bug or something and drop it in to the CSRF.io form and submit the request and just, at that point it's out there in public. And you can send the link. So basically a couple of horribly failable demos. This came up. I don't have internet. Yay. That didn't fail. Yay. Searching. It's great. Do you want it? Here. And that's it. Thank you. Thank you.