WEBVTT

00:00.000 --> 00:12.380
This talk was originally going to be at one, but I'm happy, we were happy to bump this talk up because this is still one of the quintessential topics in security.

00:12.700 --> 00:18.640
And without much ado, my pleasure to introduce you to Travis Palmer and Brian Somers.

00:23.770 --> 00:24.930
Thank you, folks.

00:25.110 --> 00:28.770
So, as you said, this is a quintessential topic in security.

00:28.770 --> 00:35.030
We are actually not trying to win any awards for the length of the name of our talk, but we're pretty sure we might have actually won.

00:35.590 --> 00:49.110
And we're going to give you guys not just an update on kind of the current state of what DNS is, but also go a bit further and actually give you guys a presentation on an attack that is doable very plausibly against some major resolvers.

00:49.110 --> 00:55.110
From my understanding, Google and some other folks have not really gotten back to us with a firm word of, yeah, totally, we got this yet.

00:55.110 --> 00:59.270
So very plausibly, you could turn around and actually use this if you were very quick about it.

00:59.270 --> 01:02.470
This is a nice stick to poke people to get actually moving.

01:02.470 --> 01:06.430
So without further ado, this is how you become the one in 34 million.

01:07.030 --> 01:10.430
So I'm going to go through basically introduce ourselves.

01:10.430 --> 01:12.890
Then we're going to go right into, we have to give some background on DNS.

01:12.890 --> 01:16.890
A lot of people here are new to DEF CON and relatively new to the security industry.

01:16.910 --> 01:20.510
I can't talk about the things that are different if I can't talk about the stuff that's originally.

01:20.570 --> 01:21.970
We're going to talk about fragmentation attacks.

01:21.970 --> 01:23.270
There's a bit of a history for that.

01:23.270 --> 01:31.930
And I'm going to talk, trust me, it's not, it's a very important tangent into IPAD inference and some of the more recent stuff that has come out of University of New Mexico.

01:32.470 --> 01:34.490
And then we'll go right into the attack.

01:34.510 --> 01:41.790
I'm not actually affiliated with the folks in University of New Mexico, but they are very helpful and their white paper was more than enough to get this attack rolled together.

01:41.850 --> 01:46.770
And then Brian, who is actually a proper expert, will be talking about mitigations.

01:46.910 --> 01:49.070
So hello, I'm Travis Trafico Palmer.

01:50.070 --> 01:52.350
I'm a security research engineer for Cisco Systems.

01:52.350 --> 01:54.850
I am an OSCP and OSCE if that means anything to you.

01:54.850 --> 02:00.030
And as I kind of implied, yeah, I'm not actually an expert on DNS or DNSSEC.

02:00.330 --> 02:02.070
I don't do this on a day-to-day basis.

02:02.070 --> 02:06.410
Brian, I don't think would want to call himself an expert, but he's close enough.

02:06.450 --> 02:13.510
And he is a principal engineer for Cisco System and has had a lot of free time to work on FreeSB and OpenBSD.

02:15.490 --> 02:17.390
So what did we actually do?

02:17.390 --> 02:26.610
This is, what we found was a more consistent way to poison the cache of DNS resolvers without using a man in the middle and using an existing attack that existed using fragmentation on DNS.

02:26.610 --> 02:32.930
We took that attack, reduced it from hundreds of iterations to very plausibly one on IPv4.

02:33.350 --> 02:38.130
And for IPv6, reduced it from millions of iterations to very plausibly only one.

02:38.550 --> 02:44.010
And also because of that, we're basically bypassing all the current recommendations.

02:44.270 --> 02:49.830
So even if you're doing everything right as people are telling you, yeah, we can probably still screw your domain.

02:50.510 --> 02:52.470
So yes, we did disclose responsibly.

02:52.470 --> 02:56.390
I'm, my particular team was discovered this attack during a focus pen test engagement.

02:56.390 --> 03:00.850
It was a couple of weeks, but it's a little bit of an unusual pen test engagement to say the least.

03:01.150 --> 03:12.370
And our team disclosed off to Cisco Umbrella and Umbrella has been disclosing this to other DNS operators ongoing both before DEF CON and will likely continue to do so after DEF CON as I'm sure some e-mails might come rolling in.

03:13.170 --> 03:21.730
So to start, as I said before, we need to talk about DNS and what a better place to start than talking about the attacks because we can't really talk about all of DNS.

03:21.890 --> 03:29.390
So in the early DNS, in the way back when, DNS was really only exploitable in a man in the middle scenario, which it has no protections against.

03:29.390 --> 03:34.650
Still really doesn't have a ton of protections against, but it's getting closer.

03:34.910 --> 03:51.410
In any case, back then, ignoring other protocols, the only thing that was actually keeping a normal DNS reply from being spoofed, doing things off path, not man in the middle, was the DNS ID and the styling and the structure of the response itself.

03:52.110 --> 03:53.770
It has to answer the query.

03:54.590 --> 03:57.390
DNS queries and responses are very consistent.

03:57.550 --> 04:01.170
So really, we're back to only talking about DNS ID.

04:01.650 --> 04:15.710
And again, I said before, ignoring other protocols, there's of course the issue that this is being sent across the internet and there is this extra level thing called UDP, which is going to have port numbers and some other things that are going to be very difficult to guess if you're trying to spoof a DNS reply.

04:15.990 --> 04:25.710
And Kaminsky is for original attack basically determined that a number of implementations of resolvers that were being used were programmed to query over sequential, very predictable sets of ports.

04:26.230 --> 04:31.130
And this took out basically all of their sources of entropy that were to exist to make it difficult for the attacker.

04:31.130 --> 04:33.990
So again, we're back to the 16 bits of DNS ID.

04:34.070 --> 04:37.590
And that's really not enough to stop an attack once poison records get saved.

04:37.690 --> 04:44.130
If you can try over and over and over again and if you succeed, it gets saved, well, then you're good.

04:44.130 --> 04:45.130
You're good to do this off path.

04:45.130 --> 04:45.970
You don't need to be in the middle.

04:45.970 --> 04:47.610
What do I mean by off path?

04:47.610 --> 04:48.570
Have a diagram.

04:48.890 --> 04:53.310
So dotted blue line here is the network path from DNS request from the target is taking.

04:53.770 --> 04:59.170
And we're off path because our attacker boxes, the red boxes, we're just not on the network path.

04:59.170 --> 05:00.690
We can't see anything that's going on there.

05:00.690 --> 05:03.510
We might have some idea of what's going on over there.

05:03.570 --> 05:06.190
But we can't see or modify the traffic.

05:06.870 --> 05:13.210
Now, for this particular case, and I'm going to keep this going, this diagram is going to change a little bit, but it's going to be largely the same.

05:13.210 --> 05:15.950
We have our attacker box off somewhere in the Internet.

05:16.010 --> 05:21.250
And then inside of the trust boundary, some corporate network, something that the resolver is servicing.

05:21.450 --> 05:23.510
We have both our target and a puppet.

05:23.610 --> 05:25.490
The puppet, we don't really have to fully control.

05:25.490 --> 05:28.110
It could be as simple as just some JavaScript in a web browser.

05:29.630 --> 05:31.590
But what follows is a little less simple.

05:31.690 --> 05:37.350
So first the attacker is going to basically figure out where the external facing IP is for the resolver.

05:37.350 --> 05:41.750
This can be as simple as basically talking to ourselves, making a request for a domain that we control.

05:41.750 --> 05:47.550
And as long as our box is also serving as a name server for our own domain, we get the IP address of the resolver.

05:47.550 --> 05:52.350
The attacker then can just tell their puppet, hey, send a request on my behalf.

05:52.450 --> 05:58.490
And since we know what it's requesting and when it's requesting, we can immediately start sending responses to the resolver.

05:59.030 --> 06:06.670
And since everything else is largely predictable, in the case of the Kominsky attack, even the, even the destination port on UDP is predictable, we can just start guessing DNS IDs.

06:06.770 --> 06:11.210
Because the resolver is going to make another request on behalf of our puppet.

06:11.210 --> 06:13.970
We don't know what the ID is, but we can sure start guessing.

06:14.010 --> 06:16.050
And this might take a little while.

06:16.470 --> 06:18.290
It's not always going to get cached.

06:18.290 --> 06:21.350
Sometimes the legitimate response is going to go straight through the resolver.

06:22.270 --> 06:26.910
And so really we do have to find certain types of requests that aren't going to get cached.

06:27.510 --> 06:30.230
At least when not modified.

06:30.510 --> 06:33.950
This can, you can do this in a couple of different cases.

06:34.010 --> 06:38.370
You can do this for zero time to live domains or near zero.

06:38.370 --> 06:43.330
A lot of it is content delivery networks, Akamai, CDN, YouTube.

06:43.470 --> 06:45.450
A lot of those requests aren't going to live very long in the cache.

06:45.490 --> 06:48.270
Or we can start asking for things like domains that don't exist.

06:48.470 --> 06:50.010
Which won't get cached.

06:50.450 --> 06:55.730
Unless, of course, you then proceed to give a response for them where you say that it is existent.

06:55.730 --> 06:57.190
And then you start changing some other things.

06:57.190 --> 06:59.430
Like the records for where the name servers are at and other things.

06:59.430 --> 07:01.470
Which will, of course, all end up in the cache as well.

07:02.070 --> 07:05.070
Once it's in the cache, it also comes down to our puppet.

07:05.070 --> 07:06.090
But that doesn't really matter.

07:06.110 --> 07:07.430
The important part is that it's saved.

07:07.430 --> 07:13.790
So when our poor target machine goes out and asks for it, it gets a response back that it probably shouldn't have gotten.

07:14.090 --> 07:18.290
And starts reaching out immediately to the internet for whatever it was trying to reach initially.

07:18.290 --> 07:22.150
DNS is a protocol to find other things, ultimately.

07:22.530 --> 07:24.230
And reach out to our malicious server.

07:24.230 --> 07:29.490
Malicious server goes ahead and gives them, yeah, totally, those binaries that you wanted, yeah, got them.

07:29.490 --> 07:30.250
There you go.

07:30.310 --> 07:32.970
And that person, if that person wasn't paying attention, they get farmed.

07:32.970 --> 07:35.770
The program is reaching out and not checking the TLS certificates.

07:35.770 --> 07:39.150
And frankly anything that there's not good verification in place, they get pwned.

07:39.150 --> 07:39.550
The end.

07:39.550 --> 07:42.430
Just as disturbing as it was a little bit more than a decade ago.

07:42.950 --> 07:45.510
Of course, the Kominsky attack doesn't work anymore.

07:45.650 --> 07:48.150
I'm glad we've made progress in the past decade.

07:48.710 --> 07:54.430
Shortly before that attack was presented, even, various DNS resolver applications were patched to make the UDP ports unpredictable.

07:54.430 --> 07:56.150
Dan Kominsky is a white hat after all.

07:56.150 --> 07:58.270
So he did tell everybody kind of ahead of time.

07:58.810 --> 08:01.930
Needless to say, this puts up a heck of a damper on trying to do this kind of exploit.

08:01.930 --> 08:07.130
Because now you have a destination port to guess as well.

08:07.170 --> 08:08.810
That's another 16 bits.

08:08.810 --> 08:10.450
That's 30.2 bits total.

08:10.450 --> 08:16.770
And although you could exclude some of the ports, this is about 65,000 times harder.

08:17.410 --> 08:24.950
Though the attack is still high profile and scary, you're not going to be doing this in any kind of feasible scenario.

08:25.050 --> 08:30.370
And I'm not going to pretend Kominsky alone made DNSSEC happen, but this did help along.

08:33.270 --> 08:38.950
So people scared of DNS being spoofed basically are now using DNSSEC.

08:39.090 --> 08:43.570
Without going too far into it, DNSSEC is basically public key infrastructure for domain names.

08:43.570 --> 08:52.970
And ICANN, the highest level of authority, signs for various top level domains like .org, who then in turn sign the keys used by domains.

08:52.970 --> 08:57.530
So for example, DEFCON.org, which then used to sign those keys for records.

08:57.530 --> 09:01.470
Individual records say where WW.DEFCON.org is.

09:01.990 --> 09:06.610
Of course it's a little more complicated than that, but we really can't for sake of time dig into it.

09:07.690 --> 09:13.110
A couple of things that DNSSEC adds that are really important is data origin authentication.

09:13.130 --> 09:18.390
Basically the ability to verify the data that you're receiving is coming from where it's saying it's coming from.

09:18.450 --> 09:22.190
And also trying to make sure that data cannot be modified in transit.

09:22.190 --> 09:31.470
Since the records are signed by the zone owner and the zone's private key, it would be really hard to mess with that because if it actually gets verified, well, the signatures are not going to line up.

09:31.470 --> 09:32.830
That's how cryptography works.

09:33.190 --> 09:37.310
Of course, not everybody is actually deploying DNSSEC.

09:37.330 --> 09:43.610
And even if you were to deploy DNSSEC on your domains, it's not particularly helpful if the resolvers aren't doing it either.

09:45.190 --> 09:47.630
This part, this is really not going too well.

09:47.630 --> 09:50.270
And the last report this was made was in 2016.

09:50.310 --> 09:57.750
Unless you're in central Africa and your ISP is using Google DNS for everything, you might be in a bad bit of luck.

09:57.930 --> 10:03.350
In any case, we need to bring up some more bad news and talk about what DNSSEC doesn't actually do either.

10:04.490 --> 10:06.150
Delegation and glue records.

10:06.230 --> 10:12.490
Name server, A records for IP addresses located in the authority and additional sections in DNS are not signed.

10:12.970 --> 10:16.350
Delegations are records that basically relay authority to another server.

10:16.350 --> 10:21.550
So realistically, .com isn't going to know what servers example.com is running.

10:21.630 --> 10:23.510
So you have to delegate that authority down.

10:23.870 --> 10:25.370
And I had mentioned glue records.

10:25.510 --> 10:38.590
Glue records are largely fixed to solve an issue of if you have your name server in your domain or there's some concern about somebody not knowing where your name server is for your domain, you include that at the absolute end of the request or, pardon me,

10:38.590 --> 10:40.690
include that at the absolute very end of the response.

10:41.290 --> 10:49.510
Because otherwise, someone who is looking for some resources in example.com are going to ask the .com domain, okay, where's example.com?

10:49.850 --> 10:52.590
It's going to tell, hey, you need to look over here for example.com.

10:52.770 --> 10:54.870
And okay, where's the name service for that?

10:54.870 --> 10:55.410
We don't know?

10:55.410 --> 10:55.750
Okay.

10:55.750 --> 10:56.930
Ask .com again.

10:57.530 --> 10:58.990
This continues in an infinite loop.

10:59.710 --> 11:01.430
So that's why they need to be this.

11:01.430 --> 11:06.090
But somebody, of course, in here hopefully is thinking, why aren't these signed?

11:06.170 --> 11:08.070
Why can't we just figure out a way to sign this?

11:08.070 --> 11:09.430
Well, the RFC says so.

11:10.330 --> 11:11.850
It's with actually good reason.

11:11.850 --> 11:13.010
It's delegation of duty.

11:13.210 --> 11:18.090
Child zones have a private key for authority records and the parent zone really can't be signing it for them.

11:18.490 --> 11:21.710
But there's, again, there's data origin authentication.

11:21.710 --> 11:24.610
If you can trust that parent, you can probably trust the children as well.

11:24.610 --> 11:29.610
And there's, you know, large committees that are rather trustworthy running most of the system.

11:29.830 --> 11:33.870
Of course, there's also the deal with all the signatures.

11:34.370 --> 11:38.190
All these signatures can make responses quite long, especially if there's lots of records.

11:38.190 --> 11:47.270
And as a bonus, name servers can even sign the gaps between valid subdomains and sign nearby names to prove there's no subdomain in between using NSEC or NSEC 3.

11:47.430 --> 11:48.950
But how bad could it be?

11:48.950 --> 11:49.830
Someone might ask.

11:49.830 --> 12:04.550
Well, if today you go ahead and ask DefCon.org for a non-existent domain, they're using NSEC, and so they will respond very verbosely with 1,922 bytes to tell you something doesn't exist.

12:04.910 --> 12:05.550
Seriously?

12:06.210 --> 12:08.330
This is our best solution.

12:09.050 --> 12:16.190
You can't even send this across the internet in one piece without expecting it to be fragmented, which is something we need to talk about.

12:17.070 --> 12:23.010
So Hertzberg and Shulman realized that this was kind of a problem.

12:23.010 --> 12:27.270
If the response is getting split up, UDP has no means of dealing with fragmentation.

12:27.270 --> 12:28.330
Only really that's TCP.

12:28.330 --> 12:30.390
And everything in DNS is running by UDP by default.

12:30.390 --> 12:32.310
So it has to be fragmented to the IP layer.

12:32.670 --> 12:35.830
And that means it gets an IP identifier.

12:36.670 --> 12:41.930
And mind you, these are rather inexact diagrams, but I'm trying to keep it simple.

12:41.930 --> 12:44.810
It is IP around UDP around DNS.

12:44.850 --> 12:49.110
And in red is basically all the things that an attacker can't really spoof.

12:49.470 --> 12:52.030
And that IP identifier is an IP layer 3 thing.

12:52.030 --> 12:53.970
It's used on both IPv4 and IPv6.

12:53.970 --> 12:56.470
In any case, it's an additional factor source of entropy.

12:56.470 --> 12:58.270
We have to guess that it's an attacker.

12:58.790 --> 13:06.590
But if you're noticing, that second fragment's looking a little lonely because all of those QDC signing bits and the other protocols end up in that first fragment.

13:06.630 --> 13:10.350
And the second fragment, the only thing we have is that IP layer identifier.

13:11.590 --> 13:13.970
Now, DNS actually adds even more stuff.

13:13.970 --> 13:19.070
But again, it ends up in the headers or the first couple of things in DNS.

13:19.170 --> 13:20.770
Nothing in the second fragment.

13:21.550 --> 13:25.690
And as it turns out, the IP ID for IPv4 is 16 bits.

13:25.950 --> 13:27.430
This familiar to anybody?

13:27.910 --> 13:34.010
As a further bonus, many resolvers when this paper was published were using global counters for IP ID.

13:34.370 --> 13:38.750
And it was the default in Windows, default in FreeBSD according to them when they published in 2012.

13:39.170 --> 13:46.250
And there was a lot of resolvers they were able to find right before they published it that were doing global IP ID.

13:46.250 --> 13:49.130
So what does this attack end up looking like in that particular case?

13:49.210 --> 13:51.850
Well, I have to add something to the diagram real quick.

13:52.210 --> 13:54.770
We now have an IP fragment cache on this diagram.

13:54.950 --> 13:56.310
It holds up to 64 fragments.

13:56.310 --> 13:57.570
That's relatively the default.

13:58.250 --> 14:01.670
It holds them up so they can be reassembled when and if they all get received.

14:01.670 --> 14:03.850
And if nothing else, it drops them after a couple of minutes.

14:04.110 --> 14:08.810
In any case, the first thing we do when performing this attack is ask.

14:09.510 --> 14:11.030
Sometimes you only need to ask.

14:11.190 --> 14:16.830
As an attacker, we basically just ask the name server if the response is fragmented or it's IPv4, we get an IP ID back.

14:16.830 --> 14:20.610
So we already know what IP ID the name server is using if it's using global IP ID.

14:20.690 --> 14:23.730
And then we proceed doing what we were doing before.

14:23.890 --> 14:26.770
Puppet goes ahead and asks something on our behalf.

14:26.950 --> 14:31.670
And while the name server is still thinking about responding to that, we start guessing IP IDs.

14:32.030 --> 14:34.730
And DNS is relatively well structured, very consistent.

14:34.730 --> 14:39.190
If you ask for something, you're always going to get roughly the same reply, short of maybe some garbling up in the headers.

14:39.190 --> 14:40.290
But again, we don't care about the headers.

14:40.290 --> 14:42.690
We're sending the second fragment over and over and over and over again.

14:42.690 --> 14:43.970
And we actually have a good starting point.

14:43.970 --> 14:46.890
We know what the IP ID was before.

14:46.990 --> 14:51.450
And so we can go ahead and just send that sucker along and start guessing everything in front of it.

14:51.570 --> 14:53.990
Mind you, it is global, so we have to do this kind of quickly.

14:53.990 --> 14:58.350
Other people could be talking into this name server, and they probably are, which is going to increase the IP ID.

14:58.350 --> 15:00.090
But we can guess 64 times.

15:00.350 --> 15:12.810
So at some point, we're not just going to go through, but we're actually going to be combined with the first fragment of the original legitimate request, which contains all of the lovely headers that are signing this thing.

15:12.910 --> 15:16.590
And then that's going to go right on up into the cache and then down to our puppet.

15:16.590 --> 15:26.270
But again, the thing we care about most is the cache because when at a later point, when that poor target machine goes ahead and asks, hey, where's Defcon.org?

15:26.910 --> 15:29.310
They're going to get that assembled, but tampered response.

15:29.490 --> 15:34.830
And just like a Kominsky's detect before, target makes a query for what was, it gets told it lives with the attacker.

15:34.830 --> 15:36.770
It pulls some data from the attacker.

15:36.770 --> 15:38.250
It all downhill from there.

15:40.650 --> 15:42.630
And pardon me, my mouth is getting really dry.

15:45.230 --> 15:49.230
So there's a lot of stuff you can actually do with this.

15:49.230 --> 15:54.290
Even with DNSSEC , DNSSEC does limit what you can do with these kind of poisoning attacks.

15:54.290 --> 15:59.010
And there's only so much you can really mess with in the cache that isn't directly signed.

15:59.030 --> 16:06.810
But of the four sections, question, answer, authority, and additional, the ones we care about most with DNSSEC are those last two, the ones that are going to contain the stuff that's likely to be unsigned.

16:07.070 --> 16:10.430
And they're almost always going to make it in that second fragment.

16:10.470 --> 16:13.670
And we get some options.

16:13.870 --> 16:19.550
I would love to verbally explain to you all the limitations, but they made a diagram for me, so I'm going to use the diagram from their paper.

16:20.650 --> 16:28.490
So the main ones you want to look at here, because there's a couple, and that third from bottom line there is permissive or island.

16:28.490 --> 16:32.050
Basically the resolver is not actually doing some good resolving, not checking anything.

16:32.050 --> 16:36.570
Yeah, there's a lot of stuff in this you can do immediately if the resolver is not checking DNSSEC.

16:36.570 --> 16:41.590
But for the other cases when everything is in line doing what it's supposed to do, there's other stuff you can still do.

16:41.590 --> 16:48.710
So if you're using NSEC 3, and you're using it with an opt-out, that means you're not signing delegations with NSEC 3.

16:48.870 --> 16:58.470
And that means that if someone were to say, I don't know, replace one of your NSEC 3 records with an NS record for a subdomain, yeah, that subdomain exists now as far as your resolver is concerned.

16:59.110 --> 17:02.630
The other thing you can do is basically something in two phases.

17:02.630 --> 17:13.310
You can do NS hijacking, which if you've noticed, doesn't have a lot of requirements, and name server blocking, which again doesn't have a lot of requirements, at the same time.

17:13.310 --> 17:21.170
Basically what you do is you poison an NS record that makes it in the cache, and then you start performing server blocking on all the other name servers.

17:22.270 --> 17:28.510
And it's actually really easy to do name server blocking, because the only thing you have to do is ruin the responses from all those other name servers.

17:28.930 --> 17:33.130
And if you can just ask what their IP ID is, all you have to do is just mess it up.

17:33.290 --> 17:36.610
You don't have to poison anything, you don't have to have it even be correctly structured.

17:36.610 --> 17:40.310
If it gets reassembled and it's the wrong way, it's not going to be accepted.

17:40.390 --> 17:49.910
And for most DNS software, and unbound particularly, two failed queries at a 15 minute interval, that name, that resolver marks that name server as not responsive.

17:50.510 --> 17:51.630
All bad news.

17:52.270 --> 18:04.030
And if that last slide wasn't concerning enough, there's also the possibility the attacker could cause fragmentation by tricking the name server into believing that it needs to further fragment traffic, which of course helps get a complete record into that second fragment,

18:04.030 --> 18:06.770
or as many records as you want into that second fragment.

18:06.870 --> 18:13.370
And this does work on IPv6 as well, and there's been a couple of studies done that you can get this stuff well below what should be the minimum transmission unit.

18:13.570 --> 18:17.050
Any case, there are some more limitations to this.

18:17.570 --> 18:22.010
This, you folks probably would have heard about this if it had not been for some additional limitations.

18:22.290 --> 18:25.950
There's a lot of name servers that aren't deploying with global counters anymore.

18:26.070 --> 18:29.990
No real surprise there, that's something we generally expect from the network stack of a printer.

18:31.230 --> 18:39.770
Windows is still, as far as we know, using a global counter, but FreeBSD is now using a mostly random searchable queue system and Linux still isn't using global counters.

18:39.850 --> 18:42.990
Even back in 2012, Linux was using mostly per destination.

18:43.610 --> 18:47.070
And we can't query something that gets cached, just kind of like before.

18:47.070 --> 19:02.070
A significant portion of the difficulty here is finding the query that returns a predictable fragmented response, and sometimes the options for a given target are pretty slim, and maybe just the response to the any query is enough, but it can be dicey.

19:02.070 --> 19:03.130
And there's also the future.

19:03.130 --> 19:05.430
IPv6 throws a complete wrench in this.

19:06.230 --> 19:18.550
32 bits in trying to guess with IPv6, that puts you in the territory of 34 million iterations, and that's doing it on average.

19:18.550 --> 19:27.490
The actual case for exhausting the entire key space, and this is assuming stuff isn't moving or other people are talking to this name server, is around 67 million.

19:27.710 --> 19:29.450
You're not going to do this.

19:29.450 --> 19:32.450
This is literal terabytes of traffic you'd have to send.

19:32.490 --> 19:34.110
You're not doing this on IPv6.

19:34.110 --> 19:34.990
There's no way.

19:36.110 --> 19:37.730
But there has been some notice.

19:37.950 --> 19:46.950
This is kind of a bit of a thing for IPv4, and prior to our engagement with Umbrella, their implementation was using IPv6 whenever possible.

19:47.010 --> 19:47.870
Why wouldn't you?

19:48.190 --> 19:54.190
And they detect IPv4 fragments and re-query them over TCP or IPv6 if it's, or, ah, pardon me.

19:55.410 --> 20:03.530
Read, re-query it over IPv6 where possible and basically re-query over TCP if that still fails or you can't just query over IPv6.

20:03.670 --> 20:10.270
There was also a presentation this May at ORC, which wasn't us, actually.

20:10.810 --> 20:12.470
Now, please excuse the crayon colors.

20:12.470 --> 20:14.250
I am taking directly from their slides.

20:15.930 --> 20:21.050
But this is a rather pertinent presentation.

20:21.050 --> 20:24.730
I had said before this was what we found had bypassed all recommendations.

20:24.730 --> 20:36.010
Yeah, this is kind of the weird case because in an earlier slide in this presentation, they had said drop all fragments, but then here they say, well, the attack's only effective on IPv4 and kind of directly implied IPv6 is safe.

20:36.170 --> 20:36.810
I digress.

20:36.810 --> 20:38.490
In any case, this is good news.

20:38.490 --> 20:47.850
There's interested parties and the people who are the major operators of DNS are generally trying to loose, tie up all the loose ends without any major performance impact.

20:48.350 --> 20:53.970
So now we have to have that little tangent I was talking about before, which might make a little more sense now.

20:54.430 --> 20:58.510
So the sequential nature of IPID is largely why idle scanning exists.

20:58.510 --> 21:07.610
It's what Nmap uses, but as a lot of people here may know, the kind of scan has some requirements for zombies, namely global counters, and also they have to kind of be idle machines.

21:08.590 --> 21:11.610
They need to act like a 1990s printer, basically.

21:11.930 --> 21:31.670
I won't explain what this particular team found in depth because we really don't have the time, but in a somewhat similar manner to idle scanning, a university of New Mexico research team developed a way to abuse the IP fragment cache in Linux machines to basically determine if something had been sent and much like idle scanning,

21:31.670 --> 21:36.970
you could do this to figure out whether or not traffic was being sent on a link that you can neither see nor control.

21:37.550 --> 21:41.970
And it works on fully per destination IPID counters, which is what Linux had.

21:42.170 --> 21:46.670
And you can measure how many ‑‑ and you can really just do any kind of measurement across the Internet.

21:46.750 --> 21:49.590
Needless to say, the Linux folks didn't appreciate this.

21:49.730 --> 21:55.750
And they didn't really want every Linux machine on the Internet being used as a zombie for an idle scan.

21:55.850 --> 21:59.830
So around the same time as this paper being published, they created some patches.

22:00.010 --> 22:05.990
The first that we care about was to directly prevent measuring communication between two machines.

22:06.070 --> 22:10.950
And the second was an optimization to IPID, how IPIDs were handled.

22:11.290 --> 22:14.790
So the first one, I did say was a direct mitigation.

22:14.790 --> 22:16.390
Well, it doesn't actually completely fix it.

22:16.390 --> 22:19.470
Because what it's doing is just making it harder.

22:20.690 --> 22:30.130
It's basically incrementing the IPID by a random, but normal, between one and the number of kernel ticks since the last sent packet.

22:30.130 --> 22:34.370
This kind of requires keeping track of the last kernel tick values as part of per destination counter.

22:34.370 --> 22:38.450
And this makes this operation rather extensive, especially if you have a lot of things to talk to.

22:39.310 --> 22:40.630
But it does work.

22:40.630 --> 22:49.670
And if your interest was trying to do a long-term idle scan or a long-term query as to what was going on between two machines, yeah, this is going to make it real hard for you to do that.

22:49.670 --> 22:54.410
Because if you spend more than one kernel tick in between your polling, you have no idea what's actually coming back.

22:54.410 --> 22:55.530
It's properly random.

22:55.810 --> 22:58.350
The second one was an optimization.

22:58.870 --> 23:05.390
Before the network stack was keeping track of all the IPID counters for all destinations individually and storing them in a binary tree.

23:05.390 --> 23:10.110
This caused a lot of performance issues for servers that talk to a lot of clients, like name servers.

23:10.830 --> 23:17.870
And since every comp sci graduate knows that O of a constant is much better than O of long N, they made a new way based on hashing and binning.

23:18.170 --> 23:27.610
So destination addresses, both IPV4 and IPV6 are hashed to match it with a bin, which will contain the current IPID counter, which will then be used on the next thing that gets sent out the port.

23:27.950 --> 23:33.450
Now, this does mean that some destination addresses are going to have to share an IPID counter.

23:33.450 --> 23:41.630
So to prevent an outsider knowing which addresses are sharing a bin, the seed for this hash function, which is doing all the determination, is secret and determined at boot.

23:41.810 --> 23:42.470
Perfect.

23:42.550 --> 23:45.390
Especially if you have enough bins and hash collisions are rare.

23:46.430 --> 23:48.870
That's a low number.

23:50.390 --> 23:57.670
Now, if you think this is kind of low, like I think this is kind of low, the researchers at University of New Mexico would agree with you.

23:57.890 --> 24:03.850
And so they, of course, immediately then proceeded to make another idle scanning using the Linux network stack.

24:04.510 --> 24:09.910
So basically the way they do this is they use IPV6 to legitimately get very large source address spaces.

24:09.910 --> 24:14.090
You could use IPV4, but as we know, that address space is a little bit sparse nowadays.

24:14.090 --> 24:25.250
And all these sources, they query the IPID counter for their IPID address with a fragmented ICMP6 echo request, which then returns a fragmented response.

24:25.310 --> 24:31.010
And they increment the IPID counter for the target by spoofing a SYNAC to the target and then query again.

24:31.010 --> 24:39.650
Basically figuring out the hard way whether or not the talking and the spoofing they're doing is in the same bin as what they're able to query on.

24:39.650 --> 24:40.690
Their address.

24:40.970 --> 24:43.630
And then they just change addresses if it doesn't appear to line up.

24:44.410 --> 24:46.270
Now, why fragmented IPV6 echoes?

24:46.270 --> 24:50.710
Well, IPV6 is a little weird because it doesn't fragment the IPID counter unless the traffic is sent fragmented.

24:51.050 --> 25:01.200
And, well, all of the above requests as an extra stipulation have to arrive within one system tick, one kernel tick of another to force that random perturbation of one to the number of kernel ticks to always be one.

25:01.200 --> 25:04.860
It's funny, you know, the difference, random number between one and one is always one.

25:05.820 --> 25:07.320
Not the best mitigation.

25:07.580 --> 25:10.500
Thankfully for most systems, this timing is actually pretty low.

25:10.500 --> 25:16.260
Ever since Jiffy's were invented, that counter is about 10 milliseconds, 100 hertz.

25:16.260 --> 25:26.060
It could be as low as .66 milliseconds on specialty systems that are running clocks all the way up to 1,500 hertz.

25:26.120 --> 25:29.300
But that has to be a very specifically configured OS.

25:30.860 --> 25:34.860
Once the collision is found, you can basically just flip this triangle.

25:36.000 --> 25:37.060
It's nice.

25:37.720 --> 25:40.740
And start doing your idle scan.

25:41.120 --> 25:50.440
Basically instead of trying to figure out whether or not you have a collision with a target, you can start sending stuff off to another machine and see whether it responds back to this machine that you're doing the querying for.

25:50.600 --> 25:53.560
And they called this not an idle scan.

25:54.360 --> 25:55.020
Oh, well.

25:57.300 --> 26:03.000
So, there is something that you folks probably have noticed at this point.

26:03.040 --> 26:10.220
This is a lot of knowledge that you can get about the IPIDs and the state of IPIDs and the IPIDs for communications to other machines.

26:11.100 --> 26:13.040
And, well, hold on now.

26:13.040 --> 26:16.680
Why didn't the folks at the University of New Mexico realize that this might have some other implications?

26:16.680 --> 26:20.780
Why didn't they realize that this was going to have a huge implication on DNS and fragmentation attacks?

26:20.860 --> 26:22.660
Well, they were thinking about idle scanning.

26:22.660 --> 26:23.740
I don't blame them.

26:23.740 --> 26:27.500
And show of hands, who knew about Hertzberg and Shulman's research before today?

26:29.120 --> 26:30.400
No hands.

26:31.520 --> 26:33.100
Yeah, you can't blame them.

26:33.800 --> 26:35.980
So we get to talk about something new today.

26:36.660 --> 26:45.810
So basically this attack, which, mind you, that's what I get for pressing the down arrow.

26:45.970 --> 26:50.510
So we start this attack basically the same way as ONUS.

26:50.750 --> 26:59.430
And no, for those of you who are about to ask, I am not going to call this ANIS or actually not an idle scan for various reasons.

26:59.790 --> 27:02.630
But we're going to start by finding collisions just like with ONUS.

27:02.630 --> 27:05.810
And instead of a zombie and a target, we basically have a name server and resolver now.

27:06.170 --> 27:11.190
The text is a little bit small, but if you noticed, we're using IPV4 in there.

27:11.190 --> 27:12.710
Well, what if they're talking over IPV6?

27:12.710 --> 27:16.810
What if we need to find collisions on IPV6 addresses like Umbrella was planning on doing?

27:16.830 --> 27:19.170
Well, no problem.

27:19.170 --> 27:21.530
We'll make them IPV6 echo frags as well.

27:22.090 --> 27:24.230
And what about getting our address space?

27:24.230 --> 27:29.870
The entire point of using IPV6 to do this particular attack is it's got to be convenient.

27:30.550 --> 27:32.870
How convenient is it, Travco?

27:33.150 --> 27:36.450
Well, AWS to the rescue.

27:37.150 --> 27:42.370
So even the free tier of AWS VPC, virtual private cloud, you can get some IPV6 address space.

27:42.370 --> 27:45.270
But the real question is, of course, you know, is it big enough?

27:45.690 --> 27:48.870
I haven't done extensive testing, albeit.

27:49.110 --> 27:56.470
But I'm going to say that this is probably enough for those folks that can't count commas as fast as the slide is going to be up.

27:56.470 --> 28:00.130
That is 18 and a half quintillion, give or take a couple dozen quadrillion.

28:00.310 --> 28:07.990
Mind you, statistically, it only takes about 10,000 addresses to get a 99.2% chance of a collision because there's only 2,048 bins.

28:08.410 --> 28:16.590
And this is outright better than trying to do global IP name servers, global IP ID for name servers because in this scenario, we get protection.

28:18.210 --> 28:28.870
We get that added improvement of all the other bits of binning and if there's a couple of random hosts on the internet, 2,047 of them aren't going to mess with our IP ID.

28:29.510 --> 28:33.790
And also, once we find this collision, we can kind of sit on it.

28:33.790 --> 28:38.770
And the server selection is like literally any remotely recent Linux kernel.

28:38.830 --> 28:42.330
If your Linux kernel is older than 2014, by the way, you should probably patch.

28:42.330 --> 28:44.030
There's some stuff that you need to deal with.

28:45.070 --> 28:55.930
And as far as like what our target space looks like now, well, there's something that exists a lot more than existed in 2008 or 2012 when some of the other attacks were coming out.

28:55.930 --> 28:58.250
And that's these lovely, lovely public resolvers.

28:58.430 --> 29:00.650
And they're really trusted.

29:00.770 --> 29:06.230
In fact, as I mentioned before, there's entire Central African nations where all the ISPs are going through Google DNS.

29:06.230 --> 29:08.710
Sure would be a shame if somebody did something to Google DNS.

29:08.830 --> 29:09.410
Yeah.

29:11.350 --> 29:16.710
And frankly, don't get me wrong, there's some presuppositions.

29:16.710 --> 29:18.090
There's some difficulty in doing this attack.

29:18.090 --> 29:19.890
You need to find the right set of targets.

29:19.890 --> 29:26.290
But if you poison a resolver, you're attacking everybody who's using these.

29:26.290 --> 29:29.950
And as far as getting a puppet downstream, well, you can be the puppet too.

29:29.950 --> 29:34.170
You can be both the attack server and the puppet because they're public resolvers.

29:34.170 --> 29:35.170
You just enroll yourself.

29:35.170 --> 29:35.930
It's free.

29:37.690 --> 29:44.410
And as I kind of mentioned before, this whole collision finding bit is completely detached from the attack.

29:44.990 --> 29:47.230
Time is on our side as an attacker.

29:47.650 --> 29:50.090
And now it's actually really on our side as an attacker.

29:51.990 --> 29:55.710
The hardest part and the most legwork to find this is in the collisions.

29:55.930 --> 29:58.730
And although they could be found in minutes, we're really in no rush.

29:58.730 --> 30:06.470
We can probably stay around for weeks, months or years because that key that is determining the hash doesn't change until the system reboots.

30:06.550 --> 30:09.130
And I don't know if any of you know a lot about name servers.

30:09.130 --> 30:10.670
They're not going to reboot a lot.

30:11.030 --> 30:12.510
That's bad for the internet.

30:14.950 --> 30:27.690
And we've got some interesting options as well because we can do a lot of really short duration cache attacks because we have a very good idea of what the IP ID is and we can very plausibly do this in the first hit.

30:27.830 --> 30:31.930
And we can also accumulate a ton of matches for multiple name servers, multiple resolvers.

30:31.930 --> 30:42.270
Even if Google is running 101 resolvers and we want to poison 101 name servers, we can just get the collisions all hooked up for that and then just start poisoning away.

30:42.290 --> 30:48.510
And eventually we're going to get poisoned records into every last one of them if we know what the IP IDs are that we need to send.

30:49.650 --> 30:53.570
It's kind of a strange work around for load balancing.

30:54.750 --> 31:02.210
And because we're doing this in one shot, we may not even need a puppet in the case of non-public resolvers.

31:02.210 --> 31:11.190
If you're trying to do this on a corporate network, maybe you don't even need to have something make a request because there's a lot of stuff that happens at midnight and patch Tuesday.

31:11.350 --> 31:19.030
If there's a cron job or some automated client that's going to reach up, I don't know if your blue teams are working midnights, but we can.

31:19.590 --> 31:21.690
And maybe the puppet can be completely passive.

31:21.690 --> 31:33.910
If we see common requests when they're being requested, we know what the time to live is on those records and we can just wait until they go out of cache and have to be requested again by the resolver.

31:34.070 --> 31:41.610
And so we can start actually consider poisoning things that are getting cached every single time because we can very plausibly do it the first time.

31:41.750 --> 31:43.490
And maybe poison isn't even our purpose.

31:43.490 --> 31:47.370
Maybe what we want to do is just DOS the entire world or prevent patch Tuesday from happening.

31:47.530 --> 31:52.630
Which would be very bad if we're an attacker in the middle of a corporate network and the Windows updates aren't coming down anymore.

31:52.870 --> 31:58.510
If we can do poisoning in one shot, we can really mess up a response in one shot too.

32:02.110 --> 32:04.610
So I've said a lot of words up to this point.

32:04.770 --> 32:07.050
What does the actual final attack look like?

32:07.810 --> 32:11.190
So basically we have to pick our targets.

32:11.190 --> 32:13.410
And this is a little difficult to do.

32:13.410 --> 32:21.090
We can at least figure out what the resolver is if we're a downstream puppet or we have some kind of way or it's a public resolver.

32:21.110 --> 32:22.530
And we also find some domains.

32:22.530 --> 32:24.870
Some domains that are likely to send some large responses.

32:25.150 --> 32:28.130
And we have to find some servers that are actually running Linux.

32:28.130 --> 32:31.870
That shouldn't actually be terribly difficult, but it is an important point.

32:32.430 --> 32:39.610
Once we determine the resolver's public IP address for the request, we can just basically evaluate the domain responses to see whether or not we can actually poison anything.

32:39.610 --> 32:44.830
And then we do our collision finding, which should be good again until the name server actually finally restarts.

32:44.830 --> 32:45.750
And then we wait.

32:48.260 --> 32:49.580
Punctual water drinking.

32:50.200 --> 32:58.140
Now, right before we do an attack, we can optionally trick the name server into lowering the PMTU and forcing fragmentation to exactly the number we want it to be.

32:58.160 --> 33:05.520
Or we could also just not and just request for a non-existent domain on DefCon.org.

33:05.520 --> 33:08.300
There's a lot of domains that are using NSEC and NSEC 3.

33:08.300 --> 33:09.680
The responses get quite large.

33:10.360 --> 33:13.600
And then we just query the name server to get the IP ID because we've already found the collision.

33:13.900 --> 33:20.180
And then we do that, yeah, I should say, we do that directly before a known request is about to be sent.

33:20.180 --> 33:21.180
We do the query.

33:21.180 --> 33:24.820
And then we basically send 64 smooth fragments .

33:24.820 --> 33:28.000
We could send only one if we're very confident in ourselves.

33:28.000 --> 33:31.980
But, I mean, if we're doing this, we might as well send the full payload that we could possibly send.

33:32.340 --> 33:37.780
And we do that based on the known IP ID as described in fragmentation considered poisonous.

33:37.780 --> 33:43.360
And I will point you to Hertzberg and Shulman's paper as to what you can do from here because it is all laid out and that paper is nice and old.

33:45.380 --> 33:49.600
So, now's a good time to start talking about how do you actually get around this?

33:50.860 --> 33:52.500
What's the fix, Trafco?

33:52.500 --> 33:54.420
Well, as I said before, I'm not the expert.

33:54.420 --> 33:59.340
So I'm going to hand it over to Brian who is closer to an expert and he can talk about some mitigations.

34:00.440 --> 34:01.820
Thanks, Travis.

34:03.940 --> 34:05.040
I'm Brian Summers.

34:05.040 --> 34:08.380
I work on the resolvers at Cisco.

34:09.060 --> 34:11.520
So this is a really interesting problem.

34:12.580 --> 34:14.400
There are lots of parties involved.

34:14.400 --> 34:17.500
There's the zone owner, the person who owns the data.

34:17.500 --> 34:19.140
There's the name server.

34:19.300 --> 34:23.340
So that's the person that, or that's where the data lives.

34:23.340 --> 34:24.940
Sometimes it's the same as the owner.

34:24.940 --> 34:26.400
Sometimes it's a registrar.

34:26.400 --> 34:28.420
Sometimes it's a third party.

34:28.700 --> 34:33.020
And then there's the resolver that almost never lives with the data.

34:33.700 --> 34:37.120
So the resolver normally lives closer to the client.

34:37.120 --> 34:40.120
And of course, it's the client, the person who actually wants to look up the address.

34:40.280 --> 34:41.420
It's usually an address.

34:41.420 --> 34:46.200
It's not always an address with DNS, but addresses are the most interesting parts.

34:46.800 --> 34:58.440
So really what we're actually trying to avoid here, or what the problem is, is that the attacker is attacking the resolver due to a bug in the name server.

34:58.960 --> 35:06.780
And the name server is holding the data on behalf of the zone owner, and the lie is getting propagated to the client.

35:06.780 --> 35:08.940
So there's a whole ton of people involved here.

35:09.440 --> 35:12.740
And really the attack target is the resolver.

35:12.740 --> 35:14.700
So that makes it my problem.

35:17.580 --> 35:24.860
IP fragmentation has been an issue for years, like since Kaminsky first observed these issues.

35:25.140 --> 35:29.220
So our approach has always been, well, that's easy.

35:29.220 --> 35:30.380
We drop fragments.

35:31.040 --> 35:41.740
DNS has a mechanism built in where when you actually ask a question of the name server, you can say, and by the way, my maximum payload size is X.

35:41.740 --> 35:50.480
So if you set X to something like 1410 and drop all fragments at the resolver, well then the name server is going to respond.

35:50.480 --> 35:56.580
If they respond with something that's less than 1410 bytes and it gets fragmented, then we lose it.

35:56.580 --> 35:57.960
We don't get the response.

35:59.960 --> 36:10.640
And that's never been a problem because really modern day hardware really does have packet sizes of at least 1492 or whatever these numbers are.

36:12.320 --> 36:14.440
So that's how we always played it.

36:14.440 --> 36:18.100
And then we came to try to support DNSSEC.

36:18.100 --> 36:27.480
And DNSSEC RFCs have lots of requirements and those requirements say that we should deal with packet sizes of 4K.

36:27.500 --> 36:32.480
And that's because DNSSEC payloads are much larger and we don't really want to send everything over TCP.

36:32.480 --> 36:34.820
So that seemed like a kind of sensible requirement.

36:34.900 --> 36:37.700
So we had to come up with a solution to this fragment problem.

36:37.700 --> 36:43.260
We wanted to be able to turn on fragments, but not fall victim to these sorts of attacks.

36:43.940 --> 36:48.940
So our first scheme came up with a, as it turns out, a naïve approach.

36:50.680 --> 36:59.040
So our naïve approach was to assume that IP IDs were random because, well, that's what the RFCs say they are.

36:59.040 --> 37:00.460
They're random, right?

37:00.660 --> 37:03.540
And of course, IPv4 has a 16-bit random number.

37:03.540 --> 37:05.180
Well, that's easy to attack.

37:05.220 --> 37:08.020
And IPv6 has a 32-bit random number.

37:08.020 --> 37:09.660
Way, way harder to attack.

37:09.660 --> 37:15.640
IPv6 also uses PMTU to discover what the fragment sizes are.

37:15.640 --> 37:20.000
So that's much more difficult to attack for the attacker as well.

37:20.200 --> 37:30.480
So we naïvely assumed that IPv4 was bad, IPv6 was good, and we implemented something that cleverly marked packets at the firewall.

37:30.640 --> 37:37.560
Marked whether or not they used to be fragments and marked whether or not that first fragment was of a reasonable size, 1280 in our case.

37:38.060 --> 37:54.800
And if stuff arrived at the resolver and it was marked as a fragment at 1280, then we'd cache all of the data in the first 1280 bytes, say that that's absolutely good, and we'd cache all of the remaining data as, kind of, I'm not too sure about this stuff.

37:54.800 --> 37:57.780
And if we ever need to use that data, then we'd actually look it up again.

37:57.780 --> 38:01.240
And we'd look it up over either v6 or TCP.

38:01.800 --> 38:08.580
That seemed like a great idea until Travis came along and pointed out that that didn't actually work because these IDs aren't actually random.

38:11.750 --> 38:13.390
So what do we do?

38:13.390 --> 38:23.670
We could try to do the same thing for IPv6, but that's actually really, really difficult because IPv6 fragments are harder to deal with at the firewall there.

38:23.710 --> 38:28.050
And in fact, well, actually DNS already has this ability built in.

38:28.050 --> 38:35.410
It's the ability that we used to use of limiting the payload size and just expecting things to go over TCP.

38:35.410 --> 38:49.150
So we did some experiments and really when you run a, kind of, public facing resolver, we've observed that more or less, slightly less than .1% of our traffic is TCP traffic.

38:49.170 --> 38:57.830
So if you look at all the queries, for every thousand queries, there's one TCP query and the other 999 are UDP.

38:58.150 --> 39:17.730
And in fact, when you turn on DNSSEC and you start querying all of those big, juicy DNSSEC payloads and you do all of this over UDP, either IPv6 or IPv4, actually that .1% goes all the way up to almost .5%.

39:17.730 --> 39:28.030
So, in fact, the RFCs that say that this is a requirement to be able to handle large packets in UDP is just not true.

39:29.190 --> 39:33.270
So how many people here have heard of DNS Flag Day?

39:34.950 --> 39:37.830
So a handful of people, four or five people.

39:37.950 --> 39:41.310
So DNS Flag Day is a really big deal.

39:41.830 --> 39:58.570
It was a really big deal for me anyway, where the DNS community are basically trying to take some of the awkwardness in DNS, the kind of rule breaking that has been going on for years in the industry and make it not OK anymore.

39:58.830 --> 40:09.630
So there was a DNS Flag Day last year and it was all about whether or not name servers versus resolvers supported eDNS.

40:09.650 --> 40:14.810
So the way resolvers talk to name servers, they'd say, hey, name server, can you talk eDNS?

40:14.810 --> 40:17.690
And it would do this by supplying some eDNS options.

40:17.730 --> 40:22.010
And if it got no response from the name server, it would send another packet.

40:22.190 --> 40:25.230
And if it still didn't get a response, it would try it without eDNS.

40:25.410 --> 40:30.210
And if it got a response, then it would kind of say, OK, this guy doesn't support eDNS and I'm going to continue on.

40:30.310 --> 40:33.890
And there was an awful lot of kind of behavior like that going on.

40:33.910 --> 40:37.270
And Flag Day is all about kind of saying, OK, well, that behavior is not OK anymore.

40:37.270 --> 40:41.570
If you don't behave properly, then things just aren't going to work.

40:41.930 --> 40:44.270
So there's going to be another Flag Day in 2020.

40:44.370 --> 40:47.070
And this Flag Day is all about fragmentation.

40:47.290 --> 40:58.170
I'm not sure the entire DNS community is convinced, but one of my kind of pushes for this Flag Day is going to be fragmentation is not OK.

40:58.170 --> 41:01.790
All resolvers and all name servers don't do fragmentation.

41:01.790 --> 41:13.850
So resolvers will block fragmentation coming inbound from the name servers and the name servers will just configure their UDP payloads to be a maximum of something smaller than their MTU.

41:18.240 --> 41:21.160
Measuring this on a resolver, how do you tell whether you're getting poisoned?

41:21.160 --> 41:24.160
Well, you can look for lots of echo responses.

41:24.480 --> 41:26.520
You could look for IPv6 echo responses.

41:26.520 --> 41:28.660
You could look for IPv4 echo responses.

41:29.100 --> 41:30.380
You could graph them.

41:31.340 --> 41:33.820
If you think you're getting poisoned, what do you do about it?

41:33.820 --> 41:41.780
Like there's limited use in doing any of this sort of stuff, because if somebody attacks you, well, you just have bumps in your graph.

41:41.780 --> 41:44.580
If you can't do anything about it, there's no point in worrying about it.

41:44.660 --> 41:47.560
You need to worry about it and make it not happen in the first place.

41:49.120 --> 41:58.960
So on the name server side, I mean, the name server guys really have almost the same problem, but in reverse.

42:01.620 --> 42:17.820
I guess, yeah, I mean, from a name server point of view, really what you want to do is limit your EDNS buffer sizes or your EDNS payload sizes and avoid fragments altogether.

42:18.300 --> 42:23.500
You can do some clever things, which aren't, as it turns out, too clever.

42:23.540 --> 42:34.500
So with the DNS IP ID 2048 bucket setup, that's all actually hashed using SIP hash.

42:34.500 --> 42:40.720
If you reboot your server, you can receive that SIP hash and you can basically give everybody new slots in the array.

42:41.060 --> 42:43.080
But, well, how long does it take to reboot your server?

42:43.080 --> 42:48.520
And even if you did introduce a way of kind of saying, OK, we seed now, really, what are you going to do?

42:48.600 --> 42:49.860
Run that every second?

42:49.860 --> 42:52.940
Well, why don't you just choose random numbers in the first place?

42:55.580 --> 42:58.840
So again, yeah, the answer for name servers is to do the same.

42:58.840 --> 43:00.080
Don't send fragments.

43:01.900 --> 43:07.620
And again, you can you can try to avoid them guessing things at the name server.

43:07.620 --> 43:13.860
You could tar pit ICOMPS, but really they could do exactly the same attack over DNS.

43:14.140 --> 43:20.360
And you'll never be able to notice that because it'll be a drop in the ocean in terms of the number of queries that you're actually getting.

43:20.360 --> 43:23.020
So like even if you graph that, you're not even going to see it.

43:25.900 --> 43:29.760
And of course, you can go a little bit more hardcore and you can rebuild your kernel.

43:29.760 --> 43:33.260
You can make this IBI dense size, which is set to 2048.

43:33.260 --> 43:38.260
You can make that a bigger number or you could just change the code and actually make a bigger random number.

43:40.640 --> 43:54.040
And for domains, for the domain owner, like if you're a domain owner and you don't really know what your name server is going to do and you don't really know what the resolvers in between are going to do, well, really your only hope is to use DNSSEC.

43:54.040 --> 43:59.180
And the big flaw in DNSSEC, as Travis said, is delegations.

43:59.480 --> 44:03.460
Delegations are fine if you're delegating to another signed zone.

44:03.460 --> 44:09.860
If you're delegating to an unsigned zone, then actually the unsigned zone is very vulnerable because your delegations aren't secured.

44:11.460 --> 44:17.200
And remember that DNSSEC, all that tells you is whether or not something is good or not.

44:17.520 --> 44:20.340
It doesn't stop denial of services.

44:20.380 --> 44:24.000
So it's not the answer to everything, but it's the answer to most things these days.

44:27.020 --> 44:34.240
And yeah, of course, if you're using DNSSEC, make sure that you've got reasonable sized keys.

44:34.260 --> 44:36.760
Don't go for the lower size keys.

44:36.760 --> 44:38.060
Yeah, don't go for the lower size keys.

44:38.060 --> 44:47.540
And if VeriSign tells you that a key that's going to be up on the internet for 120 days, a 30-day pre-period, then an active period of 90 days, know that RSAs do get broken.

44:47.540 --> 44:51.860
And if your key gets broken, maybe choose a bigger key pair.

44:52.020 --> 44:53.600
Just an idea.

44:54.640 --> 45:04.760
And I guess one of the more exciting things about DNSSEC that's coming out recently, lately, is that it's moving towards elliptic curve technology.

45:04.760 --> 45:07.500
And elliptic curve uses way smaller hash sizes.

45:07.500 --> 45:12.480
So the signatures are, well, not hash sizes, but signature sizes.

45:12.480 --> 45:18.320
So as a result, the signatures are smaller, and you're less likely to actually bump into fragmentation problems anyway.

45:20.840 --> 45:22.720
And yeah, panic.

45:25.800 --> 45:27.040
Maybe panic a little.

45:27.700 --> 45:30.100
All of the resources are up here if you need to screenshot this.

45:30.100 --> 45:33.500
Obviously, the files are probably going to be uploaded somewhere on the DEF CON Media Server at a later point.

45:34.040 --> 45:39.000
And I've been Travis, this has been Brian, and this has been the talk.

45:46.600 --> 45:48.300
I don't know if there are any questions.

46:18.950 --> 46:25.930
So the question was regarding IPID and whether or not we should have released a CVE for it and whether or not this has other implications.

46:25.930 --> 46:27.990
Oh, yeah, this totally has other implications.

46:28.190 --> 46:32.950
This is actually rather terrifying for certain things like online gaming, which are using a lot of UDP.

46:33.350 --> 46:39.690
If you can get in the second fragment of these things, and they're doing all their off in the front, it's bad news.

46:39.690 --> 46:43.370
We could release a CVE, but what's the target for the CVE?

46:43.410 --> 46:44.350
The Internet?

46:44.490 --> 46:48.910
I would have loved to send that to Mitch, but I have a sneaking suspicion it's probably not going to be accepted.

46:49.310 --> 46:51.410
But I do appreciate the question.

46:51.810 --> 46:53.770
It seems like a bit of a target, yeah.

46:56.570 --> 47:12.010
I guess it's worth mentioning as well for IPID that the original RFCs for IP talked about caching fragments for 30 seconds against being able to marry them up with the original and deliver the packet.

47:12.010 --> 47:15.610
That's clearly just not a good idea in this day and age.

47:15.610 --> 47:22.830
In this day and age, caching them for, say, at most 50 milliseconds would probably be way more appropriate.

47:23.310 --> 47:27.350
But I haven't seen any RFCs that suggest that sort of behavior.

47:27.350 --> 47:33.170
I mean, this sort of thing could be mitigated a lot more, certainly raw IPID attacks.

47:37.510 --> 47:38.570
Sorry, say again?

47:43.770 --> 47:44.950
Yes, absolutely.

47:44.950 --> 47:59.490
So you cache it for a smaller amount of time and just fling them away way more eagerly and it will stop lots of second fragment attacks where people are dropping multiple second fragments, hoping that they'll marry up on the IPID.

48:07.750 --> 48:09.050
OK, thank you very much.

