WEBVTT

00:00.000 --> 00:04.320
Today we're going to be talking about hunting mobile rogue access points.

00:04.840 --> 00:10.420
And so it's kind of the same methodology, but we've beefed it up just a bit.

00:10.860 --> 00:12.140
I'm Todd Parity.

00:12.720 --> 00:13.820
I'm Minnie.

00:13.940 --> 00:15.500
We're out of Colorado.

00:15.640 --> 00:19.140
We're both pen testers, and we like to do stuff on the side for fun.

00:19.140 --> 00:23.140
So none of the things that we're going to talk about today reflect anything about our employers.

00:23.320 --> 00:28.040
This is all a personal project, especially any opinions or jokes we might make.

00:28.040 --> 00:30.960
These were not approved by our employers.

00:32.300 --> 00:33.180
All right.

00:35.780 --> 00:42.540
So, first of all, whenever we give this presentation, we like to just set the stage so that everybody understands what we're talking about.

00:42.540 --> 00:44.820
What is a rogue access point?

00:44.940 --> 00:55.580
A rogue access point is a wireless access point that's either misconfigured or maliciously configured and exists in a hardware baseline that you don't want it there.

00:55.580 --> 00:58.960
So the idea is you want to find these and get rid of them.

00:59.040 --> 01:01.040
They come in all sorts of forms.

01:01.040 --> 01:09.080
You know, you have sysadmins that set up an old Netgear router, hoping to get stuff done, and they leave it open.

01:09.080 --> 01:21.900
Or you have a retail shop that installs a wireless extender, and they authenticate to your WPA2 main hub, and anybody else can access that extender because it is broadcasting open.

01:21.900 --> 01:22.620
Boom.

01:22.620 --> 01:23.520
Right behind the network.

01:23.520 --> 01:34.420
So these are real threats in terrestrial networks, and they require some specific tactics to find out.

01:34.560 --> 01:40.240
So last year, Minnie and I talked about hunting the stationary APs.

01:40.480 --> 01:46.760
There's a link here that I guess we'll post the slides on the Wireless Villages page.

01:46.900 --> 01:49.600
Follow the link, watch our talk from last year.

01:49.600 --> 01:51.180
We won't talk too much about it.

01:51.180 --> 01:53.700
But this year we're talking about mobile rogue APs.

01:53.700 --> 01:55.060
These are the foxes.

01:55.440 --> 02:01.160
If you're competing in the CTF, if you've ever competed in the CTF, you know that this is one of the challenges.

02:01.280 --> 02:05.940
Go out and find a wireless access point that's roaming around.

02:05.940 --> 02:18.460
Now this presents its own challenges, because in order to find it, whatever gear you have with you, that antenna pattern has to match the antenna pattern of what you're searching for.

02:18.460 --> 02:20.680
At least they have to be in the same vicinity.

02:20.680 --> 02:28.460
So you can spend a ton of time on your feet looking for a fox and never pick up its signal if you're not doing things right.

02:29.120 --> 02:34.020
And if you go back and watch our talk from last year, it's pretty much what happened.

02:34.020 --> 02:35.220
We just walked around a lot.

02:35.220 --> 02:42.580
If you think about Caesar's Palace blueprints, and if you put a Roomba on that blueprint, that's pretty much what we did.

02:42.580 --> 02:46.280
It just went back and forth until we found the stationary AP.

02:46.280 --> 02:51.880
So hunting mobile APs takes on its own form.

02:52.180 --> 02:57.940
Because you can go back and forth just like a Roomba would to try to cover your entire search space.

02:57.940 --> 03:01.680
But if you're not in the same place as the fox, you're going to miss them.

03:02.720 --> 03:04.100
So it's attacker controlled.

03:04.100 --> 03:07.980
The attackers got the hardware on themselves.

03:08.980 --> 03:12.260
So for any sort of hunting, what do you need?

03:12.260 --> 03:17.500
What are the key pieces of information that you need to go out and hunt the rogue AP?

03:18.360 --> 03:20.440
You have to be able to identify your target.

03:20.440 --> 03:26.960
Here in the wireless CTF, the organizers post a BSSID and that's it.

03:27.100 --> 03:28.440
They'll just give you a BSSID.

03:28.440 --> 03:29.400
They don't tell you the frequency.

03:29.400 --> 03:30.680
They don't tell you the channel.

03:30.700 --> 03:32.260
And you've got to go out and find it.

03:32.340 --> 03:36.300
So you have to at least start with a BSSID.

03:36.300 --> 03:41.620
And a lot of folks will pick this up like if they're doing this threat hunting for real.

03:41.620 --> 03:45.080
They'll have some indication that something's wonky in their environment.

03:45.080 --> 03:50.000
And they'll be able to pull a BSSID and that's what they start from.

03:50.640 --> 03:55.100
So it's better if you have a frequency and a channel because you narrow your search space.

03:55.140 --> 03:57.960
You can tune your gear a lot easier that way.

03:58.180 --> 04:02.080
But you also have to deal with a bunch of structural and wireless interference.

04:02.100 --> 04:06.080
So you may need different types of antennas, directionals.

04:06.080 --> 04:11.360
In our talk last year, we talked about not using Yagi's for these types of hunting.

04:11.500 --> 04:12.560
It's kind of cool.

04:12.560 --> 04:13.080
Looks cool.

04:13.080 --> 04:16.520
You're walking around with this big thing that looks like a sniper rifle.

04:17.080 --> 04:19.320
But it actually makes the search a lot harder.

04:19.320 --> 04:24.940
Because remember, your antennas, your radiation patterns have to overlap.

04:24.940 --> 04:32.980
And if you've got a soda straw that you're just pointing around in whatever direction, then it's going to be really difficult to find somebody else's donut.

04:33.980 --> 04:40.600
And here, especially this year, for the contest, you have a huge space to cover.

04:40.600 --> 04:43.660
Last year we talked about Caesar's Palace.

04:43.660 --> 04:53.280
Something like 60 acres of space, 30,000 people, 600 floors of rooms.

04:53.280 --> 04:54.840
So just tons of space to cover.

04:54.840 --> 04:56.860
And this year we're across three different casinos.

04:56.860 --> 05:00.720
So you just imagine how that scales up.

05:02.560 --> 05:13.140
So, coming off our success from DC25, finding the stationary access point, Minnie and I decided that we were done walking around.

05:13.420 --> 05:16.400
Like, we were going to cut that out of our strategy immediately.

05:16.620 --> 05:21.880
I get shin splints really easy, I've got flat feet, and Minnie's got a bum knee.

05:21.920 --> 05:27.760
So, we were done walking and we thought, okay, how do we approach this in a smart way?

05:27.760 --> 05:34.300
So our idea was, let's just sit still, or at least relatively still.

05:34.300 --> 05:42.000
Let's deploy some sort of sensor that can just stay in one place and somehow we get notified.

05:42.340 --> 05:47.840
Well, one way to do that is just get a huge team of people, 12 plus people.

05:47.860 --> 05:52.540
Everybody gets a raspberry pie and you're on ham radio and you all go out to your different locations.

05:52.540 --> 05:53.500
Well, guess what?

05:53.580 --> 05:55.460
People are unreliable.

05:55.760 --> 05:57.700
And they suck at communicating.

05:57.700 --> 06:08.580
So, we needed something that we could control, something that had a protocol that made sense to us, that we could check out and would work, you know, 9 times out of 10.

06:08.580 --> 06:13.460
Of course, we wanted 10 out of 10, but 9 times out of 10 is good enough for us.

06:15.920 --> 06:26.280
So with that in mind, traditional hunting takes, you know, walking around but using direction finding.

06:26.280 --> 06:28.080
And that's still important to us.

06:28.080 --> 06:33.420
Even though we didn't want to walk around, we still have to eventually use traditional methods.

06:33.560 --> 06:48.380
So the idea is, once we deploy an automated non-human sensor network, and at this point we still didn't know what that would be, we're going to narrow down our search space and be notified where we need to be next.

06:48.380 --> 06:51.660
And hopefully we're somewhat close to where we need to be next.

06:51.660 --> 06:56.820
And we thought that might make things just a little more efficient.

06:57.860 --> 07:00.900
So another thing that we needed to make sure is that we kept our costs down.

07:00.900 --> 07:08.820
Like I said at the beginning, Minnie and I bankrolled this whole project ourselves, and we're pretty poor, so we had to keep all of our costs down.

07:08.920 --> 07:18.120
Also, we had to keep our costs down for this last point, because we needed to make these things concealable, at least to compete in the wireless CTF.

07:18.120 --> 07:28.480
We wanted to be able to place whatever these sensors would be, we wanted to be able to place them in places that we didn't have to have physical security over.

07:28.600 --> 07:30.040
That we could just leave them there.

07:30.200 --> 07:33.720
And it's DEF CON, there's a bunch of thievery happening here.

07:34.040 --> 07:37.860
If you guys see things on the walls or on tables, you're probably going to pick it up.

07:38.060 --> 07:53.620
This is important because we could have built out this whole strategy I've described so far by just buying a bunch of Aruba access points, or Cisco Enterprise access points, because they have this functionality built into them.

07:53.780 --> 08:04.100
If you deploy enough of them, they can build out a two-dimensional heat map, and you can see relatively where specific users, specific access points are.

08:04.880 --> 08:12.860
But at $500 to $1500 a wireless access point, we didn't want those just walking off here at DEF CON.

08:12.860 --> 08:23.140
So our approach was a low-cost, rapid prototype of a deployable and unmanned sensor network.

08:24.340 --> 08:32.140
So after doing some research, trying to figure out what devices kind of fit that model, we came across the ESP8266.

08:32.140 --> 08:35.160
How many of you ever played around with this before?

08:35.200 --> 08:37.500
It's gaining popularity.

08:37.500 --> 08:44.180
The ESP family of wireless chips has been around, at least the DEF CON scene, for a long time.

08:44.260 --> 08:55.160
The last several years, some of the badges have featured ESPs, ESP32s, and then obviously a lot of the Indy badges feature that same chip.

08:55.560 --> 08:57.340
There's a lot of functionality in them.

08:57.340 --> 09:01.260
For us, the ESP32 is a little more expensive than what we wanted.

09:01.260 --> 09:07.620
I think it came in at about a $15 a node price, and we wanted to keep costs extremely low.

09:07.620 --> 09:10.780
So if you see here, it's $3.

09:11.380 --> 09:15.160
Get it on Amazon, $3, no big deal.

09:15.800 --> 09:18.980
And that was the building block for our whole sensor network.

09:19.500 --> 09:21.740
These were released in 2014.

09:21.960 --> 09:23.760
Somebody out of China was manufacturing them.

09:23.760 --> 09:29.140
Nobody here really caught wind of it, except if you were really into hardware hacking.

09:29.140 --> 09:35.680
And then Hackaday picked up the ESP8266 for one of their pieces.

09:36.060 --> 09:41.040
And there's a great article on what they were able to do with the ESP8266.

09:41.360 --> 09:43.240
Because it's pretty unique.

09:43.240 --> 09:49.480
At $3, you get almost 20 dB out of this tiny little chip that's powered by 3.3 volts.

09:49.480 --> 09:58.120
So in open space, some people have done tests, and it reaches client to the wireless access point is about 300 meters.

09:58.120 --> 10:02.120
So it's got a really, really good radiation pattern.

10:03.000 --> 10:13.660
And even better in the chip is all the functionality that you need to run WPA and WPA2.

10:13.860 --> 10:20.080
So that meant that we didn't have to write that from scratch, which is really important for me because I'm a horrible coder.

10:20.080 --> 10:25.120
Really important for many because I didn't want to turn them into a slave during this project.

10:25.120 --> 10:32.880
So the ESP8266 has two GPIO transmit and receive serial pins.

10:33.160 --> 10:36.480
This is really neat for debugging because we can just see.

10:36.480 --> 10:42.280
We can print stuff out, you know, just like really rudimentary debugging.

10:42.720 --> 10:45.240
Entering our own print line, seeing what's going on.

10:45.540 --> 10:50.480
But it also allows us to combine multiple ESPs if we wanted to.

10:50.480 --> 10:56.740
Or put other sorts of sensors on it so that we can read and control what's going on.

10:56.740 --> 11:03.900
So this quickly became our number one choice for how we would build this network out.

11:03.900 --> 11:06.460
It's got a 32-bit RISC processor on it.

11:07.280 --> 11:10.160
You can overclock it up to 160 megahertz.

11:10.660 --> 11:17.200
And one of the limitations is it only has a meg of RAM, and that's for both program code and user data.

11:17.200 --> 11:22.660
So that may not seem like it now, but when you're dealing with wireless stuff, that's very small.

11:22.700 --> 11:28.360
So our ability to just dump a bunch of logic onto this is slim.

11:29.160 --> 11:35.140
It runs on 3.3 volts, which means you can power it with a little tiny coin cell.

11:36.300 --> 11:41.020
A lot of the projects that you'll find online for 8266 is a bunch of IoT stuff.

11:41.020 --> 11:56.080
Farmers who are monitoring their water flows, and folks who are watering plants, and a lot of watering going on with 8266s, because they act as a wireless access point themselves, and they run natively.

11:56.080 --> 12:07.260
If you just bought this right now, this little guy, and it came to you over Amazon, and you just powered it up on 3.3 volts, it's got a full web server running on it.

12:07.260 --> 12:09.200
So it's really plug and play.

12:09.200 --> 12:18.140
You just start working with it, access the website, and kind of build it to suit your needs just from there.

12:19.660 --> 12:23.500
Yeah, so if you hadn't seen one before, that's about how small it is.

12:25.120 --> 12:27.640
Picture does not depict actual size.

12:27.640 --> 12:29.160
I forgot to put that up there.

12:31.340 --> 12:39.620
Indoors, it has a pretty limited range, what wireless doesn't, because you're dealing with a bunch of concrete and steel, and here you're dealing with a bunch of water, because all the humans walking around.

12:39.620 --> 12:41.080
You've got about 80% water.

12:41.080 --> 12:43.300
That's a lot of attenuation happening.

12:44.560 --> 12:50.320
And if you're running, if you're using the wireless chipset the entire time, it's super power-hungry.

12:50.320 --> 13:00.220
So this, what we ended up learning as we built these, is these coin cells running with our code base lasted about 15 minutes, which was awesome.

13:00.220 --> 13:02.280
And then it got really, really hot.

13:02.280 --> 13:10.060
So if you had little tiny robin eggs, you could crack them on top of the chip and you'd have breakfast for a minute.

13:11.140 --> 13:14.960
The other limitation is it's 2.4 gigs only.

13:14.960 --> 13:22.640
That's the only band that it operates on, which is a limitation for the contest, because there's a ton of stuff in the wireless CTF that is on 5 gigs.

13:22.640 --> 13:25.520
So that's just completely out of the ballpark for us.

13:27.260 --> 13:29.500
But it makes a really good proof of concept.

13:29.500 --> 13:37.140
So if we decide that we can stomach more cost per node, we can upgrade that to a dual-band chip and move on.

13:40.300 --> 13:47.940
So I want to walk you through a bit of history, lessons learned, or just a journey of the 8266.

13:48.280 --> 13:59.120
Since we picked this up last year, about December of 2017 is when we started this project so that we could compete last year in the wireless CTF.

14:01.280 --> 14:05.400
The 8266 didn't have a lot of documentation online.

14:06.280 --> 14:10.380
What it did have was inconsistent between different sources.

14:11.180 --> 14:14.020
Even worse, the tooling was just not even there.

14:14.020 --> 14:18.500
So development boards didn't really exist for this specific model.

14:18.500 --> 14:20.780
Now, for the 32, they're all over the place.

14:20.780 --> 14:25.240
But this really cheap model, there wasn't a lot of resources available to us.

14:25.240 --> 14:31.680
So we ended up having to go back to our electrical engineering days and remind ourselves what a breadboard is.

14:32.200 --> 14:36.840
So this was our first kind of development board.

14:36.960 --> 14:42.140
The idea was, since we were building a network of sensors, we needed at least three.

14:42.220 --> 14:47.060
One to act as the root node, and two more so we could see how they communicated with each other.

14:47.180 --> 14:54.360
So this allowed us to program and run the chips all on the same board, just made it a lot more simple.

14:55.380 --> 15:00.420
Even more simple is how you interact with the 8266.

15:00.680 --> 15:05.740
Flashing firmware, powering it off, putting it into operational mode.

15:05.740 --> 15:07.220
Just these two buttons.

15:07.760 --> 15:16.800
Well, it's a pull-down and a pull-up on two of the GPIO pins, but we use these buttons to perform that.

15:16.800 --> 15:31.720
And a certain pattern of using those puts the chip into program mode, so you can take your entire program, load it on, flash it, and then it resets automatically, and then it's automatically in operational mode.

15:31.720 --> 15:34.100
So whatever code you're running, you're seeing it happen right there.

15:34.100 --> 15:39.300
So if you're changing the access point, right after it flashes, that access point name is going to pop up.

15:39.440 --> 15:41.300
So it's really quick, a lot of fun.

15:42.860 --> 15:46.460
Later on, we improved our design for our development board.

15:46.460 --> 15:48.700
This is the next one on the left.

15:48.700 --> 15:52.140
We needed them to be individual nodes.

15:52.140 --> 15:55.580
We are now ready to go out and deploy these and test them more.

15:55.980 --> 16:06.060
So on that board on the right is just a 5-volt FTDI that has a power regulator on it that takes it down to...

16:06.060 --> 16:08.720
a voltage regulator that takes it down to 3.3 volts.

16:09.400 --> 16:13.020
At $3 a piece, they're pretty...

16:13.460 --> 16:14.820
I mean, what do you expect?

16:14.820 --> 16:15.820
They're dainty.

16:15.820 --> 16:20.560
So if you put 3.39 volts into it, they're going to fry.

16:20.600 --> 16:23.660
So it's important that your voltage regulator is sound.

16:23.660 --> 16:25.640
And we found that this one was really good.

16:27.200 --> 16:30.020
And that was 2017.

16:30.340 --> 16:45.840
Earlier this year, on the right, somebody on Amazon, or somebody released on Amazon their own USB to ESP UART adapter, which I cursed at because I really wanted that at the end of 2017.

16:46.220 --> 16:47.960
It would have made things a lot easier.

16:47.960 --> 16:50.900
You see there's a switch on the side instead of two buttons.

16:50.900 --> 16:54.160
Makes it so much faster, smoother development.

16:55.900 --> 16:57.560
And that's $8.

16:57.680 --> 17:04.040
That whole thing comes with an ESP8266 and the development board.

17:04.100 --> 17:05.440
That's why I gave you a link.

17:05.440 --> 17:08.820
If you want to get started with this, it honestly just costs you $8.

17:08.820 --> 17:19.540
And it's a great way to dive down into the actual beacons and packets and frames that are coming in and out of the 802.11 space.

17:21.780 --> 17:25.900
We've competed in the wireless CTF the last two and a half years.

17:25.900 --> 17:27.100
We didn't do it this year.

17:28.260 --> 17:36.080
And I can't tell you that I ever once actually looked into a packet and pulled out the beacon.

17:36.180 --> 17:37.360
I just used tools to do it.

17:37.360 --> 17:41.540
So it was really fun to get our hands dirty and really get down to the protocol level.

17:41.740 --> 17:43.000
Quickly, cheaply.

17:43.760 --> 17:47.460
And now, with a lot more documentation and support out there.

17:48.220 --> 17:49.960
So anyways, that's kind of part of the journey.

17:51.740 --> 17:59.720
After we were done developing, we had to go back to that requirement of making our nodes, our sensor nodes, concealable.

18:00.200 --> 18:00.660
Right?

18:00.660 --> 18:01.720
Because you all be thieving.

18:01.920 --> 18:04.100
So we needed to make sure you couldn't find them.

18:04.100 --> 18:06.500
Or if you did see them, you didn't think they were anything valuable.

18:06.500 --> 18:14.820
We even got to the point of talking about putting Cyrillic characters inside of our code in case anybody dumped the firmware.

18:14.840 --> 18:17.920
So they thought it was coming from somewhere in Eastern Europe.

18:18.880 --> 18:21.640
The NSA actually has their own OUI.

18:21.720 --> 18:29.740
OUI is the first three bytes of the MAC address for your chip.

18:30.280 --> 18:33.720
And so we thought about setting our MAC address to the NSA's OUI.

18:33.720 --> 18:40.020
But Minnie talked some sense into me and said that probably wouldn't be a good idea because there might be some legal things that we don't know about.

18:40.440 --> 18:41.960
Anyways, it's public.

18:41.960 --> 18:42.860
You can go look it up.

18:42.860 --> 18:46.040
Just go to an OUI database and type in NSA and it's there.

18:47.840 --> 18:49.360
Anyways, I digress.

18:49.620 --> 18:53.260
So we needed to build our concealables.

18:53.260 --> 19:04.040
So we went from the board you saw in the previous one on the right, which allows us just to take that ESP out and back in to our deployable, as we call them, on the left.

19:04.080 --> 19:09.640
We upgraded from the nickel cell to lithium ion batteries.

19:09.640 --> 19:12.320
This one is a 3.3 volt.

19:13.020 --> 19:19.560
I think it's a 1200... I don't know what it was in terms of amperage.

19:19.760 --> 19:22.240
But it was enough to last longer than 15 minutes.

19:22.240 --> 19:24.160
These lasted us about two hours.

19:26.180 --> 19:28.720
We rolled through those batteries pretty quick.

19:28.720 --> 19:30.020
But this is just a case.

19:30.020 --> 19:33.840
It's a utility case that you might install at your house or something.

19:33.960 --> 19:37.020
And we found that with all the heat that was generated, this wasn't a great idea.

19:37.440 --> 19:41.020
Because there's no way to ventilate all the heat, so that plastic got really hot.

19:41.020 --> 19:43.880
And the last thing we wanted to do was cause another fire.

19:43.880 --> 19:45.340
Well, we didn't cause the fire.

19:46.600 --> 19:49.440
Have another fire at DEF CON.

19:49.500 --> 19:51.920
And these are a little big, right?

19:53.520 --> 19:56.420
I had one earlier, but they're about this big.

19:56.420 --> 19:59.300
About the size of the fish I caught, too.

20:00.860 --> 20:05.520
We realized, probably not an ideal form factor, so we shrunk it even more.

20:06.380 --> 20:08.760
Here's what they look like now.

20:08.840 --> 20:11.200
By the way, Todd's acting like he planned all this.

20:11.200 --> 20:16.660
But he actually just decided that we were going to start using the coin cells right in the middle of the CTF.

20:16.660 --> 20:19.780
Yeah, it was a flexible choice.

20:20.340 --> 20:22.000
It was ad hoc.

20:23.140 --> 20:25.800
So it's just this little coin cell holder.

20:25.800 --> 20:32.000
These were for nodes that we were okay with deploying for 15 minutes, going and picking up, and then resetting.

20:32.680 --> 20:37.080
I've got a whole box of ESPs here, I don't know if you can see it.

20:37.080 --> 20:38.160
Come up afterwards.

20:38.620 --> 20:41.200
Yeah, if you'd like one, I'm happy to give them away.

20:42.240 --> 20:44.100
The ones that we're not using now.

20:44.780 --> 20:50.700
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.

20:51.500 --> 20:58.160
And then that is blue masking tape on the battery bank that you see on the left, and it works perfectly.

20:58.160 --> 21:01.080
It distributes heat unimaginably.

21:01.960 --> 21:07.200
All right, and then we just had Velcro on the bottom, so we would stick these, and I think...

21:07.920 --> 21:09.800
We stuck these everywhere.

21:09.840 --> 21:14.320
We stuck them under tables, behind chairs, behind the pillars, on the walls.

21:15.100 --> 21:21.540
TVs, underneath, we came into the wireless village and stuck them underneath the tables.

21:22.360 --> 21:24.660
For purposes we'll explain later.

21:25.760 --> 21:30.420
And, yeah, so that was kind of our deployment strategy.

21:31.820 --> 21:47.920
My goal with this kind of introduction, I'm about to turn the time over to Mini, was if you hadn't heard of the ESP8266, to kind of give you an introduction to it, it's an awesome little chip, a great way to get started with wireless stuff, either if you just need a wireless access point,

21:47.920 --> 22:04.260
or if you want to do some of the more cool things that you can do with the software that you load on, that Mini's going to talk about, and then kind of show you our progress for our methodology and what brought us to the form factor and the deployment that we had here.

22:04.340 --> 22:09.720
So at this point, Mini, I'm going to turn this over to you, and Mini's going to talk to us about software considerations.

22:11.820 --> 22:21.280
So, yeah, like Todd was saying, we were just looking for something super straightforward that I could get started with, with a relatively shallow knowledge of wireless and 802.11.

22:21.280 --> 22:23.000
I'm not, like, a wireless expert.

22:23.000 --> 22:37.980
I'm sure all of these fine people over here could tell you a lot more than I could, so I was just looking to prototype something really quick, find something with some open source software out there that I could fork and just bootstrap in and start writing firmware on the fly.

22:38.980 --> 22:40.900
Obviously, I wanted to flash it quick.

22:41.460 --> 22:43.560
I had no idea what I was doing with the hardware.

22:43.560 --> 22:47.400
If I destroyed it in some manner, I didn't want it to matter.

22:47.400 --> 22:54.040
That happened several times, but that's why we work as a team, because I got to build the new hardware that Mini destroyed.

22:55.340 --> 23:16.300
So we used this prototype software at the time called Painless Mesh that a guy named GMag wrote, and basically you have a centralized route and it dynamically forms a wireless topology based on some kind of shortest path algorithm in the background.

23:16.580 --> 23:20.780
And so our leads are obviously just those little implants out there.

23:20.780 --> 23:23.140
And yeah, that was really it.

23:23.140 --> 23:27.320
What I'm trying to demonstrate here is that you have to have a root node in order to make this work.

23:27.320 --> 23:33.160
So we ended up putting this on just a little Raspberry Pi with an LED screen and carried it around.

23:35.660 --> 23:55.280
So for the root node, we ended up getting to a point where we wanted, since they kept sending out foxes, to dynamically introduce BSS IDs and have the opportunity to remove them at a later date if we needed to or clear everything and start over from scratch.

23:55.500 --> 24:07.360
So we just took a Python script, hooked it up over serial on our root node and sent it a JSON blob and propagated that blob over the mesh to the slaves.

24:07.720 --> 24:25.140
And then we came up with a kind of, just a pseudo TCP SYNAC data flow, I suppose you could say, just to make sure that the message gets out and that the bots acknowledge the message and that we're actually hunting for the thing that we're looking for,

24:25.140 --> 24:26.760
or the things, plural.

24:27.480 --> 24:33.320
And then, you know, you could probably forward the bot data into like a cool web app or something.

24:33.640 --> 24:37.640
But there's only a team of two, so we didn't really get to that.

24:37.680 --> 24:42.340
But there was another project on GitHub that I got some help from.

24:43.240 --> 24:54.740
It's mentioned in the readme somewhere, I can't remember what it's called, but he did some pretty cool visualizations with the wireless traffic for sniffing on just like a single ESP.

24:56.080 --> 25:06.440
So for the bots, like I said, going into this, I didn't even know that I couldn't run promiscuous mode at the same time as station AP mode.

25:06.620 --> 25:09.080
So I was like, oh, oops.

25:09.080 --> 25:13.800
I have to put this into kind of like a bimodal functionality.

25:14.220 --> 25:41.260
So using the task, it's like an asynchronous task scheduler, which is a fancy way of saying you write these responsibilities that the bots are supposed to achieve at any given time, like channel hopping or re-initialization to the mesh network or signal acknowledgements to the other bots.

25:41.860 --> 25:46.900
And yeah, that was kind of a learning experience.

25:46.900 --> 25:51.300
So we came up with this kind of bimodal functionality in short.

25:52.980 --> 26:17.380
And we also found a necessity to kind of change the, when we found a target, we needed to send out an alert and that kind of, with the way the topology changes when the mesh reconnects, we had to kind of change the way that the software is functioning so that the message could get across the mesh network as expediently as possible.

26:17.880 --> 26:38.180
So we ended up leveraging some strategies with NTP, network time protocol, and yeah, keeping everything in synchronization in those bimodal segments at the same time so that each bot was doing the same thing at the same time, if that makes sense.

26:38.940 --> 26:41.040
And we'll talk more about that in a second.

26:41.040 --> 26:42.960
So this is just the basic duty cycle.

26:42.960 --> 27:04.780
So by default, 20,000 milliseconds, communicating over the mesh, renegotiating topology, getting information about NTP synchronizations, and then for nine seconds going promiscuous and continuously scanning, looking for the beacons in the frames, basically 802.11 frames in the air that you're trying to hunt.

27:07.120 --> 27:09.440
And then here's the root duty cycle.

27:09.440 --> 27:26.860
We're handling communications between the mesh, synchronization with NTP, obviously, with the bots, and sending responses to alerts, acknowledging that we've found a target or not, and saving cycles since these things are already so power hungry.

27:30.230 --> 27:50.710
And I'm calling this NTP magic because it was all built in a painless mesh and I can't take credit for implementing it, but basically you take the duty cycle time and then you offset that with the current NTP synchronization interval and that basically just allows everything to do what I call synchronized swimming,

27:50.710 --> 28:12.150
where like we were talking about before, they're communicating at the same time and then they're all scanning at the same time so that when someone finds something, they can automatically jump into a, hey, I found your target alert mode screaming at the air and the rest of the mesh continues to do what it's doing and then the message will come over as soon as the rest of the mesh network gets back into synchronization.

28:13.410 --> 28:16.070
So this is just a short video.

28:16.490 --> 28:23.710
I do apologize, we were trying to get a live demo together and we had some upstream dependency issues that kind of broke.

28:24.130 --> 28:26.050
Is that playing, Todd?

28:26.050 --> 28:27.070
How do you play that?

28:30.960 --> 28:32.640
All right, so you got to give it a sec.

28:32.640 --> 28:46.340
So basically on the left and the right, we're just monitoring serial of two of these bots and what I want you guys to see is them entering the promiscuous mode at the same time and also communicating over the mesh at the same time, making NTP negotiations.

28:50.400 --> 28:51.720
It takes a sec.

28:51.720 --> 29:02.200
This is kind of one of the hardest things that we had to wrap our heads around because sometimes there'd be interference where a leaf wouldn't be able to, or a bot as we call them, wouldn't be able to communicate back to the root node.

29:02.200 --> 29:06.820
So independently, it still needed to be in sync with the rest of the mesh.

29:06.820 --> 29:14.800
Yeah, so the bot initialization, it's in mesh communication mode right now and there's actually a lot of back-end calls that are happening.

29:14.880 --> 29:22.940
You can change the debug level on the painless mesh library to get more granular view of the things that are actually taking place.

29:22.940 --> 29:25.160
Oh, and then there's beacons.

29:25.920 --> 29:40.480
And it's actually capturing the whole 802.11 frame and we ended up having to capture probe requests too because they had a fox where you actually had to capture the source PSSID of who was making a probe.

29:40.640 --> 29:45.340
So we had to kind of change our tactics later on in the CTF for that as well.

29:45.340 --> 29:47.580
So right now, it's just a conditional block.

29:47.580 --> 29:56.300
It looks for a beacon that's in an array of PSSID targets that you're looking for and then if it doesn't find a beacon, it'll check the probe.

29:57.400 --> 30:05.260
And so the waterfall of data that you're seeing here, just like Minnie was saying, is the beacons that we're capturing in sniffing mode.

30:05.260 --> 30:06.920
And we do that for 20 seconds.

30:07.140 --> 30:11.380
And then they go back into mesh communication mode.

30:11.380 --> 30:13.240
I think you had a better name for it.

30:13.920 --> 30:15.780
Mesh communication mode works.

30:15.840 --> 30:16.600
Awesome.

30:16.860 --> 30:18.400
I'll take credit for that.

30:25.090 --> 30:27.150
And this looks like a duplicate slide.

30:28.050 --> 30:29.010
My bad.

30:29.890 --> 30:47.390
These are just the JSON blobs, the data we're sending back to the root node and then we just put some directional arrows on there to indicate that while we didn't have to do as much walking as we did in the stationary hunt, we still had kind of a patrol that we would do so that we had a higher likelihood of capturing the operator on the move.

30:47.390 --> 30:52.350
And you can see here that we didn't deploy these all over Caesars.

30:52.350 --> 30:54.430
This was a proof of concept for us.

30:54.590 --> 31:07.190
So the limitation here is that our mesh network would only work for us in the one specific place that we deployed it, which this is kind of a map of the hallway right around the wireless CTF from last year.

31:07.630 --> 31:11.510
And that was, you know, an obvious limitation of what we did.

31:11.630 --> 31:19.950
Yeah, and granted, you could consolidate all your root nodes and create a distributed C2 strategy if you wanted to.

31:20.430 --> 31:22.290
It wouldn't be a huge push-up.

31:23.690 --> 31:26.070
This is the alert mode I was talking about.

31:26.070 --> 31:33.770
So basically, like I was saying, it stops everything it's doing and it just starts screaming at the rest of the network indicating that it's found the target.

31:34.230 --> 31:51.330
And it does that for a certain amount of time before it receives an acknowledgement from the root and then it also sends back a finish acknowledgement back to the root to tell the root to shut up and get back to its job of listening to as much traffic as possible.

31:51.570 --> 31:59.730
And then it re-synchronizes with the same NTP offsets and goes back to its default communication mode with the mesh.

32:02.990 --> 32:04.110
All right.

32:05.070 --> 32:12.290
So, on the left here, this is a bunch of traffic on the root node over serial.

32:12.570 --> 32:20.250
So you can see the different connections that we're making wirelessly with our slaves.

32:20.250 --> 32:32.930
And then on the right, I don't know if you guys can see it in the upper right-hand corner, that's going to be an updater script where we're updating the root over serial before the root sends out commands to the rest of the bots in the mesh.

32:33.990 --> 32:41.510
And then on the bottom right, I was just using that as an indicator to synchronize the videos because there's another video that's overlaid on top of this.

32:41.510 --> 32:42.210
Give us a sec.

32:42.210 --> 32:43.870
We're not great video editors.

32:44.570 --> 32:45.750
Don't judge us.

32:52.830 --> 32:55.170
Okay, so, yes, I sent a target.

32:55.870 --> 32:57.710
That's a MAC address right there.

32:58.630 --> 33:01.230
And that's a real MAC address of one of my devices.

33:01.710 --> 33:09.290
Anyways, the root is acknowledging with the JSON blob that it's received it and it's sent it over the mesh.

33:09.290 --> 33:11.430
I'm just printing out the JSON on the left there.

33:11.430 --> 33:14.270
So now these nodes are actually hunting.

33:16.090 --> 33:18.270
Is the overlay video going to play now?

33:20.710 --> 33:21.610
There it is.

33:21.610 --> 33:23.590
All right, so, we're in a library.

33:24.330 --> 33:28.170
And as you can see, there's one of our nodes connected to a Chromebook.

33:30.210 --> 33:32.930
And I'm going back to my root next to Spider-Man.

33:35.510 --> 33:38.430
And we're trying to show you guys here that there's no smoke and mirrors.

33:42.040 --> 33:51.080
And when it catches a target, it's going to spit out something in that Python monitor script on the left that's green, indicating that it's found one of its targets.

33:51.080 --> 33:54.700
And we also wrote a script where it goes through...

33:54.700 --> 33:55.440
Oh , there it goes.

33:55.440 --> 33:59.960
And Todd's about... I don't know if there... he's over there.

34:00.080 --> 34:02.920
Like, oh, what, 50 meters away or so?

34:03.120 --> 34:04.560
Probably like 50 feet, yeah.

34:04.560 --> 34:06.460
Yeah, and it's pretty basic.

34:06.460 --> 34:08.440
You know, you just have one slave out there.

34:09.520 --> 34:15.420
You probably can't see it from back there, but the last number on the right, that highlighted green, is the RSSI value.

34:15.420 --> 34:16.560
It's negative 85.

34:16.560 --> 34:18.640
Yeah, and now it's negative 78.

34:20.260 --> 34:25.880
And so, yeah, the script we wrote, you can also pull that out and go straight into arrow dump.

34:25.880 --> 34:32.260
So, we also had an alpha card, and we would just dump that BSSID straight in and start hunting.

34:32.420 --> 34:35.760
But for demonstration purposes, we kept it in monitor mode.

34:35.760 --> 34:40.500
Yeah, that's when we'd switch into just the traditional hunting direction finding.

34:41.140 --> 34:54.020
But one really neat thing about the way that we deployed these, and just, I mean, it wasn't anything we did, it's just the theory behind it is, especially with the RSSI values and the different nodes that are communicating back, at that point, we can establish direction,

34:54.020 --> 34:54.340
right?

34:54.340 --> 35:08.000
So, if we're in a hallway and everybody's going that way, but our signal is coming back to us saying that, hey, the signal's getting stronger, and each subsequent node is telling us it's right there, and we're just looking for the people or person that's just walking towards us,

35:08.000 --> 35:13.200
and that's when we kind of switch into the traditional mode and get on our feet.

35:17.370 --> 35:18.850
Oh, there we go.

35:19.450 --> 35:21.570
And we thought this was interesting.

35:21.570 --> 35:30.010
While we were doing the CTF, we had noticed other people were putting these things, this is not ours, other people were putting these out in the field for shenanigans like de-authentication.

35:30.590 --> 35:38.630
We got really frustrated at the end of the hunt because we hadn't found any foxes, so we just downloaded, what's his name, Space Hoon?

35:38.630 --> 35:50.090
Space Hoon's beacon spamming software, and started beacon spamming out the target VSS IDs in and around the village, just to drive the other teams crazy.

35:50.110 --> 35:51.310
Yeah, so you heard that right.

35:51.310 --> 35:54.930
We didn't find the fox, so I hope we didn't say that at the beginning.

35:54.930 --> 35:56.570
Yeah , here's how you find a fox.

35:56.730 --> 36:00.010
This was just kind of our approach, we thought it was cool and novel.

36:01.090 --> 36:05.870
And we did get very frustrated, but we got kind of our...

36:05.870 --> 36:08.390
We wasted a bunch of some of these guys' time.

36:08.390 --> 36:10.470
Yes, it was vindictive for us.

36:11.190 --> 36:16.570
At least two people went chasing our signal, and Mini did something very evil.

36:17.010 --> 36:26.190
He set a delay in when the beacon would spam, so it wouldn't just be constant, it would be like every seven seconds you'd get a beacon spam for three seconds.

36:26.190 --> 36:29.690
It was every 25 seconds, and it would be for like two seconds.

36:29.690 --> 36:31.170
You'd just get a little blip.

36:31.170 --> 36:39.970
25 seconds is long enough for you to think that, okay, I'm going to go out in that hallway, and I'm going to go down this way, and then before you know it, your signal's gone.

36:40.470 --> 36:48.930
So we watched people, and the desperation in their face, as they went out into the hallway, thinking they found it, and then it just disappeared, and just their face went white.

36:49.610 --> 36:51.990
And then we targeted that team from Idaho.

36:51.990 --> 36:54.190
Do you remember the gentleman with the white beard?

36:54.190 --> 36:54.550
Yeah , yeah.

36:54.550 --> 37:03.550
Hunter tablet, we kind of followed him over, and then we placed one of them behind the TV, we knew one of the goons, and he was like losing his mind for a good 20 minutes.

37:03.550 --> 37:05.230
We kind of felt, did we apologize to him?

37:05.230 --> 37:05.470
Yeah.

37:05.470 --> 37:06.090
Okay.

37:09.620 --> 37:27.400
So since we basically came up with this little scheme to have a, what I call, a Wi-Fi C2, if you will, it'd be really cool to apply the distributed model to the stuff that's already out there for the ESP8266 software, like the beacon spamming, and instead of just throwing them out there in beacon spamming,

37:27.400 --> 37:35.140
to actually have some level of control and feedback, deauth would be cool too.

37:35.700 --> 37:51.480
I mean, I'm not going to like suggest it to anyone, but I'll just say, just imagine if you placed these outside, if someone placed these outside of like an enterprise or something like that, and just like sat in their car and screwed around with the Python script for a couple hours,

37:51.480 --> 37:59.360
you could like, you could probably, I mean, theoretically, I'm not suggesting anything to anyone, but it'd be kind of fun.

38:01.760 --> 38:15.380
So, for the future, we were thinking 802.11, maybe one of the reasons we didn't find the foxes, there was like, there's just so much saturation, there's so many pineapples, and there's so much shenanigans.

38:15.720 --> 38:21.260
Some of the times we couldn't even get like traffic back from the mesh, depending on where we deployed it.

38:22.320 --> 38:37.920
Yeah, and the way that that looked in the spectrum, so like if you were using regular tools like AeroDump, what you would see is every 20 seconds, an access point would stand up on one of our ESPs, and it was called test in production, I think.

38:37.920 --> 38:53.080
And so you would see that pop up, but folks who are walking around with pineapples, that are doing what's called karma mode, where they're just responding to every single beacon as if they are a legitimate access point, are stealing those handshakes, right?

38:53.080 --> 38:58.200
Or stealing those initial connection attempts.

38:58.200 --> 39:14.400
So whenever we would stand up in station AP mode, our theory is, we didn't collect the data on this, you know, while we were doing it, but our theory is that we would lose connection, because our node would try to connect to that karma response.

39:15.380 --> 39:25.530
So 802.11 really is not a great protocol, Wi-Fi is not a great protocol to backhaul all your communications back to the root node on.

39:26.030 --> 39:32.150
Obviously we're going to use it to sniff and all of this stuff, but there's some better options out there.

39:32.230 --> 39:42.550
In terms of reliability, I mean, for obvious reasons, in an environment like this that's so hostile, it's just probably not the best choice, but it's great for a quick and dirty POC.

39:43.670 --> 39:49.970
Otherwise, we're thinking about switching it up to something more expensive that Todd was thinking about.

39:50.110 --> 39:58.010
Yeah, well, like, if we could just stomach more money just walking away with each node, if somebody walked away with it, then we could do a lot more.

39:58.330 --> 40:01.310
We could build this into dual band.

40:01.870 --> 40:06.090
LoRa is great for, would be our backhaul communications.

40:06.090 --> 40:19.150
We do that over, I forget what frequency it is, but we could use LoRa for backhaul, and obviously, you know, battery packs and all of that, and casings and however we concealed it.

40:19.350 --> 40:28.890
We could definitely dump more money into it, but for us, we wanted to keep costs low and be able to test, deploy, and interact with it pretty quick.

40:29.070 --> 40:39.830
So, in the future, if we can do that, we might seek out a dual band chip to do that with, but that's at like $30 just starting, sometimes more.

40:40.170 --> 40:42.550
If you know of any, please tell us.

40:42.550 --> 40:49.110
Maybe our research is just poor, we haven't found it yet, but a $3 dual band chip would be ideal.

40:50.210 --> 40:57.890
Yeah, yeah, we were thinking about just, well, should we talk about the other idea, about clustering the USPs together?

40:57.930 --> 41:04.290
Yeah, so, switching between the modes takes a lot of power.

41:05.510 --> 41:07.830
And there's a lot of overhead, too.

41:07.830 --> 41:08.270
There is.

41:08.270 --> 41:17.930
Things are running on a single thread, even though it's asynchronous, it's pseudo-asynchronous, it's basically like coding in the 90s, I guess, whatever that's like.

41:17.930 --> 41:23.210
Right, you're taking up most of that 1 meg code RAM.

41:23.210 --> 41:30.470
That 1 meg RAM is just being eaten up by both of your processes for going from station mode to sniffing mode.

41:30.470 --> 41:35.190
So, you could just distribute that over two ESPs and put them in the same box.

41:35.790 --> 41:40.410
Doubles your cost of a node, because it's two ESPs, it's not a big deal.

41:40.610 --> 41:43.470
But now you have more processing power available to you.

41:43.470 --> 41:45.830
Yeah, they can just communicate over serial to you.

41:45.830 --> 41:53.570
And we could sleep one chip while the other one's monitoring, and you save power that way, too.

41:53.870 --> 41:55.370
Yeah, definitely.

41:56.250 --> 42:05.610
But obviously, implications with going with the hardware Todd's talking about, we'd have to roll our own code and stop copying other people's stuff.

42:05.610 --> 42:08.830
Which is actually the reason we didn't have a live demo today.

42:09.690 --> 42:15.330
Five days ago, somebody committed an update to one of the libraries we were dealing with, and...

42:15.330 --> 42:21.290
What we know is we didn't track our dependencies well, and the last time that the compiled version worked was May.

42:21.330 --> 42:26.370
So it's on GitHub, and it's MIT, so you guys can take it and do whatever you want with it.

42:27.010 --> 42:29.230
All we know is back in May it was working fine.

42:29.230 --> 42:34.930
Yep, and so if we had our own painless mesh library, obviously we'd be testing any changes there.

42:34.930 --> 42:39.270
But we rushed into it, didn't version stuff, and... shit broke.

42:39.270 --> 42:51.630
Yeah, and just want to tip our hat for all the people who wrote a lot of these lower-level libraries for the ESPs, and for all the other talkers that did such an awesome job here, and for having us.

42:51.630 --> 42:53.210
Thank you guys very much.

42:53.270 --> 42:53.750
Yeah.

42:53.750 --> 42:55.410
Do you guys have any questions?

42:55.710 --> 42:56.130
No?

42:56.130 --> 42:56.850
All right.

42:58.470 --> 42:59.930
We got two.

42:59.930 --> 43:01.010
Way back there.

43:02.990 --> 43:05.130
I can't hear you, dude.

43:06.490 --> 43:07.710
Just yell.

43:12.260 --> 43:13.660
The BLE?

43:14.240 --> 43:17.820
Yeah, that was an option, but cost-prohibitive.

43:18.920 --> 43:21.940
Let me repeat the question, make sure I got it right.

43:21.940 --> 43:26.300
Did we think about using BLE for communication across nodes?

43:26.500 --> 43:26.960
Yes.

43:26.960 --> 43:36.120
Cost-prohibitive for us, because we had to sniff with the wireless chip anyways, so putting another chip on there...

43:39.410 --> 43:41.010
32 does.

43:41.010 --> 43:42.350
He says the 32 has BLE.

43:42.350 --> 43:48.670
Yes , 8266 is like a stripped-down Honda Civic, right?

43:49.110 --> 43:52.610
ESP32 is like an elite Hyundai.

43:54.650 --> 43:59.650
You know, it's still not like the best, but you do get BLE with it, which would be a great idea.

43:59.650 --> 44:02.810
If I wasn't so cheap, I probably would do that.

44:02.810 --> 44:03.810
Great question.

44:03.810 --> 44:04.890
Yes.

44:13.280 --> 44:14.320
No.

44:15.160 --> 44:16.280
Can you repeat the question, Todd?

44:16.280 --> 44:21.840
Yeah, did we have a linear regulator that...

44:31.750 --> 44:32.930
Right.

44:33.850 --> 44:35.970
Yeah, we just plugged it straight in.

44:35.970 --> 44:37.410
We were like, let's go.

44:37.510 --> 44:42.450
So that may have been part of our power usage issue, for sure.

44:42.810 --> 44:44.410
Okay, thank you.

44:44.890 --> 44:46.590
Other question up here?

44:47.130 --> 44:47.910
Yeah.

45:04.890 --> 45:23.330
So the question was if the current constraints of the hardware limited the amount of beacons we were able to parse, and the answer was, I mean, it depends on how fast you're hopping channels, and we didn't really have a baseline to measure it against,

45:23.330 --> 45:33.010
but from what I could tell, compared to just standard arrow dumps with an alpha card and a laptop, it was actually, it pulled out a good amount of data.

45:33.690 --> 45:38.490
Yeah, we weren't storing every single beacon correct.

45:38.490 --> 45:43.570
We were just churning through it and comparing the beacon address.

45:44.050 --> 45:45.590
I don't know, you wrote that logic.

45:45.590 --> 45:46.170
What did we do?

45:46.170 --> 45:48.230
Yeah, we were just looking for the beacon.

45:48.230 --> 45:49.230
Yeah, we would just compare it.

45:49.230 --> 45:50.670
If it was the right one, then we popped it.

45:50.670 --> 45:51.710
And the probes eventually.

45:51.970 --> 45:54.250
Any other questions?

45:55.170 --> 45:56.350
Okay, thank you all very much.

45:56.350 --> 45:56.850
Thanks, guys.

45:56.850 --> 45:57.870
Enjoy the rest of your DEF CON.

45:57.870 --> 45:58.110
Thank you.

