All right. Welcome, everyone. We're coming up to our, what, 5 o'clock talk? And really quick, before we go anywhere, I want to, so we put this on every year and we can't do this without our sponsors. So I'd just like to really quick say thank you to a few companies who have been helping us out so that we can afford to do this. RSA, Fidelis guys are somewhere back there. Mobile Iron, Veracode, NoStarch Press, we should be getting some books from them pretty soon. Splunk guys, take a look at that. They have their tool running over there. It's really cool stuff. Risk Analytics, CrowdStrike, and Evident.io. Please remember these companies. Give them, thank them if you see them. We wouldn't be able to do this without them. So, yeah, that's where we get the free shirts and everything else. So up next is one of our own. And he's going to be giving a talk here, one of the volunteers at the Wall of Sheep. So let's give a big hand for Ron Taylor coming up here talking about what volunteers are doing. Ron Taylor. Violating web services. All right. Can everyone hear me? Good. All right. So it's 5 o'clock, right? So most of us have been drinking for about eight hours. So this should be a good time to get started. All right. So my talk is violating web services. So who the heck am I? My name is Ron Taylor. For the past seven years I've been working for Cisco systems. Before that I did about ten years in consulting. So my mom says I've been breaking shit since I was born. So I guess I've been a hacker for about 38 years. You can find me on Twitter under Gus Gorman. Who here knows what the character Gus Gorman, what movie it comes from? For a T-shirt. Anybody? Superman III? Richard Pryor played a hacker in Superman III. Best hacker in a movie ever. Super fun. So we're going to talk about web services, right? So who here has done web services testing? Rest, SOAP, awesome. Cool. Who here thinks they're really secure? Didn't think so, right? So what are web services? Let's start there. So web services are a standardized way of communicating between servers, between multiple applications. They were originally used to replace things like EDI or as front ends and main frames, things like that. Now they're used to replace things like HTML. You see them more used for mobile applications. Typically the back end server for a mobile application. Typically what we see is a mixture of JSON or XML over HTTP. That's, you know, those are the services that we typically see. They're stateless, which we'll talk about some of the issues there later. And they're platform independent, which is part of the reason why they're used the way they are. So we're going to talk about that a little bit. So a little bit. So we're going to talk about that a little bit. So the difference between web services and web applications. Your web application is like a typical web interface. It's the GUI that renders in a browser and it talks directly to the web application back end. The web service, on the other hand, is more of a programical interface to talk to a web application back end, right? So the typical web application that we see these days are REST and SOAP. There are other ones that are used, but typically they're a variation of some sort of XML, like REST type service. So you can see here, they've been around for a while, right? REST was created in 2000, were introduced in the year 2000. SOAP in 1998. So they've been around for quite a while. REST is based on HTML. It's based on HTTP. Uses HTTP methods, which gives it the ability to be lower overhead, right? SOAP, on the other hand, is more structured. Uses a WSDL, the web services description language. And it works on top of any communications protocol, not just HTTP. But typically you see it used on HTTP. So like I said, these have been around for a while. These are some of the DEF CON talks that I've found that people have done on web services testing. Back in DEF CON 13, Alex Deimos, he kind of introduced us to it and said, hey, look, these are things we need to look out for because they're coming, right? In DEF CON 15, Steve Warren talked more about some of the testing that we can do. It was mainly about SOAP at that point. And then one of my favorites, DEF CON 19, Tom Estes. He talked about the same thing that Jason and Josh Abraham did, don't drop the SOAP. And they went into some more real world attacks that you can do and showed off some cool tools that you can do. So, again, we've been talking about this for a while. So why are they still vulnerable, right? There's serious issues with these web APIs, these web services. And even though they've been around for a while, they're not new, right? So some of the reasons, first of all, they were designed originally to be for server to server communication, right? They weren't originally, they didn't have mobile applications or browsers in mind. They were typically used for server to server communication. They were also, you know, another reason why is because of the fact that they're more difficult to test, right? So if you do any web testing, web application testing, the tools that, some of the tools work, and we'll talk about that in a little bit, but some of the tools work with web services. A lot of times it just causes the tools to puke, right? You point it at a web service, try to scan it, it just doesn't work well. So in general, it's much more difficult to test web services. So when you have development teams who are doing some QA testing, a little bit of security testing on their apps, a lot of times they get overlooked. The other thing is, you know, the other thing that they're doing is, sometimes you'll see where they're implemented but not really documented. So someone rolls out a web app and they also install a web service interface, but they don't document it. Those are things that we see as well. So hey, if it's not documented, guess what? It's not going to get tested, right? So some of the common use cases, typically REST you'll see used in social media services, you'll see used in social networks, chat, things like that, because of the low overhead and the ease of deployment. SOAP, on the other hand, like we said earlier, it's more structured. It has some extra security features, I guess, built into or it's easier to install or deploy the security with WS services. So you'll see those more used with financial services, payment, things like that. But they're quickly migrating from the SOAP to REST because it's just so much easier and so much lower overhead. So this is one of the biggest reasons, too, is the speed. Basically this graph is just showing us, it's a benchmark of the speed of the different services. And you can see in the blue, the REST using JSON is just extremely, extremely fast compared to SOAP, right? So of course that's a reason why it's being deployed more that way. So talked a little bit about, you know, the basics of web services, what they are. What I want to do now is talk more about some actual things that we've seen, some defects that have been filed, things like that, just to show you that they really are still insecure and these things are out there and you can find them if you know how to test them. So this first one here was found. This is with Facebook. This is the Facebook found just recently in February 2015 by Laxman. Basically what he did was he found a way to utilize, he found a way to delete anyone's photo album, right? This is on the Facebook graph API. It uses REST and JSON. He also later on found a way to view other photos. And he actually, he got pretty good bounty for it, too. You know, if you find something like this in Facebook, it's pretty serious, right? And it was pretty simple, right? Look, this is the proof of concept code. That's it. All he did was replace the access token, right, with the access token for, that was used for Android, right? He used the access token that wasn't meant to be used for this application but it allowed it and he was able to do all these things, right? So, yeah. Fairly simple attack. Netgear, this is another one. A little bit different. This is with their devices. They have a SOAP interface that's used for remote management. So, if you have, there's a desktop app you can install and you can remotely manage your Netgear device. And one of the things that makes this even more serious of a defect is the fact that you can turn on this SOAP interface on the outside, on the WAN interface. Once you do that, then anyone can access it. And again, this is basically an authentication issue. They were able to bypass authentication connecting through the SOAP. So, you know, it's a situation where they overlooked this interface for, you know, for the device. Moon Pig, I had never heard of Moon Pig, but apparently they're a really big good reading card company in the U.K. But this one, you can see here, was originally reported in August of 2013. It's a little old, but the reason why I put this in here is because it still existed as of January 2015. So, they obviously don't really care that much about security because with this one, it's very simple. All we had to do was swap the customer ID. Once he was logged in, swapped the customer ID with another customer ID. So, you could go in and manipulate their orders or get any of their personal information maybe that they put into an order like credit card numbers, things like that. So, again, kind of a serious thing. Citrix, this one is, this one is with SOAP. And this is a little more, this is a different type of attack. This is actually a memory corruption attack. This is a memory corruption attack where they were able to get root access to the system via the SOAP interface. All right. So, a little bit more complex of an attack, but this is just another type of thing that you can, you can, you can attack with these web services. So, this gentleman, Randy Westergren, he, you'll see here, he's got a couple of them here. He was pretty busy in January 2015. But, you know, he got curious. He wanted to see what he could do with his, his My Fios mobile, application. Started looking at things and found that he could view anyone's e-mail. Basically, based, all he had to do, again, was swap the user ID out with a different person's user ID, which typically the user ID is going to be e-mail address, right? So, it's not that difficult to find. And this was through the, the, the REST, REST interface for Verizon, for the Verizon app. So, again, here with Randy, he, he found what he was looking for. So, this is the one with the, the Marriott application, mobile application. And with this one, all it used for authentication was the membership ID. So, very simple to find those things and swap them out. And, and get access to things that you're not supposed to, right? So, the whole point of these slides here was to kind of point out that these things really do, they're still happening. These, you can still find these, these types of vulnerabilities. And, and, and, so, done talking about that. Let's talk about how do we, we attack the web services. So, with web services, we can do a lot of the same attacks as we can do with web applications. So, web applications, we do cross-site scriptings, SQL injection, command injection, things like that. Cross-site scripting is not as prevalent with web services because of the, you know, because of the way it, it renders. But typically what you can do is persistent cross-site scripting attack where you inject the, the, the script via the, the services interface and it shows up on a web, web interface. Because typically what you're going to see is you'll, you'll have a web server, you'll have a web interface and a services interface to access. So, a lot of times you can inject in the web service and, and it'll show up on the, the web interface. Authentication attacks are another thing that, that, those are the most prevalent issues that, that, that I've seen out there. So, very similar types of attacks that we see with web services that we see in web applications. On top of that, we also have some new types of attacks based on XML, right? So, XML injection, XPath injection, very similar to SQL injection, query injection and XML entity, XML external entities, different ways you can manipulate the, the XML files to inject things. So, these are some additional types of attacks that you can look for in these types of services. So, I know what you're saying. I've heard enough of this basic stuff. Tell me how to break it. All right. So, the rest of, that's what we're going to talk about. So, first of all, burp is the bomb. Anyone else, anyone use burp? Yes? Okay. Any time you see this slide, I want everyone to say burp is the bomb, okay? So, let's start with SOAP testing. What is SOAP? Kind of talked about this already. Simple Object Access Protocol. It's very structured. Uses XML. And it relies on other application layer protocols, right? So, this is what a, a typical SOAP message would look like. You have, let me see if I can use the slide. You've got the envelope, right? And then you've got a header and a body. Now, all of this is going to go into, you know, another header, right? So, whether it's HTTP or whatever else you're sending your SOAP message over, right? So, you'll see when we talk about REST, why REST is so much more lightweight when we get there, right? So, this is the typical structure of what the, what a SOAP message is. This is what it looks like in, in, in a request, right? You've got the envelope starting here and the header and the body, right? So, what a, a WSDL file, the Web Services Description Language, SOAP has this and basically what it is, is it's a file that, that has all the information about what the web service does, right? So, when you, when you, when you want to attack a web service, what you first have to do is figure out what the, what the capabilities of the app are, what services, what functions you can use. Um, and what, to figure out what types of things you can attack. So, if it's a shopping cart or something like that, um, can you update the shopping cart? Can you, um, cat, check out? Things like that. You've got to figure that stuff out first to understand how to attack it. So, a WSDL file is nice for, for hackers because it's like a blueprint, right? It tells you all that information that you need to know to figure out how to, how to attack this, right? So, it's got all the definitions of, you know, of, of, of the web service, right? So, it's all written in XML, and you can see here, this is kind of a, a crappy slide here, but, uh, this is what a WSDL file looks like. It's got a ton of information about the service. Um, and, uh, you know, we'll talk here about how we can use that file. So, I mentioned WS security earlier. Um, what this is, is an extension of SOAP. Uh, you can use this to kind of enhance the security of, of your SOAP interface. It, uh, it allows you to, it helps you to address things like authentication, signatures, and encryption. Um, this is somewhat of an advantage over REST because, uh, REST doesn't necessarily have this extension. There's other things that you can do to add it on, but, um, this, this is something that's been used for a while, and, and it's fairly helpful. So, uh, what are the tools that we're going to use, right? Um, so, there are some tools, uh, like, like SOAP UI, right? SOAP UI is built for, uh, for, uh, it was originally made for, um, interoperability testing and functional testing, things like that. But it now has some security features where it will pull in a WSDL file and then create test cases for you. Um, we'll talk next about how I like to use it. Uh, but some of the web scanner tools, like web inspect, app scan, things like that, they understand WSDL files and they can consume the WSDL file. So, you, you, uh, uh, you, you start up a scan and you pull in that, that WSDL file and it's going to populate the, uh, the, the tool and, and, and, and then build its test cases from there. So, those, for, with SOAP we can use things like web inspect and app scan, not so much with, with REST. Um, and what we typically use, which, what I typically use is a combination of, uh, burp and something like SOAP UI, some sort of, uh, client that I can, uh, you know, I can, you know, I can populate, uh, burp suite with or zap and then I can do my, my testing from there, right? So, we'll talk about that. So, SOAP and burp works well together. Basically, what you're gonna do is you're gonna configure SOAP UI to proxy through burp. So, all the test cases that, that SOAP UI give you, you can now feed those into burp and then, um, manipulate, uh, the test cases in burp, replay them, use all the same tools that you have in burp uh, to, to, um, carry out your attacks. Uh, so there is a, what, um, by default, burp does not support WSDL, but there is a, uh, a plug-in that was written by Eric Gruber, um, that will pull in that WSDL file and populate it with the operations. Basically, what you do is you, you install this plug-in, right? When you, uh, you, you, you, you feed a, uh, uh, a, uh, a SOAP request, you feed a SOAP request through burp and from there, uh, when you find this, a request that includes the WSDL, all you have to do is right click on it, uh, on the request and say parse WSDL and then you'll get this little tab that says, uh, WSDLer. From there, you can see all the parsed operations. So, it's a handy way to feed some of these things in there. Um, these are all just different ways that you can, you can test these things. So, I said there are some issues with, with tools. So, I'm gonna go ahead and show you how you can test tools, right? And the tools don't always work with web services. One of the reasons why, uh, it's tested less and there's vulnerability still. Um, authentication is a big issue. Uh, certificates, we're gonna, you're gonna see next year, um, something we can, we can do to get around that. Um, and then sometimes missing form data can be, you know, issues that we run into. Uh, so, the certificate issues are typically some sort of, uh, you have a client. So, so, if you're doing a web, web, uh, test, if you're using a, testing a web, web application, what you're gonna do is, it's easy. Use your browser and, uh, if it's using HTTPS and it doesn't recu-, if the services is some, is, uh, or if the certificate is invalid, it'll tell you and you just say, okay, I wanna install this cert and it'll go through burp, no problem. Well, when you're testing these APIs or these, these mobile clients, mobile apps, sometimes you can't do that, right? Um, it makes it, it's just a little bit more difficult. So, one option is to, um, install the CA cert, of course, if you can do that. A lot of times, if it's like a mobile app, you have to email it and move it around. Kind of difficult. One, uh, really easy workaround, though, is, is to use the, uh, force use SSL option in burp. Um, basically, what you do is, you go into the proxy listeners and edit the request and, or edit the, uh, request handler and tell it to force SSL. So, now, what that's gonna do is, uh, from your emulator, uh, from your, uh, or your, your, your app, app, whatever you're testing, the client you're using, you're gonna do HTTP from there to burp and then burp is then gonna convert it, is gonna use SSL from there to the, the back-end API. So, it, it makes things, uh, work all together because the, the back-end API is expecting HTTPS. You have to run HTTPS. So, anyway, that's a quick little, uh, workaround to some of the certificate issues that I've run into. So, let's talk about REST testing. So, uh, REST is representational state transfer. Again, it's based on HTTP. Uh, you can use the HTTP methods like GET and POST. Um, and typically, what we see is, is, uh, you're using some, either JSON or XML, right? So, this is what a typical, uh, RESTful URL looks like, right? Looks very similar to a normal HTTP request, right? Uh, you've got your hosts, the port, and then the API directory. So, you can, you can, you can, you can, that, that you're calling, um, the specific functions. So, uh, say it's a, it's a shopping cart. You know, you might have something like product here and then the element would be product one. Uh, so, if you did a GET request, this would return product one. Um, very similar to HTTP. Simple to, uh, to see. Um, this is a, this is what a message looks like, right? So, we talked about SOAP. With SOAP, we would have, you know, this all, the envelope and everything else here. And in the envelope is where, you know, the, the, the, the, the, you the methods are, right? With rest, we can directly interact with just using HTTP methods, right? So you can see here why it's so much more lightweight, right? And one of the reasons why this is being used a lot more. You also have, so you have your typical HTTP methods like put, get, delete. You also have something called patch. What patch does is it allows you to update a specific piece of the XML instead of having to provide, you know, the full entity. So this is what you would see here for a rest request. This is our simple request looking for just asking for product one and this is what it returns, right? So this is an XML and this is returning just what product one is, right? Restful authentication, a lot of times we see basic authentication. I think we all know why basic authentication is bad, especially if you're doing it over HTTP and not HTTPS. So typically this is what we see which is bad. What's, the preference and what we recommend is using something like OAuth or SAML, right? So there is a WSDL type file for, you know, REST, but it's not used very much and mainly because it's not as valuable. There's not as much helpful information. So what I see, I don't see, I don't see WADL files being used very often with REST. So and the other thing is a lot of the tools don't, don't, don't work with, with WADL files either. So typically with a REST interface what you're going to have to do is you're going to have to look more at documentation, okay? To figure out what those services do. And we're going to talk more about how we can figure out what those services, what the functions are using burp. So here's some of the tools that we're going to use. Obviously we're going to use burp. Why? Because burp is the bomb. We can use SOAP and we can even use something as simple as curl. Because it's based on HTTP, we can use a command line tool like curl to populate burp suite with all sorts of other things. So we're going to talk more about all the functions that we want to do. So this is, so let's talk about using curl. So it's very simple. What we're going to do is with curl we can use the dash X option and send it through burp suite, right? So here we're sending all of our traffic through burp suite. We get the authorization token. We paste it in here using this, the header option. And this is our request, right? And we can use some different options like, let me go to the next slide. What we can do, too, is we can even for the payload, right? So if we need to send a larger payload, obviously you can't really put it all into the command line. But what we can do is we can use the dash data and pull in this XML file which looks like this. And this is what would have our payload, right? So all from the command line, we're pumping it through burp and populating burp with all this information that we can then use to attack it, right? Another thing you can use, you can use is there's different Firefox extensions. One that I like is called Poster. Very simple to use. Like I said, it's a Firefox extension you can install. You build your requests right in the interface and feed them through burp and you'll get your responses right back in the browser. So very simple to use. Really you can use whatever you want. The main thing is that you want to get everything going through burp so that burp understands and is populated with all these different requests. From there you can manipulate and attack, right? So let's talk about mobile app testing because this is where we see, this is where the rise in web services is happening, right? So at this point, we know mobile apps use some sort of web service typically. Not all of them, but a lot of them do. So we're going to test them. We know that we need to get to test them. We need to somehow get the requests from the mobile app through burp suite or we need to understand those, those, those requests. We need to populate our tool, right? So what we're going to use is burp. Why? Burp is a bomb. All right. Okay. So this is what our lab setup is going to look like for mobile testing. Some sort of emulation. We don't have enough time to do it for emulator so you can use Android emulator, iOS emulator. I find the Android emulator is easier to use for various reasons. Burp suite and then to proxy all of our traffic through and then obviously our web API. Okay. So this is what we're going to do. So what we're going to do and I'm going to show you a demo in a few minutes here. We're going to fire up burp suite. From there we're going to start up our emulator and it's fairly simple if you've never done this to send your emulator, this is for Android, to send the traffic from through burp suite you just start it from the command line with these options here and all of your emulator traffic will then go through burp suite. Okay. So you start up your emulator. From there you start up your mobile application and you just start going through all the functions, right? Go through the mobile application, whatever the functions are, add to cart, delete, delete, delete, delete, delete, delete, delete, whatever. Run through all of them because while you're doing that and it's going through burp, it's giving us all the information that we need to then attack it, right? We don't need to, when we do it this way, we don't need to read as much documentation about what the service is, right? Because we can just, we can learn it all using the proxy. So this is what you're going to see in burp once you start feeding all that traffic through there, right? You should see in proxy history, you'll see all the different requests that you submitted and then from there we can start analyzing it, right? So like I said before, what we're trying to do is we're trying to feed the burp monster. We want to get all that traffic through there and then we can analyze and attack. So once we run through all these functions of the mobile app, we have all the information in burp, now we can start examining the traffic, analyzing it to understand what's going on in the app. So these are some of the things that we're going to look for, right? We're going to look for input parameters, X path, different types of, what type of authentication is it using? Is there a way that we might be able to use, do command injection? Again, a lot of the same stuff that we do with web applications, just kind of a different way to go about it, right? Burp is the bomb. Burp is the bomb. Burp is the bomb. Thank you, sir. All right. So now we can attack. Now we've analyzed it in burp. We've looked at all the requests. Now it's time to attack, right? Now what can we use? In burp, we've got burp intruder. We've got repeater. And then, of course, you have to have an evil mind set. You have to be thinking about how can I break this API? How can I do something that isn't expected, right? All right. So we're going to go ahead and do a demo. So we're going to wrap up with a demo. Basically what the demo is, is using, we're going to use Xamarin, which is an Android emulator. It's kind of handy to use. Of course, burp suite. And hackazon, so hackazon is kind of like a damn vulnerable web app, one of those types of tools, right? It's really cool, though. It was originally, I think, created by NTO. And now, I think, we're going to be able to use it in the future. I think they belong to rapid seven. But anyway, if you Google hackazon, you'll find it. It's a nice set up that you can use for doing some different testing. All right. So let's see if this plays. Okay. Here we go. So we've got our emulator. We're going to start up burp suite. Start up. All right. Okay. So now what we're going to do is we're going to, I'm going to, you see here, this is how we set up our emulator to feed everything through burp, right? So you go into the network interface. Sorry if this is kind of fast. So you configure it to go through this interface on burp suite. So that's all set up. So now all of our traffic from the emulator, from any application on the emulator, is going to go through burp suite. All right? So proxy history is clean. We go into hackazon. And then we go to the emulator. And this is basically just a shopping cart app, kind of like Amazon or something like that. But it's, you know, it's a demo app, right? So what we're going to do is we're going to go through and start going through functions. So we add one of these Martha Stewart pom-pom pink, I don't know what that is. But we add that to the cart. And then we're going to look at the actual request. So we see here it's doing a put. It's using rest, of course. And it's using JSON. So this is all the JSON. Right? So from here we figure out, okay, let's send it over to rest and see what we can do with this request. So, yes. So you can see here we're able to change the price. Not a good idea, right? I mean, a client can manipulate these things. You shouldn't be able to change it. So change it. Send it. We get a 200 okay. We'll refresh our cart and see what it looks like. All right. Yeah. So we were able to buy one for a dollar. Instead of $10. Fail. Let's see what else we can do. So we can also update the quantity. Send that. Refresh our cart. All right. $20 is going to cost us. Maybe we can do something even more evil. I mean, I still don't want to pay $10 or $20 for these pom-pom things. Let's see what happens when we use negatives. Send the request. Request. No. The first thing, before we send refresh our cart. Look at that. Now we're getting $20 back. That's still not enough. I want to see if we can get more. I don't think there's any limits here. I think we can keep going. Send our request. Refresh. All right. Now we're getting $20,000 back. That's much better. Much better. Now let's see if we can actually proceed to check out. At this point we don't know. Maybe we can't. Maybe they're going to check it at some point. Let's see if we can do that. Place the order. Right now it's still $20,000. Still hasn't changed it. It hasn't flagged it yet. All right. Success. So if we use PayPal, maybe we went back to our PayPal account. That's a nice bonus there. So anyway, like I said, this is a demo app. The point is these are some of the types of issues that you'll see. And they're out there. Right? You just have to look. You know, what I recommend at this point, you know, what I recommend is start looking through these mobile applications. So this is a demo app. But you can run through some other applications. I'll tell you that I've gone through a couple of them. I'm going to show you a couple of them. I've gone through some and found some things and applications that I didn't expect. Okay? I couldn't do that demo here because the things that I found weren't disclosed. But feel free to go back and do some testing. Because it's kind of fun to find, you know, some of these vulnerabilities that you wouldn't typically find in web applications these days. But go forth and test. That's all I have. Thank you.