start	end	text
0	4320	Today we're going to be talking about hunting mobile rogue access points.
4840	10420	And so it's kind of the same methodology, but we've beefed it up just a bit.
10860	12140	I'm Todd Parity.
12720	13820	I'm Minnie.
13940	19140	We're out of Colorado. We're both pen testers, and we like to do stuff on the side for fun.
19140	23140	So none of the things that we're going to talk about today reflect anything about our employers.
23320	28040	This is all a personal project, especially any opinions or jokes we might make.
28040	30960	These were not approved by our employers.
32300	33180	All right.
35780	40040	So, first of all, whenever we give this presentation, we like to just set the stage
40040	42540	so that everybody understands what we're talking about.
42540	44820	What is a rogue access point?
44940	50420	A rogue access point is a wireless access point that's either misconfigured or maliciously
50420	55580	configured and exists in a hardware baseline that you don't want it there.
55580	58960	So the idea is you want to find these and get rid of them.
59040	61040	They come in all sorts of forms.
61040	67720	You know, you have sysadmins that set up an old Netgear router, hoping to get stuff done,
67720	69080	and they leave it open.
69080	74680	Or you have a retail shop that installs a wireless extender, and they authenticate to your
76140	81900	WPA2 main hub, and anybody else can access that extender because it is broadcasting open.
81900	83520	Boom. Right behind the network.
83520	92520	So these are real threats in terrestrial networks, and they require some specific
92520	94420	tactics to find out.
94560	100240	So last year, Minnie and I talked about hunting the stationary APs.
100480	106760	There's a link here that I guess we'll post the slides on the Wireless Villages page.
106900	109600	Follow the link, watch our talk from last year.
109600	111180	We won't talk too much about it.
111180	113700	But this year we're talking about mobile rogue APs.
113700	115060	These are the foxes.
115440	119360	If you're competing in the CTF, if you've ever competed in the CTF, you know that this
119360	121160	is one of the challenges.
121280	125940	Go out and find a wireless access point that's roaming around.
125940	131300	Now this presents its own challenges, because in order to find it, whatever gear you have
131300	137920	with you, that antenna pattern has to match the antenna pattern of what you're searching
137920	138460	for.
138460	140680	At least they have to be in the same vicinity.
140680	146200	So you can spend a ton of time on your feet looking for a fox and never pick up its signal
146200	148460	if you're not doing things right.
149120	154020	And if you go back and watch our talk from last year, it's pretty much what happened.
154020	155220	We just walked around a lot.
155220	161320	If you think about Caesar's Palace blueprints, and if you put a Roomba on that blueprint,
161320	162580	that's pretty much what we did.
162580	166280	It just went back and forth until we found the stationary AP.
166280	171880	So hunting mobile APs takes on its own form.
172180	177260	Because you can go back and forth just like a Roomba would to try to cover your entire
177260	177940	search space.
177940	181680	But if you're not in the same place as the fox, you're going to miss them.
182720	184100	So it's attacker controlled.
184100	187980	The attackers got the hardware on themselves.
188980	192260	So for any sort of hunting, what do you need?
192260	197500	What are the key pieces of information that you need to go out and hunt the rogue AP?
198360	200440	You have to be able to identify your target.
200440	206960	Here in the wireless CTF, the organizers post a BSSID and that's it.
207100	208440	They'll just give you a BSSID.
208440	209400	They don't tell you the frequency.
209400	210680	They don't tell you the channel.
210700	212260	And you've got to go out and find it.
212340	216300	So you have to at least start with a BSSID.
216300	221620	And a lot of folks will pick this up like if they're doing this threat hunting for real.
221620	225080	They'll have some indication that something's wonky in their environment.
225080	230000	And they'll be able to pull a BSSID and that's what they start from.
230640	235100	So it's better if you have a frequency and a channel because you narrow your search space.
235140	237960	You can tune your gear a lot easier that way.
238180	242080	But you also have to deal with a bunch of structural and wireless interference.
242100	246080	So you may need different types of antennas, directionals.
246080	251360	In our talk last year, we talked about not using Yagi's for these types of hunting.
251500	253080	It's kind of cool. Looks cool.
253080	256520	You're walking around with this big thing that looks like a sniper rifle.
257080	259320	But it actually makes the search a lot harder.
259320	264940	Because remember, your antennas, your radiation patterns have to overlap.
264940	269380	And if you've got a soda straw that you're just pointing around in whatever direction,
269380	272980	then it's going to be really difficult to find somebody else's donut.
273980	280600	And here, especially this year, for the contest, you have a huge space to cover.
280600	283660	Last year we talked about Caesar's Palace.
283660	293280	Something like 60 acres of space, 30,000 people, 600 floors of rooms.
293280	294840	So just tons of space to cover.
294840	296860	And this year we're across three different casinos.
296860	300720	So you just imagine how that scales up.
302560	310100	So, coming off our success from DC25, finding the stationary access point,
310100	313140	Minnie and I decided that we were done walking around.
313420	316400	Like, we were going to cut that out of our strategy immediately.
316620	321880	I get shin splints really easy, I've got flat feet, and Minnie's got a bum knee.
321920	327760	So, we were done walking and we thought, okay, how do we approach this in a smart way?
327760	334300	So our idea was, let's just sit still, or at least relatively still.
334300	342000	Let's deploy some sort of sensor that can just stay in one place and somehow we get notified.
342340	347840	Well, one way to do that is just get a huge team of people, 12 plus people.
347860	352540	Everybody gets a raspberry pie and you're on ham radio and you all go out to your different locations.
352540	355460	Well, guess what? People are unreliable.
355760	357700	And they suck at communicating.
357700	364040	So, we needed something that we could control, something that had a protocol that made sense to us,
364040	368580	that we could check out and would work, you know, 9 times out of 10.
368580	373460	Of course, we wanted 10 out of 10, but 9 times out of 10 is good enough for us.
375920	386280	So with that in mind, traditional hunting takes, you know, walking around but using direction finding.
386280	388080	And that's still important to us.
388080	393420	Even though we didn't want to walk around, we still have to eventually use traditional methods.
393560	399160	So the idea is, once we deploy an automated non-human sensor network,
399160	402340	and at this point we still didn't know what that would be,
402340	408380	we're going to narrow down our search space and be notified where we need to be next.
408380	411660	And hopefully we're somewhat close to where we need to be next.
411660	416820	And we thought that might make things just a little more efficient.
417860	420900	So another thing that we needed to make sure is that we kept our costs down.
420900	424460	Like I said at the beginning, Minnie and I bankrolled this whole project ourselves,
424460	428820	and we're pretty poor, so we had to keep all of our costs down.
428920	431760	Also, we had to keep our costs down for this last point,
432500	438120	because we needed to make these things concealable, at least to compete in the wireless CTF.
438120	444260	We wanted to be able to place whatever these sensors would be,
444260	448480	we wanted to be able to place them in places that we didn't have to have physical security over.
448600	450040	That we could just leave them there.
450200	453720	And it's DEF CON, there's a bunch of thievery happening here.
454040	457860	If you guys see things on the walls or on tables, you're probably going to pick it up.
458060	464020	This is important because we could have built out this whole strategy I've described so far
464020	470880	by just buying a bunch of Aruba access points, or Cisco Enterprise access points,
470880	473620	because they have this functionality built into them.
473780	477620	If you deploy enough of them, they can build out a two-dimensional heat map,
477620	484100	and you can see relatively where specific users, specific access points are.
484880	492860	But at $500 to $1500 a wireless access point, we didn't want those just walking off here at DEF CON.
492860	503140	So our approach was a low-cost, rapid prototype of a deployable and unmanned sensor network.
504340	509160	So after doing some research, trying to figure out what devices kind of fit that model,
509160	512140	we came across the ESP8266.
512140	515160	How many of you ever played around with this before?
515200	517500	It's gaining popularity.
517500	524180	The ESP family of wireless chips has been around, at least the DEF CON scene, for a long time.
524260	530660	The last several years, some of the badges have featured ESPs, ESP32s,
530660	535160	and then obviously a lot of the Indy badges feature that same chip.
535560	537340	There's a lot of functionality in them.
537340	541260	For us, the ESP32 is a little more expensive than what we wanted.
541260	547620	I think it came in at about a $15 a node price, and we wanted to keep costs extremely low.
547620	550780	So if you see here, it's $3.
551380	555160	Get it on Amazon, $3, no big deal.
555800	558980	And that was the building block for our whole sensor network.
559500	561740	These were released in 2014.
561960	563760	Somebody out of China was manufacturing them.
563760	569140	Nobody here really caught wind of it, except if you were really into hardware hacking.
569140	575680	And then Hackaday picked up the ESP8266 for one of their pieces.
576060	581040	And there's a great article on what they were able to do with the ESP8266.
581360	583240	Because it's pretty unique.
583240	589480	At $3, you get almost 20 dB out of this tiny little chip that's powered by 3.3 volts.
589480	592200	So in open space, some people have done tests,
592200	598120	and it reaches client to the wireless access point is about 300 meters.
598120	602120	So it's got a really, really good radiation pattern.
603000	613660	And even better in the chip is all the functionality that you need to run WPA and WPA2.
613860	617080	So that meant that we didn't have to write that from scratch,
617080	620080	which is really important for me because I'm a horrible coder.
620080	625120	Really important for many because I didn't want to turn them into a slave during this project.
625120	632880	So the ESP8266 has two GPIO transmit and receive serial pins.
633160	636480	This is really neat for debugging because we can just see.
636480	642280	We can print stuff out, you know, just like really rudimentary debugging.
642720	645240	Entering our own print line, seeing what's going on.
645540	650480	But it also allows us to combine multiple ESPs if we wanted to.
650480	656740	Or put other sorts of sensors on it so that we can read and control what's going on.
656740	663900	So this quickly became our number one choice for how we would build this network out.
663900	666460	It's got a 32-bit RISC processor on it.
667280	670160	You can overclock it up to 160 megahertz.
670660	673780	And one of the limitations is it only has a meg of RAM,
673780	677200	and that's for both program code and user data.
677200	682660	So that may not seem like it now, but when you're dealing with wireless stuff, that's very small.
682700	688360	So our ability to just dump a bunch of logic onto this is slim.
689160	695140	It runs on 3.3 volts, which means you can power it with a little tiny coin cell.
696300	701020	A lot of the projects that you'll find online for 8266 is a bunch of IoT stuff.
701020	706960	Farmers who are monitoring their water flows, and folks who are watering plants,
706960	710300	and a lot of watering going on with 8266s,
710300	716080	because they act as a wireless access point themselves, and they run natively.
716080	719960	If you just bought this right now, this little guy,
719960	724640	and it came to you over Amazon, and you just powered it up on 3.3 volts,
724640	727260	it's got a full web server running on it.
727260	729200	So it's really plug and play.
729200	732320	You just start working with it, access the website,
732320	738140	and kind of build it to suit your needs just from there.
739660	743500	Yeah, so if you hadn't seen one before, that's about how small it is.
745120	749160	Picture does not depict actual size. I forgot to put that up there.
751340	754220	Indoors, it has a pretty limited range, what wireless doesn't,
754220	756200	because you're dealing with a bunch of concrete and steel,
756200	759620	and here you're dealing with a bunch of water, because all the humans walking around.
759620	763300	You've got about 80% water. That's a lot of attenuation happening.
764560	768420	And if you're running, if you're using the wireless chipset the entire time,
768420	770320	it's super power-hungry.
770320	773420	So this, what we ended up learning as we built these,
773420	778140	is these coin cells running with our code base lasted about 15 minutes,
778140	780220	which was awesome.
780220	782280	And then it got really, really hot.
782280	784520	So if you had little tiny robin eggs,
784520	790060	you could crack them on top of the chip and you'd have breakfast for a minute.
791140	794960	The other limitation is it's 2.4 gigs only.
794960	796960	That's the only band that it operates on,
796960	799300	which is a limitation for the contest,
799300	802640	because there's a ton of stuff in the wireless CTF that is on 5 gigs.
802640	805520	So that's just completely out of the ballpark for us.
807260	809500	But it makes a really good proof of concept.
809500	813440	So if we decide that we can stomach more cost per node,
813440	817140	we can upgrade that to a dual-band chip and move on.
820300	824260	So I want to walk you through a bit of history,
824260	827940	lessons learned, or just a journey of the 8266.
828280	830780	Since we picked this up last year,
830780	836280	about December of 2017 is when we started this project
836280	839120	so that we could compete last year in the wireless CTF.
841280	845400	The 8266 didn't have a lot of documentation online.
846280	850380	What it did have was inconsistent between different sources.
851180	854020	Even worse, the tooling was just not even there.
854020	858500	So development boards didn't really exist for this specific model.
858500	860780	Now, for the 32, they're all over the place.
860780	862760	But this really cheap model,
862760	865240	there wasn't a lot of resources available to us.
865240	868680	So we ended up having to go back to our electrical engineering days
868680	871680	and remind ourselves what a breadboard is.
872200	876840	So this was our first kind of development board.
876960	880400	The idea was, since we were building a network of sensors,
880400	882140	we needed at least three.
882220	883800	One to act as the root node,
883800	887060	and two more so we could see how they communicated with each other.
887180	892620	So this allowed us to program and run the chips all on the same board,
892620	894360	just made it a lot more simple.
895380	900420	Even more simple is how you interact with the 8266.
900680	905740	Flashing firmware, powering it off, putting it into operational mode.
905740	907220	Just these two buttons.
907760	914200	Well, it's a pull-down and a pull-up on two of the GPIO pins,
914200	916800	but we use these buttons to perform that.
916800	922020	And a certain pattern of using those puts the chip into program mode,
922020	927700	so you can take your entire program, load it on, flash it,
927700	929780	and then it resets automatically,
929780	931720	and then it's automatically in operational mode.
931720	934100	So whatever code you're running, you're seeing it happen right there.
934100	935840	So if you're changing the access point,
935840	939300	right after it flashes, that access point name is going to pop up.
939440	941300	So it's really quick, a lot of fun.
942860	946460	Later on, we improved our design for our development board.
946460	948700	This is the next one on the left.
948700	952140	We needed them to be individual nodes.
952140	955580	We are now ready to go out and deploy these and test them more.
955980	960860	So on that board on the right is just a 5-volt FTDI
960860	966060	that has a power regulator on it that takes it down to...
966060	968720	a voltage regulator that takes it down to 3.3 volts.
969400	973020	At $3 a piece, they're pretty...
973460	975820	I mean, what do you expect? They're dainty.
975820	980560	So if you put 3.39 volts into it, they're going to fry.
980600	983660	So it's important that your voltage regulator is sound.
983660	985640	And we found that this one was really good.
987200	990020	And that was 2017.
990340	993320	Earlier this year, on the right,
993320	996460	somebody on Amazon, or somebody released on Amazon
996460	1000260	their own USB to ESP UART adapter,
1000260	1005840	which I cursed at because I really wanted that at the end of 2017.
1006220	1007960	It would have made things a lot easier.
1007960	1010900	You see there's a switch on the side instead of two buttons.
1010900	1014160	Makes it so much faster, smoother development.
1015900	1021260	And that's $8. That whole thing comes with an ESP8266
1021880	1025440	and the development board. That's why I gave you a link.
1025440	1028820	If you want to get started with this, it honestly just costs you $8.
1028820	1031900	And it's a great way to dive down into
1031900	1036140	the actual beacons and packets and frames
1036140	1039540	that are coming in and out of the 802.11 space.
1041780	1045900	We've competed in the wireless CTF the last two and a half years.
1045900	1047100	We didn't do it this year.
1048260	1051180	And I can't tell you that I ever once
1051960	1056080	actually looked into a packet and pulled out the beacon.
1056180	1057360	I just used tools to do it.
1057360	1059380	So it was really fun to get our hands dirty
1059380	1061540	and really get down to the protocol level.
1061740	1063000	Quickly, cheaply.
1063760	1067460	And now, with a lot more documentation and support out there.
1068220	1069960	So anyways, that's kind of part of the journey.
1071740	1073360	After we were done developing,
1074340	1075680	we had to go back to that requirement
1075680	1079720	of making our nodes, our sensor nodes, concealable.
1080200	1081720	Right? Because you all be thieving.
1081920	1084100	So we needed to make sure you couldn't find them.
1084100	1086500	Or if you did see them, you didn't think they were anything valuable.
1086500	1089340	We even got to the point of talking about putting
1090880	1092820	Cyrillic characters inside of our code
1092820	1094820	in case anybody dumped the firmware.
1094840	1097920	So they thought it was coming from somewhere in Eastern Europe.
1098880	1101640	The NSA actually has their own OUI.
1101720	1109740	OUI is the first three bytes of the MAC address for your chip.
1110280	1113720	And so we thought about setting our MAC address to the NSA's OUI.
1113720	1115660	But Minnie talked some sense into me
1115660	1117480	and said that probably wouldn't be a good idea
1117480	1120020	because there might be some legal things that we don't know about.
1120440	1122860	Anyways, it's public. You can go look it up.
1122860	1126040	Just go to an OUI database and type in NSA and it's there.
1127840	1129360	Anyways, I digress.
1129620	1133260	So we needed to build our concealables.
1133260	1136780	So we went from the board you saw in the previous one on the right,
1136780	1139820	which allows us just to take that ESP out
1139820	1144040	and back in to our deployable, as we call them, on the left.
1144080	1149640	We upgraded from the nickel cell to lithium ion batteries.
1149640	1152320	This one is a 3.3 volt.
1153020	1159560	I think it's a 1200... I don't know what it was in terms of amperage.
1159760	1162240	But it was enough to last longer than 15 minutes.
1162240	1164160	These lasted us about two hours.
1166180	1168720	We rolled through those batteries pretty quick.
1168720	1173840	But this is just a case. It's a utility case that you might install at your house or something.
1173960	1177020	And we found that with all the heat that was generated, this wasn't a great idea.
1177440	1181020	Because there's no way to ventilate all the heat, so that plastic got really hot.
1181020	1183880	And the last thing we wanted to do was cause another fire.
1183880	1185340	Well, we didn't cause the fire.
1186600	1189440	Have another fire at DEF CON.
1189500	1191920	And these are a little big, right?
1193520	1196420	I had one earlier, but they're about this big.
1196420	1199300	About the size of the fish I caught, too.
1200860	1205520	We realized, probably not an ideal form factor, so we shrunk it even more.
1206380	1208760	Here's what they look like now.
1208840	1211200	By the way, Todd's acting like he planned all this.
1211200	1216660	But he actually just decided that we were going to start using the coin cells right in the middle of the CTF.
1216660	1219780	Yeah, it was a flexible choice.
1220340	1222000	It was ad hoc.
1223140	1225800	So it's just this little coin cell holder.
1225800	1232000	These were for nodes that we were okay with deploying for 15 minutes, going and picking up, and then resetting.
1232680	1237080	I've got a whole box of ESPs here, I don't know if you can see it.
1237080	1238160	Come up afterwards.
1238620	1241200	Yeah, if you'd like one, I'm happy to give them away.
1242240	1244100	The ones that we're not using now.
1244780	1250700	In fact, I've got that whole programming board, I've got an extra one, so come talk to me if you'd like it.
1251500	1258160	And then that is blue masking tape on the battery bank that you see on the left, and it works perfectly.
1258160	1261080	It distributes heat unimaginably.
1261960	1267200	All right, and then we just had Velcro on the bottom, so we would stick these, and I think...
1267920	1269800	We stuck these everywhere.
1269840	1274320	We stuck them under tables, behind chairs, behind the pillars, on the walls.
1275100	1281540	TVs, underneath, we came into the wireless village and stuck them underneath the tables.
1282360	1284660	For purposes we'll explain later.
1285760	1290420	And, yeah, so that was kind of our deployment strategy.
1291820	1296020	My goal with this kind of introduction, I'm about to turn the time over to Mini,
1296020	1301600	was if you hadn't heard of the ESP8266, to kind of give you an introduction to it,
1301600	1305660	it's an awesome little chip, a great way to get started with wireless stuff,
1305660	1307920	either if you just need a wireless access point,
1307920	1312260	or if you want to do some of the more cool things that you can do with the software that you load on,
1312260	1313880	that Mini's going to talk about,
1314720	1318440	and then kind of show you our progress for our methodology
1318440	1324260	and what brought us to the form factor and the deployment that we had here.
1324340	1327280	So at this point, Mini, I'm going to turn this over to you,
1327280	1329720	and Mini's going to talk to us about software considerations.
1331820	1335040	So, yeah, like Todd was saying, we were just looking for something super straightforward
1335040	1341280	that I could get started with, with a relatively shallow knowledge of wireless and 802.11.
1341280	1343000	I'm not, like, a wireless expert.
1343000	1346560	I'm sure all of these fine people over here could tell you a lot more than I could,
1346560	1349220	so I was just looking to prototype something really quick,
1349220	1352500	find something with some open source software out there that I could fork
1352500	1357980	and just bootstrap in and start writing firmware on the fly.
1358980	1360900	Obviously, I wanted to flash it quick.
1361460	1363560	I had no idea what I was doing with the hardware.
1363560	1367400	If I destroyed it in some manner, I didn't want it to matter.
1367400	1370480	That happened several times, but that's why we work as a team,
1370480	1374040	because I got to build the new hardware that Mini destroyed.
1375340	1381900	So we used this prototype software at the time called Painless Mesh
1381900	1387860	that a guy named GMag wrote, and basically you have a centralized route
1387860	1392240	and it dynamically forms a wireless topology
1392560	1396300	based on some kind of shortest path algorithm in the background.
1396580	1400780	And so our leads are obviously just those little implants out there.
1400780	1403140	And yeah, that was really it.
1403140	1405720	What I'm trying to demonstrate here is that you have to have a root node
1405720	1407320	in order to make this work.
1407320	1411740	So we ended up putting this on just a little Raspberry Pi with an LED screen
1411740	1413160	and carried it around.
1415660	1421160	So for the root node, we ended up getting to a point where we wanted,
1421160	1426100	since they kept sending out foxes, to dynamically introduce BSS IDs
1426100	1432060	and have the opportunity to remove them at a later date if we needed to
1432060	1435280	or clear everything and start over from scratch.
1435500	1441260	So we just took a Python script, hooked it up over serial on our root node
1441260	1447360	and sent it a JSON blob and propagated that blob over the mesh to the slaves.
1447720	1455580	And then we came up with a kind of, just a pseudo TCP SYNAC data flow,
1455580	1458520	I suppose you could say, just to make sure that the message gets out
1458520	1460980	and that the bots acknowledge the message
1461480	1465140	and that we're actually hunting for the thing that we're looking for,
1465140	1466760	or the things, plural.
1467480	1470860	And then, you know, you could probably forward the bot data
1470860	1473320	into like a cool web app or something.
1473640	1477640	But there's only a team of two, so we didn't really get to that.
1477680	1482340	But there was another project on GitHub that I got some help from.
1483240	1485960	It's mentioned in the readme somewhere, I can't remember what it's called,
1485960	1490420	but he did some pretty cool visualizations with the wireless traffic
1490420	1494740	for sniffing on just like a single ESP.
1496080	1501000	So for the bots, like I said, going into this,
1501000	1504640	I didn't even know that I couldn't run promiscuous mode at the same time
1504640	1506440	as station AP mode.
1506620	1509080	So I was like, oh, oops.
1509080	1513800	I have to put this into kind of like a bimodal functionality.
1514220	1520080	So using the task, it's like an asynchronous task scheduler,
1520080	1526980	which is a fancy way of saying you write these responsibilities
1526980	1530360	that the bots are supposed to achieve at any given time,
1530360	1534100	like channel hopping or re-initialization to the mesh network
1534100	1541260	or signal acknowledgements to the other bots.
1541860	1546900	And yeah, that was kind of a learning experience.
1546900	1551300	So we came up with this kind of bimodal functionality in short.
1552980	1558160	And we also found a necessity to kind of change the,
1558160	1561120	when we found a target, we needed to send out an alert
1561120	1566660	and that kind of, with the way the topology changes
1566660	1568920	when the mesh reconnects,
1568920	1571880	we had to kind of change the way that the software is functioning
1571880	1574800	so that the message could get across the mesh network
1574800	1577380	as expediently as possible.
1577880	1584440	So we ended up leveraging some strategies with NTP,
1584440	1589700	network time protocol, and yeah, keeping everything in synchronization
1589700	1593580	in those bimodal segments at the same time
1593580	1597000	so that each bot was doing the same thing at the same time,
1597000	1598180	if that makes sense.
1598940	1601040	And we'll talk more about that in a second.
1601040	1602960	So this is just the basic duty cycle.
1602960	1608160	So by default, 20,000 milliseconds, communicating over the mesh,
1608160	1612740	renegotiating topology, getting information about NTP synchronizations,
1613240	1616980	and then for nine seconds going promiscuous and continuously scanning,
1616980	1622800	looking for the beacons in the frames, basically 802.11 frames in the air
1622800	1624780	that you're trying to hunt.
1627120	1629440	And then here's the root duty cycle.
1629440	1633120	We're handling communications between the mesh,
1633120	1636840	synchronization with NTP, obviously, with the bots,
1636840	1639180	and sending responses to alerts,
1639180	1642920	acknowledging that we've found a target or not,
1642920	1646860	and saving cycles since these things are already so power hungry.
1650230	1653470	And I'm calling this NTP magic because it was all built in a painless mesh
1653470	1655290	and I can't take credit for implementing it,
1655290	1658230	but basically you take the duty cycle time
1658230	1664830	and then you offset that with the current NTP synchronization interval
1665750	1670710	and that basically just allows everything to do what I call synchronized swimming,
1670710	1672070	where like we were talking about before,
1672070	1675190	they're communicating at the same time and then they're all scanning at the same time
1675190	1677650	so that when someone finds something,
1677650	1680630	they can automatically jump into a,
1680630	1684030	hey, I found your target alert mode screaming at the air
1684030	1686750	and the rest of the mesh continues to do what it's doing
1686750	1690070	and then the message will come over as soon as the rest of the mesh network
1690070	1692150	gets back into synchronization.
1693410	1696070	So this is just a short video.
1696490	1699490	I do apologize, we were trying to get a live demo together
1699490	1703710	and we had some upstream dependency issues that kind of broke.
1704130	1707070	Is that playing, Todd? How do you play that?
1710960	1712640	All right, so you got to give it a sec.
1712640	1714560	So basically on the left and the right,
1714560	1717040	we're just monitoring serial of two of these bots
1717860	1722400	and what I want you guys to see is them entering the promiscuous mode at the same time
1722400	1724640	and also communicating over the mesh at the same time,
1724640	1726340	making NTP negotiations.
1730400	1731720	It takes a sec.
1731720	1734960	This is kind of one of the hardest things that we had to wrap our heads around
1734960	1739100	because sometimes there'd be interference where a leaf wouldn't be able to,
1739100	1742200	or a bot as we call them, wouldn't be able to communicate back to the root node.
1742200	1746820	So independently, it still needed to be in sync with the rest of the mesh.
1746820	1751600	Yeah, so the bot initialization, it's in mesh communication mode right now
1751600	1754800	and there's actually a lot of back-end calls that are happening.
1754880	1758300	You can change the debug level on the painless mesh library
1758300	1762940	to get more granular view of the things that are actually taking place.
1762940	1765160	Oh, and then there's beacons.
1765920	1768800	And it's actually capturing the whole 802.11 frame
1768800	1772280	and we ended up having to capture probe requests too
1772280	1778360	because they had a fox where you actually had to capture the source PSSID
1778360	1780480	of who was making a probe.
1780640	1785340	So we had to kind of change our tactics later on in the CTF for that as well.
1785340	1787580	So right now, it's just a conditional block.
1787580	1793320	It looks for a beacon that's in an array of PSSID targets that you're looking for
1793320	1796300	and then if it doesn't find a beacon, it'll check the probe.
1797400	1800600	And so the waterfall of data that you're seeing here,
1800600	1805260	just like Minnie was saying, is the beacons that we're capturing in sniffing mode.
1805260	1806920	And we do that for 20 seconds.
1807140	1811380	And then they go back into mesh communication mode.
1811380	1813240	I think you had a better name for it.
1813920	1815780	Mesh communication mode works.
1815840	1818400	Awesome. I'll take credit for that.
1825090	1827150	And this looks like a duplicate slide.
1828050	1829010	My bad.
1829890	1833030	These are just the JSON blobs, the data we're sending back to the root node
1833030	1835770	and then we just put some directional arrows on there to indicate that
1835770	1839750	while we didn't have to do as much walking as we did in the stationary hunt,
1839750	1843390	we still had kind of a patrol that we would do
1843390	1847390	so that we had a higher likelihood of capturing the operator on the move.
1847390	1852350	And you can see here that we didn't deploy these all over Caesars.
1852350	1854430	This was a proof of concept for us.
1854590	1859150	So the limitation here is that our mesh network would only work for us
1859150	1861270	in the one specific place that we deployed it,
1861270	1867190	which this is kind of a map of the hallway right around the wireless CTF from last year.
1867630	1871510	And that was, you know, an obvious limitation of what we did.
1871630	1874950	Yeah, and granted, you could consolidate all your root nodes
1874950	1879950	and create a distributed C2 strategy if you wanted to.
1880430	1882290	It wouldn't be a huge push-up.
1883690	1886070	This is the alert mode I was talking about.
1886070	1889330	So basically, like I was saying, it stops everything it's doing
1889330	1891290	and it just starts screaming at the rest of the network
1891290	1893770	indicating that it's found the target.
1894230	1896610	And it does that for a certain amount of time
1896610	1899830	before it receives an acknowledgement from the root
1899830	1904590	and then it also sends back a finish acknowledgement back to the root
1904590	1907770	to tell the root to shut up and get back to its job
1907770	1911330	of listening to as much traffic as possible.
1911570	1914470	And then it re-synchronizes with the same NTP offsets
1914470	1919730	and goes back to its default communication mode with the mesh.
1922990	1924110	All right.
1925070	1927850	So, on the left here,
1927850	1932290	this is a bunch of traffic on the root node over serial.
1932570	1935410	So you can see the different connections that we're making
1938170	1940250	wirelessly with our slaves.
1940250	1942970	And then on the right, I don't know if you guys can see it
1942970	1946310	in the upper right-hand corner, that's going to be an updater script
1946310	1948170	where we're updating the root over serial
1948170	1952930	before the root sends out commands to the rest of the bots in the mesh.
1953990	1956910	And then on the bottom right, I was just using that as an indicator
1956910	1959890	to synchronize the videos because there's another video
1959890	1961510	that's overlaid on top of this.
1961510	1963870	Give us a sec. We're not great video editors.
1964570	1965750	Don't judge us.
1972830	1975170	Okay, so, yes, I sent a target.
1975870	1977710	That's a MAC address right there.
1978630	1981230	And that's a real MAC address of one of my devices.
1981710	1985330	Anyways, the root is acknowledging with the JSON blob
1985330	1989290	that it's received it and it's sent it over the mesh.
1989290	1991430	I'm just printing out the JSON on the left there.
1991430	1994270	So now these nodes are actually hunting.
1996090	1998270	Is the overlay video going to play now?
2000710	2001610	There it is.
2001610	2003590	All right, so, we're in a library.
2004330	2008170	And as you can see, there's one of our nodes connected to a Chromebook.
2010210	2012930	And I'm going back to my root next to Spider-Man.
2015510	2018430	And we're trying to show you guys here that there's no smoke and mirrors.
2022040	2025480	And when it catches a target, it's going to spit out something
2025480	2028340	in that Python monitor script on the left that's green,
2028340	2031080	indicating that it's found one of its targets.
2031080	2034700	And we also wrote a script where it goes through...
2034700	2035440	Oh, there it goes.
2035440	2039960	And Todd's about... I don't know if there... he's over there.
2040080	2042920	Like, oh, what, 50 meters away or so?
2043120	2044560	Probably like 50 feet, yeah.
2044560	2046460	Yeah, and it's pretty basic.
2046460	2048440	You know, you just have one slave out there.
2049520	2051500	You probably can't see it from back there,
2051500	2055420	but the last number on the right, that highlighted green, is the RSSI value.
2055420	2056560	It's negative 85.
2056560	2058640	Yeah, and now it's negative 78.
2060260	2062960	And so, yeah, the script we wrote,
2062960	2065880	you can also pull that out and go straight into arrow dump.
2065880	2067760	So, we also had an alpha card,
2067760	2072260	and we would just dump that BSSID straight in and start hunting.
2072420	2075760	But for demonstration purposes, we kept it in monitor mode.
2075760	2080500	Yeah, that's when we'd switch into just the traditional hunting direction finding.
2081140	2083600	But one really neat thing about the way that we deployed these,
2083600	2085220	and just, I mean, it wasn't anything we did,
2085220	2087060	it's just the theory behind it is,
2087060	2089040	especially with the RSSI values
2089040	2091500	and the different nodes that are communicating back,
2091500	2094340	at that point, we can establish direction, right?
2094340	2097700	So, if we're in a hallway and everybody's going that way,
2097700	2100540	but our signal is coming back to us saying that,
2100540	2101960	hey, the signal's getting stronger,
2101960	2105060	and each subsequent node is telling us it's right there,
2105060	2108000	and we're just looking for the people or person that's just walking towards us,
2108000	2113200	and that's when we kind of switch into the traditional mode and get on our feet.
2117370	2118850	Oh, there we go.
2119450	2121570	And we thought this was interesting.
2121570	2124630	While we were doing the CTF, we had noticed other people were putting these things,
2124630	2125690	this is not ours,
2125690	2130010	other people were putting these out in the field for shenanigans like de-authentication.
2130590	2134670	We got really frustrated at the end of the hunt because we hadn't found any foxes,
2134670	2138630	so we just downloaded, what's his name, Space Hoon?
2138630	2142390	Space Hoon's beacon spamming software,
2142390	2147270	and started beacon spamming out the target VSS IDs in and around the village,
2147270	2150090	just to drive the other teams crazy.
2150110	2151310	Yeah, so you heard that right.
2151310	2154930	We didn't find the fox, so I hope we didn't say that at the beginning.
2154930	2156570	Yeah, here's how you find a fox.
2156730	2160010	This was just kind of our approach, we thought it was cool and novel.
2161090	2163550	And we did get very frustrated,
2163550	2165870	but we got kind of our...
2165870	2168390	We wasted a bunch of some of these guys' time.
2168390	2170470	Yes, it was vindictive for us.
2171190	2174190	At least two people went chasing our signal,
2174190	2176570	and Mini did something very evil.
2177010	2179950	He set a delay in when the beacon would spam,
2179950	2181510	so it wouldn't just be constant,
2181510	2186190	it would be like every seven seconds you'd get a beacon spam for three seconds.
2186190	2189690	It was every 25 seconds, and it would be for like two seconds.
2189690	2191170	You'd just get a little blip.
2191170	2193790	25 seconds is long enough for you to think that,
2193790	2196570	okay, I'm going to go out in that hallway,
2196570	2197970	and I'm going to go down this way,
2197970	2199970	and then before you know it, your signal's gone.
2200470	2204190	So we watched people, and the desperation in their face,
2204190	2206450	as they went out into the hallway, thinking they found it,
2206450	2208930	and then it just disappeared, and just their face went white.
2209610	2211990	And then we targeted that team from Idaho.
2211990	2214190	Do you remember the gentleman with the white beard?
2214190	2214550	Yeah, yeah.
2214550	2217090	Hunter tablet, we kind of followed him over,
2217090	2219210	and then we placed one of them behind the TV,
2219210	2220410	we knew one of the goons,
2220410	2223550	and he was like losing his mind for a good 20 minutes.
2223550	2225230	We kind of felt, did we apologize to him?
2225230	2225470	Yeah.
2225470	2226090	Okay.
2229620	2232760	So since we basically came up with this little scheme
2232760	2236980	to have a, what I call, a Wi-Fi C2, if you will,
2236980	2239640	it'd be really cool to apply the distributed model
2239640	2243240	to the stuff that's already out there for the ESP8266 software,
2243240	2244660	like the beacon spamming,
2244660	2247400	and instead of just throwing them out there in beacon spamming,
2247400	2253280	to actually have some level of control and feedback,
2253280	2255140	deauth would be cool too.
2255700	2258640	I mean, I'm not going to like suggest it to anyone,
2258640	2262340	but I'll just say, just imagine if you placed these outside,
2262340	2266600	if someone placed these outside of like an enterprise or something like that,
2266600	2270420	and just like sat in their car and screwed around with the Python script
2270420	2274480	for a couple hours, you could like, you could probably,
2274480	2277340	I mean, theoretically, I'm not suggesting anything to anyone,
2277340	2279360	but it'd be kind of fun.
2281760	2286840	So, for the future, we were thinking 802.11,
2286840	2288780	maybe one of the reasons we didn't find the foxes,
2288780	2291340	there was like, there's just so much saturation,
2291940	2295380	there's so many pineapples, and there's so much shenanigans.
2295720	2299560	Some of the times we couldn't even get like traffic back from the mesh,
2299560	2301260	depending on where we deployed it.
2302320	2304640	Yeah, and the way that that looked in the spectrum,
2304640	2307100	so like if you were using regular tools like AeroDump,
2307100	2309840	what you would see is every 20 seconds,
2309840	2313700	an access point would stand up on one of our ESPs,
2313700	2317920	and it was called test in production, I think.
2317920	2320160	And so you would see that pop up,
2320160	2323080	but folks who are walking around with pineapples,
2323080	2325740	that are doing what's called karma mode,
2325740	2327740	where they're just responding to every single beacon
2327740	2331020	as if they are a legitimate access point,
2331020	2333080	are stealing those handshakes, right?
2333080	2338200	Or stealing those initial connection attempts.
2338200	2341310	So whenever we would stand up in station AP mode,
2341640	2344460	our theory is, we didn't collect the data on this,
2344460	2345760	you know, while we were doing it,
2345760	2348660	but our theory is that we would lose connection,
2348660	2354400	because our node would try to connect to that karma response.
2355380	2359130	So 802.11 really is not a great protocol,
2359690	2363870	Wi-Fi is not a great protocol to backhaul all your communications
2363870	2365530	back to the root node on.
2366030	2369790	Obviously we're going to use it to sniff and all of this stuff,
2369790	2372150	but there's some better options out there.
2372230	2375690	In terms of reliability, I mean, for obvious reasons,
2375690	2377990	in an environment like this that's so hostile,
2377990	2380230	it's just probably not the best choice,
2380230	2382550	but it's great for a quick and dirty POC.
2383670	2387030	Otherwise, we're thinking about switching it up
2387030	2389970	to something more expensive that Todd was thinking about.
2390110	2392750	Yeah, well, like, if we could just stomach more money
2392750	2396030	just walking away with each node, if somebody walked away with it,
2396030	2398010	then we could do a lot more.
2398330	2401310	We could build this into dual band.
2401870	2406090	LoRa is great for, would be our backhaul communications.
2406090	2408990	We do that over, I forget what frequency it is,
2408990	2412010	but we could use LoRa for backhaul,
2412010	2415890	and obviously, you know, battery packs and all of that,
2415890	2419150	and casings and however we concealed it.
2419350	2421170	We could definitely dump more money into it,
2421170	2423810	but for us, we wanted to keep costs low
2423810	2428890	and be able to test, deploy, and interact with it pretty quick.
2429070	2432030	So, in the future, if we can do that,
2432030	2435770	we might seek out a dual band chip to do that with,
2435770	2439830	but that's at like $30 just starting, sometimes more.
2440170	2442550	If you know of any, please tell us.
2442550	2445530	Maybe our research is just poor, we haven't found it yet,
2445530	2449110	but a $3 dual band chip would be ideal.
2450210	2452610	Yeah, yeah, we were thinking about just,
2452610	2455930	well, should we talk about the other idea,
2455930	2457890	about clustering the USPs together?
2457930	2464290	Yeah, so, switching between the modes takes a lot of power.
2465510	2467830	And there's a lot of overhead, too.
2467830	2468270	There is.
2468270	2470250	Things are running on a single thread,
2470250	2473690	even though it's asynchronous, it's pseudo-asynchronous,
2473690	2476850	it's basically like coding in the 90s, I guess,
2476850	2477930	whatever that's like.
2477930	2483210	Right, you're taking up most of that 1 meg code RAM.
2483210	2486250	That 1 meg RAM is just being eaten up by both of your processes
2487050	2490470	for going from station mode to sniffing mode.
2490470	2493370	So, you could just distribute that over two ESPs
2493370	2495190	and put them in the same box.
2495790	2499290	Doubles your cost of a node, because it's two ESPs,
2499290	2500410	it's not a big deal.
2500610	2503470	But now you have more processing power available to you.
2503470	2505830	Yeah, they can just communicate over serial to you.
2505830	2511130	And we could sleep one chip while the other one's monitoring,
2511130	2513570	and you save power that way, too.
2513870	2515370	Yeah, definitely.
2516250	2520650	But obviously, implications with going with the hardware Todd's talking about,
2520650	2525610	we'd have to roll our own code and stop copying other people's stuff.
2525610	2528830	Which is actually the reason we didn't have a live demo today.
2529690	2535330	Five days ago, somebody committed an update to one of the libraries we were dealing with, and...
2535330	2537450	What we know is we didn't track our dependencies well,
2537450	2541290	and the last time that the compiled version worked was May.
2541330	2546370	So it's on GitHub, and it's MIT, so you guys can take it and do whatever you want with it.
2547010	2549230	All we know is back in May it was working fine.
2549230	2552230	Yep, and so if we had our own painless mesh library,
2552230	2554930	obviously we'd be testing any changes there.
2554930	2559270	But we rushed into it, didn't version stuff, and... shit broke.
2559270	2567050	Yeah, and just want to tip our hat for all the people who wrote a lot of these lower-level libraries for the ESPs,
2567050	2571630	and for all the other talkers that did such an awesome job here, and for having us.
2571630	2573210	Thank you guys very much.
2573270	2575410	Yeah. Do you guys have any questions?
2575710	2576850	No? All right.
2578470	2581010	We got two. Way back there.
2582990	2585130	I can't hear you, dude.
2586490	2587710	Just yell.
2592260	2593660	The BLE?
2594240	2597820	Yeah, that was an option, but cost-prohibitive.
2598920	2601940	Let me repeat the question, make sure I got it right.
2601940	2606300	Did we think about using BLE for communication across nodes?
2606500	2611580	Yes. Cost-prohibitive for us, because we had to sniff with the wireless chip anyways,
2611580	2621010	so putting another chip on there... 32 does.
2621010	2622350	He says the 32 has BLE.
2622350	2628670	Yes, 8266 is like a stripped-down Honda Civic, right?
2629110	2632610	ESP32 is like an elite Hyundai.
2634650	2639650	You know, it's still not like the best, but you do get BLE with it, which would be a great idea.
2639650	2643810	If I wasn't so cheap, I probably would do that. Great question.
2643810	2644890	Yes.
2653280	2654320	No.
2655160	2656280	Can you repeat the question, Todd?
2656280	2661840	Yeah, did we have a linear regulator that...
2671750	2672930	Right.
2673850	2677410	Yeah, we just plugged it straight in. We were like, let's go.
2677510	2682450	So that may have been part of our power usage issue, for sure.
2682810	2684410	Okay, thank you.
2684890	2686590	Other question up here?
2687130	2687910	Yeah.
2704890	2713550	So the question was if the current constraints of the hardware limited the amount of
2713550	2719250	beacons we were able to parse, and the answer was, I mean, it depends on how fast you're
2719250	2723570	hopping channels, and we didn't really have a baseline to measure it against, but from
2723570	2729570	what I could tell, compared to just standard arrow dumps with an alpha card and a laptop,
2729570	2733010	it was actually, it pulled out a good amount of data.
2733690	2739570	Yeah, we weren't storing every single beacon correct. We were just churning through it and
2739570	2746170	comparing the beacon address. I don't know, you wrote that logic. What did we do?
2746170	2748230	Yeah, we were just looking for the beacon.
2748230	2750670	Yeah, we would just compare it. If it was the right one, then we popped it.
2750670	2751710	And the probes eventually.
2751970	2756350	Any other questions? Okay, thank you all very much.
2756350	2756850	Thanks, guys.
2756850	2757870	Enjoy the rest of your DEF CON.
2757870	2758110	Thank you.
