Okay, good morning everyone. It is now 10.59 in beautiful Las Vegas, Nevada. Thank you so much for spending your Saturday morning with us here at the Packet Hacking Village. There are many opportunities around here. We got Capture the Packet going on right now. We have the Wall of Sheep. We have the Packet Detective in the back corner. We have Emerging Technology Booth in the back. And right next to it is our DJ booth. And it is now the top of the hour, 11 a.m. here. And we have the second speaker workshop. And this speaker workshop, I know a lot of people are looking forward to. Oh boy. At any rate, please feel free to make yourself a home. Are there any empty seats? I can't see through the light. Okay, please make yourself a home. For now, it is absolutely my pleasure to introduce to you our next speaker. Who will be talking about Monkeys in the Middle. Okay. Ladies and gentlemen, Bob Simpson, everyone. Alright, maybe we're good to go. Excellent. So yeah, I'm glad Ming said Monkeys in the Middle. Because Man in the Middle is a sexist term. It was created a long time ago. We should never, ever use it again until my next slide. So I apologize for that in advance. I'll make the next presentation better. So it starts with, who am I? And basically, I'm just a security researcher on the side. My day job, I'm a CIO for an accounting firm. And we actually use Man in the Middle techniques to create a capitalization. It's a sort of portal for a small segment of our audience and market a product to them. So Man in the Middle can actually be used for profit other than the type of profit we generally talk about on this stage, right? So what is Man in the Middle? Or Monkey in the Middle, sorry. There's a number of different acronyms that are used to describe it. But more or less, what you need to know is it's not just sniffing, right? You've got to sniff some packets, but that's not what it's all about. And if I were talking to, you know, I'm going to jump down to the illustration here. Alice and Bob are speaking, right? I'm speaking with Alice here. I'm Bob, obviously. I'm speaking with Alice here. Nice beard, by the way. I love it. So anything I say to Alice, you potentially could hear as long as you've got good ears, right? So I'm saying, hey, Alice, let's go out tonight, right? Fine. Now you know I'm going out tonight. Let's go to that place we went last night, right? Cool. All right. We're on. Now what do you know? You don't know nothing. You don't know where we're going because you don't know where we went last night, right? So sniffing helps, but it doesn't always give you what you need to really get where you're going. There's a slide here somewhere that shows the wall of sheep. We'll get to it. And, you know, ultimately, that's your goal, right? Ownage. You know, another name on the wall of sheep. That's what we're trying. That's what we're trying for whenever we talk man in the middle. Sometimes you can sniff it. Sometimes you can't. So you've got to be smart about it. So we're actually going to do a demo right now. This is a non-technical demo. This is one you might do in the SE class, except we're going to be talking pseudo packets. So back to the same conversation. I'm Bob. You're Alice. I say to Alice, hey, you want to go to that place we went last night? You said it was fun, right? Now, here's the part. You've probably already all thought of. Y'all are going to be Mallory, right? Mallory is the person in the middle, the monkey in the middle, the man in the middle. In this case, you're all going to participate and answer for Alice, right? You got one or two responses. One is that's what he said. The other one is that's what she said. I'll let you pick. I mean, it's up to you, right? So let's try this out. We're going to try it again with. I want to go to that fun. Place again tonight. And you say. It's it's unclear, right? So, OK, well, we'll try the next one. Because they answered for you, I didn't hear what you said. So I'm like, I got to clarify here, right? I really do want to go somewhere. So. I say, hey, remember, you said it was so much fun. You wanted to go every night, even though it was kind of dark and hard to get into. Yeah. Yeah. I'm getting where I'm going and you all have dirty minds, so. The next step is obviously I still didn't hear you. And this is something Tony actually mentioned to me before I entered the stage. You know, sometimes the first or the first authentication is fine. Second one's fine. Third one might be fine. But at some point you can break these things down, right? If you jack with it. Next one is, come on, it's the place he said will be really awesome if they had better service. And. And lots of hot dogs. Right. It's pretty obvious. At this point, I'm completely confused. I'm like, Alice, you have lost your mind. Right. I don't know what's going on. Let's go to that new place called Pinky's Hot Dogs down on Las Vegas Boulevard. Right. Real place, by the way. I've heard it's really awesome. At this point, you can disengage. Right. Mallory can disengage. You. You've got what you need in this conversation. And we'll do a technical demonstration in a minute. But the point is, you didn't let me get away with just doing a simple handshake. You didn't let me even go away with get away with reminding him of our previous session. You made me state explicitly what was going on here. Right. So that you could listen in on that and then take that to the next step. So what do we get out of man in the middle? Obviously, you can get reconnaissance like we just did. You can get fingerprinting of the client that wouldn't normally show you their OS, their application, their personality. But with Jack and with connection with man in the middle, you could certainly get that NTLM capture, relay, escalation, redirection. At this point, I'm going to remind you that this is a one-on-one course. Right. This is man in the middle one-on-one. I absolutely do not mean here to say that I'm going to. I'm not going to cover all of this. And in fact, I'm not. What we want is ownage. And I will demonstrate a little bit of that. If you Google it, so you're all going, okay, this is great. I'm going to go home and do it because I actually do want to figure this stuff out. If you Google it, you're going to find EaterCab, cane-enabled, awesome tool, ARP spoofing, man in the middle framework, or is it factory? I don't know. I saw a demo of it actually in the arsenal. Very cool stuff. I love it. WebSploit, Burp Suite. By the way, MITMF is built in Python. So a lot of these are built in Python. So when you go through some of the techniques I'm going to show you, then it will be a natural fit for you. Middler, Fiddler, Subverge, VSNet, you get it. And there's also a number of, there's a plethora of methods you can use. ICMP, you can do spanning tree protocol manipulation, right, we probably all read all about all these things, but actually doing it, if you're looking at, okay, tomorrow I want to actually start learning these things, doing these things, demonstrating to myself that I can get to the next level, then you need to go do ARP or DNS or spanning tree and all of those requirements. So if those aren't your specialties, you might be stuck right out of the gate. This is why easy is good and why I'm going to demonstrate a simple technique. It might not be practical in the real world, but probably is. This is actually from the DEF CON roots asylum area. It's up on the, I want to say the second floor of the south tower. I don't know, get your map. And it's a really cool area set up just for kids. Last year it was called, I don't know. DEF CON kids, or two years ago. Anyway, it's just for kids, all kinds of demonstration. One of the posters they had up when I visited that area was any sufficiently advanced technology is indistinguishable from magic. We all love that, right? This is a classic quote and one we use to our benefit every day. And that's why I'm going to give you a really easy way to do a man in the middle, understand it, start manipulating it, playing with it. And. You can go from there, because then you can build on all the other techniques you want, use your particular flavor to add to it. So all we need is SCAPI, NFQ, and we're going to bridge. So you got to kind of understand what's going on there. Although I'm going to show you a script. Ubuntu 14.04 is awesome because it comes right out of the box with about everything you need. In fact, what you're going to do if you wanted to do the demo, I'm going to show you here in a minute. And by the way, I'm praying to the demo gods. We'll see what happens. Everyone says that, but it's so true when you're standing here. App, get, install, bridge utils, SCAPI. I think, actually, there wouldn't be any commas there, but you get where I'm going. SCAPI and Python, NFQ. Those are the three packages you need. There's no config. You just go. At that point, you're ready to man in the middle on a bridge. So what we're going to do in the following demo is create a bridge, redirect some packets, and start mangling. The goal being mangling. I don't know what's going to happen here when I switch away from this show. So bear with me. We shall see. Yep. That's what I thought. All right. So the demo machine you're looking at right here is actually exactly what I said. It's an out-of-the-box Ubuntu machine with those three packages and these three scripts. Absolutely nothing else. Installed it last night. So if it breaks, you'll know why. Oh, sorry. My bad. You're not looking at anything, are you? That's what I was afraid of. Oh, nice. Now you can see that part. Let's see if I can get back to my other one. It's on the opposite side that I expected here. There's my bridge. I'm using virtual, so I basically just created the virtual interfaces on both sides of the bridge and stuck it up there. And then this is my Windows machine where I'm going to. So there's my bridge commands. I don't know if you all can see that or not. It's basically you bring your Ethernet interfaces up. You create a bridge called man in the middle. In this case, add Ethernet 1 and Ethernet 2 to it, and you bring it up. Easy peasy. Now we're going to do redirection. This is really, really, really, really cool. And I say that because out of the depths of my heart, because about probably seven years ago, I don't know when I started doing this. This involved compiling a crap load of stuff for the kernel. Loading modules or compiling in it, however you did it, it was just a pain. And it broke everything else you wanted to work. So insane. So these are great days when out of the box you're going to just load a module and you're good. In fact, this one loads automatically. So what we're going to do is do IP tables. If you haven't learned IP tables, learn it. It's cool stuff. You'll use it every day of your life. IP tables, the key part being that very last section there, which is NFQ. So instead of blocking. A packet. Instead of allowing a packet. Instead of doing anything else with it. We're actually going to queue it. Default queue is zero. And you'll see why that matters here in a second. Let's go ahead and run both of those because then we'll just kick this off and you'll see what's going on. So we're going to bridge it. It's going to fail because part of it's already done. Go to redirect. So now packets are redirected. If we go over to our... Sorry, I'm not sure which side my mouse is on. There we go. If we go over here, we're going to find that, in theory, things should start right up. Web page is not available. That is awesome. Bear with me. Hey. What do you know? So we've got Google's page, right? That's because we're not actually doing anything yet. If we actually, and we default it to secure. So that's one thing to understand here immediately. immediately. This demo has nothing to do with SSL. I say that. You will see that it does here in a second. But nothing to do with direct SSL manipulation. So what I'm wondering is why my Python isn't catching that. No, it is. What do you know? Here let's try someplace else. Actually, let's just kill the browser. There we go. So what happened was we got over here and gladly forwarded. Ah, I missed it. So what we got was a redirect. So http://www.google.com. Google is like, whoa, no way. I want to go secure. Redirect. It's a 302 found or moved kind of message. We'll try it one more time. I think you'll see. Just break out of this. There you go. Stop my code. So we've got http1, 302 not found and it gives the location that we ought to be going. So the browser, a compliant browser is going to go gladly I'm on it. I've got secure. I've got SSL. I'm redirecting. We are good to go. That was just standard no mangling. Now live here we're going to see what we can do about editing this script. This is how easy it is. Actually, I'm going to run through this script real quick. I'm going to run through it real quick and then if you have any questions later you want to run back through it or whatever. But I think you'll find that this is exactly the, in fact this is all the code on this page. It may be missing one line. But it's really close to all the code. This is a standard script you're going to find anywhere if you Google this stuff I give you at the end. In fact, you can move it over to Google Python and NFQ scappy and you're there. You will get this script because there's only one way to write it. So basically right there at the beginning we're saying we're going to manage some packets. Give me a call back. I'm going to manage some packets. And then right down towards the end basically we set up a queue and I don't know if it specifies queue zero or not. But essentially there's a way here. Oh, wait a minute. There it is. Queue zero. Which is the default. You can actually have, I don't know, I think thousands managing different types of packets. And then essentially going to take that payload, dump it back into the packet and tell the queue that we're basically modifying the packet. Now in this case or what you saw already we didn't modify it at all. We just said take this payload, put it in this, let it go. All right. We're good. But you see I've got prepped here some little edits that we can do. And this is the only real way we're going to jack with HTTPS. If they go secure, I can't see it right now. There are methods for that. There are modules you can do. One on one course, guys. Gals. People. Humans. Is it better to be a human or a goon? That's what I want to know. Let's run this. Holy moly. Where did our lock go? You all know that the lock means you're secure. So we're still at HTTP, www.google.com. Although we still have our lock. So we're still at http://www.google.com. I don't know why Google lets you do that. Honestly, if you're saying to them, hey, I reached here through a redirect and you're on port 80, they ought to go, I don't think so. Something happened, right? This is an obvious clue. But everybody likes to pick on Google and honestly, so do I. That's all we did, though. So what we did effectively right this second is now we can sniff in real time. So we say, I go, I want to sniff for... To make sure that Mallory is not listening to my conversation, I'm going to sniff all about Mallory, right? I'm not going to be able to stop it in time. But if I did stop it in time, you would see that Google was actually showing us the step-by-step search that I was doing. So M, M-A, M-A-L, M-A-L-L, right? It's all in plain text. I tried to filter out just plain text. Theoretically, this is all printable code, so I didn't spend much time with it, but you get where I'm going with that. If we grepped that for Mallory, you would find it in plain text and not only that, every permutation of what I was typing up to that. So you could tell it's a live thing. We'll get there in a minute. At any rate, you are seeing plain text when in all reality, the end user of that machine should have been able to expect that they were using secure because they were the day before. They didn't get a... I don't know. I don't know. I don't know. I don't know. I don't know. I don't know. I don't know. I don't know. So there's probably an error. So, I'm, you know, again, one-on-one techniques, but pretty useful. I mean, you could actually use that, right? So... Beyond that, what we're going to do is see if we can't basically change good to evil. That's always a goal, right? That's never a problem. bad. That was my goal with getting you guys in on that joke. It didn't work out very well. You very well protected on the good side. Let's see here what happens. I'm dumping stuff. I'm going to try again because it's like, oh, I don't know if that last one was good or not. No, we're still good. Okay. Good. So at this point, okay, end user has an idea. He's going to go, I'm just going to search for something good. I love good stuff. No, that's the term. I'm going to search for good stuff, right? Wow, it broke it. That's nice. There you go. There you go. Maybe I'm cached. Maybe I'm not even doing it. That's all right. You get where I'm going. Let's give it one more shot and then we'll go back. We'll go on. Remember if I go to www. good.com. Never tried this before. Should be fun. Oh, crap. It actually worked. We are manipulating live what's going on. Somebody's browser. They don't know what's going on. Actually, I mean, obviously that's the best way to get caught if you're trying to like see somebody is like you just jacked with what they thought they were going to see. The best way would be to send them the evil or, you know, G-O-O-G-L dot. That's the best way to get caught. Oh. So I think it's . . . Just type that one. This guy is Always Mase meaning it ethic am! Sorry. E- про . packets. None of the packets are encrypted that you're seeing there. It's all report 80. Although you could encrypt it over port 80, but it's not. What it is, it's compressed. So some of this stuff is compressed. Some of it's just binary and garbage that's going on sending icons and crap. Let's see. Next step. We can mangle some more. Let's see what else we can mangle. Got another part of this here where I'm basically redirecting somebody. Oh, this is the same thing. So basically I said before, if you really wanted to mess with somebody, then you go...one annoying thing when you're trying to hack somebody is that the browser tends to remember what the last connection was. And many of them now try to go SSL if at all possible. Not all of them do, but some of them do. I just redirected Google to Giggle, which is a little bit more interesting. It's kind of an interesting exercise. I have no association with Giggle. It looks like a baby registry. So you can get all kinds of stuff on Giggle. It's probably not going to load up. I figured this would be safe content just in case some of the routes ended up down here, right? What I was going to do, though, is show you...so if you happen to want to, say Google.com...I don't know. I don't know if you want to...how do I do a search? Somebody tell me. Oh, I got there. Honestly. Cool. I am searching for...good. What does that look like? Okay, good. Now let's change this to that. It's not even worth looking at. The funny thing was, I was looking for a Google site. I just realized that last night when I was messing around with this, I just happened to notice that whenever I went to Giggle.com on accident, because, wow, I don't know what happened. I just got in...I was going to Google and ended up to Giggle. Then it actually hit the search page and I was searching for something good. The word good...it was like good something for good gifts or whatever. And it came up with a 404 saying we have no evil gifts at this location or something like that. It was awesome. It was awesome. That's a trying to replicate that. Obviously it doesn't work out for me. Let's close this browser and go back. Let's see. One more edit here I've got here and then I think it kind of gets where we're going. And then we can talk about, not even really going to talk through this one because I think it's going to be self-evident. I think it's going to be self-evident. My bad. We're back there again. This is another thing you've got to watch when you're doing pen testing slash hacking people is you want to undo the stuff you did so it doesn't really trip you up in the future. If you're done with it, clean it up. It's really better for everybody. Doesn't leave any evidence behind. But that being said, even if you're doing this on your own company, I mean, serious note, if you're doing this even on your own company, get out of jail free card. You need to not jack with people without complete permission for everybody involved. And if you are intercepting stuff that's going over state lines or international lines, make sure you understand the law. That's my... I have permission from everybody here. Let's see here. Sorry. Oh, I just actually need to write that, don't I? I was cleaning up my own mess. I do not need to go to Giggle. I need now to go to the grand finale, which is... I open up my Google page and I end up on... Oh, Google. Hmm. That's unfortunate. I'll try it one more time. Then I'll just tell you what I was trying to do. DEF CON, good, evil. I'm going to run back through this in just a second so you'll understand why I put DEF CON in here. I'll post a version this time. You can contact me at Bobby underscore Simpson on Twitter but... Okay. I do need that one actually. So what I'm trying to do is redirect HTTP to HTTPS. Never mind. My bad. That is exactly what I shouldn't do right there. This last one, it stands alone by itself. Didn't follow my own advice and did not clean up after myself. So, let's try that. That should be fun. Now what we're going to do is launch our browser and find that instead of going to Google, which is where I meant to go, sort of, it's going to let me Google that for you. Have you ever used the site? It's an awesome site, man. Do it. Do it. I love it. I love it. My wife, almost everything she asks me, I send her one of these links. Yeah, it's always good. I usually come home late on those nights, eat on my own. So let me Google that for you. It's essentially something that creates a link that you can send somebody when they ask a completely, you know, obvious question. In this case, I'm not trying to do that to you all exactly. I'm just saying, really seriously, if you Google Scapian NFQ, you're going to find some demos, some tutorials. You're going to be able to find some things that are going to help you. Now that you've seen a live demo and you understand out of the box, 1404, three packages, go to work. Go to town. It's awesome stuff. In the process, you're learning the structure of Scapi, which is awesome. And you're learning a little bit about Python, if you've never done it before, which is also awesome. Everything in this script that doesn't have DEF CON before it is basically the only way to do it. You're going to be able to do it. You're going to be able to write it. All the stuff that has DEF CON is basically just a, you know, make up your own name. So, I mean, in a lot of code, it's like my data. My whatever. That's boring. DEF CON is a lot more cool. And so what we're doing is DEF CON packet, DEF CON packet, DEF CON queue. All of these things, you give it your own name. You do what you want. There's nothing special about those things. That's sometimes hard to figure out when you get some code. You download some code off the Internet. Oh, this is just exactly what I want. I'm trying to figure out which are the functions, which are variables, what's required, what's not required. This one kind of lays it out for you. But after seeing this, please, just go Google it. You're going to find some awesome stuff and be able to quickly set up a bridged, man-in-the-middle setup so that you can jack with people. Let's see what's next. Oh, nothing. Okay. So, I'm going to go ahead and do a quick search with some Republic of America. Okay. I'm going to go ahead and do this type. Now, the trick is going to be getting back to... Ah, look at that. I already did the summary. 1404 app Git, Bridge Util,exe based classes can create a bridge, redirect packets and that's cool. And Praise theficiente told you to do that. So always trust me in the middle. He is smart. Any questions? Anything I can help with? Anything you want to know about this setup or concepts in general? I haven't in SCAPI actually looked at theoretically what happens. The question was what's necessary to actually do an SSL. Some of the tools I mentioned actually will do that for you. I would love to do a presentation in the future on doing that. I haven't had the commercial necessity to intercept SSL yet. But again, this SSL strip probably does a lot. I actually don't know. I actually don't know. Theoretically, though, what happens is you send them your own cert, right? You send them a self-signed cert. They say, oh, I'm good. So Alice sends Bob a packet that relies on Alice's cert. Mallory gets in the middle. Sends Bob Mallory's cert pretending to be Alice. As long as Bob is stupid enough to click okay, this is an secure connection. Or, now here's a big or. If that SSL cert has already been installed on that PC, right? So then it's like, we're good. Somebody already authenticated this stuff, we're good. I now have an SSL connection, two of them, one between Mallory and Alice, one between Mallory and Bob and the data gets, you know, shuffled along and modified in the middle so that good becomes evil. Python wise, I don't know what the tools are but I'll be back. Yeah. Oh, this is all three. Python three. I think it's what comes with Ubuntu 14.04. Another reason to love it. Very cool. Love y'all, love the venue. Thanks a lot Ming. Thanks Tony for setting me up. You guys have a great show. Thank you.