So, this is the efficient bug bounty automation techniques talk. If that isn't the talk you're here for. You know? So, my name is Gunner Andrews. I'm an AppSec engineer by day, bug bounty hunter by night. I do a little bit of content creation on YouTube and Twitch and some other stuff around basically the same thing. Bug bounty hunting, recon, tool dev, that kind of thing. There's three main goals for the talk that I want to go over. So, three basically different parts. The first one is the idea of resources versus findings. In bug bounty automation, you can get a lot of data really fast and have zero findings, which means zero dollars. So, we're going to talk about getting from zero to 100 with as little cost as possible and scaling up to actually having results that can get you bugs, which means hopefully money. The second part is automating collection. So, I'm going to talk about what I personally collect and how I collect it efficiently. And then the little last portion at the end is going to be kind of a portion on data engineering for bug bounty automation to hopefully encourage some people to move away from flat text files as much as bug bounty hunters seem to love those. So, I want to start the talk with this slide because I think it's a weird take for some automationists. I basically don't do any brute forcing at all until I have to. I monitor millions of domains every day. I found all of them without brute forcing anything. I monitor a ton of endpoints, JavaScript files, all that kind of stuff, just like everybody else does. I didn't brute force for any of those. I only brute force something when I absolutely have to because brute forcing is guessing and nowadays there's just a lot of other techniques to cover before you start guessing. When you're taking a test, the last thing you do is guess. When you're totally screwed, then you guess. So, I'm going over all this stuff before you're screwed and you have to guess. So, I'm going to start at the beginning with Apex domains and kind of a warning about Apex domains because Apex domains are very important in bug bounty, especially for bug bounty automationists. Seeing that wild card, star dot anything dot com means we can hunt on everything. There's a lot of bug bounty programs that say hunt all of our stuff no matter what. Just anything that meta owns or anything that Yahoo owns or anything like that. So, for some programs, the place to start is Apex domains, finding all of the root domains to then put into automation, finding all of the IP space they own, that kind of stuff. But specifically for Apex domains, these are some of the sources. It's not the complete picture, especially if they're cloud friendly and we'll get into the cloud stuff later. There's reverse whizzing. There's ASN, like, checking their ASNs against certain ASN sources. But the thing at the bottom, I'm not going to hit on this for a whole bunch because I personally don't like automating this a ton. I do a little bit of it, I write some scripts to run it, but then I manually look at the output because I found and I have personally been burned multiple times on very big bugs where I turn in a huge bug, get really excited, and then the domain isn't in scope. Right? Maybe they shared some kind of registrar, they did some kind of thing and it happened to slip into my automation because I automated it and I got burned. So, these are some of the sources. I put them up there anyway. But as a warning, I personally don't start at Apex domains for that reason. It's hard to automatically 100% confirm that it's in scope. So, if you are interested in looking for Apex domains, though, automate it. And we'll talk about some of this later. But these are some of the things I do. So, nowadays, it is very easy for everybody in this room to get a hold of enough hardware to scan the entire IPv4 IP address space. You don't need an ASN. Some companies do run on IPv6 only, but it's very few, to be really honest. I built some of my own tooling for this. If you look on my GitHub, one of the tools is called Caduceus. I like naming my tools after mythological weapons, you'll see. But there's some ports there. I always do port 443, but there's some other ports that will have certificates on them that are used. Basically, what Caduceus does is it does half the TLS handshake, enough to get the certificate, and then it pulls any domain names out of the common name and subject alternative name fields and then gives the output with what IP address it found it from and what domains. Right? So you can use this, scan the entire internet, and I end up with a whole list of domain names and what IP address I got them from, right? And we'll talk about this a little bit more later in depth, because this obviously works for subdomains, too. But the other half of it is reverse DNS lookup. So I do reverse DNS, which is searching for PTR records. So it basically does the opposite of DNS, right? So instead of what IP address does this DNS name resolve to, it's the other way around. You put an IP address and it gives you DNS names. I do that using some of those tools. I prefer ZDNS, but there's a bunch of good tools. I do that across the whole IPv4 space as well. And then those scans can also give you APEX domains. We'll talk about it, because it can give you subdomains, too. But for APEX domains, I found a lot of APEX domains just looking around the internet. You'll find something that says Yahoo on it that you've never seen before, and then you can go back and check who it's registered to and all that kind of stuff and confirm that it does, in fact, belong to Yahoo or whatever company it is, right? The little tip at the bottom, we can mention later, too, but if you are scanning the IPv4 space, a big chunk of that is cloud providers. If you want to take the time, scanning a cloud provider from the cloud provider is disgustingly fast. Compared to everything else. 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 in, like, a minute. But I didn't tell you that. Okay? So now we're going to start with what actually is just automatically for me is automated. Everyone likes to start with subdomains, so that's where we're going to start. It's basically like Pokemon, right? I full, like, wholeheartedly use passive DNS sources, because if you read the small print for all these companies, especially the ones that run public DNS servers and big ISPs, everyone sells their DNS data to someone. They might say they don't sell it, but then at the end, it's loopholed because they add their DNS data as part of some other business contract with another company. So a lot of these companies you've heard of, like VirusTotal, Security Trails, and stuff like that, they do their own internet scanning. Sure, they might put bots out there and scan the internet and stuff like that, but they also buy a lot of this data from major DNS providers that are happy to also profit from it. So I pay for some. You don't have to. I'm not here to tell you to pay for any product, obviously, because I don't work for any of them. But I do pay for some of them, because in my opinion, they've been way worth it for me. I always, always, always tell someone, do not just hook up a tool and use it because it says it hits that API. Read the docs, look at the rate limiting, look at the pagination, how many credits you use per this or that, and just try writing it yourself first. Because we're gonna talk about it right now, but all those tools on the right, everyone has made all these tools that hit every passive DNS source on the planet, and you can put in your keys, and that's all great, and they are amazing. Project Discovery, the people that made Amass, Bbot, I think it's Black Lantern Security, they're all amazing. They've made amazing tools, and they work amazing. But if you want specific things, I would write your own logic, just so you 100% know what's going on. One of the reasons for that is because when you audit these tools, they try and make everybody, all of you in this room, as happy as they can, all at the same time. And to do that, sometimes you have to cut corners. Some of those corners are, for instance, failing quietly. So when you audit tools, you'll find something like this. If anyone recognizes this, this is Subfinder. Again, if someone from Project Discovery is here, I love you, please talk to me, okay? I'm sorry. But you'll notice on, like, the fifth row down, I ran this. If you run it with a dash stats flag, you'll get this output that will tell you the statistics of your run. I ran this against Tesla.com with dash all, meaning use all the sources you possibly can, which is how a lot of people are encouraged to run it. You'll notice it took 43 seconds and 43 and a half. Well, Common Crawl took 43 and a half seconds. And how many results did I get? Negative 70,782, which makes a ton of sense. So I ran for 43 seconds for an error, basically. If you look at the next fastest source or the next slowest, it was 10 seconds from Security Trails or 30 seconds from Wayback Archive that also gave me nothing. So if I cut out Common Crawl and Wayback Archive, lose no results, and I would have ran in about 10 seconds, because I think Security Trails is the next slowest. So I would have ran in a fourth of the time and gotten the same things, just by paying attention to what sources I'm using and what they're actually giving me. Right? So back to certificates. Okay? So again, I do IPv4 certificate scanning with Caduceus, which I just talked about. You get Apex domains from that, but what you really can look for is subdomains. Those subdomains can be used in a ton of different ways, which I will talk about in a second, but when we talk about certificates, we cannot not talk about cert.sh and CT logs. So CT logs are Merkle trees that are public to everybody, and cert.sh was made by some really smart people. It ingests those logs and saves them in a database that is queryable. Subfinder does it, other tools do it, and you can do it directly. The problem I found with cert.sh is I want domains before all of you have it. Sorry. Right? Some of the bigger CT logs, cert.sh actually won't have in their database queryable for up to 48 hours. Some are instant, some are not. So what I did is I made my own tool, it's also in my repo, it's called Gungnir, also another weapon, and all it does is it does the same thing that cert.sh does, but I already have databases and all that other stuff later, so it's just the Unix philosophy of CT log scraping. So it just scrapes the CT logs as fast as it can with exponential backoffs in case it gets rate limited and then it catches back up, and it will give you a domain within seconds of that certificate getting created. So if someone creates new site.example.com, it will show up in Gungnir in under 20 seconds. You'll know instantly. So if anyone puts a new service online and they want a real certificate behind it that's backed by a certificate authority, you'll know about it basically the second the certificate's created, no matter where they put it. Now, again, cert.sh will do that for you, and you can look historically with cert.sh, so it's still a fantastic tool. Gungnir is just if you want it immediately. So that's what I do. We'll talk about virtual hosting later, but Caduceus, like I said, Gungnir will give you certificates, but no IP address to what they go with. Caduceus and the certificate scanning will give me the IP address it came from, as well as all the domains. So keep that in mind. These are some other good things that I do. I automate them, but I don't do them constantly. Gwen made a very good tool called GitHub subdomains that I think he's actually rewriting, I've heard. I've talked about the reverse DNSing, and then I'll do light spidering, as in I'll land on a page and pull all the second order assets, which costs me nothing, and it doesn't get you banned. One Git request has not gotten me banned yet. Fingers crossed. Virtual host scanning, I wanted to release a tool today. It will be public very soon in my same repo, but I found a bug literally this morning, which is just terrible. But it's gonna be called Harpy, and basically what it'll do is you can take the JSON output from Caduceus, and you can pipe it right into Harpy, and it will do virtual host scanning specifically only for that IP address and the domains found on that certificate. So it's really efficient, and it doesn't do virtual host scanning for a huge list of subdomains against every single IP address. It's just what domains actually came from the certificate on that IP address. And I've already found a lot of nice stuff with it. So I would encourage you to look at it. So this is the other big part, is DNS resolution. Because if you get stuff from passive DNS, you are not 100% sure it resolves, right? So there's an issue if you're gonna do very high speed, very consistent resolving, is a lot of current tooling silently fails, just like I talked about with subfinder, or it returns surf fails, which if you're not looking for those, it will just drop, but surf fails can actually, if you guys are into, like, subdomain takeovers and stuff, those are nice to know about. If you attempt to resolve one time, like, if you get a domain from one of these APIs and you try and resolve it once, I promise you, you're missing assets. I promise you right now. If you don't have a running retry list of I'll try this for the next five days or something, I promise you, you're missing assets. So the trickest has a list of trusted resolvers that are public and out there and that kind of stuff, and I know a lot of people use those. It's what I started with. But I moved on. They have timeouts and a bunch of different issues. I actually wasn't going to talk about this, but I'll just do it anyway. So I look for subdomain takeovers personally, not in a bug bounty presence, but in a different engagement for consulting. I actually found a whole handful of takeovers that every public resolver on trickest's list actually says it's a no error, and what we'll talk about next actually gave it a surf fail. It was a surf fail. They were all takeoverable Azure assets. So I'm not sure why, because I'm not a DNS expert by any means, but the public resolvers, because they have to be on the edge and all that kind of stuff and very fast, can have other things behind the scenes that might mess up what you as a bug bounty hunter are trying to do. So this is what I did instead. So there's a tool or a set of tools called PowerDNS. They have three main tools. They have an authoritative server, which we don't really care about. They have a tool called PowerDNS Recursor, which is a recursive DNS resolver we definitely care about, and they have a tool called DNSdist, which is just a load balancer for DNS servers. Sounds pretty nice. So with very little dev effort, you can create a virtual IP, so all of your cluster has the same IP using something like keepalid and using DNSdist and Recursor, which all work together because they're the same company and it's basically plug and play. You can make your own DNS resolution cluster that has unlimited rate limits, can be tuned to your exact needs, whatever caching you want. Using this, you can attempt to resolve a domain as many times as you want. You don't hit rate limits. You can put it into Prometheus or any other kind of monitoring and monitor your own stack and make sure your stuff is working as you think it's working. And then to solve the problem of attempting to resolve multiple times, I actually use caching. I use Redis. You can use memcache. You can use whatever you want. Using just sorted sets with timestamps or anything else or the number of retries, whatever you want to do. It's lightning fast. You can pull it automatically. You're not pulling from a DB. You don't have to worry about a schema. You can just keep a running list of these are all the domains I've seen, this is how many times I've tried it or the last time I've seen it, whatever you want to do. That kind of stuff is what I do, so I can see when I resolve stuff last, how many times I've tried it, if it hasn't, that kind of stuff, and it's really fast right out of the box. Those are the records that I look for for bug bounty. I don't pull them all. So using this stack just for reference, I spend about $25 a month on my cluster, and just two days ago, I was able to ramp it up with no errors and no packet drops to write about 125,000 queries per second. So I do a couple hundred million, like 600 to 800 million requests a day to that cluster, and it works pretty nice. So port scanning. Now we're getting into the good stuff. Okay? Kind of. So there's active and there's passive. Now, I hold an opinion on this. This is a purely opinion post. There are active tools out there, but there is a passive tool that I learned about from Jason Haddix if he's in this room, but it's called SMAP, and all it does is it takes your NMAP flags, whatever, but it does it all against Shodan. It doesn't actively port scan. So if you want to port scan a bunch of IPs, it actually does it against Shodan. So what I do is I run everything through SMAP with Shodan, and then all the ports that it says are up, I then actively check with NMAP, whatever you want to use. Way less traffic. I've gotten banned zero times, and SMAP is right a lot of the time, because Shodan is pretty good. So you can still find all those ports on the right with all kinds of juice and all kinds of stuff without scanning every single port on every single IP until you eventually get abuse reports and get banned off of a cloud provider. I've never done that. Okay? Web servers and endpoints. Same thing scanning the web. So I obviously only do web fingerprinting on stuff that resolved. So again, do DNS resolution first. I'm assuming that's pretty basic, but we're going to start with that. Again, you don't want to get blocked, you don't want to get banned. So slow scanning is an idea. Always watch your user agent. A lot of these tools make their own custom user agents, and they're all blocked. Okay? There's probably someone from Akamai or someone else in this room, they block HTTPS, they block all that stuff that come with the custom user agents, go to Chrome, download Chrome, look in the requests, find the most recent user agent, and just paste that into your tooling. And like once a month, make sure it still matches. You're golden. All right? Some of the other things that we're not supposed to talk about are proxies and Lambdas, right? AWS Lambda, every time you spin up a Lambda, comes with a brand new IP address out of AWS's IP pool. It's a huge IP pool, and each one is new. I know Shubbs has talked about it, I know Shadow Clone has been out there for a ton, if you are going to do high speed scanning on the web, brute forcing, directories, whatever it may be, split it up with serverless architecture. It's cheap, I'm not supposed to tell you that, people don't like it, do it anyway. Okay? This is DEF CON, it's kind of the point. Okay? But, on the flip side, one Git request gets you a ton of data. Again, it will get you any second order resources, JavaScript files, S3 buckets, whatever it may be, it will get you the title, status code, you'll follow redirects, whatever that may be, you'll get your CSP from it, you'll get a lot of cookies from it. So, to be fair, on the flip side, one Git request gets you a ton of information. Right? So, you don't have to scan the web, and I personally don't. Because, basically, every request you send nowadays, you risk incurring wrath from someone. Especially because bug bounty tests in prod, because we're gangster. All right? So, for endpoints, there are passive sources. Varying results. Obviously, if you hit a brand new endpoint from Gungnir or something like that, and you go look for it in Gau or Waymore, which hits some of these passive sources, there's not going to be anything there. But if you find some old stuff, something might be there. So, it's worth looking. Again, it costs you nothing. I have two minutes. Okay. We're going to have to hustle. So, spidering and crawling is hard to do. When you kick off spidering, find stuff that looks interesting. Headless works best. Okay. Actually, I'm doing pretty good. So, this is the data engineering side. So, subdomains versus IP addresses, they're both extremely useful for those reasons. So, use both. I track subdomains and IPs, and I cross reference them. Track both. Do not just make subdomains your primary key in a database. Do not just make IPs. Do both, please. For those reasons. Okay? Look into data engineering, please. This is a plug. Okay? There are two books on the right side and a list of topics under them. I highly recommend those are both audio books on Audible. You can listen to them and fall asleep. I've never done it. Right? Read them. Okay? They are boring. They are technical. But it's so good. You're going to end up with so much data. And if you don't use the data or just put it in flat files and Postgres, you're going to regret it. I promise you. Okay? So, please take a picture of this slide. More data is more bugs, but only if you use it correctly. Okay? This slide is automation's advantage. Again, we can cruise through this, take a picture, whatever. This is what you want out of your automation. This should be your mission statement right here. This is what I do. Feel free to take a picture of it. This is basically my workflow. That's the second page of the workflow. That's a long workflow. Okay? The last thing I want to say is the people on this slide right here have been huge with me learning this stuff. And there's so many more people to list. I see some of you out there. But anyone who has interacted with me, thank you so much. These people are people I interact with every day. Find them. Look their names up. Everyone in this space is great. Don't do automation in a vacuum. There's bugs for everybody. Share your stuff. Talk to people. And this is a really crappy slide. If you want to reach out further, that's all I got. I think I made time.