00:00:00.067 --> 00:00:07.674 All right. How is everybody doing? Good? So all the opening 00:00:07.674 --> 00:00:10.377 acts are finished. It's time for the headliner. Before we get 00:00:10.377 --> 00:00:15.916 started with the last talk, which is going to be awesome, I 00:00:15.916 --> 00:00:18.685 need to remind you guys that when we finish this, we're going 00:00:18.685 --> 00:00:21.989 to need to dump the room so that we can prep for closing 00:00:21.989 --> 00:00:24.157 ceremonies. They have to move air walls and do all that kind 00:00:24.157 --> 00:00:28.662 of stuff. So we know you'll have questions and stuff like that. 00:00:28.662 --> 00:00:32.132 Try to catch him in the hall and exit out the back just as 00:00:32.132 --> 00:00:36.069 quickly as normally as you can. That will help us get set up and 00:00:36.069 --> 00:00:41.375 get squared away for closing ceremonies. Make sense? Now, 00:00:41.375 --> 00:00:44.444 since the last time I get to talk to you guys until next 00:00:44.444 --> 00:00:47.214 year, I want to thank you guys. I take vacation for this. How 00:00:47.214 --> 00:00:53.320 many take vacation for this? We've had a lot of others, I 00:00:53.320 --> 00:01:00.527 think, but this is the best in the world. There we go. Let's 00:01:00.527 --> 00:01:06.533 get this started. So let's give Zeke a hand. He's the last talk 00:01:09.369 --> 00:01:16.877 of the day. ( Applause ) >> Thank you, everyone, for 00:01:16.877 --> 00:01:20.781 sticking around for my little talk. As the man said, I'm 00:01:20.781 --> 00:01:26.787 headless Zeke. This is my talk. I swear I'm going to try and not 00:01:29.356 --> 00:01:35.362 sing salt and pepper. That's a lie. I'm going to sing. Let's 00:01:39.566 --> 00:01:45.572 talk about you. Okay. Introductories. I'm a security 00:01:47.574 --> 00:01:54.247 researcher at the awesome HB tipping point. I'm on the TP 00:01:54.247 --> 00:02:00.187 labs team, but before that I was at rapid 7. Rapid 7. Before that 00:02:02.289 --> 00:02:07.260 Breaking Point. Somebody. So, yeah, I've spoken at a few 00:02:07.260 --> 00:02:12.099 conferences before. This is actually my second time speaking 00:02:12.099 --> 00:02:19.239 at DEF CON, so unfortunately no shot for me. Even though I think 00:02:19.239 --> 00:02:21.575 the last time didn't even count because it was like the little 00:02:21.575 --> 00:02:24.911 time slot, and it was many years ago. So I think I should get 00:02:24.911 --> 00:02:32.352 another shot at that. But, yeah, so I've been around a little 00:02:32.352 --> 00:02:38.358 bit. Recon insomniac and I did both that was awesome, but 00:02:40.961 --> 00:02:47.300 anyways, I'm more excited to be here. So in my spare time I do 00:02:47.300 --> 00:02:49.369 the same thing that I do professionally, which is just 00:02:49.369 --> 00:02:52.439 tearing devices out of my house and seeing if I can break them, 00:02:52.439 --> 00:02:58.445 which tends to tick off my wife and kids or whatever. I read 00:03:01.882 --> 00:03:07.187 some comic books. The jewel of my collection is a first 00:03:07.187 --> 00:03:11.091 printing of Alan Moore's Batman the killing Joe which is 00:03:11.091 --> 00:03:15.729 awesome, which I bought for 75 cents. That's near here for 00:03:15.729 --> 00:03:22.969 their. Anyways, a little fun fact about me to give you an 00:03:22.969 --> 00:03:26.640 idea of the kind of person I am, I guess. I once got a job at a 00:03:26.640 --> 00:03:29.509 police department when I had four active warrants out for my 00:03:29.509 --> 00:03:35.382 arrest. That's kind of hiding in plain sight, I guess. Nonviolent 00:03:35.382 --> 00:03:41.388 crimes. Didn't I. Let's get into it. The Internet of things is a 00:03:49.563 --> 00:03:53.366 thing whether we want it to be or not. Putting a network 00:03:53.366 --> 00:03:57.938 interface on a random device is very in fashion right now in the 00:03:57.938 --> 00:04:03.877 season. Even if it has no reason to have an Internet connection, 00:04:06.580 --> 00:04:11.351 even if it's not a good idea at all. Basically all of our 00:04:11.351 --> 00:04:16.490 devices are smart devices now, but they're not actually that 00:04:16.490 --> 00:04:20.026 smart. They need a very simple way to communicate with each 00:04:20.026 --> 00:04:23.897 other. They all need to speak the same language and be able to 00:04:23.897 --> 00:04:27.501 without us getting involved, and that's what makes them smart. 00:04:27.501 --> 00:04:34.307 That is basically handled with SOAP services, which I'll talk 00:04:34.307 --> 00:04:41.648 at length about. Anyways, very broadly they're very super 00:04:41.648 --> 00:04:47.320 talkative services. You can jump on an unknown network, send out 00:04:47.320 --> 00:04:51.458 a few packets, and you'll find these devices and they'll tell 00:04:51.458 --> 00:04:57.030 you who they are, what they can do, what you can do to them. 00:04:57.030 --> 00:05:02.135 Really awesome and you, too, will be able to do that by the 00:05:02.135 --> 00:05:06.740 end of this talk. Yeah, also a really important part of these 00:05:06.740 --> 00:05:12.679 is the whole working together without getting us involved 00:05:12.679 --> 00:05:16.349 means things like authentication doesn't come into play, because 00:05:16.349 --> 00:05:19.853 you don't want to bother your users with entering passwords 00:05:19.853 --> 00:05:22.756 and things like that. That gets in the way of the seamless 00:05:22.756 --> 00:05:28.995 experience. So I do have to talk about a couple of definitions 00:05:28.995 --> 00:05:33.667 real quick. These terms are sometimes muddied up 00:05:33.667 --> 00:05:38.271 interchangeably at times. I'm probably going to do the same 00:05:38.271 --> 00:05:42.509 thing in my talk just because there's so much overlap in this 00:05:42.509 --> 00:05:50.383 protocol. Basically it breaks down like UPNP is what I 00:05:50.383 --> 00:05:57.390 considered the 3G side of things. SSPD is kind of hand in 00:05:57.390 --> 00:06:04.731 hand with UPNP and then SCPP is more on the definition side when 00:06:04.731 --> 00:06:09.269 we move over to TCP, it becomes clear in a moment. That's like 00:06:09.269 --> 00:06:14.908 the control where you send actions to the device. All 00:06:14.908 --> 00:06:21.781 right. Let's talk about all the good things. I'm warning you now 00:06:21.781 --> 00:06:25.452 this next part is going to be a little bit dry, but I'm a nice 00:06:25.452 --> 00:06:30.423 guy so I put a TLDR slide at the end. Until then if you want to 00:06:30.423 --> 00:06:33.793 put your heads down and relax, I'll be sure to wake you back up 00:06:33.793 --> 00:06:39.799 when we get to that point. Okay. So, UPNP operates on UDP board 00:06:43.737 --> 00:06:48.942 1900, responds to multi-cast packets, which comes in very 00:06:48.942 --> 00:06:54.948 handy as you will see. UPNP.org defines the stack thusly, so 00:06:54.948 --> 00:07:00.887 they could -- it's kind of like an umbrella term encompassing 00:07:00.887 --> 00:07:05.825 everything else. So it's actually six layers to the 00:07:05.825 --> 00:07:10.897 stack. There's a layer zero, but I didn't wanting to through 00:07:10.897 --> 00:07:13.833 having to explain how to get an IP address, because I think 00:07:13.833 --> 00:07:18.438 that's kind of superfluous. If you don't understand it, you're 00:07:18.438 --> 00:07:20.707 probably not to this point yet. Anyways, so discovery, 00:07:20.707 --> 00:07:28.181 description, control. Eventing and presentation I'm not going 00:07:28.181 --> 00:07:34.220 to talk about. It's kind of a ( inaudible ) this presentation. 00:07:34.220 --> 00:07:36.222 That's going to be -- inventing is like listening for events 00:07:36.222 --> 00:07:42.228 sent back from the device. Presentation is presenting the 00:07:45.699 --> 00:07:53.139 SOAP actions in like a UI to the user, which I guess means the 00:07:53.139 --> 00:07:57.977 web management portal, because that's the only thing I've seen 00:07:57.977 --> 00:08:03.216 that even comes close to doing something like that. So anyways, 00:08:03.216 --> 00:08:09.756 all right. UPNP discovery. This is everything you need to 00:08:09.756 --> 00:08:15.562 perform UPNP discovery. There are actually two types of 00:08:15.562 --> 00:08:17.564 discovery. The left side of the screen is passive discovery and 00:08:17.564 --> 00:08:20.467 the right side of the screen is active discovery. So with 00:08:20.467 --> 00:08:27.707 passive discovery you can just sit there and listen for packets 00:08:27.707 --> 00:08:33.413 coming in on UDP port 1900. If you see these notify things, you 00:08:33.413 --> 00:08:38.284 can just pull out the location URL or the URL and the location 00:08:38.284 --> 00:08:42.555 header and make a note of it. Or if you want to take a more 00:08:42.555 --> 00:08:46.993 active approach, you could do what's called an M-search 00:08:46.993 --> 00:08:52.399 request, and you get an HDPD reply. You notice all of these 00:08:52.399 --> 00:08:57.437 are basically the HDPD over UPNP. That's intentional. It's 00:08:57.437 --> 00:09:04.978 very, very similar. Then, again, in the response that you got to 00:09:04.978 --> 00:09:10.550 the end search, pull out the URL from the location header. 00:09:10.550 --> 00:09:14.554 Basically this guy is your new best friend. Any network that 00:09:14.554 --> 00:09:19.259 you connect to you should send out an M-search probe on, and 00:09:19.259 --> 00:09:22.729 you will be amazed at the devices that tell you, here I 00:09:22.729 --> 00:09:30.336 am. Talk to me, talk to me! So, yeah, any network you're on, 00:09:30.336 --> 00:09:36.342 your home network, your business network, a hotel in Las Vegas. I 00:09:42.182 --> 00:09:46.252 don't know. So if you pull out the URL from the location header 00:09:46.252 --> 00:09:51.791 and you do a get request, what you will get is the description 00:09:51.791 --> 00:09:56.930 layer. So this is going to be a huge part of XNL that defines 00:09:56.930 --> 00:10:04.537 everything about what the device is. So you see the version info 00:10:04.537 --> 00:10:11.511 which is UPNP 1.0. It's whatever version they're using, and I've 00:10:11.511 --> 00:10:16.249 only seen 1.0. There's a bunch of device definitions, which 00:10:16.249 --> 00:10:20.553 when we go to the next slide you see what it looks like. It tells 00:10:20.553 --> 00:10:27.026 you exactly what the twice is. It's really great. Anyways, the 00:10:27.026 --> 00:10:32.132 important things to pull out is you see the services list is 00:10:32.132 --> 00:10:35.301 going to list all of the SOAP services that are listening to 00:10:35.301 --> 00:10:40.640 the device. That's going to contain the service type, CPD 00:10:40.640 --> 00:10:44.444 URL which we need later on and control URL that we need later 00:10:44.444 --> 00:10:50.850 on and event URL, which we don't care about. All right. I don't 00:10:50.850 --> 00:10:54.354 think there's any way anything could possibly read that. I'll 00:10:54.354 --> 00:11:00.093 just do my best to be descriptive. So at the top 00:11:00.093 --> 00:11:07.200 there's the version like I was saying, and then you see the -- 00:11:07.200 --> 00:11:11.204 it's -- I wish you all could read that. Anyway, can anybody 00:11:11.204 --> 00:11:15.875 read it? >> I can. >> There you go. You can see this was a 00:11:15.875 --> 00:11:19.846 mystery device. We have no idea. We just sent an M-search and 00:11:19.846 --> 00:11:24.484 followed the URL we got back, and all of a sudden we know it's 00:11:24.484 --> 00:11:28.588 in -- a Netgear 3100 router because it told us so, which is 00:11:28.588 --> 00:11:35.261 great. These three fields are the service type that we need 00:11:35.261 --> 00:11:41.267 when we compose our control. Then the SEPD URL and the 00:11:43.670 --> 00:11:51.010 control URL. So if we follow that SCPD URL what we get back 00:11:51.010 --> 00:11:57.016 is another wall of XML. This contains the version info. This 00:11:59.352 --> 00:12:01.888 one is where it starts to get really interesting because this 00:12:01.888 --> 00:12:05.191 is where the device tells you what it can do and what you can 00:12:05.191 --> 00:12:11.998 do to it. So you're going to see a list of actions, and these 00:12:11.998 --> 00:12:17.036 will contain the arguments that the action takes, whether it's 00:12:17.036 --> 00:12:20.373 an input or an output. So me sending to you or you sending to 00:12:20.373 --> 00:12:22.375 me. Then variable definitions where it gives you the name of 00:12:22.375 --> 00:12:28.381 the variable and then ties it to the data type at the end. So 00:12:32.952 --> 00:12:36.489 literally tells you everything you need to know. Makes it 00:12:36.489 --> 00:12:40.393 really, really easy, and again, this is what that looks like. 00:12:40.393 --> 00:12:46.399 These slides are on the CD. You'll see this says set default 00:12:51.537 --> 00:12:58.077 connection service, and then takes an argument of new default 00:12:58.077 --> 00:13:02.582 connection service. Down at the bottom the new default 00:13:02.582 --> 00:13:07.553 connection service is a string type. So if you want to set a 00:13:07.553 --> 00:13:11.557 new -- set a default connection service, you give it a string 00:13:11.557 --> 00:13:16.562 argument in the new default connection service action 00:13:16.562 --> 00:13:22.568 argument. Okay. So finally we get to talk about SOAP. This is 00:13:25.338 --> 00:13:30.343 where we're sitting because after that information 00:13:30.343 --> 00:13:33.546 gathering, we take all that, put it together and actually get to 00:13:33.546 --> 00:13:39.852 send commands to the device and have it do what we say. So with 00:13:39.852 --> 00:13:45.358 SOAP the front end is very well-defined, always going to be 00:13:45.358 --> 00:13:50.763 basically the same idea. The back end you never know what 00:13:50.763 --> 00:13:54.967 you're going to see. It could be an RPC service or a CGI script 00:13:54.967 --> 00:13:58.738 or a Shell script. You really have no idea what's running on 00:13:58.738 --> 00:14:04.677 the back end. The way, again, is XML. Sound familiar? You perform 00:14:07.580 --> 00:14:12.985 a post request and you send it to the controlled URL we've got 00:14:12.985 --> 00:14:17.290 in one of the previous steps. The body of the post request 00:14:17.290 --> 00:14:20.259 going to be what's called the SOAP envelope, which is 00:14:20.259 --> 00:14:25.965 basically just an XML formatted API call. That's going to have 00:14:25.965 --> 00:14:31.404 the action argument and the type and all that. Easy piecy. Can 00:14:31.404 --> 00:14:37.410 people read this one? Kind of, sort of? No? Okay. So the things 00:14:40.546 --> 00:14:46.552 that are highlighted in red are from the description first off, 00:14:51.457 --> 00:14:57.463 the things that are in blue are from the SEPD. The action 00:14:57.463 --> 00:15:01.701 definition. So we're putting them altogether. The things in 00:15:01.701 --> 00:15:06.105 black are fairly standard, and going to be the same over and 00:15:06.105 --> 00:15:12.111 over again. So, yeah, this is how to SOAP. Okay. Everybody can 00:15:15.081 --> 00:15:21.120 start paying attention again now. This is the TLDR UPNP 00:15:21.120 --> 00:15:26.959 flowchart. You start out with the request and get back the 200 00:15:26.959 --> 00:15:31.831 okay with the description URL. You get a description URL and 00:15:31.831 --> 00:15:36.068 get a 200 okay and control URL. You syndicate it to the URL, and 00:15:36.068 --> 00:15:42.074 you get back another XML that has the action name and the 00:15:45.244 --> 00:15:48.981 arguments. Put all that together in a post request to the control 00:15:48.981 --> 00:15:54.720 URL, and hopefully you get back an HDTP 200 and executes 00:15:54.720 --> 00:16:00.326 whatever you sent to it. More often than not you get a 500 00:16:00.326 --> 00:16:07.466 error because you did something wrong. Okay? Even better 00:16:07.466 --> 00:16:11.971 screenshot. This one. So this one I actually had no intention 00:16:11.971 --> 00:16:17.977 of you guys being able to read. I just wanted it to put this on 00:16:17.977 --> 00:16:20.880 there to show you. It's a screen capture with SOAP specs on 00:16:20.880 --> 00:16:23.316 UPNP.org. This gives you an idea of the breadth and depth of 00:16:23.316 --> 00:16:30.523 things that are already officially defined in the 00:16:30.523 --> 00:16:37.196 UPNP.org specks. It runs the gamut from, you know, the 00:16:37.196 --> 00:16:40.900 obvious things like you can automate control of the 00:16:40.900 --> 00:16:45.004 audio/video systems. That's when you've got by remote to control 00:16:45.004 --> 00:16:50.109 your TV. Home automation. We see more and more of that with 00:16:50.109 --> 00:16:53.379 motion sensors and air conditioner controls working 00:16:53.379 --> 00:17:00.152 together to turn off your AC when nobody is home. It starts 00:17:00.152 --> 00:17:03.356 to get a little bit questionable when you start talking about 00:17:03.356 --> 00:17:07.960 things like physical security systems. I could kind of see a 00:17:07.960 --> 00:17:11.898 purpose for that maybe. Like being able to unlock the door 00:17:11.898 --> 00:17:15.268 from your cell phone might be kind of cool, but it might be 00:17:15.268 --> 00:17:20.606 kind of dangerous also. And then we start talking about how 00:17:20.606 --> 00:17:26.012 they're defining SOAP controls for like DS because why wouldn't 00:17:26.012 --> 00:17:31.617 you want to be able to control your nuclear power plant from 00:17:31.617 --> 00:17:35.721 your iPhone? That seems like a perfectly good idea. This is 00:17:35.721 --> 00:17:41.694 just what's officially defined. A whole can of worms when 00:17:41.694 --> 00:17:46.599 talking about vendors that decide to roll their own. You 00:17:46.599 --> 00:17:48.901 never know what's out there. The handy thing about SOAP is it 00:17:48.901 --> 00:17:52.939 tells you what it does. So dates. This is all awesome, and 00:17:52.939 --> 00:17:58.945 we live in the jetsons basically. We talk together and 00:18:03.015 --> 00:18:09.689 work together and everything is great. You have your toaster, 00:18:09.689 --> 00:18:13.626 turn off the lights, set the TV to the news channel, and send to 00:18:13.626 --> 00:18:16.662 you a text message that breakfast is ready. That's not 00:18:16.662 --> 00:18:21.033 even a joke. We can totally do that, and it's awesome, right? 00:18:21.033 --> 00:18:28.708 Everything is sunshine and rainbows. The end. And the bad 00:18:28.708 --> 00:18:36.382 things. So now we have the security. These things really 00:18:36.382 --> 00:18:44.090 have the system from the get-go. First off they're embedded 00:18:44.090 --> 00:18:51.364 devices, so we're talking about limited memory and space so 00:18:51.364 --> 00:18:55.534 you're not going to see like an exploit mitigation like memory 00:18:55.534 --> 00:19:00.840 corruption mitigations. Lots of time the board development and 00:19:00.840 --> 00:19:04.877 the software development are completely separate companies. 00:19:04.877 --> 00:19:08.848 The board is just cranked out by some hardware company and then 00:19:08.848 --> 00:19:12.585 different software vendors put their software on top of it and 00:19:12.585 --> 00:19:16.455 it's not always designed to go on top of it. You start seeing a 00:19:16.455 --> 00:19:21.193 lot of the same code, especially when you consider SDKs released 00:19:21.193 --> 00:19:24.897 by the board manufacturer. The software manufacturer is like, 00:19:24.897 --> 00:19:28.200 that's great. That's what I need. Just use that every time. 00:19:28.200 --> 00:19:34.206 All in an effort to keep costs down. Whether you talk about 00:19:38.110 --> 00:19:45.084 deployment, the attack surface is growing bigger and bigger as 00:19:45.084 --> 00:19:47.086 the Internet of things is growing bigger and bigger. We 00:19:47.086 --> 00:19:53.292 have millions of these devices on the Internet from every 00:19:53.292 --> 00:19:58.297 vendor you can imagine like, I don't know, I think even Nike is 00:19:58.297 --> 00:20:02.601 doing things on the Internet of things now. Yeah, I mean, it 00:20:02.601 --> 00:20:10.376 becomes really impossible to keep on top of firmware patches, 00:20:10.376 --> 00:20:14.480 especially if you're not able to actively push out updates to 00:20:14.480 --> 00:20:18.717 your customers. You have to rely on them to search you out and 00:20:18.717 --> 00:20:24.723 pull down the firmware update. It's never going to happen. So 00:20:27.827 --> 00:20:33.099 this slide has some statistics on it that I put on here. I just 00:20:33.099 --> 00:20:40.573 felt like it needed some statistics, so I put some on 00:20:40.573 --> 00:20:42.575 there. Yeah. XML parsing is really using a lot of resources, 00:20:42.575 --> 00:20:48.581 and there's a lot of bugs that come with it. You need to parse 00:20:54.887 --> 00:21:00.826 it properly. Yeah. In 2013 2.5 of all CVs were XML-related and 00:21:03.562 --> 00:21:09.602 of those almost 36% had CVVS severity of 7 or above. I know, 00:21:09.602 --> 00:21:15.608 right? Okay. With all that in mind, it's no surprise at all 00:21:21.847 --> 00:21:24.617 that there's a huge attack surface here spanning every step 00:21:24.617 --> 00:21:26.785 of the UPNP stack. Yeah, we start seeing all of the standard 00:21:26.785 --> 00:21:32.791 old school bones coming back again in a brand-new protocol 00:21:39.732 --> 00:21:45.738 like HDTP header parsing, command injection, XML parsing, 00:21:48.340 --> 00:21:52.378 and then you start to see new things like SSDP header parsing 00:21:52.378 --> 00:21:58.384 and XXE, XML external entity expansion. So what I would like 00:22:04.423 --> 00:22:10.329 to do now before I get into the really cool, fun stuff, I want 00:22:10.329 --> 00:22:14.633 to give you guys an idea of the attack complexity that we're 00:22:14.633 --> 00:22:19.405 talking about here. That's a pretty ( inaudible ) as you will 00:22:19.405 --> 00:22:24.276 see. I'll talk about some examples that have already been 00:22:24.276 --> 00:22:28.948 disclosed. So first off, can't talk about UPNP without 00:22:28.948 --> 00:22:32.051 mentioning the work of H.D. Moore from a couple of years 00:22:32.051 --> 00:22:35.988 back. I'm sure you all heard about it. He released a list of 00:22:35.988 --> 00:22:41.994 vulnerabilities. The 2012 5958 was one of those. Basically in 00:22:44.730 --> 00:22:50.736 many UPNP, I think, they were taking the ST header from those 00:22:54.807 --> 00:23:01.380 notify packets or from the insert packets and calling stir 00:23:01.380 --> 00:23:08.654 and coffee, which is good. The argument they used for the 00:23:08.654 --> 00:23:13.692 length to copy was based on the input that you were sending to 00:23:13.692 --> 00:23:17.129 it. It was based on the number of characters between colons and 00:23:17.129 --> 00:23:20.866 the thing. What you end up with is this, which is the 00:23:20.866 --> 00:23:25.204 vulnerability we saw since the '90s. The kind of thing we 00:23:25.204 --> 00:23:31.210 learned countless times and now they have the attack surface. 00:23:39.551 --> 00:23:44.690 One thing to know about this is this is a multi-cast packet. You 00:23:44.690 --> 00:23:49.862 can jump on a network and send this out without a working 00:23:49.862 --> 00:23:54.500 exploit as the payload. It will just bring down devices all 00:23:54.500 --> 00:24:00.072 across the network. Anything that's vulnerable to it. Another 00:24:00.072 --> 00:24:07.680 example of UPNP vulnerability was discovered by Zach Cudlett, 00:24:07.680 --> 00:24:13.686 who will I will mention again. This is the D-link DIR-15. 00:24:16.221 --> 00:24:23.162 D-Link has a terrible couple of years. I don't know if you keep 00:24:23.162 --> 00:24:29.601 up on this, but they've gotten really, really good at response. 00:24:29.601 --> 00:24:35.708 Like, they are one of the quickest vendors to respond to 00:24:35.708 --> 00:24:40.145 vulnerability disclosures now because they've had a lot of 00:24:40.145 --> 00:24:46.218 practice. Yeah, so here's a command injection vulnerability. 00:24:46.218 --> 00:24:51.023 Again, the ST header, this time they feed whatever you give it 00:24:51.023 --> 00:24:56.996 to a Shell script called M-Search with no validation or 00:24:56.996 --> 00:25:03.335 signaturization. I'm sorry. I always say sanitation. I have to 00:25:03.335 --> 00:25:08.474 enunciate. Yeah. What you end up with is this multi-facet packet. 00:25:08.474 --> 00:25:14.179 You can send it out on the network and have no idea they're 00:25:14.179 --> 00:25:18.050 in the network and you're popping boxes right and left. 00:25:20.319 --> 00:25:23.756 Yeah, so the ST had the colon whatever command you want to 00:25:23.756 --> 00:25:27.393 execute. This one was from this year, and the RT series devices. 00:25:27.393 --> 00:25:30.829 Again, disclosed by ( inaudible ). There's the link to it. This 00:25:30.829 --> 00:25:33.232 was even more school because we're looking at an M-copy with 00:25:33.232 --> 00:25:35.234 a buffer overflow and then copying the action that we're 00:25:35.234 --> 00:25:37.236 sending in a SOAP request into a buffer, which looks like this. 00:25:37.236 --> 00:25:39.238 So you see the SOAP action with the service type, and then the 00:25:39.238 --> 00:25:41.240 pound sign and then more than 2 --> 048 bytes of data for the 00:25:41.240 --> 00:25:43.242 buffer. You know, typical 90 zones over and over and over 00:25:43.242 --> 00:25:45.244 again. Broadcom also had a few bones disclosed recently. This 00:25:45.244 --> 00:25:51.250 one was in the set connection type of the new connection type. 00:26:13.772 --> 00:26:19.778 Sorry. The new connection type argument of the second 00:26:36.829 --> 00:26:42.835 connection type action. Again, format streaming vulnerabilities 00:26:52.744 --> 00:26:58.917 are back apparently. Same old same old. I'm sorry. I'm 00:26:58.917 --> 00:27:05.124 starting to get bored with this myself. So this is kind of the 00:27:05.124 --> 00:27:08.961 example of this vulnerability is a little bit arbitrary, but 00:27:08.961 --> 00:27:13.298 because this was in Python's SOAP libs, it was a pretty big 00:27:13.298 --> 00:27:19.671 deal. At least I thought so. This is a good example of an ( 00:27:19.671 --> 00:27:26.445 inaudible ). So he wrote an echo service so that it would just 00:27:26.445 --> 00:27:32.384 echo whatever you said, but you see the external entity defined 00:27:32.384 --> 00:27:38.724 at the top with a path to path SDWD. So the service is like 00:27:38.724 --> 00:27:41.727 I'll expand that to you and send back the contents of that file 00:27:41.727 --> 00:27:47.733 just fine. A shout-out to my homey in Austin, bran deny -- 00:27:50.769 --> 00:27:56.775 Brandon Perry. This is a simple command injection and the host 00:27:59.244 --> 00:28:05.250 name argument on F5 iControl devices. Shell demand dot 00:28:05.250 --> 00:28:11.256 whatever dot com is my host name. This is a great series of 00:28:14.026 --> 00:28:18.997 live posts. I definitely recommend anybody go out there 00:28:18.997 --> 00:28:23.635 and read them. He basically takes some -- I don't know if it 00:28:23.635 --> 00:28:28.640 was intentionally broken, but it was definitely broken code that 00:28:28.640 --> 00:28:33.712 was shipped with a device. And basically it goes through and 00:28:33.712 --> 00:28:37.749 fixes the code to be able to upload firmware images, whatever 00:28:37.749 --> 00:28:41.887 ones he wants. It's a wild ride now. It's a series of blog 00:28:41.887 --> 00:28:47.893 posts. Anyways, that was SOAP also. Now, demos are here. It's 00:28:52.798 --> 00:28:58.937 all right. That caption says the things you own will end up 00:28:58.937 --> 00:29:04.876 owning you. Okay. So can people read that? I can zoom that. 00:29:13.285 --> 00:29:19.791 Good? Okay. So when I first started this project, the right 00:29:19.791 --> 00:29:26.665 command injection puzzle, which I did after having to fix up the 00:29:26.665 --> 00:29:30.235 ruby SOAP parsing libs, which are woefully inadequate. I don't 00:29:30.235 --> 00:29:34.573 think they're supported anymore. The project seems like it hasn't 00:29:34.573 --> 00:29:41.913 had an update in years. This is SOAP 4-R, by the way. So I 00:29:41.913 --> 00:29:47.219 basically kind of forked it and then made a bunch of changes, 00:29:47.219 --> 00:29:52.057 but I can't remember what all I did. So I haven't been able to 00:29:52.057 --> 00:29:55.994 release these libraries, but I wrote this to the point where I 00:29:55.994 --> 00:29:59.631 could run it against something. The first thing I ran it around 00:29:59.631 --> 00:30:05.637 found a vulnerability. It's that easy. So the device that I ran 00:30:08.907 --> 00:30:14.146 it against happened to be this Trendnet TEW WiFi router, which 00:30:14.146 --> 00:30:20.152 I just happened to have laying in a pile at my house. I found 00:30:23.055 --> 00:30:27.392 the vulnerability in that. Then, after researching it with 00:30:27.392 --> 00:30:35.300 enormous amounts of help from my buddy Josh Smith of the ZDI 00:30:35.300 --> 00:30:40.105 Team, we found out that it actually was not just in this 00:30:40.105 --> 00:30:46.111 device with the binary of the SDK released by RealTek and were 00:30:51.083 --> 00:30:57.389 vulnerable and were thousands of devices across multiple 00:30:57.389 --> 00:31:02.994 manufacturers largely still unpatched. I think D-Link 00:31:02.994 --> 00:31:09.000 released a patch. Trendnet is not vulnerable to it because 00:31:11.103 --> 00:31:16.408 they don't use many anymore, which is where the vulnerability 00:31:16.408 --> 00:31:20.212 is. They use many UPNP which used to have the vulnerability, 00:31:20.212 --> 00:31:26.618 but it had been patched. Anyways, the details of the 00:31:26.618 --> 00:31:32.491 vulnerability, again, it's pretty -- okay. Hold on. Before 00:31:32.491 --> 00:31:37.362 I start the demo, I have to say one more thing. This was my ugly 00:31:37.362 --> 00:31:39.364 -- this exploit. M1K3, Mike released a much nicer version of 00:31:39.364 --> 00:31:45.370 this and put it in the framework. But I tried his -- in 00:31:53.745 --> 00:31:57.415 my hotel room, and even though I tried it before and it worked 00:31:57.415 --> 00:32:00.252 beautifully before, it did not work in the hotel room and 00:32:00.252 --> 00:32:03.455 that's what it accounted for me. This one did. I'm using the ugly 00:32:03.455 --> 00:32:11.129 version. Hang on. Dude, I'm sorry. We're looking at the 00:32:11.129 --> 00:32:16.968 wrong thing. Sorry. This is what we should be looking at. Sorry 00:32:16.968 --> 00:32:22.974 about that, everyone. This is a vulnerability in the ad port 00:32:25.243 --> 00:32:31.249 mapping action. This can be used as an Internet gateway device 00:32:33.418 --> 00:32:37.856 where somebody comes over and puts their computer on your 00:32:37.856 --> 00:32:42.461 network and neat port forwarding for gaming and whatever, their 00:32:42.461 --> 00:32:47.999 computer can forward ports through the firewall on the 00:32:47.999 --> 00:32:54.206 router, which is awesome, great idea. One of the actions is this 00:32:54.206 --> 00:33:00.145 add port mapping, and then you will see right here in the new 00:33:02.781 --> 00:33:09.754 internal client it will just execute whatever command I want. 00:33:09.754 --> 00:33:15.760 So without further delay, let's go ahead and try this. So this 00:33:20.565 --> 00:33:27.205 is going to send a bunch of add port mapping commanding over and 00:33:27.205 --> 00:33:29.841 over again because I have to build up my payload little by 00:33:29.841 --> 00:33:34.412 little and then mark it executable, and then I can run 00:33:34.412 --> 00:33:38.383 it. It takes a little while, and it's blind exploitation, so I 00:33:38.383 --> 00:33:45.624 can't tell if it even works until it works. Let's see if 00:33:45.624 --> 00:33:51.630 it's ready. Fingers across the room. It's connecting. Hey, 00:33:55.300 --> 00:34:01.239 there we go. ( Applause ) There we go. Thank you. I can't run 00:34:12.183 --> 00:34:20.091 like IB or PMI, but I can show every single process is running 00:34:20.091 --> 00:34:26.097 the route including the bottom. Root command injection on 00:34:28.733 --> 00:34:32.404 thousands and thousands and thousands of routers largely 00:34:32.404 --> 00:34:37.776 still unpatched. Some of them allegedly are even affected over 00:34:37.776 --> 00:34:41.112 the LAM port, although it's confirmed true in this device 00:34:41.112 --> 00:34:47.118 and not substantiated in others. So there's that. Next demo. I 00:34:52.157 --> 00:34:58.163 wanted a really visual way to demonstrate the danger involved 00:35:00.298 --> 00:35:05.337 in giving this amount of unathey not indicated control over the 00:35:05.337 --> 00:35:09.341 devices to any random person on the network. So when I was 00:35:09.341 --> 00:35:13.044 looking through the official specs, I came across this set AV 00:35:13.044 --> 00:35:19.050 transport URI action. Basically what this does is it takes a 00:35:21.386 --> 00:35:27.926 round of a media share just like a media file or it could be a 00:35:27.926 --> 00:35:33.565 gift or song or whatever you want. It sets that as the 00:35:33.565 --> 00:35:38.103 transport URI on the device. And then there's a play action where 00:35:38.103 --> 00:35:44.109 you then play it. So that's pretty great. So an idea. 00:35:47.512 --> 00:35:51.816 Scripts. This was the one that I was showing you earlier that 00:35:51.816 --> 00:35:58.256 would basically scan the network, find all of the TVs and 00:35:58.256 --> 00:36:04.195 Blu-Ray players, anything that implements this set AV transmit 00:36:07.699 --> 00:36:13.705 URI and rolled them. So yeah, this works on like Samsung, 00:36:20.011 --> 00:36:26.017 Sony, Panasonic, you name it. I'm going to show you a little 00:36:28.653 --> 00:36:34.659 video now. I'm going to show you this working. I didn't bring an 00:36:38.196 --> 00:36:43.001 RTV with me. I don't know. Hopefully the sound is working 00:36:43.001 --> 00:36:45.570 on this. It's really not going to be funny if the sound isn't 00:36:45.570 --> 00:36:51.576 turned up on my laptop. Anyways, give it a media share URL. It 00:37:01.319 --> 00:37:07.425 scans the network. It starts listing out all of the UPNP 00:37:07.425 --> 00:37:12.897 hosts that it finds. Then you see pretty close to the bottom 00:37:12.897 --> 00:37:18.903 it will say I found one ready to roll. All of a sudden the TV 00:37:21.573 --> 00:37:27.579 picture changes when you're watching. ( Applause ) So, you 00:37:30.682 --> 00:37:36.321 know, I don't condone this kind of behavior, but one could 00:37:36.321 --> 00:37:44.295 imagine going into like a large electronics consumer store, that 00:37:44.295 --> 00:37:50.301 kind of thing. You could even from a more malicious 00:37:52.704 --> 00:37:57.041 standpoint, if you found a bug in a video Kodak or something 00:37:57.041 --> 00:38:01.012 like that, this would be a great avenue to force the device to 00:38:01.012 --> 00:38:07.018 render it without any user interaction. So yeah, it's 00:38:10.789 --> 00:38:16.027 dangerous, and it's stupid to give this kind of control to 00:38:16.027 --> 00:38:18.329 just anybody. That's kind of the conclusion I drew in the 00:38:18.329 --> 00:38:24.369 immortal words of Tyler Durden, with enough SOAP one could blow 00:38:24.369 --> 00:38:30.074 up just about anything. Yeah. You have to really think about 00:38:30.074 --> 00:38:32.944 what your device is going to be used for and where it's going to 00:38:32.944 --> 00:38:37.282 be deployed before you just throw a network interface on it 00:38:37.282 --> 00:38:41.119 and throw a random service on it and let everybody talk to it. It 00:38:41.119 --> 00:38:47.292 makes perfect sense in some situations but not in all. You 00:38:47.292 --> 00:38:53.631 really have to keep the same situation as with other things. 00:38:53.631 --> 00:38:59.237 So what you can take home from this on your own network, I have 00:38:59.237 --> 00:39:05.043 the -- I give this advice regardless of what service 00:39:05.043 --> 00:39:08.379 you're talking about, but know your network. You should be, as 00:39:08.379 --> 00:39:12.717 I said earlier, you should sent out M-search requests on every 00:39:12.717 --> 00:39:15.620 network you connect to, because you'll be amazed what you'll 00:39:15.620 --> 00:39:20.558 find. You know, if you don't want to be loud about it, you 00:39:20.558 --> 00:39:25.129 can just sit on the network and listen to board 1900, and 00:39:25.129 --> 00:39:29.367 whenever a device powers up, I mean if you've ever watched the 00:39:29.367 --> 00:39:35.573 traffic from Windows laptops, by default they have UPNP enabled 00:39:35.573 --> 00:39:39.510 and constantly bombard the network with notify messages. 00:39:39.510 --> 00:39:44.415 Just ridiculous amounts of traffic. Yeah, more important 00:39:44.415 --> 00:39:49.020 than that if you don't need UPNP for anything, disable it. If you 00:39:49.020 --> 00:39:53.925 can't disable it on the device, you might be able to do 00:39:53.925 --> 00:39:58.997 something with the router but just finding some way to prevent 00:39:58.997 --> 00:40:06.137 UPNP if you don't need it. Then, yeah, as always, keep on top of 00:40:06.137 --> 00:40:12.010 updates if possible. On the other hand, the darker side of 00:40:12.010 --> 00:40:18.016 the half, if you want to find vuns of your open, I guarantee 00:40:20.718 --> 00:40:26.724 you can find some vuns in SOAP services. Burp is always great 00:40:30.561 --> 00:40:36.567 before HDTP style requests like SOAP is. WS buzzer is by the 00:40:38.703 --> 00:40:42.440 owas project. I've never used it, but it's targeted 00:40:42.440 --> 00:40:48.446 specifically to HTPN SOAP, so that's pretty handy. Miranda is 00:40:50.915 --> 00:40:55.620 fantastic. It's written by Greg Hefner. I think it's Greg. It 00:40:55.620 --> 00:41:02.794 might be Chris, the bitmon guy. Really, really great, but it's 00:41:02.794 --> 00:41:08.633 in Python, and I'm not a Python guy. Sorry. So UFUS just came 00:41:08.633 --> 00:41:16.374 out recently. It's actually supposedly a Ruby port of 00:41:16.374 --> 00:41:19.911 Miranda, or at least that's what the guy is billing it as. 00:41:19.911 --> 00:41:24.382 Unfortunately, I tried it, and I couldn't even get the thing to 00:41:24.382 --> 00:41:29.120 send traffic. It might be me. It might be him. He says on GitHub 00:41:29.120 --> 00:41:34.625 that it's still in beta, so I might look into that further and 00:41:34.625 --> 00:41:42.033 submit some requests. But also if I ever decide to release my 00:41:42.033 --> 00:41:45.303 stuff, which I might, I might not. I don't know. It depends on 00:41:45.303 --> 00:41:51.309 how the mood strikes me, then we'll see. Yeah, I've got some 00:41:55.780 --> 00:41:58.683 that work pretty well. Yeah, that's basically it. I'm head 00:41:58.683 --> 00:42:03.888 Zeke on every communication medium. Feel free to hook me up. 00:42:03.888 --> 00:42:09.894 If you find cool vuns, I'd love to look at this them. Feel free 00:42:13.164 --> 00:42:19.170 to hit me up, and that's it. ( Applause ) >> Are there any 00:42:25.309 --> 00:42:29.914 questions? Make them quick because we have to clear the 00:42:29.914 --> 00:42:35.920 room. ( Inaudible question ) >> No, I don't. I have beat me head 00:42:42.693 --> 00:42:48.699 over it, so as an example -- so over -- see if it's a spec, like 00:42:52.036 --> 00:42:55.440 an officially defined spec and read it really carefully, 00:42:55.440 --> 00:42:59.577 because I was beating my head over that set AB transport URI 00:42:59.577 --> 00:43:06.884 for forever. I read the spec line by line and found out that 00:43:06.884 --> 00:43:13.458 it took a ditilight META tag. It needed that empty tag, and then 00:43:13.458 --> 00:43:19.464 it worked fine. >> Anyone else? All right. Thank you. ( Applause 00:43:27.405 --> 00:43:29.407 )