start	end	text
0	5860	So, this is the efficient bug bounty automation techniques talk. If that isn't the talk you're
5860	13060	here for. You know? So, my name is Gunner Andrews. I'm an AppSec engineer by day,
13060	17200	bug bounty hunter by night. I do a little bit of content creation on YouTube and Twitch and
17200	22380	some other stuff around basically the same thing. Bug bounty hunting, recon, tool dev,
22380	27540	that kind of thing. There's three main goals for the talk that I want to go over. So, three
27540	33960	basically different parts. The first one is the idea of resources versus findings. In bug bounty
33960	39920	automation, you can get a lot of data really fast and have zero findings, which means zero dollars.
39920	45360	So, we're going to talk about getting from zero to 100 with as little cost as possible and scaling
45360	50780	up to actually having results that can get you bugs, which means hopefully money. The second
50780	54680	part is automating collection. So, I'm going to talk about what I personally collect and how I
54680	59400	collect it efficiently. And then the little last portion at the end is going to be kind of a
59400	64500	portion on data engineering for bug bounty automation to hopefully encourage some people
64500	70400	to move away from flat text files as much as bug bounty hunters seem to love those.
70400	75380	So, I want to start the talk with this slide because I think it's a weird take for some
75380	82500	automationists. I basically don't do any brute forcing at all until I have to. I monitor millions
82500	88580	of domains every day. I found all of them without brute forcing anything. I monitor a ton of
88580	92140	endpoints, JavaScript files, all that kind of stuff, just like everybody else does. I didn't
92140	97060	brute force for any of those. I only brute force something when I absolutely have to because brute
97060	102440	forcing is guessing and nowadays there's just a lot of other techniques to cover before you start
102440	107760	guessing. When you're taking a test, the last thing you do is guess. When you're totally screwed,
107760	113000	then you guess. So, I'm going over all this stuff before you're screwed and you have to guess.
114400	119180	So, I'm going to start at the beginning with Apex domains and kind of a warning about Apex
119180	124780	domains because Apex domains are very important in bug bounty, especially for bug bounty
124780	130640	automationists. Seeing that wild card, star dot anything dot com means we can hunt on everything.
130660	134140	There's a lot of bug bounty programs that say hunt all of our stuff no matter what.
134140	139640	Just anything that meta owns or anything that Yahoo owns or anything like that. So,
139640	144240	for some programs, the place to start is Apex domains, finding all of the root domains to
144240	147740	then put into automation, finding all of the IP space they own, that kind of stuff.
147740	154540	But specifically for Apex domains, these are some of the sources. It's not the complete picture,
154540	157700	especially if they're cloud friendly and we'll get into the cloud stuff later.
158060	162720	There's reverse whizzing. There's ASN, like, checking their ASNs against certain ASN sources.
162720	166740	But the thing at the bottom, I'm not going to hit on this for a whole bunch because I personally
166740	172880	don't like automating this a ton. I do a little bit of it, I write some scripts to run it,
172880	178820	but then I manually look at the output because I found and I have personally been burned multiple
178820	184660	times on very big bugs where I turn in a huge bug, get really excited, and then the domain
184660	190040	isn't in scope. Right? Maybe they shared some kind of registrar, they did some kind of thing
190040	194240	and it happened to slip into my automation because I automated it and I got burned.
194360	198440	So, these are some of the sources. I put them up there anyway. But as a warning,
198440	204600	I personally don't start at Apex domains for that reason. It's hard to automatically 100%
204600	211980	confirm that it's in scope. So, if you are interested in looking for Apex domains, though,
211980	216620	automate it. And we'll talk about some of this later. But these are some of the things I do.
216620	221800	So, nowadays, it is very easy for everybody in this room to get a hold of enough hardware
221800	230800	to scan the entire IPv4 IP address space. You don't need an ASN. Some companies do run on IPv6
230800	236540	only, but it's very few, to be really honest. I built some of my own tooling for this.
236820	241380	If you look on my GitHub, one of the tools is called Caduceus. I like naming my tools after
241940	247360	mythological weapons, you'll see. But there's some ports there. I always do port 443,
247360	251880	but there's some other ports that will have certificates on them that are used. Basically,
251880	256680	what Caduceus does is it does half the TLS handshake, enough to get the certificate,
256680	261240	and then it pulls any domain names out of the common name and subject alternative name fields
261840	266760	and then gives the output with what IP address it found it from and what domains. Right?
267880	273120	So you can use this, scan the entire internet, and I end up with a whole list of domain names
273120	276620	and what IP address I got them from, right? And we'll talk about this a little bit more later
276620	281340	in depth, because this obviously works for subdomains, too. But the other half of it is
281340	286260	reverse DNS lookup. So I do reverse DNS, which is searching for PTR records. So it basically
286260	290940	does the opposite of DNS, right? So instead of what IP address does this DNS name resolve to,
290940	295000	it's the other way around. You put an IP address and it gives you DNS names. I do that using some
295000	299420	of those tools. I prefer ZDNS, but there's a bunch of good tools. I do that across the whole
299420	306560	IPv4 space as well. And then those scans can also give you APEX domains. We'll talk about it,
306560	311780	because it can give you subdomains, too. But for APEX domains, I found a lot of APEX domains
311780	316440	just looking around the internet. You'll find something that says Yahoo on it that you've
316440	320520	never seen before, and then you can go back and check who it's registered to and all that kind
320520	324720	of stuff and confirm that it does, in fact, belong to Yahoo or whatever company it is, right?
324720	330360	The little tip at the bottom, we can mention later, too, but if you are scanning the IPv4 space,
330460	335600	a big chunk of that is cloud providers. If you want to take the time,
335600	343260	scanning a cloud provider from the cloud provider is disgustingly fast. Compared to everything else.
343260	351920	They might not like it, but it is. So if you scan US East 1 in AWS from US East 1, you can finish it
351920	359740	in, like, a minute. But I didn't tell you that. Okay? So now we're going to start with what
359740	364700	actually is just automatically for me is automated. Everyone likes to start with
364700	369220	subdomains, so that's where we're going to start. It's basically like Pokemon, right?
369560	377960	I full, like, wholeheartedly use passive DNS sources, because if you read the small print
377960	384460	for all these companies, especially the ones that run public DNS servers and big ISPs,
384460	391140	everyone sells their DNS data to someone. They might say they don't sell it, but then at the end,
391140	396580	it's loopholed because they add their DNS data as part of some other business contract with another
396580	401140	company. So a lot of these companies you've heard of, like VirusTotal, Security Trails,
401140	404800	and stuff like that, they do their own internet scanning. Sure, they might put bots out there
404800	408880	and scan the internet and stuff like that, but they also buy a lot of this data from
408880	416660	major DNS providers that are happy to also profit from it. So I pay for some. You don't have to.
416660	420200	I'm not here to tell you to pay for any product, obviously, because I don't work for any of them.
420320	424700	But I do pay for some of them, because in my opinion, they've been way worth it for me.
425540	430600	I always, always, always tell someone, do not just hook up a tool and use it because it says
430600	435180	it hits that API. Read the docs, look at the rate limiting, look at the pagination,
435180	439480	how many credits you use per this or that, and just try writing it yourself first.
439480	443440	Because we're gonna talk about it right now, but all those tools on the right,
443440	447840	everyone has made all these tools that hit every passive DNS source on the planet,
447840	451760	and you can put in your keys, and that's all great, and they are amazing. Project Discovery,
452300	456460	the people that made Amass, Bbot, I think it's Black Lantern Security, they're all amazing.
456460	461340	They've made amazing tools, and they work amazing. But if you want specific things,
461340	465300	I would write your own logic, just so you 100% know what's going on.
465500	471300	One of the reasons for that is because when you audit these tools, they try and make everybody,
471300	476760	all of you in this room, as happy as they can, all at the same time. And to do that,
476760	483100	sometimes you have to cut corners. Some of those corners are, for instance, failing quietly.
483100	487780	So when you audit tools, you'll find something like this. If anyone recognizes this,
487780	491260	this is Subfinder. Again, if someone from Project Discovery is here, I love you,
491260	497960	please talk to me, okay? I'm sorry. But you'll notice on, like, the fifth row down, I ran this.
497960	502320	If you run it with a dash stats flag, you'll get this output that will tell you the statistics of
502320	508420	your run. I ran this against Tesla.com with dash all, meaning use all the sources you possibly can,
508420	512480	which is how a lot of people are encouraged to run it. You'll notice it took 43 seconds
512480	519360	and 43 and a half. Well, Common Crawl took 43 and a half seconds. And how many results did I get?
519360	529120	Negative 70,782, which makes a ton of sense. So I ran for 43 seconds for an error, basically.
529120	534080	If you look at the next fastest source or the next slowest, it was 10 seconds from Security Trails
534080	540620	or 30 seconds from Wayback Archive that also gave me nothing. So if I cut out Common Crawl
540620	545960	and Wayback Archive, lose no results, and I would have ran in about 10 seconds, because I think
545960	549880	Security Trails is the next slowest. So I would have ran in a fourth of the time and gotten the
549880	553620	same things, just by paying attention to what sources I'm using and what they're actually
553620	562080	giving me. Right? So back to certificates. Okay? So again, I do IPv4 certificate scanning with
562080	566580	Caduceus, which I just talked about. You get Apex domains from that, but what you really can look
566580	571400	for is subdomains. Those subdomains can be used in a ton of different ways, which I will talk
571400	576560	about in a second, but when we talk about certificates, we cannot not talk about cert.sh
576560	582280	and CT logs. So CT logs are Merkle trees that are public to everybody, and cert.sh was made by
582280	587340	some really smart people. It ingests those logs and saves them in a database that is queryable.
587340	592820	Subfinder does it, other tools do it, and you can do it directly. The problem I found with cert.sh
592820	600200	is I want domains before all of you have it. Sorry. Right? Some of the bigger CT logs, cert.sh
600200	605820	actually won't have in their database queryable for up to 48 hours. Some are instant, some are
605820	612020	not. So what I did is I made my own tool, it's also in my repo, it's called Gungnir, also another
612020	618960	weapon, and all it does is it does the same thing that cert.sh does, but I already have databases
618960	624600	and all that other stuff later, so it's just the Unix philosophy of CT log scraping. So it just
624600	630400	scrapes the CT logs as fast as it can with exponential backoffs in case it gets rate
630400	635640	limited and then it catches back up, and it will give you a domain within seconds of that
635640	641420	certificate getting created. So if someone creates new site.example.com, it will show up in Gungnir
641420	648600	in under 20 seconds. You'll know instantly. So if anyone puts a new service online and they want a
648600	653120	real certificate behind it that's backed by a certificate authority, you'll know about it
653120	657000	basically the second the certificate's created, no matter where they put it.
657580	663220	Now, again, cert.sh will do that for you, and you can look historically with cert.sh, so it's
663220	669740	still a fantastic tool. Gungnir is just if you want it immediately. So that's what I do. We'll
669740	674980	talk about virtual hosting later, but Caduceus, like I said, Gungnir will give you certificates,
674980	679360	but no IP address to what they go with. Caduceus and the certificate scanning will give me the IP
679360	684360	address it came from, as well as all the domains. So keep that in mind. These are some other good
684360	689500	things that I do. I automate them, but I don't do them constantly. Gwen made a very good tool
689500	694020	called GitHub subdomains that I think he's actually rewriting, I've heard. I've talked about the
694020	699320	reverse DNSing, and then I'll do light spidering, as in I'll land on a page and pull all the second
699320	704520	order assets, which costs me nothing, and it doesn't get you banned. One Git request has not
704520	711640	gotten me banned yet. Fingers crossed. Virtual host scanning, I wanted to release a tool today.
711640	715840	It will be public very soon in my same repo, but I found a bug literally this morning, which is
715840	721280	just terrible. But it's gonna be called Harpy, and basically what it'll do is you can take the
721280	726320	JSON output from Caduceus, and you can pipe it right into Harpy, and it will do virtual host
726320	731860	scanning specifically only for that IP address and the domains found on that certificate. So
731860	736920	it's really efficient, and it doesn't do virtual host scanning for a huge list of subdomains
736920	741660	against every single IP address. It's just what domains actually came from the certificate
742240	749260	on that IP address. And I've already found a lot of nice stuff with it. So I would encourage you
749260	754440	to look at it. So this is the other big part, is DNS resolution. Because if you get stuff from
754440	762980	passive DNS, you are not 100% sure it resolves, right? So there's an issue if you're gonna do
762980	770060	very high speed, very consistent resolving, is a lot of current tooling silently fails,
770060	774200	just like I talked about with subfinder, or it returns surf fails, which if you're not looking
774200	778380	for those, it will just drop, but surf fails can actually, if you guys are into, like,
778380	783980	subdomain takeovers and stuff, those are nice to know about. If you attempt to resolve one
783980	788320	time, like, if you get a domain from one of these APIs and you try and resolve it once,
788320	794060	I promise you, you're missing assets. I promise you right now. If you don't have a running retry
794060	799080	list of I'll try this for the next five days or something, I promise you, you're missing assets.
800000	805340	So the trickest has a list of trusted resolvers that are public and out there and that kind of
805340	810360	stuff, and I know a lot of people use those. It's what I started with. But I moved on. They have
811160	815120	timeouts and a bunch of different issues. I actually wasn't going to talk about this,
815120	820460	but I'll just do it anyway. So I look for subdomain takeovers personally, not in a bug bounty
821240	826380	presence, but in a different engagement for consulting. I actually found a whole handful
826380	834000	of takeovers that every public resolver on trickest's list actually says it's a no error,
834000	838400	and what we'll talk about next actually gave it a surf fail. It was a surf fail. They were
838400	844880	all takeoverable Azure assets. So I'm not sure why, because I'm not a DNS expert by any means,
844880	848860	but the public resolvers, because they have to be on the edge and all that kind of stuff and very
848860	853860	fast, can have other things behind the scenes that might mess up what you as a bug bounty
853860	860920	hunter are trying to do. So this is what I did instead. So there's a tool or a set of tools
860920	865920	called PowerDNS. They have three main tools. They have an authoritative server, which we don't
865920	870840	really care about. They have a tool called PowerDNS Recursor, which is a recursive DNS
870840	876240	resolver we definitely care about, and they have a tool called DNSdist, which is just a load
876240	883980	balancer for DNS servers. Sounds pretty nice. So with very little dev effort, you can create a
883980	890140	virtual IP, so all of your cluster has the same IP using something like keepalid and using DNSdist
890140	893920	and Recursor, which all work together because they're the same company and it's basically
893920	901000	plug and play. You can make your own DNS resolution cluster that has unlimited rate limits,
901000	906380	can be tuned to your exact needs, whatever caching you want. Using this, you can attempt
906380	911780	to resolve a domain as many times as you want. You don't hit rate limits. You can put it into
911780	915300	Prometheus or any other kind of monitoring and monitor your own stack and make sure your stuff
915300	920120	is working as you think it's working. And then to solve the problem of attempting to resolve
920120	924220	multiple times, I actually use caching. I use Redis. You can use memcache. You can use whatever
924220	929400	you want. Using just sorted sets with timestamps or anything else or the number of retries,
929400	933940	whatever you want to do. It's lightning fast. You can pull it automatically. You're not pulling
933940	938700	from a DB. You don't have to worry about a schema. You can just keep a running list of these are all
938700	942020	the domains I've seen, this is how many times I've tried it or the last time I've seen it, whatever
942020	947440	you want to do. That kind of stuff is what I do, so I can see when I resolve stuff last, how many
947440	951540	times I've tried it, if it hasn't, that kind of stuff, and it's really fast right out of the box.
951660	957480	Those are the records that I look for for bug bounty. I don't pull them all. So using this
957480	965520	stack just for reference, I spend about $25 a month on my cluster, and just two days ago,
965520	972280	I was able to ramp it up with no errors and no packet drops to write about 125,000 queries per
972280	980220	second. So I do a couple hundred million, like 600 to 800 million requests a day to that cluster,
980500	987140	and it works pretty nice. So port scanning. Now we're getting into the good stuff. Okay?
987140	993800	Kind of. So there's active and there's passive. Now, I hold an opinion on this. This is a purely
993800	1000460	opinion post. There are active tools out there, but there is a passive tool that I learned about
1000460	1006460	from Jason Haddix if he's in this room, but it's called SMAP, and all it does is it takes your
1006460	1012880	NMAP flags, whatever, but it does it all against Shodan. It doesn't actively port scan. So if you
1012880	1017720	want to port scan a bunch of IPs, it actually does it against Shodan. So what I do is I run
1017720	1025140	everything through SMAP with Shodan, and then all the ports that it says are up, I then actively
1025140	1031860	check with NMAP, whatever you want to use. Way less traffic. I've gotten banned zero times,
1031860	1036460	and SMAP is right a lot of the time, because Shodan is pretty good. So you can still find
1036460	1040920	all those ports on the right with all kinds of juice and all kinds of stuff without scanning
1040920	1044980	every single port on every single IP until you eventually get abuse reports and get banned off
1044980	1051420	of a cloud provider. I've never done that. Okay? Web servers and endpoints.
1052100	1057940	Same thing scanning the web. So I obviously only do web fingerprinting on stuff that resolved.
1058140	1062980	So again, do DNS resolution first. I'm assuming that's pretty basic, but we're going to start
1062980	1067300	with that. Again, you don't want to get blocked, you don't want to get banned. So slow scanning
1067300	1072000	is an idea. Always watch your user agent. A lot of these tools make their own custom user agents,
1072000	1076480	and they're all blocked. Okay? There's probably someone from Akamai or someone else in this room,
1076480	1081320	they block HTTPS, they block all that stuff that come with the custom user agents,
1081320	1087220	go to Chrome, download Chrome, look in the requests, find the most recent user agent,
1087220	1091880	and just paste that into your tooling. And like once a month, make sure it still matches.
1092080	1096220	You're golden. All right? Some of the other things that we're not supposed to talk about
1096220	1102360	are proxies and Lambdas, right? AWS Lambda, every time you spin up a Lambda,
1102360	1107960	comes with a brand new IP address out of AWS's IP pool. It's a huge IP pool, and each one is new.
1108720	1112480	I know Shubbs has talked about it, I know Shadow Clone has been out there for a ton,
1112480	1119140	if you are going to do high speed scanning on the web, brute forcing, directories, whatever it may
1119140	1124700	be, split it up with serverless architecture. It's cheap, I'm not supposed to tell you that,
1124700	1129960	people don't like it, do it anyway. Okay? This is DEF CON, it's kind of the point.
1129960	1135760	Okay? But, on the flip side, one Git request gets you a ton of data. Again, it will get you
1135760	1141220	any second order resources, JavaScript files, S3 buckets, whatever it may be, it will get you the
1141220	1145960	title, status code, you'll follow redirects, whatever that may be, you'll get your CSP from
1145960	1151180	it, you'll get a lot of cookies from it. So, to be fair, on the flip side, one Git request gets
1151180	1158200	you a ton of information. Right? So, you don't have to scan the web, and I personally don't.
1158200	1164260	Because, basically, every request you send nowadays, you risk incurring wrath from someone.
1164260	1169060	Especially because bug bounty tests in prod, because we're gangster. All right?
1169400	1176520	So, for endpoints, there are passive sources. Varying results. Obviously, if you hit a brand
1176520	1181540	new endpoint from Gungnir or something like that, and you go look for it in Gau or Waymore,
1181540	1184720	which hits some of these passive sources, there's not going to be anything there.
1184720	1189500	But if you find some old stuff, something might be there. So, it's worth looking. Again,
1189500	1194620	it costs you nothing. I have two minutes. Okay. We're going to have to hustle.
1195220	1200260	So, spidering and crawling is hard to do. When you kick off spidering, find stuff that looks
1200260	1205180	interesting. Headless works best. Okay. Actually, I'm doing pretty good. So, this is the data
1205180	1210260	engineering side. So, subdomains versus IP addresses, they're both extremely useful for
1210260	1218320	those reasons. So, use both. I track subdomains and IPs, and I cross reference them. Track both.
1218320	1222940	Do not just make subdomains your primary key in a database. Do not just make IPs. Do both,
1222940	1230620	please. For those reasons. Okay? Look into data engineering, please. This is a plug. Okay? There
1230620	1236920	are two books on the right side and a list of topics under them. I highly recommend those are
1236920	1243160	both audio books on Audible. You can listen to them and fall asleep. I've never done it. Right?
1243340	1248200	Read them. Okay? They are boring. They are technical. But it's so good. You're going to
1248200	1254200	end up with so much data. And if you don't use the data or just put it in flat files and Postgres,
1254200	1259440	you're going to regret it. I promise you. Okay? So, please take a picture of this slide.
1259440	1267100	More data is more bugs, but only if you use it correctly. Okay? This slide is automation's
1267100	1271200	advantage. Again, we can cruise through this, take a picture, whatever. This is what you want
1271200	1277240	out of your automation. This should be your mission statement right here. This is what I do.
1277240	1282380	Feel free to take a picture of it. This is basically my workflow. That's the second page
1282380	1289760	of the workflow. That's a long workflow. Okay? The last thing I want to say is the people on
1289760	1294700	this slide right here have been huge with me learning this stuff. And there's so many more
1294700	1301580	people to list. I see some of you out there. But anyone who has interacted with me, thank you so
1301580	1307220	much. These people are people I interact with every day. Find them. Look their names up.
1307220	1311300	Everyone in this space is great. Don't do automation in a vacuum. There's bugs for
1311300	1316980	everybody. Share your stuff. Talk to people. And this is a really crappy slide. If you
1316980	1320360	want to reach out further, that's all I got. I think I made time.
