Okay, so now is the time for the second last talk for today. And we've got some interference from our neighbors. So we'll have to bear with it, cope with it, unfortunately. So we've got this time Jasper Insinger. Jasper is a security researcher at Hadrian Security. He has given multiple presentations in the past and has been present in Black Hat multiple times. He was in Black Hat yesterday as well, I'm assuming. Yes. Nice. The topic that he will be covering is pushing the limits of mass DNS scanning. Now, Jasper and his team developed an ultra-fast open-source DNS scanner named as SanicDNS. Using multiple parallelization techniques, the result in a scanner is that it has two orders of magnitude. The result is twice faster. It has two orders of magnitude faster than other popular tools. Jasper will take us under the hood of the code and share the techniques that have been used in identifying such kind of a result. With SanicDNS, it is possible to identify DNS misconfigurations, conduct name server takeover scans, and do a lot more fun stuff, which Jasper will let us know about. So please give it up for Jasper. All right, thank you. Okay, let's get into it. So thanks for inviting me. So I've also talked about exactly this subject two years back. And back then, the tool was like half-finished, very shitty, not usable at all. But in the last two years, I've been able to actually polish it up, make it a lot nicer, and also especially make sure that everyone in the security community can go and use it. So who am I? I'm Jasper. My background is in electrical engineering. So I studied back in the Netherlands, Dutch guy. And I primarily just love C++ and building fast things. That has kind of been my main thing in life that I just absolutely love. The background in embedded systems. Currently, I'm working as a security researcher at Hadrian, where I work primarily on DNS scanning, and also just building random hacking tools. Whatever works. All right, quick outline. So first, I'm going to start with why do we actually want to scan DNS? Because, like, why? Also, after that, we're just going to go into how you can actually build a brute-forcer where you can actually reach these lightning speeds. Tell a bit about the tool itself. Also, of course, I'm going to do a recap of how you can use the tool and also why you would want to use this tool. And also, a mandatory scanning responsibly. And I think there's also quite some future work that can still be done. So, DNS. Why scan it? DNS is like the backbone of the Internet. Like, a very nice spine here. And HTTP, FTP, SSH, they all kind of need DNS to work nicely. Because you don't want to be typing in IP addresses. And DNS is in this way critical to the Internet. It's been around for a long time. And it's just super, super relevant for almost anything you want to do online. So, DNS is very relevant for hackers because of this. Because the step zero for any hacker should be to map out the attack service of the target they're trying to hack. And one way that this can be done is by DNS brute-forcing. And this is basically trying millions and millions of subdomains for a given root domain. And the larger the word list, they have a higher chance of finding interesting stuff. But the downside is that if you have a super large word list, then it's also going to take a lot of time for a scan to complete. Which you don't really want. Which brings us to scanning fast. So, large attack service, lots of things to scan. And currently mass DNS is the fastest tool for DNS scanning. You have ZDNS, which also comes quite close. But one thing that I noticed is that ZMap or some other fast port scanning tools can actually reach orders of magnitudes higher in packet rates than mass DNS can. So, for example, you can reach millions and millions of packets with ZMap while mass DNS only does like 50k, maybe 100k if you're very lucky. So, why is mass DNS so slow in comparison to these port scanning tools? So, I made this very nice schematic representation of how mass DNS scans. So, we have mass DNS, we have the Linux kernel, and you have your network interface cards which connects your actual OS to the worldwide internet. So, mass DNS goes around and says, yo, Linux kernel, can you send this packet for me? Linux says, alright, I can do that for you. It asks the NIC to send the packet, the NIC sends the packet, and it goes to the internet. And the same thing has to happen the other way around when the answer is received. NIC receives the answer, goes to the kernel, goes to mass DNS, but there's a lot of overhead. So, Linux networking is super chill to use for if you're, I don't know, doing anything with web browsing, emails, just any regular internet traffic, but it is just not very, very fast. So, how do we fix this? That brings us to the next part, which is the kernel bypass networking. So, the mass DNS situation is kind of like this, but a bit more professional schema. Hardware talks to the device driver, device driver puts the packet into the network stack, and through the network stack, the packet goes to the application. So, how do we make it faster if the Linux is actually slow? Solution, skip the kernel. So, what you can do is, like, I'm using the Data Plane Development Kit. Usually, you would use the Data Plane Development Kit if you're a researcher, and you're working on data centers, and you're working on hyper-fast interlinks, or whatever. It allows you to access the NIC directly from your application. And port scanners actually use a similar principle to really speed up their scanning speed. So, the advantages, it's a little faster. Disadvantage, it's super hard to use. It cost me, like, a month to even send a single packet and receive a reply. It is quite cumbersome. But, what if there was a DNS scanner that was written with this kernel bypass mechanism, and loads of other tricks, by the way. So, it goes way deeper than that. That you can install in 10 seconds, written in C++. So, introducing SonicDNS today. With exactly that purpose. So, how fast can we go? So, this benchmark is very much lab-tested. So, I use a self-written resolver, which only returns NX domain responses. And I use, like, a 9 gigabit input file with domains. And, using this method, I can reach, like, over 7.5 million packets per second. Which is, like, quite a bit faster than messaging in S3, which can maybe, like, 50k, 100k per second, if you're really lucky. So, it's super nice. And can we, like, connect this to the internet right now and expect to brute force anything with 7.5 million packets per second now? Well, unfortunately not. So, today I'm also gonna tell you a bit , like, why that is, and how we can circumvent that. So, there are some limits towards, like, actually scanning the internet really, really, really, really fast. So, you want to be this guy scanning with your minigun, just hitting those DNS resolvers. But, that's unfortunately not always how it works. So, first limit is the resolvers. Second limit is, like, bad network interfaces. And third limit is packet switching limits. I'll take you through these in individual slides. First of all, the recursive resolvers. So, recursive resolvers such as 1.1.1.1 will actually take care of the actual resolving part and walking the DNS tree for you. But these resolvers actually start rate limiting quite fast. So, in order to scan fast, you need lots of good resolvers and spread the load. But still, these resolvers remain a very, very tricky subject. They start rate limiting, they start giving back bullshit responses. So, like, having a really, really good, like, a word list with resolvers is actually critical towards getting good results with MyDNS and also with MassDNS. So, I personally use the fresh resolvers and Trickist repos for that. They have some pretty nice resolvers in there. But, like, experiment and if you find a resolver list that's even better, please pop me a message. I'd be very interested to hear. Like, limit two bad network interfaces. So, what you probably all have is your VPS, which you use for scanning. And they're super convenient. You can go to DigitalOcean, Skillway, Linode and pay a couple of dollars a month. Sometimes a bit more if you want a beefy one. Super nice, but these VPSs have virtualized network interfaces. So, in the image here on the right, you can actually see that these VPSs run on one larger server that's actually the bare metal server. And the downside is that the actual physical network card is connected to this bare metal server and these VPSs communicate to the internet with virtualized network interfaces. And the big downside with these virtualized network interfaces is that they're just not so fast as your dedicated super fast network card that these servers usually have. Which brings us to the third limit to fast DNS scanning. Packet switching speeds. So , some of you might already have a 10 gigabit internet connection at home. Can you actually go and scan DNS with 10 gigabit now, which is in outgoing packets around 10 million packets per second? Unfortunately not. And that is mainly because consumer routers cannot handle the packet routing speeds necessary for these DNS packets. So, usually what you do when you have your 10 gigabit internet system is you use it to download a large file or use it to transfer large files. That's, I think, the main use case. And what the internet does with these large files is they cut the large files up into pretty big chunks. And your router can actually process those really big chunks quite well. But if you give your router very, very small packets then it just becomes totally overwhelmed. I definitely had my home router crash with this once. Then I didn't use it anymore from home. And also my internet at home is quite shit. So, that doesn't help. But anyway, also that is like a serious limit that you will also encounter in data centers. And it's actually really, really hard to get around this one. Alright. Then, also very, very important. What is in this for you guys? Because I already thinking, I don't have a dedicated server. I don't have a super crazy network card. I hate C++, because who doesn't? And this is my $5 a month VPS. So, what do I do now? Can I use this tool? Well, I have good news. This tool can actually bring a lot for you, especially if you have a shitty VPS. Because static DNS is like a lot more efficient in well, basically anything than ZDNS or mass DNS. Also, when you're a very shitty VPS. So, with static DNS, you can go around like if you're lucky, it has a good day and the internet has a good day. You can go around like scan 100K domains a second, just from the super, super simple VPS. And with mass DNS, usually I get like 1 or 2K domains a second. I put the max here I ever saw, which is 5K domains a second. And what brings this for you? So, for example, if you look at the zonefiles.io screenshot, they have like 266 million domains in there. Which sounds like quite a lot, but what this tool allows you to do is actually scan every root domain out there on the internet, with your shitty $5 VPS, in under an hour. So, that's pretty sick. And you can put that in a database and do, for example, reverse IP lookups. So, that's actually what I use this tool most for. I scan 2 billion DNS records, put them in a database so I can do reverse IP lookups, reverse MX lookups. So, that's my personal use case for this tool. So, demo time. So, let's hope the live demo doesn't break. Alright. Perfect. So, what I'm gonna do is I'm gonna create a... let's see if this page still works. Yes. Yes. Alright, I'm gonna make a new VPS. This is how you show the installation process. Pro XS. So, it's not very big. It's like the lowest tier you can get here. $0.05 an hour. So, expensive. Create it, wait for a bit. It actually goes quite fast. I tested it a lot of times. Alright, let's wait for it to start for a bit. Alright, running. Try SSH into it. Yeah, it usually takes a couple of tries on the first time. Give it a minute. Gotta take a picture of the guys. Lots of people have come over. Alright, there we go. So, now we can actually go connect to the VPS. So, totally blank VPS. Nothing on there. One password. Alright, so, nothing on there. Totally new. First need to install jq, because otherwise it doesn't work. Can you guys in the back read it, by the way? Otherwise I can also make it a bit bigger. Alright, perfect. Oh, bigger. I thought I saw the thumbs up. This okay? Yes, nice. Love to hear it. Alright, then we go to the SonicDNS repo. I have a single line install script. There we go, that's it. Now, so, actually, because of the way this works, it needs some, like, more specific kernel thingies, such as huge pages. So, it makes it run faster. I mean, who doesn't want that? Also, I'm going to download the majestic-million.txt. That is just a million domains that we can go resolve right now. And I think, actually, that's it. Then, let's try to copy this. Let's put a timeout at, like, one second or something. We're gonna, like, have 300,000. So, now we can, like, resolve 300,000 domains at the same time. All very efficient, so you can, like, run it on anything. Let's just start with, like, 80,000 packets per second. Let's hope it works. There we go. I mean, you can see that it's kind of, like, doing weird stuff, because, like, the SSH connection is not working too well when, like, you're resolving this fast, because you're, like, hammering that network interface, like, really hard. But... Last time also takes a bit longer. But there we go. 22 seconds. One million domains later. So, like, this is really, really nice, and you can try it for yourself with mass DNS. I'm not gonna go through the installation process myself right now. But, like, most I've gotten was, like, 3k packets per second, like, sustained brute forcing with exactly the same resolvers and stuff, exactly the same VPS. So, nothing different there. It's just, like, really, really, really efficient. So, also, when you have a small VPS, it'll run a lot faster. So, what you can do if you want to resolve even more, like, these things are 5 cents an hour, you just get 10 of them, and then you resolve and get, like, 800,000, or, like, it's pretty well scalable. You just get more VPSs. So, brings us to the next slide, which is scanning responsibly. So, this is kind of a schematic representation of static DNS versus your average Python-based resolver of most companies. At least, I don't know what they actually use, but we wouldn't be surprised if they use Python. It's not a fair match. So, this tool can actually resolve way, way, way faster than most things are made to handle. So, don't break stuff, please. Static DNS is really, really nice for internet-wide DNS research, or, I mean, that's also why I'm putting it online, so I hope you guys can find more use cases. But if used correctly. If you don't use it correctly, then don't do that. It's not good. So, DNS servers are just not made for this type of traffic. And also, one thing is be nice to authoritative DNS servers, which I will explain in a bit. So, for example, a very common use case, I think a lot of you guys are doing this, you have a couple of programs you want to go brute-force, and you have a word list that you're going to use for the inputs. So , the left thing is what you shouldn't do, where, for example, you want to brute-force github, apple .com, and google.com, where you first go and resolve everything for github, then everything for apple, and then last, everything for google. This is really bad, because that'll make sure that first, all the load gets redirected to github, then all the load goes to apple, and then all the load goes to google, and you made them all very, very pissed. So, what you can better do is actually mix it all up. That's also what I do myself, or if I have to do like 2 billion very, very big DNS resolvings. So, I just jumble it all up. You just round-trim it between the github, apple, google, github, apple, google, apple, github, google, I don't know, I messed the order up there. But in this way, you're making sure that you're spreading the load over the authoritative DNS resolvers of github, apple, and google, and that you're not making anyone angry. The tool I use myself is Terashift. Very, very nice tool. It can take a 50 gigabyte input file and shuffle all the lines and this will make sure that you're not going to make anyone angry. Also, if you do the thing on the right, then you'll be able to go a lot faster because everything starts rate limiting a lot less fast. So, I think that was the majority of it. Now some future work that I still want to do. So, one very relevant thing is wildcard detection, of course. So, we can resolve really fast, but wildcards, they'll still pop up all over the place. Also, one thing that I think would be very nice, implementing IPv6, so we can actually rotate the IPs that we're using because there are 128 bits worth of IPv6 addresses, which is way too much. So, it's very easy to get your hand on, like, a block of a gazillion IPv6 addresses and you can just rotate through all of them, which will evade rate limiting, which is, of course, what we want. Another thing that I want to combine the IPv6 stuff with is recursive resolving in the tool itself. Like, right now, you need recursive resolvers to actually go and, like, ask for these IP addresses, but it is actually pretty doable to also implement this yourself. And I think if you combine that with IPv6 and the wildcard detection, then you have, like, a DNS scanning tool where you can actually go and make a live map of the entire internet in real time. And I think that is, of course, really nice. So, that's what I personally want. But I think that's it. So, that kind of wraps it up. Output is all JSON, by the way. So, JSON line by line. I mean, go check it out. You can find the repo link on github.com slash Hedion security slash static DNS. I also included some basic documentation of how it works. Not finished completely, but I hope to get to that next week. And if you have any ideas, questions, recommendations, feel free to, like, make a GitHub issue or send me a message at github.com. So, just contact me on X. And thanks a lot, guys, for being here. All right. Any questions? Nothing? All good. Lots of information, I know. Yes. All right. Thanks, guys.