start	end	text
0	8300	After an amazing talk by Brian, now is the time when we have, next up, TechRomancer.
8740	11280	So quite an interesting name, right?
11380	12500	TechRomancer.
12640	15860	Let's see what chemistry brews between him and technology.
17140	20760	Okay, so we've got an additional screen set up over here.
20760	27640	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.
28820	36560	So, TechRomancer is a part of Black Lantern Security and he will be talking about recursion.
36560	38800	It's a harsh mistress.
39500	42700	How not to build a recursive internet scanner.
43040	54640	In this talk, witness the myriad of strange and unexpected bugs we encountered while building BeeBot, a recursive internet scanner.
54720	63240	These bugs may appear fun sometimes, hilarious, but not when they occurred extremely problematic.
64000	76120	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.
76220	82020	The tricks that you... and also, he'll also discuss about some of the tricks that were used to overcome them.
82480	92280	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.
92280	94620	So please give it up for TechRomancer.
97600	98760	Hey guys.
99060	101140	Alright, welcome.
101440	112460	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.
112740	119160	I feel like you guys are really equipped to hear it, and I have a feeling you'll do some cool stuff with it.
121340	125520	Alright, so this talk is mainly broken into two parts.
125660	129420	So the first part is dedicated to bugs.
129620	134920	So these are bugs, not that I exploited, but bugs that exploited me.
135380	142360	These were basically just horrible recursion bugs that we ran into while building BeeBot, so there's just lots of demos of things failing.
142560	143540	Kind of fun.
144220	151160	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.
152500	155940	So, this is... I'm Joel, aka the TechRomancer.
156100	160640	Basically, only one thing you need to know about me is that I like to build things.
160680	163720	So, this was me when I was six years old.
164620	166120	I loved Legos.
166120	167540	I was a huge Lego kid.
168360	176280	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.
179480	181340	Alright, I'm a pentester.
181820	183740	I've written some security tools.
183740	192280	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.
193960	196880	Who all here has used BeeBot, just out of curiosity?
197520	198960	Okay, we have like four people.
198960	200000	Okay, awesome.
200020	203700	Alright, so for everyone who hasn't used BeeBot, you're in the right talk.
205200	218540	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.
218540	222300	We had one big client, and this client had a huge attack surface.
222480	230860	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.
232060	236680	And originally, we didn't intend to make it a recursive tool, or not necessarily.
236680	242260	We just needed something that was stable, that we could basically scan a huge target with, and it wouldn't break.
242260	243300	It was like consistent.
243320	251700	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.
252720	256500	So, we tried a lot of different ones, and there are some great tools out there.
256800	261560	The ones in this list, like Amass, The Harvester, I ran a lot of these.
262280	267260	But what turned me on to recursion, originally, was Spiderfoot.
267840	273640	So, something interesting about Spiderfoot is that it's built in a unique way.
273640	277120	Its design is totally different from all these other tools.
277280	286860	And it's not immediately obvious from looking at Spiderfoot, or using it, but a lot of tools claim to be recursive.
286860	292540	For example, if you've ever used FUF for directory brute forcing, it has a recursive option, right?
293260	296780	But Spiderfoot is actually recursive.
297320	305460	And the way that it's recursive is super important, because it has 200 modules, and each of those modules interact with each other.
305460	315420	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.
315420	318000	So, it's actually a really genius design.
318620	326700	So, I just sketched out here, sort of a classic workflow for OSINT, or external task surface mapping.
326700	342000	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,
342000	342320	right?
342320	344980	Pretty typical, and most of us have probably done this.
345740	347760	But yeah, Spiderfoot does not work like this.
347760	350400	It's not like a phased scanner.
350660	356780	So, just to explain how Spiderfoot works, because this is also how Bebot works, but I did not invent this idea.
356780	358480	Spiderfoot was the first one to do it.
362380	367160	Okay, so, the way Spiderfoot works is each of its modules do one specific thing.
367160	370000	So, in this example, I have three modules.
370000	374400	So, we have SSL cert, Nmap, and HTTP.
375000	382420	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.
382560	387900	So, in this example, the red line is open port, and the blue line is host.
387900	392960	So, you see that Nmap consumes hosts, port scans them, and outputs open ports.
392980	400980	And then SSL cert consumes the open ports, and basically visits that open port, and pulls down the SSL certificates.
401160	405120	HTTP visits the website, if there is one, and extracts URLs.
405440	410260	And then, from SSL cert and HTTP, you get more hosts, and they feed into Nmap.
410260	415040	So, to illustrate this, you start off with EvilCorp.com, right?
415100	417160	Port scan it, get open ports.
417560	429780	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?
429780	433280	So, it's not just a phase thing, like it just keeps churning until there's nothing left.
433380	435440	And this is recursion, okay?
435440	436580	So , this is the big idea.
436580	439840	This is the big idea that Spiderfoot basically put into practice.
440340	442580	And it's what fascinated me about it.
442620	446960	So, unfortunately, Spiderfoot itself didn't end up working out for us .
446960	451100	You know, I tried to make it our, like, one tool, and it didn't end up working out.
451500	453180	I won't get into the details of that.
453400	455240	But it did infect me.
455240	470940	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.
470940	472640	And that's what Spiderfoot was doing.
472640	479960	So, at the time, I felt a lot like Spiderfoot's idea was really good, but its execution wasn't as good.
480320	486220	So, the plan became, you know, build a new scanner that was stable and also recursive.
486880	488660	And what could go wrong, right?
488660	489760	How hard could it be?
489760	490940	It's just like this.
490980	494700	So, here's the first VBOT scan that we had.
495020	500240	The first scan, the first feature that I added to VBOT was DNS resolution.
501360	507080	So, what you're watching right here is a recursive DNS resolution of Tesla.com.
507740	519700	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.
520200	523040	So, yeah, that's how it's supposed to work.
523740	529140	And try and remember what that looked like, because, yeah, that's what a scan is supposed to look like.
529500	535260	And because this talk is about bugs, we're going to about see a lot of things that don't look like that.
539300	540100	Okay.
541940	545860	So, the DNS bugs were the first to arrive since DNS was the first thing I made.
547140	547940	All right.
548200	549820	So, what is happening here?
552160	553580	Kind of weird looking.
553660	556520	Definitely not looking at all like the last one.
557260	561520	So, yeah, something is clearly off here.
561980	566300	And if you're close enough, and you can see the terminal, you might be able to guess what that is.
567480	575600	But if we look at what's happening in Neo4j, kind of zoom in and look at it, our target was EvilCorp.com.
576260	590660	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.
591360	594440	So, this is a C name loop.
594440	597500	And if you know anything about DNS, you know this should never exist.
597980	600560	There's absolutely no sane reason to do it.
601140	605880	But I promise you, it exists, and we ran into it, and it seriously messed with us.
606480	614280	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.
614280	616880	I don't know what it was, but it was very frustrating.
618020	621440	All right, so more DNS bugs.
621440	623700	This one is a bit more explosive.
625040	628340	But basically, yeah, just wait a second, just wait for it.
632420	635960	Okay, so this is more than just a simple DNS lookup.
635960	641680	This is, right now, what we're doing is a subdomain enumeration on github.io.
641940	650280	Okay, so github.io has an interesting quality, which is that it's a wildcard domain.
650620	655140	Yes, okay, so how many of you have had fights with wildcard DNS?
655820	661420	Yeah, okay, so I'm sure that you probably hate wildcards, and I do too.
661500	663640	These cause us a lot of pain in BeBot.
663860	674880	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?
675060	676920	Because what happens is this.
677680	684760	You do a lookup on something that clearly doesn't exist, and github.io is going to tell you, oh yeah, that exists.
684760	686400	Here it is for everything.
686700	691240	So in a mass, this isn't a big problem because you can just clean them out at the end.
691240	694000	You know, you're going to have some extra garbage data, just clean it out at the end.
694160	705060	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.
706580	713780	So yeah, so basically in the early days of BeBot, and we had a lot of bugs, and they just kept coming.
713780	726400	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.
727420	734740	And sometimes these would collide, so sometimes we'd get interactions between DNS bugs and web bugs, and those were always the worst.
735700	750140	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,
750140	751700	can you run this, test it out for me?
751700	752860	Like, sure, why not?
753160	762040	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.
762720	765440	And well, first I asked, like, which modules did you enable?
765540	767640	And they said all of them, obviously.
768360	774220	So basically there are other modules besides just the web module that we have that visits websites.
774220	778780	For example, we have a nuclei module, which does, like, vulnerability scanning.
779780	795180	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,
795180	799440	but because they were a wildcard, they all just brought it back to the same server.
799440	807720	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.
808640	815020	So yeah, example of kind of, like, how DNS and HTTP, like, combine together to screw us over.
820110	833310	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,
833310	842910	or just doing something crazy, so, and this wasn't just with wildcards, like, we had issues also with, like, cloud.
843430	854990	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?
854990	858010	Like, maybe, like, a cloud domain or something like that, like azure.com?
858730	861270	This was kind of an issue with BeBot, right ?
861270	864910	Maybe, yeah, maybe you had, like, a cloud bucket or something in there accidentally, right?
864910	866350	Bad things can happen.
866350	876170	So right here, what we have is, we have what starts off as just a normal subdomain enumeration of spacex.com.
877030	884530	So you can see, yeah, it's lots of, lots of sort of URLs, DNS names, IP addresses coming in that belong to SpaceX.
885150	890770	But if we watch this, if we watch this for a little while, I'm going to fast forward it a little bit.
890770	899330	What you can start to see happening is, we start to see some weird little things spin off to the side here.
900290	908170	So, so what happened is SpaceX, at this point, they had, well, first of all, SpaceX is a, is a, they do government contracts.
908190	910410	So they use Azure for a lot of their stuff.
910470	912510	But it's like the government version of Azure.
912510	913830	So it's got azure.us.
913830	921610	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.
921750	925290	And there was a bug where it would be like, oh, azure.com?
925290	925990	Yeah, that's in scope.
925990	931530	And it would just start to enumerate all of Azure, which obviously is huge and obviously not what you want.
931590	935250	So over here, this, this one over here is azure.us.
935470	937170	This one's azure.com.
937170	940570	Like this cluster at the bottom is like microsoft.com.
940570	941790	It's just like going ham.
941790	945510	So this is a scan you not want to leave running for very long.
946410	953150	So yeah, there's this one time when we accidentally scanned a dot gov.
953250	954870	This was kind of embarrassing.
955610	960830	What made it worse was that we found a critical RCE on the dot gov.
961450	964050	And so we were like talking like, should we report this?
964050	965030	Obviously we have to report it.
965030	965810	It's a dot gov.
965810	966910	It's a critical.
966950	977590	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.
977590	981850	And yes, it did end up getting exploited and it may or may not have been in the news.
981850	983390	So that was an experience.
983630	984010	Yeah.
984010	986790	We, we had some accidental accidents happen.
987690	990190	And this, this was kind of normal for spiderfoot.
990190	991710	Has anyone used spiderfoot?
992290	992870	Okay.
992870	993230	Okay.
993230	993450	Yeah.
993450	1007770	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.
1007770	1015610	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.
1015910	1017310	But it totally did.
1017930	1023590	And so, yeah, basically like, you know, spiderfoot had a scope system and like, I just didn't think it was fixable.
1023590	1025270	I thought I could write my own that was better.
1026370	1030670	And yeah, it, it didn't work out quite like I planned.
1030670	1038810	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.
1039050	1041490	You know, like OSINT, when you think about OSINT, right?
1042030	1045850	OSINT is just like, recon OSINT is just like relationships.
1045850	1047650	And so it's, it's a recursive problem.
1047650	1049490	Like we know it's a recursive problem.
1049490	1050810	We've known this for a long time.
1050810	1053730	So like, why aren't all our tools recursive?
1053730	1056410	Why are they all just sort of like linear scanners?
1057670	1060190	And there's, there's a really important reason for that.
1060310	1067290	And this was what I was just beginning to discover, which was that recursion is the mortal enemy of stability.
1067350	1074190	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.
1075050	1078890	So speaking of stability, I want to show some more bugs.
1079450	1081430	This, this is kind of a weird one.
1081530	1087050	And this starts off in the same way as the cloud one with a, a subdomain enumeration of SpaceX.
1088090	1101830	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.
1110600	1111520	Okay.
1112800	1113480	All right.
1113480	1120380	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.
1121340	1123280	So, so what's, what exactly is happening?
1123280	1127660	This is all the same host and it's just like tons of URLs coming in.
1127700	1135360	So, so basically what this is, if we look at it more carefully, is it's an infinite redirect.
1135720	1145160	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.
1145160	1158180	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.
1158180	1160600	So basically it would just go on forever.
1161120	1178180	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.
1179460	1182740	So yeah, the web bugs, the web bugs were real.
1182860	1188280	There were many times with actually, there were actually three separate times that we accidentally made a web spider.
1189480	1196120	And it, it, this, this may seem silly, but, but it was like, it, it was a real problem.
1196120	1206760	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.
1206760	1211500	The first one is you need to visit URLs, simple, right?
1211500	1216020	And the second ingredient is you need to extract the URLs from that response.
1216300	1217220	That's a loop.
1217220	1218460	It's, it's all, it's all you need.
1218640	1222820	If you have those two things in a recursive tool, you have a web spider.
1223060	1229040	So if you're curious what a rogue web spider looks like, this is what it looks like.
1231060	1247560	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.
1247860	1253600	Well, first of all, because the Linux people have super fast servers and they're really good at keeping everything running.
1254300	1257280	But also because there's just lots of goodies in there.
1257280	1267380	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.
1267380	1271880	It'll download files like PDFs, Word documents, that kind of thing.
1272000	1280260	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.
1280600	1282000	But yeah, kind of fun.
1283940	1294280	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.
1294280	1306900	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.
1306900	1313440	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.
1313680	1325040	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.
1325040	1329340	And like the whole thing would just be a character building exercise, which I definitely didn't want.
1329860	1334780	So yeah, reminded us like Calvin and Hobbes, you know, just builds character, builds character.
1334860	1336640	So basically I had a choice.
1336640	1346360	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.
1347160	1349220	So, so yeah, obviously I chose recursion.
1349220	1351700	I wouldn't be here talking about it if I hadn't.
1351820	1355560	But yeah, Spiderfoot had done a number on me.
1355560	1363420	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.
1363680	1364660	So, so, okay.
1364660	1367540	So like, what, what were the consequences of that?
1368380	1373260	Well, they were pretty excruciating, especially at first.
1373440	1378300	So the most excruciating thing that we had to deal with was unit tests.
1378300	1379040	Okay.
1379340	1387380	If you, if you haven't experienced the pain that are unit tests and like CICD pipelines, I definitely envy you.
1387600	1389940	This is, this is what you're supposed to do in software development.
1389940	1398960	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.
1400220	1409980	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.
1409980	1416180	Like I'd written hacking tools before, never written tests for them, just kind of got away with not doing that.
1416660	1419100	But B-Bot could not exist without tests.
1419100	1421400	Like, we have a unit test for everything.
1421400	1427640	Every one of those bugs that I showed off, we wrote a test to make sure that it doesn't come back.
1427640	1434560	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.
1434720	1437580	And all of this runs every time you push new code to B-Bot.
1437580	1443320	So basically, this is like the structure that's holding it all together and holding it up and making sure that it stays stable.
1444700	1445820	So, yeah.
1445980	1446720	So, yeah.
1447860	1452120	By embracing recursion, I was like sort of torturing myself, and I realized that.
1452120	1454140	But it was really humbling.
1454640	1464120	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.
1465440	1471960	I think the biggest lesson I learned, well, the biggest lesson was that maybe I'd been a little bit too hard on Spiderfoot.
1471960	1473900	I kind of felt bad for that.
1475420	1483480	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.
1483620	1487400	And from that perspective, it just seemed super complicated.
1487660	1499840	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.
1504860	1515820	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.
1515920	1529660	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.
1529840	1534040	It turns scope into a threshold.
1534040	1542960	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.
1543200	1547320	And if you hit something that's in your target, it just resets to zero.
1547500	1553340	And this is what we use in VBot to basically allow it to do all of that spidering and stuff in a safe way.
1554560	1569760	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.
1571020	1573800	And was it worth the suffering?
1573800	1575400	So this is the big question, right?
1575400	1584460	So I want to show you something, and this is not like directly related to VBot, but it's kind of cool.
1584460	1588540	So has anyone ever used Trickist?
1588600	1590220	Has anyone heard of Trickist?
1590220	1591560	Okay, we got one guy.
1591560	1603060	So Trickist is kind of a new platform that basically allows you to construct what are essentially like workflows with your hacking tools.
1603060	1609760	So what we're looking at right here is a Trickist workflow for subdomain enumeration.
1609980	1612680	So you can see that there's a whole bunch of different phases.
1612680	1619960	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.
1619960	1635380	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.
1635620	1648920	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.
1648920	1649960	It's kind of interesting.
1649960	1652300	The first time I saw this, I was really amazed.
1652300	1653280	Trickist is really cool.
1653280	1655560	If you haven't checked it out, you should check it out.
1655560	1656500	It's pretty neat.
1657320	1669360	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.
1671660	1679460	So finally, if we go down, we have like this phase two where we do port scanning and we do websites .
1679920	1687000	So this is basically like sort of the standard like subdomain enumeration workflow with Trickist.
1687000	1693820	But there's something interesting about this, which is that you'll notice it's not recursive.
1694700	1703460	So I ran this workflow on Dell.com, and it found 11,000 subdomains.
1704220	1705800	Dell.com is a pretty big domain.
1705800	1707600	I just kind of picked it because it was big.
1707980	1709840	But here's a question.
1709840	1711200	Who would win?
1711220	1717080	So we have the six tools duct taped together, or just one tool.
1717360	1720980	So how much does recursion actually get you?
1720980	1721680	This is the big question.
1721680	1722840	You all want subdomains, right?
1722840	1724940	Give me as many subdomains as possible.
1725300	1728060	So here's the bbot command that I ran.
1728060	1729560	We have a subdomain enumeration.
1729980	1738020	Bbot found 18,000 subdomains, which is 53% more than all six of those tools combined.
1738580	1745100	So essentially it found over 6,000 subdomains that the other tools did not find.
1745740	1757340	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.
1757340	1763000	Bbot tracks exactly how it discovers each of its things.
1763000	1768940	So each event that bbot emits, this DNS name, has a discovery path.
1772800	1782780	This particular discovery path for this subdomain, which is one of the subdomains that was missed by the Tricus workflow, has 13 steps.
1782800	1786160	So if you can't read it, I'll just basically summarize really quickly.
1786160	1789280	So we seeded the scan with Dell.com.
1789600	1792900	Basically there was an API search that found a subdomain.
1792900	1799680	That subdomain had an open port, which basically when we went to visit it, had a redirect that went to this login page.
1799680	1815800	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.
1815800	1820080	And then that DNS name had a C name that pointed to this one.
1820660	1826000	So basically just like this huge chain of discovery that you never could have gotten without recursion, right?
1826000	1828920	We're like 13 levels deep in recursion here.
1829040	1831700	And this subdomain is at the very end.
1831800	1833580	So how are you going to get that, right?
1834260	1835700	Here's another one, right?
1835700	1837620	Seeded the scan with Dell.com.
1837660	1853580	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.
1854100	1854600	Okay.
1854700	1856320	Like, how are you going to get this?
1856320	1858320	Like, you know, we could do this.
1858320	1858920	We're humans.
1858920	1860840	Like we could follow this path, right?
1860860	1864240	But how long would it take you, you know, for 18,000 subdomains?
1865420	1866260	So yeah.
1867480	1869020	PayPal.com, another one.
1869020	1878080	PayPal.com, thanks to recursion.
1878080	1882340	This is thanks to us brute forcing subdomains of subdomains.
1882940	1889780	Just following those crazy chains of like, you know, visiting the website and extracting SSL certificates over and over and over again.
1890640	1892040	What about the speed, though?
1892040	1893520	Like, how fast is it?
1894000	1899860	So Bbot is a little bit slower and this makes sense because, you know, how is it going to get those giant chains?
1900640	1909020	Trickist workflow took about five hours and Bbot in this case for Dell.com took about six hours, so a little bit longer.
1910060	1921400	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.
1921500	1922680	Please don't.
1922680	1923860	Please don't do that.
1924160	1925140	You can if you want.
1925140	1925560	Okay.
1925560	1927460	But consider this.
1927460	1928000	Okay.
1928200	1931240	So let's go and let's edit this workflow.
1931960	1939100	Imagine that you want to discover those far out subdomains, those ones that like you can't reach just by doing this, right?
1939100	1949980	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.
1949980	1958040	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?
1959620	1962560	And by then we're like, how many level?
1962560	1964320	We're like, you know, three levels.
1964320	1970280	So then after that, you know, oh crap, now we have to like, we have to do web again.
1970360	1972580	So we have new subdomains, we have to do the web thing now.
1972580	1976940	And then oh no, now we have to like do more, we have to do more brute forcing now.
1977140	1978700	You see the pattern, right?
1978700	1984580	Like how many times, how many times you're going to do that before you realize it needs to be a circle.
1984840	1989660	Like it just needs to be one nice little circle that goes around and around and around until there's nothing left.
1989660	1991000	So that's what recursion is.
1991000	1992000	That's how Bebout works.
1992000	1997640	And that's how it's able to find these crazy subdomains and things that are just way out there.
1999500	1999840	Okay.
1999840	2000300	So yeah.
2000300	2004620	So basically starting to wrap up here, basically this is kind of a silly meme, right?
2004900	2017180	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?
2017640	2026680	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.
2026680	2031340	In other words, like make it the framework that you plug everything else into.
2031900	2034480	Maybe that's Bebot, maybe that's Spiderfoot.
2034480	2041320	But I can't emphasize enough how important it is to have a recursive system.
2041580	2042300	Yeah.
2042300	2044840	Again, like OSINT is a recursive problem.
2044840	2059740	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.
2059740	2064060	Um, so yeah, like I like this, this quote from hackers.
2064420	2071100	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.
2071100	2071680	Okay.
2071680	2077420	So I feel like, I, I feel like as a community, I think, um, we can handle recursion.
2077420	2078420	I think we could do it.
2078420	2082960	So, um, on that note, I want to announce that Bebot 2.0 is releasing today.
2083100	2084900	So it is out right now.
2084900	2086820	Um, and you can install it with pip.
2088080	2090460	Um, so, um, so yeah, there's a lot of new features with this.
2090460	2092640	I, I, I wish I could get into all of them.
2092640	2094220	I wish we had time to do all of them.
2094220	2101340	Um, but, uh, yeah, basically like the, the, the gist of it is that, um, we have 10 new, uh, 10 new modules.
2101340	2102780	Um, it's a lot faster.
2102840	2106980	It's, it's faster by almost an order of magnitudes, like almost 10 times.
2107040	2113900	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.
2114020	2115740	Um, we have Yara integration.
2115740	2124100	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.
2124100	2126800	Um, but yeah, um, check it out.
2126800	2127840	We, we have a GitHub.
2127840	2129680	Um, we have lots more in the pipeline.
2129680	2132980	So like development is happening at a super fast pace.
2132980	2135320	Like we're adding features every day.
2135320	2141180	Um, there are some awesome people in the community who are writing new modules and adding new features.
2141180	2146300	Um, some of some of the features that are up and coming are going to be super cool.
2146300	2147760	I'm actually super excited.
2147840	2161420	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.
2161420	2164080	So yeah, um, it's going to be, it's going to be awesome.
2165120	2166600	Oh, and it's a Python library.
2166600	2173700	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.
2173720	2175420	Um, it's basically super simple.
2175420	2177760	Hip install B-Bot from B-Bot import scanner.
2177840	2183800	Um, and you can do everything in the Python library that you can do on the command line and even a little bit more.
2185580	2186180	So yeah.
2186180	2186480	All right.
2186480	2188560	So thanks everyone for coming to this talk.
2188560	2191340	I hope it inspires all of us to think recursively.
2191660	2193800	Uh, and yeah, thanks.
2201800	2204280	Um, if there's any questions, I'll take them now as well.
2204280	2207220	Uh, any questions about B-Bot or recursion or anything like that?
2207900	2208040	Sure.
2208040	2208220	Good.
2212860	2213660	Okay.
2215080	2216080	Good, good question.
2216080	2216220	Okay.
2216220	2218160	So the question was like, why is a rogue spider bad?
2218160	2219300	Like, why wouldn't you want that?
2219300	2219820	Right.
2219820	2222840	Um, uh, and in some cases you absolutely do want that.
2222840	2228920	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.
2228920	2236680	Um, if, if we were to enable that spider for like dell.com, imagine how many pages dell.com has for documentation and stuff.
2236680	2238620	Like it, it, it'd be like a week.
2238620	2239620	It'd be, it'd be a week.
2239620	2246660	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.
2246660	2249000	So you can be like only 10 hops, no further than that.
2249000	2251640	So you can definitely dial it in to exactly what you want.
2251800	2254780	Um, or you can just turn it up to 9, 9, 9, 9, 9, if you want to.
2255160	2255560	Yeah.
2255560	2256360	Whatever you want.
2256600	2257620	All right.
2258100	2258700	Good.
2264870	2265750	Oh yeah.
2265750	2266130	Yeah.
2266130	2273410	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?
2273530	2275750	I'd say, I'd say a lot of the time.
2275870	2277310	Um, yeah, definitely.
2277310	2285970	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.
2285970	2288970	Um, or, or maybe they just don't want you spidering their website.
2288970	2291730	Like some sysadmin is like, eh, good luck spidering this thing.
2291730	2293090	Uh, so yeah.
2293090	2297350	Um, but also plenty of times people just accidentally misconfigure DNS.
2297350	2301810	Like make a recursive like link accidentally also happens.
2301810	2302770	Yeah.
2303050	2304190	All right.
2304410	2304670	Cool.
2304670	2304810	Cool.
2304810	2305890	Anyone else?
2306290	2307270	All right.
2307270	2308390	Thank you.
