WEBVTT

00:00.000 --> 00:08.300
After an amazing talk by Brian, now is the time when we have, next up, TechRomancer.

00:08.740 --> 00:11.280
So quite an interesting name, right?

00:11.380 --> 00:12.500
TechRomancer.

00:12.640 --> 00:15.860
Let's see what chemistry brews between him and technology.

00:17.140 --> 00:20.760
Okay, so we've got an additional screen set up over here.

00:20.760 --> 00:27.640
If in case people sitting in the back are not able to view things here, they can have a good vision over there as well.

00:28.820 --> 00:36.560
So, TechRomancer is a part of Black Lantern Security and he will be talking about recursion.

00:36.560 --> 00:38.800
It's a harsh mistress.

00:39.500 --> 00:42.700
How not to build a recursive internet scanner.

00:43.040 --> 00:54.640
In this talk, witness the myriad of strange and unexpected bugs we encountered while building BeeBot, a recursive internet scanner.

00:54.720 --> 01:03.240
These bugs may appear fun sometimes, hilarious, but not when they occurred extremely problematic.

01:04.000 --> 01:16.120
So in this talk, TechRomancer will discuss the nefarious traps and nightmarish edge cases that awaited in the depths of the internet and the destruction they caused.

01:16.220 --> 01:22.020
The tricks that you... and also, he'll also discuss about some of the tricks that were used to overcome them.

01:22.480 --> 01:32.280
We will get to know the kinds of hidden gems recursion can uncover because recursion has a tendency to turn little bugs into explosive ones.

01:32.280 --> 01:34.620
So please give it up for TechRomancer.

01:37.600 --> 01:38.760
Hey guys.

01:39.060 --> 01:41.140
Alright, welcome.

01:41.440 --> 01:52.460
So, some of these first slides are just going over what he already said, but first of all, I just want to say, super excited to be at DEF CON and especially at the Recon Village giving this talk.

01:52.740 --> 01:59.160
I feel like you guys are really equipped to hear it, and I have a feeling you'll do some cool stuff with it.

02:01.340 --> 02:05.520
Alright, so this talk is mainly broken into two parts.

02:05.660 --> 02:09.420
So the first part is dedicated to bugs.

02:09.620 --> 02:14.920
So these are bugs, not that I exploited, but bugs that exploited me.

02:15.380 --> 02:22.360
These were basically just horrible recursion bugs that we ran into while building BeeBot, so there's just lots of demos of things failing.

02:22.560 --> 02:23.540
Kind of fun.

02:24.220 --> 02:31.160
So in the second part, I'm going to talk more about the technical part of it, and then we have a fun announcement at the end as well.

02:32.500 --> 02:35.940
So, this is... I'm Joel, aka the TechRomancer.

02:36.100 --> 02:40.640
Basically, only one thing you need to know about me is that I like to build things.

02:40.680 --> 02:43.720
So, this was me when I was six years old.

02:44.620 --> 02:46.120
I loved Legos.

02:46.120 --> 02:47.540
I was a huge Lego kid.

02:48.360 --> 02:56.280
So, when I finally learned Python in my brain, the Lego logic just kind of became Python logic, and they're kind of the same.

02:59.480 --> 03:01.340
Alright, I'm a pentester.

03:01.820 --> 03:03.740
I've written some security tools.

03:03.740 --> 03:12.280
If you've heard of TrevorSpray, Manspider, BeeBot, which is the recursive internet scanner in this talk, is the most recent tool that I've made.

03:13.960 --> 03:16.880
Who all here has used BeeBot, just out of curiosity?

03:17.520 --> 03:18.960
Okay, we have like four people.

03:18.960 --> 03:20.000
Okay, awesome.

03:20.020 --> 03:23.700
Alright, so for everyone who hasn't used BeeBot, you're in the right talk.

03:25.200 --> 03:38.540
So, if we rewind back to 2022, I hadn't created this tool yet, and basically, Black Lantern Security back then was just sort of like a small startup up and coming.

03:38.540 --> 03:42.300
We had one big client, and this client had a huge attack surface.

03:42.480 --> 03:50.860
So, our job was basically, we needed something that could map that attack surface, and basically discover all their external websites and all that stuff.

03:52.060 --> 03:56.680
And originally, we didn't intend to make it a recursive tool, or not necessarily.

03:56.680 --> 04:02.260
We just needed something that was stable, that we could basically scan a huge target with, and it wouldn't break.

04:02.260 --> 04:03.300
It was like consistent.

04:03.320 --> 04:11.700
And something that was thorough, that we could basically, ideally, we wanted one tool that we could run, that basically just found everything that we could trust, would find pretty much everything.

04:12.720 --> 04:16.500
So, we tried a lot of different ones, and there are some great tools out there.

04:16.800 --> 04:21.560
The ones in this list, like Amass, The Harvester, I ran a lot of these.

04:22.280 --> 04:27.260
But what turned me on to recursion, originally, was Spiderfoot.

04:27.840 --> 04:33.640
So, something interesting about Spiderfoot is that it's built in a unique way.

04:33.640 --> 04:37.120
Its design is totally different from all these other tools.

04:37.280 --> 04:46.860
And it's not immediately obvious from looking at Spiderfoot, or using it, but a lot of tools claim to be recursive.

04:46.860 --> 04:52.540
For example, if you've ever used FUF for directory brute forcing, it has a recursive option, right?

04:53.260 --> 04:56.780
But Spiderfoot is actually recursive.

04:57.320 --> 05:05.460
And the way that it's recursive is super important, because it has 200 modules, and each of those modules interact with each other.

05:05.460 --> 05:15.420
So, they're constantly exchanging emails, and URLs, and subdomains between each other, and it's just this huge framework that everything plugs into, and the entire thing is recursive.

05:15.420 --> 05:18.000
So, it's actually a really genius design.

05:18.620 --> 05:26.700
So, I just sketched out here, sort of a classic workflow for OSINT, or external task surface mapping.

05:26.700 --> 05:42.000
So, you start off with your targets, like your domains and stuff, throw those into a mass, do some subdomain enumeration, take those subdomains, port scan them, take those open ports, discover web stuff on them, and then finally, at the end, you can do nuclei and stuff,

05:42.000 --> 05:42.320
right?

05:42.320 --> 05:44.980
Pretty typical, and most of us have probably done this.

05:45.740 --> 05:47.760
But yeah, Spiderfoot does not work like this.

05:47.760 --> 05:50.400
It's not like a phased scanner.

05:50.660 --> 05:56.780
So, just to explain how Spiderfoot works, because this is also how Bebot works, but I did not invent this idea.

05:56.780 --> 05:58.480
Spiderfoot was the first one to do it.

06:02.380 --> 06:07.160
Okay, so, the way Spiderfoot works is each of its modules do one specific thing.

06:07.160 --> 06:10.000
So, in this example, I have three modules.

06:10.000 --> 06:14.400
So, we have SSL cert, Nmap, and HTTP.

06:15.000 --> 06:22.420
And each of those modules consume a certain type of data, and then do something to it, and then produce a new type of data.

06:22.560 --> 06:27.900
So, in this example, the red line is open port, and the blue line is host.

06:27.900 --> 06:32.960
So, you see that Nmap consumes hosts, port scans them, and outputs open ports.

06:32.980 --> 06:40.980
And then SSL cert consumes the open ports, and basically visits that open port, and pulls down the SSL certificates.

06:41.160 --> 06:45.120
HTTP visits the website, if there is one, and extracts URLs.

06:45.440 --> 06:50.260
And then, from SSL cert and HTTP, you get more hosts, and they feed into Nmap.

06:50.260 --> 06:55.040
So, to illustrate this, you start off with EvilCorp.com, right?

06:55.100 --> 06:57.160
Port scan it, get open ports.

06:57.560 --> 07:09.780
SSL cert finds more hosts, HTTP finds more hosts, gets fed into Nmap, makes more open ports, which make more hosts, which make more open ports, which make more hosts, which make more open ports, and so on, and so on, right?

07:09.780 --> 07:13.280
So, it's not just a phase thing, like it just keeps churning until there's nothing left.

07:13.380 --> 07:15.440
And this is recursion, okay?

07:15.440 --> 07:16.580
So , this is the big idea.

07:16.580 --> 07:19.840
This is the big idea that Spiderfoot basically put into practice.

07:20.340 --> 07:22.580
And it's what fascinated me about it.

07:22.620 --> 07:26.960
So, unfortunately, Spiderfoot itself didn't end up working out for us .

07:26.960 --> 07:31.100
You know, I tried to make it our, like, one tool, and it didn't end up working out.

07:31.500 --> 07:33.180
I won't get into the details of that.

07:33.400 --> 07:35.240
But it did infect me.

07:35.240 --> 07:50.940
So, once I spent some time debbing on Spiderfoot and got to know it and got to understand how it worked, it really infected me and made me realize that we're kind of like, we've been doing recon the easy, simple way, and there's a much better way to do it.

07:50.940 --> 07:52.640
And that's what Spiderfoot was doing.

07:52.640 --> 07:59.960
So, at the time, I felt a lot like Spiderfoot's idea was really good, but its execution wasn't as good.

08:00.320 --> 08:06.220
So, the plan became, you know, build a new scanner that was stable and also recursive.

08:06.880 --> 08:08.660
And what could go wrong, right?

08:08.660 --> 08:09.760
How hard could it be?

08:09.760 --> 08:10.940
It's just like this.

08:10.980 --> 08:14.700
So, here's the first VBOT scan that we had.

08:15.020 --> 08:20.240
The first scan, the first feature that I added to VBOT was DNS resolution.

08:21.360 --> 08:27.080
So, what you're watching right here is a recursive DNS resolution of Tesla.com.

08:27.740 --> 08:39.700
And it's just DNS records, IP addresses, host names, and each, basically the result of every DNS lookup gets fed back in and DNS lookup again on that, over and over.

08:40.200 --> 08:43.040
So, yeah, that's how it's supposed to work.

08:43.740 --> 08:49.140
And try and remember what that looked like, because, yeah, that's what a scan is supposed to look like.

08:49.500 --> 08:55.260
And because this talk is about bugs, we're going to about see a lot of things that don't look like that.

08:59.300 --> 09:00.100
Okay.

09:01.940 --> 09:05.860
So, the DNS bugs were the first to arrive since DNS was the first thing I made.

09:07.140 --> 09:07.940
All right.

09:08.200 --> 09:09.820
So, what is happening here?

09:12.160 --> 09:13.580
Kind of weird looking.

09:13.660 --> 09:16.520
Definitely not looking at all like the last one.

09:17.260 --> 09:21.520
So, yeah, something is clearly off here.

09:21.980 --> 09:26.300
And if you're close enough, and you can see the terminal, you might be able to guess what that is.

09:27.480 --> 09:35.600
But if we look at what's happening in Neo4j, kind of zoom in and look at it, our target was EvilCorp.com.

09:36.260 --> 09:50.660
And so, you can see that we have EvilCorp.com, which has a C name to another DNS name, which has another C name over here, and we have this chain of DNS C names that goes all the way around and loops back right into the middle.

09:51.360 --> 09:54.440
So, this is a C name loop.

09:54.440 --> 09:57.500
And if you know anything about DNS, you know this should never exist.

09:57.980 --> 10:00.560
There's absolutely no sane reason to do it.

10:01.140 --> 10:05.880
But I promise you, it exists, and we ran into it, and it seriously messed with us.

10:06.480 --> 10:14.280
So, yeah, probably somebody either accidentally did or else they were just having a bad day at work and decided to take out their anger on the internet.

10:14.280 --> 10:16.880
I don't know what it was, but it was very frustrating.

10:18.020 --> 10:21.440
All right, so more DNS bugs.

10:21.440 --> 10:23.700
This one is a bit more explosive.

10:25.040 --> 10:28.340
But basically, yeah, just wait a second, just wait for it.

10:32.420 --> 10:35.960
Okay, so this is more than just a simple DNS lookup.

10:35.960 --> 10:41.680
This is, right now, what we're doing is a subdomain enumeration on github.io.

10:41.940 --> 10:50.280
Okay, so github.io has an interesting quality, which is that it's a wildcard domain.

10:50.620 --> 10:55.140
Yes, okay, so how many of you have had fights with wildcard DNS?

10:55.820 --> 11:01.420
Yeah, okay, so I'm sure that you probably hate wildcards, and I do too.

11:01.500 --> 11:03.640
These cause us a lot of pain in BeBot.

11:03.860 --> 11:14.880
And the reason for that is because in a normal tool, like if you ran a mass, for example, and you had a wildcard domain, you got a whole bunch of false positives, right?

11:15.060 --> 11:16.920
Because what happens is this.

11:17.680 --> 11:24.760
You do a lookup on something that clearly doesn't exist, and github.io is going to tell you, oh yeah, that exists.

11:24.760 --> 11:26.400
Here it is for everything.

11:26.700 --> 11:31.240
So in a mass, this isn't a big problem because you can just clean them out at the end.

11:31.240 --> 11:34.000
You know, you're going to have some extra garbage data, just clean it out at the end.

11:34.160 --> 11:45.060
With BeBot, it doesn't work that way because we're brute forcing subdomains of subdomains of subdomains, and so for every one, for every new subdomain that we get, it's just going to keep going forever.

11:46.580 --> 11:53.780
So yeah, so basically in the early days of BeBot, and we had a lot of bugs, and they just kept coming.

11:53.780 --> 12:06.400
Like first we had the DNS ones, and then we had, once we implemented web, we had the web ones, and web just opened up a whole new dimension of possibilities for things to go horribly wrong.

12:07.420 --> 12:14.740
And sometimes these would collide, so sometimes we'd get interactions between DNS bugs and web bugs, and those were always the worst.

12:15.700 --> 12:30.140
So there's this one time, it was early on, I would basically take the sort of alpha version of BeBot that we had going, and I'd take it and I'd give it to our operators, you know, they were on an engagement, they were doing OSINT, and I was like, hey guys,

12:30.140 --> 12:31.700
can you run this, test it out for me?

12:31.700 --> 12:32.860
Like, sure, why not?

12:33.160 --> 12:42.040
So I got dragged into a Teams call, and they were basically telling me that they ran BeBot, and one of the customers ' websites went down.

12:42.720 --> 12:45.440
And well, first I asked, like, which modules did you enable?

12:45.540 --> 12:47.640
And they said all of them, obviously.

12:48.360 --> 12:54.220
So basically there are other modules besides just the web module that we have that visits websites.

12:54.220 --> 12:58.780
For example, we have a nuclei module, which does, like, vulnerability scanning.

12:59.780 --> 13:15.180
So what happened, and this took some investigation, but what we found out is that there was a DNS wildcard, there was a bug in BeBot that failed to detect the wildcard, and then basically we had a thousand URLs, and each of those URLs was getting nuclei ran against it,

13:15.180 --> 13:19.440
but because they were a wildcard, they all just brought it back to the same server.

13:19.440 --> 13:27.720
So basically all of nuclei's, like, parallelized scan was just getting routed into one server, and that poor server could not handle it, sadly.

13:28.640 --> 13:35.020
So yeah, example of kind of, like, how DNS and HTTP, like, combine together to screw us over.

13:40.110 --> 13:53.310
BeBot had this problem, where one moment it would be going along normally, it would just be a normal scan, everything would look fine, I'd get up to, like, go get a snack, and when I came back, it would just be scanning something completely out of scope,

13:53.310 --> 14:02.910
or just doing something crazy, so, and this wasn't just with wildcards, like, we had issues also with, like, cloud.

14:03.430 --> 14:14.990
So has anyone ever, like, ran, like, a scan and had, like, a big list of targets, and realized halfway through the scan that there was a target in there that you didn't want to be in there?

14:14.990 --> 14:18.010
Like, maybe, like, a cloud domain or something like that, like azure.com?

14:18.730 --> 14:21.270
This was kind of an issue with BeBot, right ?

14:21.270 --> 14:24.910
Maybe, yeah, maybe you had, like, a cloud bucket or something in there accidentally, right?

14:24.910 --> 14:26.350
Bad things can happen.

14:26.350 --> 14:36.170
So right here, what we have is, we have what starts off as just a normal subdomain enumeration of spacex.com.

14:37.030 --> 14:44.530
So you can see, yeah, it's lots of, lots of sort of URLs, DNS names, IP addresses coming in that belong to SpaceX.

14:45.150 --> 14:50.770
But if we watch this, if we watch this for a little while, I'm going to fast forward it a little bit.

14:50.770 --> 14:59.330
What you can start to see happening is, we start to see some weird little things spin off to the side here.

15:00.290 --> 15:08.170
So, so what happened is SpaceX, at this point, they had, well, first of all, SpaceX is a, is a, they do government contracts.

15:08.190 --> 15:10.410
So they use Azure for a lot of their stuff.

15:10.470 --> 15:12.510
But it's like the government version of Azure.

15:12.510 --> 15:13.830
So it's got azure.us.

15:13.830 --> 15:21.610
So what happened was, there was a bug in BeBot, where there's basically, it would see a SpaceX domain that had a C name into Azure.

15:21.750 --> 15:25.290
And there was a bug where it would be like, oh, azure.com?

15:25.290 --> 15:25.990
Yeah, that's in scope.

15:25.990 --> 15:31.530
And it would just start to enumerate all of Azure, which obviously is huge and obviously not what you want.

15:31.590 --> 15:35.250
So over here, this, this one over here is azure.us.

15:35.470 --> 15:37.170
This one's azure.com.

15:37.170 --> 15:40.570
Like this cluster at the bottom is like microsoft.com.

15:40.570 --> 15:41.790
It's just like going ham.

15:41.790 --> 15:45.510
So this is a scan you not want to leave running for very long.

15:46.410 --> 15:53.150
So yeah, there's this one time when we accidentally scanned a dot gov.

15:53.250 --> 15:54.870
This was kind of embarrassing.

15:55.610 --> 16:00.830
What made it worse was that we found a critical RCE on the dot gov.

16:01.450 --> 16:04.050
And so we were like talking like, should we report this?

16:04.050 --> 16:05.030
Obviously we have to report it.

16:05.030 --> 16:05.810
It's a dot gov.

16:05.810 --> 16:06.910
It's a critical.

16:06.950 --> 16:17.590
So, so I can't say a lot about this, sadly, but the gist of it is that yes, we did end up reporting it and no, it did not end up getting fixed.

16:17.590 --> 16:21.850
And yes, it did end up getting exploited and it may or may not have been in the news.

16:21.850 --> 16:23.390
So that was an experience.

16:23.630 --> 16:24.010
Yeah.

16:24.010 --> 16:26.790
We, we had some accidental accidents happen.

16:27.690 --> 16:30.190
And this, this was kind of normal for spiderfoot.

16:30.190 --> 16:31.710
Has anyone used spiderfoot?

16:32.290 --> 16:32.870
Okay.

16:32.870 --> 16:33.230
Okay.

16:33.230 --> 16:33.450
Yeah.

16:33.450 --> 16:47.770
So if you've used spiderfoot, like you may have had a good experience with it, but you may have noticed like, especially with bigger targets, it can start to run into issues like get stuck spidering a website, or you might end up with some garbage results that you don't want.

16:47.770 --> 16:55.610
So this was, you know, something I'd already experienced with spiderfoot, but kind of something I thought I could fix and thought wouldn't happen to me.

16:55.910 --> 16:57.310
But it totally did.

16:57.930 --> 17:03.590
And so, yeah, basically like, you know, spiderfoot had a scope system and like, I just didn't think it was fixable.

17:03.590 --> 17:05.270
I thought I could write my own that was better.

17:06.370 --> 17:10.670
And yeah, it, it didn't work out quite like I planned.

17:10.670 --> 17:18.810
In the back of my head, I had always kind of wondered why spiderfoot was the only one, like why spiderfoot was the only recursive tool.

17:19.050 --> 17:21.490
You know, like OSINT, when you think about OSINT, right?

17:22.030 --> 17:25.850
OSINT is just like, recon OSINT is just like relationships.

17:25.850 --> 17:27.650
And so it's, it's a recursive problem.

17:27.650 --> 17:29.490
Like we know it's a recursive problem.

17:29.490 --> 17:30.810
We've known this for a long time.

17:30.810 --> 17:33.730
So like, why aren't all our tools recursive?

17:33.730 --> 17:36.410
Why are they all just sort of like linear scanners?

17:37.670 --> 17:40.190
And there's, there's a really important reason for that.

17:40.310 --> 17:47.290
And this was what I was just beginning to discover, which was that recursion is the mortal enemy of stability.

17:47.350 --> 17:54.190
So when I say I wanted to make a scanner that was both recursive and stable, that was a lot harder than I thought it would be.

17:55.050 --> 17:58.890
So speaking of stability, I want to show some more bugs.

17:59.450 --> 18:01.430
This, this is kind of a weird one.

18:01.530 --> 18:07.050
And this starts off in the same way as the cloud one with a, a subdomain enumeration of SpaceX.

18:08.090 --> 18:21.830
And to fast forward a little bit for time, we start to see something similar though, where on the bottom of the scan, if you watch close to the bottom, something weird starts to happen.

18:30.600 --> 18:31.520
Okay.

18:32.800 --> 18:33.480
All right.

18:33.480 --> 18:40.380
So again, if you're close enough to see what's happening in the terminal, you can see that what we're getting are just a whole bunch of URLs.

18:41.340 --> 18:43.280
So, so what's, what exactly is happening?

18:43.280 --> 18:47.660
This is all the same host and it's just like tons of URLs coming in.

18:47.700 --> 18:55.360
So, so basically what this is, if we look at it more carefully, is it's an infinite redirect.

18:55.720 --> 19:05.160
So, so what happens is on some pages, again, this should never happen, but it definitely does sometimes, you might get redirected to another page.

19:05.160 --> 19:18.180
But what happened in this case was we had a redirect that when you follow the redirect, it would basically generate a new random URL and redirect you to that, which when you visited that would redirect you to another random URL.

19:18.180 --> 19:20.600
So basically it would just go on forever.

19:21.120 --> 19:38.180
And yeah, if you visited that in Chrome, it would tell you this, like the error, too many redirects, you might've got this in the past, but if you scan that with a recursive tool and you don't handle that edge case, it's going to produce giant tendrils of doom and it's never going to stop.

19:39.460 --> 19:42.740
So yeah, the web bugs, the web bugs were real.

19:42.860 --> 19:48.280
There were many times with actually, there were actually three separate times that we accidentally made a web spider.

19:49.480 --> 19:56.120
And it, it, this, this may seem silly, but, but it was like, it, it was a real problem.

19:56.120 --> 20:06.760
And the reason is because when you have a recursive tool, like a recursive system, like VBot, there's actually only two ingredients that you need to make like a full blown web spider.

20:06.760 --> 20:11.500
The first one is you need to visit URLs, simple, right?

20:11.500 --> 20:16.020
And the second ingredient is you need to extract the URLs from that response.

20:16.300 --> 20:17.220
That's a loop.

20:17.220 --> 20:18.460
It's, it's all, it's all you need.

20:18.640 --> 20:22.820
If you have those two things in a recursive tool, you have a web spider.

20:23.060 --> 20:29.040
So if you're curious what a rogue web spider looks like, this is what it looks like.

20:31.060 --> 20:47.560
This is, this is VBot web spidering the Linux kernel documentation, which by the way, if you ever have a web spider, the kernel documentation is a really fun sort of like test bed for that.

20:47.860 --> 20:53.600
Well, first of all, because the Linux people have super fast servers and they're really good at keeping everything running.

20:54.300 --> 20:57.280
But also because there's just lots of goodies in there.

20:57.280 --> 21:07.380
Like for example, if you run VBot on the kernel documentation and you enable the web spider, it will not only pull out URLs and visit them, but also pull out email addresses.

21:07.380 --> 21:11.880
It'll download files like PDFs, Word documents, that kind of thing.

21:12.000 --> 21:20.260
And basically, yeah, just if you, if you actually, if you, if you look carefully somewhere in here, there's like Linus Torvald's email and just like scrolls by.

21:20.600 --> 21:22.000
But yeah, kind of fun.

21:23.940 --> 21:34.280
So, so yeah, basically, you know, the bugs kept coming and like at this point I, I kind of had to take a step back and like consider whether recursion was actually worth it.

21:34.280 --> 21:46.900
Like in the beginning, you know, I, I was very sure that I wanted to make a recursive tool, but as I started to see all these bugs and realize how hard they were to squash, I started to realize how much work it was going to be to really like make this and to keep it stable.

21:46.900 --> 21:53.440
So yeah, I felt like there was always new bugs cropping up and whenever I fixed one, just another one would come back in its place.

21:53.680 --> 22:05.040
And I, I, I felt that if I like kept going, there was a good chance that Bebop would just collapse and like basically collapse under its own weight and it'd be too late to go back.

22:05.040 --> 22:09.340
And like the whole thing would just be a character building exercise, which I definitely didn't want.

22:09.860 --> 22:14.780
So yeah, reminded us like Calvin and Hobbes, you know, just builds character, builds character.

22:14.860 --> 22:16.640
So basically I had a choice.

22:16.640 --> 22:26.360
I could either remove the recursive part of Bebop and just make like a simple scanner or I could kind of, you know, try to tough it out and kind of see what happened.

22:27.160 --> 22:29.220
So, so yeah, obviously I chose recursion.

22:29.220 --> 22:31.700
I wouldn't be here talking about it if I hadn't.

22:31.820 --> 22:35.560
But yeah, Spiderfoot had done a number on me.

22:35.560 --> 22:43.420
Like I could not, after using Spiderfoot and being so sort of like enamored with it, I definitely could not go back to anything that was not recursive.

22:43.680 --> 22:44.660
So, so, okay.

22:44.660 --> 22:47.540
So like, what, what were the consequences of that?

22:48.380 --> 22:53.260
Well, they were pretty excruciating, especially at first.

22:53.440 --> 22:58.300
So the most excruciating thing that we had to deal with was unit tests.

22:58.300 --> 22:59.040
Okay.

22:59.340 --> 23:07.380
If you, if you haven't experienced the pain that are unit tests and like CICD pipelines, I definitely envy you.

23:07.600 --> 23:09.940
This is, this is what you're supposed to do in software development.

23:09.940 --> 23:18.960
When you write a big software project, you're supposed to write tests that basically just make sure that everything is working and don't let you commit code unless it's working.

23:20.220 --> 23:29.980
But I have to say, like, even though it was very unpleasant to have to learn how to write tests, because this was the first thing I'd ever had to use test for.

23:29.980 --> 23:36.180
Like I'd written hacking tools before, never written tests for them, just kind of got away with not doing that.

23:36.660 --> 23:39.100
But B-Bot could not exist without tests.

23:39.100 --> 23:41.400
Like, we have a unit test for everything.

23:41.400 --> 23:47.640
Every one of those bugs that I showed off, we wrote a test to make sure that it doesn't come back.

23:47.640 --> 23:54.560
And we have over a hundred modules and every single module has its own custom test that runs it and makes sure it's working exactly as intended.

23:54.720 --> 23:57.580
And all of this runs every time you push new code to B-Bot.

23:57.580 --> 24:03.320
So basically, this is like the structure that's holding it all together and holding it up and making sure that it stays stable.

24:04.700 --> 24:05.820
So, yeah.

24:05.980 --> 24:06.720
So, yeah.

24:07.860 --> 24:12.120
By embracing recursion, I was like sort of torturing myself, and I realized that.

24:12.120 --> 24:14.140
But it was really humbling.

24:14.640 --> 24:24.120
And it taught me some important lessons about recursion and about the internet and kind of just about life, too, because it kind of changes the way you think about things.

24:25.440 --> 24:31.960
I think the biggest lesson I learned, well, the biggest lesson was that maybe I'd been a little bit too hard on Spiderfoot.

24:31.960 --> 24:33.900
I kind of felt bad for that.

24:35.420 --> 24:43.480
But in almost every case, whenever there was a crazy bug like that, almost always it was just because I was thinking about it in the old way.

24:43.620 --> 24:47.400
And from that perspective, it just seemed super complicated.

24:47.660 --> 24:59.840
But as soon as I could get in a recursive mindset and kind of imagine how it worked in that recursive system, most of the time the real solution became clear and most of the time it was pretty simple.

25:04.860 --> 25:15.820
One of the biggest lessons or I guess solutions that I was forced to come up with to deal with these recursive behaviors was scope distance.

25:15.920 --> 25:29.660
This is just basically an internal feature of VBot that just helps keep those explosive edge cases from happening and lets you kind of step safely out of bounds one or two hops without worrying about going completely crazy.

25:29.840 --> 25:34.040
It turns scope into a threshold.

25:34.040 --> 25:42.960
Instead of just being in scope or out of scope, you can kind of see where every hop that you go out, you increment the scope distance by one.

25:43.200 --> 25:47.320
And if you hit something that's in your target, it just resets to zero.

25:47.500 --> 25:53.340
And this is what we use in VBot to basically allow it to do all of that spidering and stuff in a safe way.

25:54.560 --> 26:09.760
All right, so yes, so in the end it was the combination of two things mainly that made VBot possible, that made even like building VBot possible, which was recursive thinking, like recursive approaches to problems, and then just lots of unit tests, like lots of unit tests.

26:11.020 --> 26:13.800
And was it worth the suffering?

26:13.800 --> 26:15.400
So this is the big question, right?

26:15.400 --> 26:24.460
So I want to show you something, and this is not like directly related to VBot, but it's kind of cool.

26:24.460 --> 26:28.540
So has anyone ever used Trickist?

26:28.600 --> 26:30.220
Has anyone heard of Trickist?

26:30.220 --> 26:31.560
Okay, we got one guy.

26:31.560 --> 26:43.060
So Trickist is kind of a new platform that basically allows you to construct what are essentially like workflows with your hacking tools.

26:43.060 --> 26:49.760
So what we're looking at right here is a Trickist workflow for subdomain enumeration.

26:49.980 --> 26:52.680
So you can see that there's a whole bunch of different phases.

26:52.680 --> 26:59.960
The first phase we have all of our targets going into these six tools, and if we zoom in you might recognize some of these.

26:59.960 --> 27:15.380
We have like find domain, and so basically Trickist has taken all of these tools and basically created almost like a glorified bash script out of them, where it's connecting the input of one tool to the output of another tool.

27:15.620 --> 27:28.920
And so we have these six subdomain enumeration tools doing passive enumeration, and then we have a DNS brute force over here to just follow like the flow of this.

27:28.920 --> 27:29.960
It's kind of interesting.

27:29.960 --> 27:32.300
The first time I saw this, I was really amazed.

27:32.300 --> 27:33.280
Trickist is really cool.

27:33.280 --> 27:35.560
If you haven't checked it out, you should check it out.

27:35.560 --> 27:36.500
It's pretty neat.

27:37.320 --> 27:49.360
So then we have, after the brute force, we have all of those subdomains being fed into a permutation phase, where it basically makes mutations of those subdomains and tries to find those.

27:51.660 --> 27:59.460
So finally, if we go down, we have like this phase two where we do port scanning and we do websites .

27:59.920 --> 28:07.000
So this is basically like sort of the standard like subdomain enumeration workflow with Trickist.

28:07.000 --> 28:13.820
But there's something interesting about this, which is that you'll notice it's not recursive.

28:14.700 --> 28:23.460
So I ran this workflow on Dell.com, and it found 11,000 subdomains.

28:24.220 --> 28:25.800
Dell.com is a pretty big domain.

28:25.800 --> 28:27.600
I just kind of picked it because it was big.

28:27.980 --> 28:29.840
But here's a question.

28:29.840 --> 28:31.200
Who would win?

28:31.220 --> 28:37.080
So we have the six tools duct taped together, or just one tool.

28:37.360 --> 28:40.980
So how much does recursion actually get you?

28:40.980 --> 28:41.680
This is the big question.

28:41.680 --> 28:42.840
You all want subdomains, right?

28:42.840 --> 28:44.940
Give me as many subdomains as possible.

28:45.300 --> 28:48.060
So here's the bbot command that I ran.

28:48.060 --> 28:49.560
We have a subdomain enumeration.

28:49.980 --> 28:58.020
Bbot found 18,000 subdomains, which is 53% more than all six of those tools combined.

28:58.580 --> 29:05.100
So essentially it found over 6,000 subdomains that the other tools did not find.

29:05.740 --> 29:17.340
So to understand what are these subdomains it's finding and how it's finding them, you have to basically look at the data in bbot.

29:17.340 --> 29:23.000
Bbot tracks exactly how it discovers each of its things.

29:23.000 --> 29:28.940
So each event that bbot emits, this DNS name, has a discovery path.

29:32.800 --> 29:42.780
This particular discovery path for this subdomain, which is one of the subdomains that was missed by the Tricus workflow, has 13 steps.

29:42.800 --> 29:46.160
So if you can't read it, I'll just basically summarize really quickly.

29:46.160 --> 29:49.280
So we seeded the scan with Dell.com.

29:49.600 --> 29:52.900
Basically there was an API search that found a subdomain.

29:52.900 --> 29:59.680
That subdomain had an open port, which basically when we went to visit it, had a redirect that went to this login page.

29:59.680 --> 30:15.800
So after visiting that login page, bbot stepped down one directory and visited that and extracted a URL from that different subdomain and basically extracted the DNS name from that subdomain.

30:15.800 --> 30:20.080
And then that DNS name had a C name that pointed to this one.

30:20.660 --> 30:26.000
So basically just like this huge chain of discovery that you never could have gotten without recursion, right?

30:26.000 --> 30:28.920
We're like 13 levels deep in recursion here.

30:29.040 --> 30:31.700
And this subdomain is at the very end.

30:31.800 --> 30:33.580
So how are you going to get that, right?

30:34.260 --> 30:35.700
Here's another one, right?

30:35.700 --> 30:37.620
Seeded the scan with Dell.com.

30:37.660 --> 30:53.580
Searched an API that host name had a quad A record that had a pointer that had another quad A record that had an open port that had an SSL certificate that had a quad A record that had a nearby IP address that had a pointer record that had a quad A record that had an open port that had an SSL certificate.

30:54.100 --> 30:54.600
Okay.

30:54.700 --> 30:56.320
Like, how are you going to get this?

30:56.320 --> 30:58.320
Like, you know, we could do this.

30:58.320 --> 30:58.920
We're humans.

30:58.920 --> 31:00.840
Like we could follow this path, right?

31:00.860 --> 31:04.240
But how long would it take you, you know, for 18,000 subdomains?

31:05.420 --> 31:06.260
So yeah.

31:07.480 --> 31:09.020
PayPal.com, another one.

31:09.020 --> 31:18.080
PayPal.com, thanks to recursion.

31:18.080 --> 31:22.340
This is thanks to us brute forcing subdomains of subdomains.

31:22.940 --> 31:29.780
Just following those crazy chains of like, you know, visiting the website and extracting SSL certificates over and over and over again.

31:30.640 --> 31:32.040
What about the speed, though?

31:32.040 --> 31:33.520
Like, how fast is it?

31:34.000 --> 31:39.860
So Bbot is a little bit slower and this makes sense because, you know, how is it going to get those giant chains?

31:40.640 --> 31:49.020
Trickist workflow took about five hours and Bbot in this case for Dell.com took about six hours, so a little bit longer.

31:50.060 --> 32:01.400
I think it's tempting, it's definitely tempting to just like take Bbot and just like plug it into like there's six tools in there right now, like just add Bbot, like make it seven tools.

32:01.500 --> 32:02.680
Please don't.

32:02.680 --> 32:03.860
Please don't do that.

32:04.160 --> 32:05.140
You can if you want.

32:05.140 --> 32:05.560
Okay.

32:05.560 --> 32:07.460
But consider this.

32:07.460 --> 32:08.000
Okay.

32:08.200 --> 32:11.240
So let's go and let's edit this workflow.

32:11.960 --> 32:19.100
Imagine that you want to discover those far out subdomains, those ones that like you can't reach just by doing this, right?

32:19.100 --> 32:29.980
So in order to do that, you'd have to basically take the output of this web phase down here and you'd have to feed it back into the brute forcer.

32:29.980 --> 32:38.040
So basically what we'd have to do is we'd have to like copy the brute force and like stick it after the web, right?

32:39.620 --> 32:42.560
And by then we're like, how many level?

32:42.560 --> 32:44.320
We're like, you know, three levels.

32:44.320 --> 32:50.280
So then after that, you know, oh crap, now we have to like, we have to do web again.

32:50.360 --> 32:52.580
So we have new subdomains, we have to do the web thing now.

32:52.580 --> 32:56.940
And then oh no, now we have to like do more, we have to do more brute forcing now.

32:57.140 --> 32:58.700
You see the pattern, right?

32:58.700 --> 33:04.580
Like how many times, how many times you're going to do that before you realize it needs to be a circle.

33:04.840 --> 33:09.660
Like it just needs to be one nice little circle that goes around and around and around until there's nothing left.

33:09.660 --> 33:11.000
So that's what recursion is.

33:11.000 --> 33:12.000
That's how Bebout works.

33:12.000 --> 33:17.640
And that's how it's able to find these crazy subdomains and things that are just way out there.

33:19.500 --> 33:19.840
Okay.

33:19.840 --> 33:20.300
So yeah.

33:20.300 --> 33:24.620
So basically starting to wrap up here, basically this is kind of a silly meme, right?

33:24.900 --> 33:37.180
But like it really gets to the essence of what I'm trying to say, which is that like if you're willing to be patient and you care about finding as much as possible, recursion is your friend, okay?

33:37.640 --> 33:46.680
And like in that case, it's best if you can take that recursive algorithm and make it at the highest level of your automation.

33:46.680 --> 33:51.340
In other words, like make it the framework that you plug everything else into.

33:51.900 --> 33:54.480
Maybe that's Bebot, maybe that's Spiderfoot.

33:54.480 --> 34:01.320
But I can't emphasize enough how important it is to have a recursive system.

34:01.580 --> 34:02.300
Yeah.

34:02.300 --> 34:04.840
Again, like OSINT is a recursive problem.

34:04.840 --> 34:19.740
And when you approach a recursive problem without a recursive algorithm, your solution will just get more and more complex infinitely without ever reaching an end, just like you saw with like the trickest, you know, keep adding phases to that.

34:19.740 --> 34:24.060
Um, so yeah, like I like this, this quote from hackers.

34:24.420 --> 34:31.100
When I was a child, I spoke as a child, I understood as a child, I thought as a child, but when I became a man, I put away childish things.

34:31.100 --> 34:31.680
Okay.

34:31.680 --> 34:37.420
So I feel like, I, I feel like as a community, I think, um, we can handle recursion.

34:37.420 --> 34:38.420
I think we could do it.

34:38.420 --> 34:42.960
So, um, on that note, I want to announce that Bebot 2.0 is releasing today.

34:43.100 --> 34:44.900
So it is out right now.

34:44.900 --> 34:46.820
Um, and you can install it with pip.

34:48.080 --> 34:50.460
Um, so, um, so yeah, there's a lot of new features with this.

34:50.460 --> 34:52.640
I, I, I wish I could get into all of them.

34:52.640 --> 34:54.220
I wish we had time to do all of them.

34:54.220 --> 35:01.340
Um, but, uh, yeah, basically like the, the, the gist of it is that, um, we have 10 new, uh, 10 new modules.

35:01.340 --> 35:02.780
Um, it's a lot faster.

35:02.840 --> 35:06.980
It's, it's faster by almost an order of magnitudes, like almost 10 times.

35:07.040 --> 35:13.900
Um, we have things that make it a lot easier to use, um, that allow you to put all your settings and just like a single YAML file.

35:14.020 --> 35:15.740
Um, we have Yara integration.

35:15.740 --> 35:24.100
So you can basically think of like, uh, Yara integration is just grep tech R for like your target's entire web presence, which is pretty cool.

35:24.100 --> 35:26.800
Um, but yeah, um, check it out.

35:26.800 --> 35:27.840
We, we have a GitHub.

35:27.840 --> 35:29.680
Um, we have lots more in the pipeline.

35:29.680 --> 35:32.980
So like development is happening at a super fast pace.

35:32.980 --> 35:35.320
Like we're adding features every day.

35:35.320 --> 35:41.180
Um, there are some awesome people in the community who are writing new modules and adding new features.

35:41.180 --> 35:46.300
Um, some of some of the features that are up and coming are going to be super cool.

35:46.300 --> 35:47.760
I'm actually super excited.

35:47.840 --> 36:01.420
Uh, we have like, um, we have features that will automatically download get repos, Docker images, and like extract them and loot them for like secrets, um, extract URLs from them and feed them back into this giant recursive machine.

36:01.420 --> 36:04.080
So yeah, um, it's going to be, it's going to be awesome.

36:05.120 --> 36:06.600
Oh, and it's a Python library.

36:06.600 --> 36:13.700
So if you're into Python, um, and, uh, you are wanting to automate something with B-Bot, um, this is the way to do it.

36:13.720 --> 36:15.420
Um, it's basically super simple.

36:15.420 --> 36:17.760
Hip install B-Bot from B-Bot import scanner.

36:17.840 --> 36:23.800
Um, and you can do everything in the Python library that you can do on the command line and even a little bit more.

36:25.580 --> 36:26.180
So yeah.

36:26.180 --> 36:26.480
All right.

36:26.480 --> 36:28.560
So thanks everyone for coming to this talk.

36:28.560 --> 36:31.340
I hope it inspires all of us to think recursively.

36:31.660 --> 36:33.800
Uh, and yeah, thanks.

36:41.800 --> 36:44.280
Um, if there's any questions, I'll take them now as well.

36:44.280 --> 36:47.220
Uh, any questions about B-Bot or recursion or anything like that?

36:47.900 --> 36:48.040
Sure.

36:48.040 --> 36:48.220
Good.

36:52.860 --> 36:53.660
Okay.

36:55.080 --> 36:56.080
Good, good question.

36:56.080 --> 36:56.220
Okay.

36:56.220 --> 36:58.160
So the question was like, why is a rogue spider bad?

36:58.160 --> 36:59.300
Like, why wouldn't you want that?

36:59.300 --> 36:59.820
Right.

36:59.820 --> 37:02.840
Um, uh, and in some cases you absolutely do want that.

37:02.840 --> 37:08.920
Um, but say for example, that you're just doing like a, a simple cell domain enumeration, you need it to finish in like a day.

37:08.920 --> 37:16.680
Um, if, if we were to enable that spider for like dell.com, imagine how many pages dell.com has for documentation and stuff.

37:16.680 --> 37:18.620
Like it, it, it'd be like a week.

37:18.620 --> 37:19.620
It'd be, it'd be a week.

37:19.620 --> 37:26.660
So, so in B-Bot we allow you to control exactly the distance that you want to go, how deep you want to go with the web spider and how many hops.

37:26.660 --> 37:29.000
So you can be like only 10 hops, no further than that.

37:29.000 --> 37:31.640
So you can definitely dial it in to exactly what you want.

37:31.800 --> 37:34.780
Um, or you can just turn it up to 9, 9, 9, 9, 9, if you want to.

37:35.160 --> 37:35.560
Yeah.

37:35.560 --> 37:36.360
Whatever you want.

37:36.600 --> 37:37.620
All right.

37:38.100 --> 37:38.700
Good.

37:44.870 --> 37:45.750
Oh yeah.

37:45.750 --> 37:46.130
Yeah.

37:46.130 --> 37:53.410
So, the question is like, how many times do you think those recursion bugs were just like intentional tar pits to like, to mess us up?

37:53.530 --> 37:55.750
I'd say, I'd say a lot of the time.

37:55.870 --> 37:57.310
Um, yeah, definitely.

37:57.310 --> 38:05.970
Um, there, there are some like just sort of like chaotic and uh, you know, very chaotic evil people out there who just like want to watch the world burn.

38:05.970 --> 38:08.970
Um, or, or maybe they just don't want you spidering their website.

38:08.970 --> 38:11.730
Like some sysadmin is like, eh, good luck spidering this thing.

38:11.730 --> 38:13.090
Uh, so yeah.

38:13.090 --> 38:17.350
Um, but also plenty of times people just accidentally misconfigure DNS.

38:17.350 --> 38:21.810
Like make a recursive like link accidentally also happens.

38:21.810 --> 38:22.770
Yeah.

38:23.050 --> 38:24.190
All right.

38:24.410 --> 38:24.670
Cool.

38:24.670 --> 38:24.810
Cool.

38:24.810 --> 38:25.890
Anyone else?

38:26.290 --> 38:27.270
All right.

38:27.270 --> 38:28.390
Thank you.

