Before I introduce the very, very, you know, roll out the red carpet to two old friends of the Wall of Sheep in the Packet Hacking Village, I want to give a quick thank you to the AV folks, Steve and Troy. Steve and Troy, thank you so much for all your help for all today, helping record these presentations. We have many, many, well, we couldn't have done this, the success of this day could not have been done without you. So, thank you so much, Steve. Thank you so much, Troy. Thank you so much. So, as I promised, it's 8 p.m. 5 p.m. is going to be 6 o'clock. Yeah, yeah. Seconds. All right. Any second now. Any second. Any second. Any second. Feel free to make yourself at home. We've got a few empty chairs here. Feel free to make yourself at home. Okay? Because we promise this is the week we've saved one of the best talks for last. Okay? You don't want to miss this. We've got an open seat up in the front. We've got it in the fourth row. Oh. Okay. And now it is 6 p.m. the top of the hour. This is it. This is the time for our last speaker workshop. Okay? And this speaker workshop, we have two old friends coming back. I'm going to say they are the authors of Penetration Testing with the Raspberry Pi. Without much ado, Joey Muniz. Come here, Lakhani. All right. Hopefully you can hear me now. So, before you go, at the end of the talk, we actually have a book over here we're going to give away. We did sign it, so it's gone down in value, unfortunately, but we will throw it out or something. All right. So, let me just introduce myself. My name is Amor Lakhani. I'm actually a researcher for Fortinet. FortiGuard Labs. And I've got my colleague here with me, Joey Muniz. So, I'm a researcher, and I also work at Cisco. All right. So, today we want to talk to you about Kali Linux. We actually wrote a book on Kali and Raspberry Pi, and using the Raspberry Pi as a penetration testing platform. So, first of all, what is the Raspberry Pi? Well, it's a $35 computer that was made by the Raspberry Pi Foundation. Now, when I grew up using computers, it was great because my parents had no idea computers needed software. They got me this piece of junk box, and they were like, here you go, son, and I have to do something with it. And today, computers are totally different, right? We click on the Internet, and we consume information. The Raspberry Pi kind of takes us back to the old days where we actually have to make it do something. So, we got this idea to actually use the Raspberry Pi as a pen testing platform. Now, besides that, what else is the Raspberry Pi? We have one mic, sorry about that. So, basically the idea came up of, well, what can we do with the Raspberry Pi? Who here has seen Mr. Robot? So, I was watching Mr. Robot, and I was like, oh, cool, the reference to Raspberry Pi. But, basically, in that episode, the idea was they wanted to basically take out the AV system so they can melt the backup system of a major corporation. So, that's one example of using the Raspberry Pi. Now, in our use case, we're using the Raspberry Pi. The idea is, well, first off, how do you turn a Raspberry Pi into a penetration testing arsenal? Naturally, we went to Kali Linux for that platform. And Kali Linux has an image for that. There's an ARM image designed for Raspberry Pi. We'll talk a little bit later. We tried some of the other ones. So, we tried Raspberry Pawn and Pawnberry and Pawn Pie was actually, Pawn Pie is pretty good. But, from a support perspective, online community, popularity perspective, Kali Linux was it. And for those that don't know what Kali Linux is, it's a full-on penetration testing arsenal. However, the recommendation is, and we'll talk about this, there's only a couple tools that are really good to use in a Raspberry Pi. Everything else kind of sucks. Because a Raspberry Pi is pretty limited. So, speaking of that, what are the use cases? The big use case that we use, this is from actually a couple of years ago, a penetration test we did. The idea was, a customer said, hey, we're cheap as shit. We're going to do this. Be honest. We're cheap. We want you to penetration test multiple locations, particularly international sites. And they didn't want to pay for it to fly us out there. So, we tried to figure out, well, how can we do this? And the idea came up of, well, why don't we just basically build these Raspberry Pis and mail it to our customer. They can remotely plug it in. We'll charge them $100 a Pi or assembly fee $200 and do our penetration test. So, it actually worked out to be a really good use case where rather than having to fly to multiple locations, literally we just charge our billboard. So, we spent multiple hours to build the Pis. And we did this from our house. And pretty much did a multi-site, like 10 location, international penetration test. So, we'll talk about the build, how to build that, everything in a few minutes. But that's a good use case. Another good use case that we'll talk about today is a leave behind system. So, Raspberry Pis, we'll talk about building one, are about $30, $50, maybe $70. So, that's really nothing. So, to plug that into a network and leave it and lose it, who cares? I'm a huge fan of those $2,000, $3,000, was it the Pawnee Express tools? But they're really expensive. I prefer to spend like $50 and lose that. Another use case, this is actually, let me hit the thing here real quick. This is one that I did live at a customer. They had one of those kiddie clocks. So, I decided to hide that in the kiddie clock and they didn't notice it. That's pretty cool. And by the way, if you guys were at Black Hat, these are awesome. These USB power supplies, they power the Raspberry Pis for a good three to five days. So, that's pretty cool. So, every time I go to a vendor, I typically grab like 10 of those. I have a whole literally case of those things. So, if you want to power your Raspberry Pi, go to like a vendor, like an RSA or a Black Hat and collect those. Because those things work out very well for powering your Raspberry Pis. You did it again. So, how do you build a Raspberry Pi to do a penetration test? Like, what's the cost for this? There is a lot of packages you can buy, but most of the packages have things you don't really need. So, if you really were going to like price out a Raspberry Pi, the Pi itself, 30 to 50 bucks. There's a new version that's out now. You guys can get that. Again, 50 bucks is overpriced, but they have it for sale over there. And then you're probably going to need a couple other things. The first attack I'll talk about here is being a man in the middle attack. Raspberry Pis only have one USB port, so most likely you're going to need to buy an adapter for that. So, about for 10 bucks, and I'll show a picture of that in a minute, you buy a second Ethernet port, and then basically you're going to be a network. And I'll talk about that attack in a few minutes. If you're doing wireless, Raspberry Pis don't have wireless, you need to buy a wireless adapter. Again, about 10 bucks, and now you basically have a wireless pen test tool. Raspberry Pis, in most cases, obviously they're small. They use micro SD. Most likely your computer won't have that. I have a Mac here, and it doesn't have a port for that. So, you buy an adapter. And adapters, 10 bucks or so, you can get an adapter. They don't have power, so you either buy a power cable, or again, go to your favorite vendor conference, and collect those USB power supplies, and that can also power your Raspberry Pi. And then lastly, your image. So, really, you know, again, cost $30 to $70. We were billing our customer for $150 to $200, but you really didn't have to buy all that. And this is kind of a screen shot of the packages they have on Amazon. But again, you don't need a case. You don't need all this color and wire crap and everything. Really, the only things you need is the wireless adapters. It's 10 bucks. And the corner left is your adapter. And maybe a power supply, which that power supply is like 5 bucks. And that's really it. That's your setup. And then obviously, if you have a monitor, you can do that as well. Go ahead. Alright, so, lesson learned. I've literally imaged probably 500 Raspberry Pis now, and I've ran across every single issue you would run across by doing this. Like, some of the example images are problems. One is, I don't know if you guys have tried this, but when you put Kali Linux on a Raspberry Pi, and you fire it up, you'll get this blank black screen, but you can move the mouse around. It's a blank black screen. And if you go online, everybody has these weird explanations of what it does. Basically, it's a driver problem. It's the same thing when I put Kali Linux on a Raspberry Pi, and the keyboard doesn't work, or certain things don't work. So, if you're getting any issues, here is Amar Akhani and Joey's recommendation for doing it. Basically, unmount and format and SSD it on there. Which, by the way, cool trick. There's control T. When you image a Raspberry Pi, when you DD it, it takes anywhere from 30 minutes to an hour to do it, and you just don't know what's going on. It's just kind of hanging there. If you hit control T, you can actually get a status, because you'll see the packets moving. So, kind of a cool trick when you're DDing. But very, very important, once you install the image, immediately do the update and the upgrade. Do not do start X. If you do start X, most likely it's going to fire up with the older drivers, and then you're kind of screwed. And then you have to reimage it again. And again, all those little problems that we found online, the blank screen with the weird mouse, keyboard not working, certain things not working, all are fixed, because when you do your update and upgrade, you're updating the drivers. And Raspberry Pis have really old, shitty drivers. Even like some of the firewall and some of the images we'll talk about later, most of the problems were driver problems. So, do not do start X. And actually, a lot of the penetration tests I know where to talk about, we do it all command line anyways, but for you ones that like to actually fire up the GUI, if you have to fire up the GUI, do not do it before you do your update and upgrade. If you do that, you'll probably run into problems. Alright, so the first example attack, the first penetration testing we did, is the man in the middle attack, the classic. Now what's cool about this is, this doesn't take an IP address. This is complete stealth. So literally you can go in and you can go to a computer, into the Raspberry Pi, plug it in the wall, they won't see it on the network, and literally you're a full on tap stealing data. To do this, it's pretty simple. First thing you need to do is download the bridge utility, because the commands aren't there in Kali Linux, so you first download that, and then at that point, you get your USB, your $10 second Ethernet adapter, you'll see both interfaces, configure them to 00, and basically bridge it. At that point, traffic will be going through the Raspberry Pi. Now, again, Raspberry Pis are not the most strong, powerful devices, so you're not going to run Wireshark or Tshark or any of those things on it. Best practice is, make it a tap, and then basically run a script, and we'll talk about it in a minute, and export the data so you have a more powerful system to do that. I've tried running all those, like, on-box, like, white versions of Wireshark, they all suck. Even the command line ones suck. They run really slow. So best practice, turn it into a tap, stick it on your victim's network, and move on. Now, there are other options. You can do this, the ARP spoofing methods, but I work for Cisco, he works for Fortinet, there's anti-ARP spoofing in a lot of the switches, and most likely it's not going to work. So, use it as a tap, don't use it as, like, an ARP spoofing mechanism. Even Ethercap, a lot of times will go to customer networks, and you're going to set off the switching logs, they're going to catch you. So there's no reason to do that. Just use it as a general tap. This is it with the case and everything, but basically, this is my $10 little USB Ethernet adapter. Actually, that one's $6 from China. And literally, you just plug it in, it's just because you can get a white or black box to make it look like it belongs there, and that's it. You plug it in, no IP address, you're full on tap. Now, once you tap the data, this is a really ghetto script, but then the idea is just take a TCP dump of that traffic and basically export it. And we'll talk about, in a minute, about how to get it off the network, because once it's planted on the network, is you run your script, and just basically take the data that you want. So this script, we're just taking usernames and passwords, but select your data, because again, it's a Raspberry Pi, not a lot of storage, so most likely, just run your tap, selectively steal your data, and that's kind of part two. So for part three is, I'm here to talk about this, is now, once you have the data, is getting it off the network. Yeah, I will tell you in this example, we just used FTP as an example, because in real life, we definitely were using SSH or some other encrypted protocol. So what we did find, well, in this customer, they really weren't monitoring anything, so it was pretty easy for us to take FTP information and transfer the data, but in other customers that are using some sort of NetFlow or some sort of monitoring, they probably would catch the data leaving their network. So how does the data leave the network? So we tried to make the Raspberry Pi a remote access tool, by essentially having it do reverse SSH. The main reason for this is we didn't know where these Raspberry Pis were going. They were going to 21 different countries pretty much all over the world, and we had no idea what was behind those networks. They could have any firewall, any rules, a lot of those places didn't even have network administrators. So we're like, how do we get our Raspberry Pi to connect back? So what we ended up doing is we ended up creating a Kali Linux box on AWS with a public IP address that had a listener on it, SSH back from the Raspberry Pi into our AWS Kali Linux box. So how do we set that up? It was pretty easy, and this is just a very basic example on how to do this. Now when we actually set this up in real life, we did use automated logins, certificates, and we actually had scripts to run the logins over and over again. So it got a little more complicated. Yay! Alright, so what we did was we ended up creating a listener, very easy to do on the Kali Linux box, you're just going to do an SSH, we're listening on port 222, that's the local port, so any time the Pi actually SSHs into our AWS server, which is going to be like 10.10.10.1 in this example, the Kali server, the AWS server is going to open up port 222, and then forward that to an SSH port. And then the .n command basically says, don't forward more SSH commands because we only need it on one place, we don't need it on both boxes tunneling the commands. Once the Pi is set up, on the local box, we just SSH to a local port, to 2222, and then it goes ahead and connects to the remote Raspberry Pi, and opens up a session. And then we have full control of that Raspberry Pi. If they would be turned off, if they would be moved around, if there would be power issues, we wrote a quick shell script to basically go ahead and try to log in over and over again. If you're paying attention, I did this example last night and I used a different IP address, so that's why you have 25s on there instead of 10.1.1.1. But all this script does is basically look at trying to SSH over and over again back into our AWS system. Don't try and connect to that server, it's on job and created a cron tab to make sure that it starts up automatically. So anytime the Raspberry Pi starts up, it's always trying to connect back to our server. Essentially what that made it do is it made all our remote Raspberry Pis all in all 21 locations connecting back to us at AWS and we're able to connect to them on different ports anytime. Once we did that, we had Eureka. So this is actually an artist's depiction of me right here when I was really happy when we got the Raspberry Pis working in China and Japan and other places we weren't supposed to go to. I just hadn't shaved for a week. I apologize. I couldn't quite hear that but you said, why was it port 2222? That was my local port, so that was the port that I had control over. I can definitely go over that more in detail. Just come to me afterwards and we can go over the config. The other issue is when I started doing this test, I was carrying my Raspberry Pi everywhere and at first I was going to hotels, I was traveling a lot and I had my Apple TV with me everywhere so I wanted to use my Apple TV and I said, hey, I'm going to use my Raspberry Pi as an access point because a lot of hotels just have wireless, they didn't have LANs and I wanted to have wireless access points and I was like, that's pretty cool. I wonder if I can actually use this in security somehow. So I went to Apple to basically look at a lot of different SSIDs and spoof SSIDs so I said, if I have these Raspberry Pis at all these remote locations can I start doing man-in-the-mill attacks on wireless and spoofing wireless SSIDs? Can I have people connect out to me? Anytime you have a wireless device it's always probing for the last networks that it connected to. So what we did is we ended up configuring the Raspberry Pi in such a way that it would respond back to those probes and say whatever wireless network your device is looking for, we have full access. We can give you DHCP, DNS, redirect you and do some other cool things as well. What we also ended up doing is we ended up building the Raspberry Pi as a local testing tool for wireless as well. We decided to have a little bit of fun with this and we recreated something that we found and we kind of thought it looked pretty cool but we were able to go around different buildings and actually look at the Raspberry Pi and make it connect to other devices and probe other networks and rogue networks as well. This is a wireless card we used called the Edimax. I think this is a dime that's just stretched out in the picture but you can see it's a very small wireless device and it works fine. It is a quarter, okay, I couldn't quite tell. I might have to examine that. One of the biggest issues that we found when you're doing wireless with the Raspberry Pi is you really have to be careful on your network cards, on your wireless cards. You really need a wireless card that works with host APD. And what we found is the wireless cards that work with host APD is pretty much going to work in Linux for any type of Linux wireless troubleshooting or pen testing. These are the recommendations. I personally love the Alpha cards. That's really what I use. The TP links are also very popular. Adafruit, they sell a lot of OEM type devices and they're great as well. Pretty much anything works. So as long as it works with host APD you're good to go because you will have to compile that. So on the Ethernet front though it doesn't really matter. I tried like 10 or 11 different Ethernet like the physical Ethernet USBs. All of them work. So we found wireless wise some work, some didn't work. But if you see the Ethernet adapters some on eBay are like $30, $40. Some are $7, $8. They all work the same. And I mean I tried troubleshooting some applications when it was a driver issue. It didn't matter. There was not one Ethernet that was better than another one. So my advice to you on the Ethernet front buy the cheapest one possible on the wireless front. Pick something that's a little more expensive and you're pretty much spending about $70 a kit. Go ahead and start this one. Alright, so what are some of the things you can do with a Raspberry Pi? We had a lot of questions when we were doing the research on defense. Can I use Raspberry Pi for a set of security attacking security defense? Our experience, first off, firewalls, IPS's, don't do it. It's a shitty, shitty firewall. Even IP tables. It sucks. And some of the claimed Raspberry Pi images for firewalling, they would work and then basically Raspberry Pi would do an update and then it wouldn't work anymore. The drivers wouldn't work anymore. And you would try to email the firewall vendor that makes it and they would be like we don't support it anymore. So for defenses, firewalls, IPS's suck. The only defense mechanisms we found that worked pretty well with the Raspberry Pi it actually makes a decent content filter. So instead of buying a network nanny if you want to basically filter porn and all that at your home house, the Raspberry Pi actually does a pretty good job. There's a good image out there in a book we built it for you. That worked out well. VPN concentrator. It's actually a decent VPN concentrator. So instead of buying an ASA or something like that you can make this a VPN concentrator to get back in your network. And then last is the Tor system. That was your thing, you can tell the story there. Yeah, so pretty recently what I started doing was a lot of research in malware and doing a lot of malware reverse engineering. What I found is a lot of malware out there you really don't want your ISP knowing you're running malware because they get a little unhappy about that. There's a lot of malware coming out from your home. And also a lot of command and control servers they're recording your IP so you don't want your IP recorded all the time either. So what we found is it's very easy to turn the Raspberry Pi into a Tor gateway. So basically, essentially I have my Raspberry Pi, my laptop connected to my Raspberry Pi which is then connected to the internet. And it's used as a Tor gateway so it goes through the entire Tor network. And it worked out really well. In fact, what you also can do with the Tor gateway is you can actually specify what your exit nodes are some malware only works from the US. So what we can do is we can actually specify hey, only use exit nodes in the US or get a little more granular as well. Just one example. As he said, any firewall or IPS besides IP tables didn't work at all. We stayed up a lot of nights just trying to make it work. The VPN concentrator pretty much worked. We were able to make it an open VPN server but not much else besides that. One of the things I really had a lot of fun with is I'm a retro gamer and so I ended up creating a couple of gaming devices. These are actually just miniature these are not full arcade cabinets they're just miniature arcade cabinets I found. You can buy little LCD screens you can actually just hook it up to your TV. It's actually pretty cool to hook up just a Raspberry Pi with HDMI on your TV and start playing Super Mario Brothers. One thing that I learned about this is all the retro gaming controllers pretty much suck. So try and buy a Super Nintendo controller and use a USB adapter or you can actually use a Xbox 360 controller as well as long as you're wired in it works fine. That's a good point. Don't buy like the newer controllers buy the old controller and buy the adapter. Yeah, the older controllers work a lot better. We're kind of going ghetto style since we have one mic here. This is like my newest project right here what I'm doing with the Raspberry Pi. What I ended up doing was I ended up getting a mirror and you have to actually go to your hardware store and ask for an observation mirror. You will definitely get a strange look when you ask for an observation mirror because, I don't know, I guess it can be used for possibly other things as well. But you want a mirror that's pretty much a one way mirror and what I ended up doing was I ended up taking a monitor I ended up stripping everything on the monitor the case, everything and I ended up mounting it behind the mirror as well. Now one thing is if you do this you really want a monitor that has a VGA connection on the side of the monitor because if it's in the back of the monitor you will have a hard time trying to identify. But you can go ahead and do that and I actually have some apps it's actually just connected to my Google account and I can see my appointments. Here's another guy. I guess he had an app that gives him high suggestions as well. We're actually working on an iPhone app that will let you update the little widgets on this as well so it will be kind of cool. Kind of just a new project we're working on. So basically to summarize the talk here because I know we kind of went on a tangent on some of the fun projects in the book we also have some fun projects but I guess the summary of the talk is this the Raspberry Pi can make a penetration testing arsenal you don't want to run anything that's a high process so any onboard analytics tools you don't want to run they run like crap any exploit we tried using I guess we should do some of the don'ts we tried doing some phishing attacks on it and it never really worked so running your set social engineering tool kit really didn't work. We tried to plan it on networks and it's just too slow so when people get redirected it doesn't really work we couldn't trick people with it so last year we did a whole social engineering talk about Emily Williams and all that we tried pulling that off it did not work on the Raspberry Pi so social engineering, beef, all those tools they don't work on a Raspberry Pi we've tried it in the real world and it just doesn't work so your best bet, really just use it in a command line form for basically capturing data and our recommendations like again the man in the middle tap and it's really hard to find even with like net flow based tools if you're stealthy about it, if your script is good they won't catch it and then the second observation was wireless wise, you can do some wireless testing but again, have it to basically collect data and then use a script to export that data and we found off the recommendations that if you have an auto always connect and you do the reverse shell we recommended that works really well we tried it in multiple countries and we were always able to connect we really didn't have a lot of problems getting past various firewalls I know I just wanted to add just in conclusion we're going to give away our book but I know this is a security conference so all you guys are probably just going to get on BitTorrent and download this book I guess that's fine but if you do end up buying it we are actually giving, I'm giving the proceeds all to hackers for charity so it goes to Johnny Long's foundation and I guess that's in conclusion have fun we'll be up here for questions we finished a little early so we can definitely start our drinking early any questions? alright I guess Joey is going to throw the book out as hard as he can alright so watch out for your eyes or head or whatever just throw it high throw it right in the spotlight I can't see so I'm going to hit somebody in the face alright you're going to fight you're going to fight thanks alright thanks a lot