All right, everyone. Welcome to Black Ops DNS. Now, usually we start our talks with a nice slide that says absolutely nothing. Instead, I seem to be showing you some kind of screen saver. Well, let me tell you guys a little story. I don't know how much you guys know about me. I wrote a really fast network scanner called ScanRand a while ago. And in the process of doing DNS research, well, I kind of adapted it to do DNS scanning. And I scanned the entire 64-dot range, and every single dot there is a DNS server. That is plotted X, Y, Z space according to the last three bytes in 64-dot. Long story short, there's about 140,000 DNS servers on one single chunk of the Internet alone. Maybe we can do it. Maybe we should look into the security aspects of this. So that's what we're talking about today. By the way, I want to thank all of you. You all waited in an incredibly long line. I can't believe how long that thing got. Thank you, everyone. And as it goes every year, first of all, I want questions. I really want good questions. So if you've got a good question, I'm going to give you a beer. Give me one second. I have to plug my laptop in, and we will begin this little shindig. Make sure they're over when we log in. All right. I'll do it. Thanks, Mom. I'll be careful. All right. I can't. He's right. You're under 21. I can't give you beer. Here. Here. All right. And anyway, guys, don't give Priest too much hell. He actually had a really good reason to be giving this speech, and he's right. They're really, just at the end of the day, I agree with the sentiment. So let's begin the tech stuff, though. First of all, who am I? I'm a geek. DNS. Why? Why are we going to be looking into this today? Well, DNS is globally deployed. This stuff is everywhere. You use DNS every time you access the Internet. If you run a server of any sort, you probably have some kind of server-level involvement in the protocol. It solves a deceptively simple problem. The Internet, like the telephone system, does not work on names. When you call your friend, you don't go to your phone and say, you know, Bob Dobbs, please. No, you put in a number. And it's the same way on the Internet. You don't put in www.defcon.org. Well, you may do that, but the computer has no idea what to do with that. It has to look up a number. And by DNS, it goes from defcon.org to 1.2.3.4 or whatever the Internet address happens to be. It is a very old protocol. We're talking early mid-'80s. It is the second oldest, what I call, uncontested... Hell yeah. You know, when you've been handed a random drink by Humperdinck, all logic says, do not drink it. Screw logic. All right. So, by... You know, you look at Telnet. You know, we... Oh, God. You're pushing it, man. Like five minutes ago, you'd be like, let me tell you about DNS. DNS is freaking awesome. Don't do that again. Wait until after. So, we don't do Telnet anymore. We do SSH. We don't do that much FTP anymore. A lot of people do HTTP. But really, you know, DNS solved this problem 20 years ago. And there's not even really anything else that comes close. I mean, SMTP is still being used. And we're really suffering for it. Hello, spammers. But DNS is really just it won. It's good. It's there. I got interested in DNS really especially when Blaster happened. Blaster is one of the three worms of the Summer of Worms last year. Blaster not changed so big. And Blaster went ahead and looked up WindowsUpdate.com. The wrong name. Guys, it's WindowsUpdate.Microsoft.com. How did you forget Microsoft? They're kind of a big company. Yeah. But it queried WindowsUpdate.com before going ahead to launch a flood against this site. Funny little thing. Everyone was running scanners to try to find their infected Blaster hosts. Meanwhile, the Blaster host, every last one of them, was making DNS queries for WindowsUpdate.com. I go ahead, put out a single one-liner Perl command over SSH that would parse out all the infected hosts. People are looking at me like, what? You can find worms? With DNS? What the? That's when I got the idea maybe we should really start experimenting with this. So, we have now a new toolkit for DNS experimentation. It's called AussieManDNS. It was released at the Black Hat briefings a few days ago. And it's pretty cool. We've got a couple tools. NOMD, as in NOMDEGEAR, is our experimental DNS test platform. It is a dynamic DNS server. Very sensible. Very easy to code for. If you can write maybe 10 lines of code in Perl, you can actually return arbitrary results on a DNS query. It's beautiful. And the joy goes to Perl for having an amazing net DNS library. Is the library good enough? I learned the freaking language. That doesn't happen. What some of you may have heard about, DROUTE. Yes, we have SSH over DNS. If you can DNS out of a network, you can get arbitrary network connectivity. All right. So we have SDNs. We have FFN, which is a source ofeker, which is a source ofeker. We have file and stream receivers and senders. ASCA and GETA. Ask a stupid question, get a stupid answer. And we have GLANCE, which is a freshness checker over DNS. I'll tell you more about that in a bit. So what are the useful traits of DNS that are interesting from a security perspective? Well, first of all, DNS is hierarchical. The example I use to explain this is to say, for instance, when you have a database, you let's say you could dial 411 and instead of just saying give me the number of this company, you could say give me the extension of this person at the company and they would go, 411 would go out and find this person's extension and tell you oh yeah Bob's extension 4391 would you like us to connect to you. The phone system is very centralized. We're really only a few Bells out there and they store all their data internally. DNS is a very distributed architecture. When you go to com, it tells you how to get to docspara.com. You go to docspara.com, it tells you how to find foodocspara.com and so on. It is a hierarchical process that gets you closer and closer. It routes you through hops much like the Internet routes you through hops. That's kind of interesting. It uses, there are two kinds of lookups. Recursive versus iterative lookup. And in a recursive lookup, you know, you basically go to some, oh hang on. So it's actually a complicated process to go through this entire hierarchy to follow the com to docspara.com to foodocspara.com and so on. This process has been offloaded to specialized servers, so-called nameservers. You go to them and you say here's the answer I'm looking for. It does a whole bunch of work in the background and then comes back to you with an answer. That means it's a proxy server. It is, you ask it something, it goes out on the internet and does a bunch of work for you. Interesting. So now we can tell other machines to do lookups for us. And also, these other machines, they cache. So in other words, I go to, you know, like the 411, let's say 411 did the whole extension finding out, said Bob was at extension 4931. The next time someone called 411 for 4931, say, oh, I remember that, I don't need to call the company again, he's at 4931. Same with the DNS, where there's a caching of results. It's much like HTTP proxy servers, like Squid will store results. So if you ask for it, instead of going out on the internet, it already knows the answer, it provides it. So these are some interesting traits for our globally deployed DNS system. Maybe we can use them. Now the primary research areas for... Fuck water. No. Okay. Sit down. So, check this out. The primary research areas for DNS, 99 in 2000 was basically not a good year for Bind. No. Paul Vixie has kind of removed that from his memories. Filled with exploits against the world's most common DNS server, it was a very bad time. Luckily, most of the bugs have been fixed. I'm sure some of you know of bugs that are... Have been... Have not been resolved. But for the most part, the DNS is okay. The second class of attack involves DNS spoofing. That's where false addresses are returned for addresses. A lot of work has gone into preventing the ability to spoof a DNS address. That's not so much of a problem anymore. It used to be a lot more. There are still some definite threats, but that's not what I'm looking in. I'm looking into DNS tunneling. Now, there's been some interesting work lately in terms of DNS spoofing. We have BitTorrent seeds. How many people in this room have used BitTorrent? Very cool. Good friend Bram wrote BitTorrent. Guy's awesome. So, BitTorrent depends on a little bit of data to seed you on your goal towards getting your files. People have been talking about putting those seeds in DNS. As a retarded little example, people have done math servers. You'd look up two plus two, fooaddress.com, receive an IP of four. . But this violates the RFC because you're not allowed to have a plus in DNS. So I'm not the first person to put odd things in DNS. I do not claim to be. But I'm doing some interesting stuff anyway. How is arbitrary data put in DNS? Now, most people think, well, you know, all DNS returns is a couple IP addresses. How much storage capacity can there be in IP addresses? They're four bytes long. Well, first of all, you don't just need to host DNS servers. You can host what are called text records. Text records are unstructured fields of data. You can get actually a decent amount of content into them and shove them into a packet. They're most commonly used in what are called SPF records, which are used to validate the source addresses for spam. Instead of that, I'm kind of putting arbitrary data in what's called base 64 format. And it looks like what you see up there, where it's just a large string. You can get about 220 bytes of arbitrary data per text record. Now, sometimes you may not want to move text records. Sometimes you just don't have those available. What you can actually do is in a query, in a lookup, in the name, in the address that you look up, you can throw data. So when you look foo.com or bar.com or so on, you can append a huge batch of data. A huge batch of arbitrary data in the lookup itself, up to 63 characters between each dot and up to 256 characters total. Through this method, and by the way, we can't use base 64, because there are 63, not 64, 63 legal characters in a DNS name. So there's actually something called base 32, which takes all arbitrary data and shoves it into 5-bit text. So you get A through Z in a couple of the numbers. And through there, you can get about 110 bytes per packet. Now, DNS tunneling. Who's doing it? Well, right now, NSTX is the most popular system for tunneling arbitrary data over DNS. It takes IP packets, standard things that you'd move over the Internet, and it encapsulates them in DNS queries. Now, the problem with NSTX is that it really only works under Linux. And... Hey. That's true. But you know what? You know, sometimes you run another operating system every once in a while. OSX, say, perhaps. See how I got that to be cool again? So, beyond that, there are serious rumors, it's true, that various botnets and malware are using DNS as a covert channel in order to get the control channel for their worms. So this is happening. And at the same time it's happening, it's not. Nobody's monitoring their DNS traffic. Nobody. People had no idea that even worms were going on over DNS. So, I mean, worms were doing lookups over DNS. So, this here is an attempt to try to raise the lights on a real problem. Well, let's start simple. NSTX requires kernel cooperation, and we don't want to have that. So, let's make something that doesn't require the kernel, but still allows remote networking. Now, what is remote networking like VPNs? I'm on this network, but I want to be on this network. I wanted to be over there. I'm at the Starbucks network. I want to be on the Internet. You know, stuff like that. So, there's a little project I was involved in. It's called SSH. You might have heard of it. And SSH has a function that I wrote called dynamic forwarding. Dynamic forwarding is basically a poor man's VPN. And where's my Ethernet jack? Could a goon come up and give me an Ethernet cable? I got a cable for you. Yeah, just come and set it up. Okay. So, let's see. Let's see. SSH dynamic forwarding is interesting because you can basically route arbitrary TCP applications over any host you can SSH into. So, you want to look up websites, you go over SSH. You want to use your instant messenger, you go over SSH. You're firewalled against websites and instant messenger, no problem because you're going out over SSH. And with the latest hack, you're now going out over SSH over DNS. Problem solved. Problem. DNS is not TCP and SSH depends on TCP. TCP moves byte streams. Here's some arbitrary data. Go send it. DNS moves records. And individual records are the blocks of data. TCP lets either side speak first. DNS is client server. The client has to look up and the server can respond. If the client doesn't look up, there's no response. And TCP is 8-bit clean. You can move any byte you want. What's the problem? There's DNS. You can only send this character. You can only send that character. You know, it's almost like I've heard this story before. I shall call him mini-HTTP. It's just HTTP all over again. You guys know like XML, RPC, and SOAP and all these other protocols that are taking really complex stuff and shoving it into the HTTP channel because, well, no one's firewalling that. Same junk. Just like HTTP tunnel, we're going to go ahead and we're going to move data over something that really it wasn't intended to. Now, I have to point out there's a significant difference between DNS and HTTP. In HTTP, you can have an arbitrarily sized response to a request. In DNS, you can't. There's really a 576-byte limit, unless you use the UDP size option, but I'm not supporting that yet. So, with that restriction, we can still do interesting things. We can still do interesting things. I'm going to start with a tool I've written called DRoute, which is a DNS stream router. Now, let me give you a little bit of an example of how it works, and then I'll see if I have enough net to show it to you because live demos are always fun. Upstream. First of all, upstream and downstream have completely different semantics. Upstream has limited bandwidth. You'll notice on your ADSL links at home, it's very slow up but very fast down. It's because most protocols in common use, you're downloading a lot more than you're uploading. Conveniently, DNS gives us a much slower upstream than downstream. We basically have the name that is available to look up. We put 110 bytes in, as I showed you earlier with the in-between every 63 dots. Downstream, we have more bandwidth. We can use that 220-byte method I talked about. But we have to pull for new content. There are text lookups, and they return base 64 data. We have a byte offset that describes how far into the download stream it's going to stream we want to be. Now, I don't want to continually be flooding a remote non-D server to grab my data, so this is how I do it. I'm always pulling. If I don't get any data back, I wait three times longer before I try again, up to some maximum sleep time. So as soon as I have data, I speed up because there's probably going to be more. But if there's no data for me to download, I back off. It's a simple protocol, but it actually works pretty well for not making too much noise when there's no data to download. Now, my present implementation is single-threaded, and only one packet can be outstanding at a given time, but this is temporary. And once it's fixed, this will be a lot faster. Now, let's do something really stupid and try to actually give you guys a demo. It's mildly readable, but not greatly. Sorry. Huh. We have no net. . Damn you, Humperdinck. . Really? Wrong one. . No, I mean, it's not live on my side. . Nice. . No, I mean, it's not live on my side. No, I don't have link on my side. All right. I'm going to continue my talk, and as soon as this thing maybe works, I'll give you guys a live demo. . . . . . . . . . . . . . . . . . . Can we do something a little bit more interesting. Something new. Something that's never been done before. Yes. Yes, we can. Check this out. So, you go to a DNS server, and you ask it to, like I said, it says if every web server was also web proxy. Every DNS server or most DNS servers out there, will do recursive lookups on your behalf. . Do you mind being on the public network? . I don't care. . . . . . . . . . . . . . You don't care. Now, the basic trick is to, obviously, you're at a hotel network that wants you to charge, you're at a Starbucks that wants you to charge, you just go out through the DNS requests, because they'll actually feed you DNS data before they actually hijack your outgoing HTTP. Instead, you just don't HTTP out. But check this out. Wait, maybe... Hang on. I might be able to give you this demo. One, two, three, four, bing. Okay, cool. Is there DNS on this? You don't say. Okay, this one fails. Okay. Do I have no DHCP on this thing? Yes, we may have net. No, I don't. Look at my top interface. I'm not getting any DNS out. That's all I actually need, too. All right. I have link, but no DHCP. DNS. What's this plugged into? The same thing? Well, hang on. I'm going to try this one last thing. Just come up here and look at what you need. I'm going to continue my talk. All right. Let's check this out, guys. DNS trusts the hierarchy to tell it where to route next. Now, like I told you, com takes you to docspare.com. Docspare.com says, no, no, no, I don't got the answer. Go here. It'll tell you where all the answers are for altdocspare.com and so on. You can do something very interesting with this, and it's called source routing. Because I go ahead and I communicate with a recursive server, a server that's doing lookups for me, and I tell it to look up an address that I control. And when it comes to me trying to resolve this address, I tell it, no, no, no, no, no, no, I don't have the address, but you know who does? 10.0.1.11. It's an address in your network. And it goes out the other interface on the DNS server. So this is very new. DNS comes from an era where firewalls didn't exist, where you could globally route to any IP address possible. That's its design. When you have a DNS server that can go out of multiple interfaces, one to the public internet, one to the internal network, and you go to that public internet interface and you say, hey, give me this answer. And then you tell it, by the way, the answer you're looking for is on your internal interface. It goes into the internal interface. So what does this look like? Because I'm not just going to tell you this theoretically. No, no, no. I'm actually going to go ahead and implement it. Part of NAMD, NAMD has an echo service. If you look up 10-0-1.55 at echoalt.xperia.com, you get the name server for that is NS, whatever. When you look up the address for that, it dynamically returns a packet that says, oh, that address you're looking for? That's at 10.0.1.55. So guess what happens? You go ahead and you try to communicate. You go to recursive server. It goes ahead and says, where's my next hop? The next hop's at 10.0.1.55. It goes backwards. Now you say, fine. I'll just disable recursion on my external interfaces. I won't let you come back into my network. And the story could end there, but I'm an evil bastard. Some interesting things happen when you scan 16 million IP addresses. About 20,000 or 30,000 hosts are like, who the hell is this guy? And what they do is they actually look up your IP address to determine the name you're coming from. Lots of firewalls, you know, IDSs, a couple individual auditors. Guys, when you're investigating someone, realize your investigations might send a big flare back that says, hi, I'm looking into you. Of course, I would need to have control over my own reverse DNS. I do have control over my own reverse DNS. Thank you very much. And there's something very interesting that you can do. They come to you and say, hey, what's the name associated with your IP address? Now, you could tell them. Or you could tell them, no, no, no, no, I don't have the answer either. You know who does, though? It's this IP address inside your network. Ah. But it gets a little bit more complicated. Because we don't just want this original reverse request to come back to us. I mean, to get to go to the inside network. No, no, no. We want arbitrary data. So what we do is we say, no, no, no, I don't know the answer. You know, bigbatchadata.otherdomain.com has the answer. Now, this bigbatchadata will actually be the address that is eventually pointed back in the network. But the very interesting thing is it is put into a separate domain than the one they looked under for the reverse lookup. Why? I told you earlier about DNS spoofing. DNS spoofing used to work like this. They would reverse, you know, they would look up through one house, look up through another, look up through another. You'd say, no, no, no, no, I don't have the answer. But Yahoo has the answer. And Yahoo is at, oh, Yahoo is at my address. And then it would store it. And now every time that server tried to go to Yahoo, it would come to this address. So this was bad. So it was deemed the solution was to not trust the server if it told you the IP address of a given domain if that domain was some completely different place. Right? It would say, oh, you know what, you aren't qualified to answer requests about Yahoo. Or you're not qualified to answer requests about this other domain. So it would start a completely new recursion process. And this new recursion process would be for this new arbitrary name and would follow that path to its inevitable IP address. And it's that arbitrary name and arbitrary IP address lookup that gets leaked all the way back into the target network. That is our pipe in. Now what's our pipe out? Well, we just do the same thing. The guy on the inside, our Trojan horse on the inside, picks up this request, says, uh-oh, I've got a big request here. I've got data. I've got an incoming message. I don't know the answer, but this guy on the outside does. And thus you have a path that goes both directions. You communicate with the IDS. It sent a message to the DNS, causing the DNS to proxy traffic back and forth. Between an outside host and an inside host. And there's no recursion involved from a public thing. It's kind of nasty. And did I mention that actually a human auditor looking into your IP address can actually cause this? Social engineering. As an aside, by the way, I'm kind of embarrassed to have to talk about this, but I'm going to do it anyway. Please don't log when you're writing software. Just the name returned from a pointer value. Your pointer value, IP address, say, 1.2.3.4 equals this name. Lots and lots of places will just say, hey, if I got a name back, I'm not going to log the IP. Well, you know what I can return for my name? 127001 is my name. Hey, do you know how much that messes up your logs? Yeah, guys. By the way, who does this? I don't know. Apache, SSHD, a bunch of IDSs. Don't do this. Thank you. Okay, this is cute. Some people came to me and they said, Dan, I would like to be able to communicate with my friend. And I'm behind in that, and he's behind in that, and we can't talk to each other, and we don't have any open bulletin boards that we can communicate through. We would like to communicate with one another. How can we do so? Can we do it through DNS servers? I'm like, well, DNS servers aren't going to, like, store, you know, list out all the results of their cache. They're like, please, Dan, there's got to be a way. So I'm like, um, okay. You go to a recursive server. You say, hey, you over there, 4221, what is datadocsparer.com? And it goes ahead and it finds out and it stores that value for a while. Now, a second guy comes along and he says, what is datadocsparer.com? Well, it's already cached. So the answer's there. When he does that second request, the second guy comes along, he can actually say, no, don't investigate. Don't recurse. If you have the answer already, that's great. Go ahead and give it to me. But if not, no, no, no, no, I don't want to know. That's just a recursion desired bit. Now, datadocsparer.com's already cached. So it still returns. That's information. I now know that this guy had already gone ahead and seen datadocsparer.com. And this is related to the whole class of information leakage where you can find out if a server has been looking up Yahoo, been looking up Hotmail, been looking up arbitrary name that you want. You can query its cache and not do it destructively by destroying your recursion desired bit. But you can also send information based on whether an individual record has already been looked up. Or not. Here is the method for single bit data transfer over DNS. And yes, this is even slower than it sounds. Step one. Split your message, and it better be short, into individual bits. For each byte that's going to be available for reading, do a recursive lookup against a value that says, you know, I'm starting another byte. For each bit that is one, do a recursive lookup against a value that says, you know, I'm starting another byte. For each bit that goes up against the wildcard hosted message, meaning it'll return a response no matter what the query is, that identifies that bit as active. How do you retrieve that data? You scan from you know, one, six to eight, and actually you scan all eight bits in a byte. First you try to see whathast depending on what they've already exploded in the symbol. Do a lookup for the first byte, start bit. If you get a reply, do a non-recursive lookup against all the names that map to the eight bits. The names that do return an answer, well, that's a one. The bits that don't return an answer are a zero. You integrate the bytes into a bit, the bits into a byte, and you save. Increment the byte counter, return step one. Long story short, you get about eight bits a second. But, two hosts can communicate over a tremendous amount of traffic. Implications. Well, first of all, we can do bidirectional communication really, really slowly. Secondly, this method can be extended to pretty much anything. Web counters can be used for communication. IPID counters and IP stacks. There's a story about Paul Revere's lamps in the tower. The British are coming. There's a quote in the intelligence community. You can always send a bit. And there's a question, you know, did it increment or not? Well, the start spikes between 601 and 602. So, I mean, there's always a way to send a bit. Who would possibly send more data? Last modified. Since last week, I'm writing all this code about DNS, and there's this last shot story. It says, RSS is overloading the internet. Well, lots and lots of news readers will do big, heavy HTTP queries every hour. And according to the admins, this looks a lot like a DDoS. You know, all these hosts coming at once is really inconvenient. Now, the only information they want to know is if there's any new data for them to download. So, I'm like, fine. We'll take this one tiny piece of information and we'll shove it in a DNS text record. And then you can just do a lookup. But, you know, it's a pain in the ass in a lot of languages to do text record lookups. And I'm like, huh. Last modified, the date that this RSS news file was updated. Well, that's a date. Dates are times. And times are represented as 32-bit integers in Unix. Huh. What does DNS move a lot of that's 32 bits wide? Oh, yeah. IP addresses. So, here's what I went ahead and wrote. I wrote last modified over DNS. It encodes a date. Date as the IP address for an arbitrary name. So, you go ahead and you run a simple command called glance. The critical source code is right above. It does a get host by name and then it casts it as a time. You glance at www.cnn.com, glance, alt.expero.com, did we kill someone again? Damn. And look at what it returns. Number of seconds since that time. Thursday, July 29th, 16-11-21, GMT. Yeah. One packet instead of ten. Very, very efficient. And it caches. Everyone at AOL can find out that CNN hasn't updated yet. Hallelujah. But let's say we wanted a little bit more storage. You know, what could we do that might possibly be interesting to move over DNS? Well, let's say we wanted to do really big files. I call this domain cast. Normally, normally in DNS, you talk to your own server and it retrieves, the canonical official data on demand for a particular request from just the official server. And the data is consistent for everyone. That's normally. Let's have a little bit more fun. I showed you that screen saver at the beginning and there were a lot of dots there, right? What if in each of those dots we stored 20 kilobytes of data? A different 20 kilobytes of data for each of those dots. Well? If you do the math, it would take. If we had 20 kilobytes of server and a 700 megabyte Noppix CD, it would only take about 35,000 servers to host all 700 megs of data. And guess what? They're all storing data in their cache for up to a week. So for up to a week, we could store this big, huge file. Would it be fast? Well, out of the DNS server, you can only get about a kilobyte a second, more or less. Well? Well, time one kilobyte a second times 35,000 is 35 megabytes a second. I think that's faster than my net connection. Now, yes, there's going to be some overhead, say 50% overhead, that's still 17 megasecond. That's still a heck of a lot faster than my net connection. So by using a divide and conquer strategy, we can actually store a tremendous amount of data in effectively the internet itself. Kind of a neat toy. Now how do we distribute the list of sites to go to? I used to have this big, complex algorithm for encoding the next hop to go to in each packet. Then I'm like, you know what? 35,000 times four bytes is 140 kilobytes. I'll just send that as my list of where to go for each individual byte. And if that's even too much to host, we'll just host that in DomainCast as well. Across seven key servers. BFD. So yeah, that's how you distribute a large file very fast over DNx. But as for a file, what if we wanted to do a stream? An audio stream. Say voice over DNx, anyone? So it turns out... Awesome. Awesome. So it turns out, voice compresses really freaking well, like two kilobits a second, like 276 bytes in a second. Okay. You know what? DNx is slow. It ain't that slow. I can move 276 bytes even through a pretty slow server. So it turns out interesting. I didn't expect this to actually be useful, but DNx caches. So you can have, like, you know, one of the things you notice when you're serving audio data is as soon as you get a whole bunch of listeners, your bandwidth bill goes through the roof. Wouldn't it be nice if everyone cached your data and it distributed, it shared? Well, I looked into this for a second, and with HTTP, it's a stream, so it doesn't know how exactly to cache it. But if you divide your data into, say, 880 millisecond chunks, it's a stream. If you divide your data into 880 milliseconds chunks, these chunks get cached just fine. So yeah, that's what we do. We basically take data, put it into 880 millisecond chunks, we upload them using standard dynamic update to a bind server, and we pull them down. What does it sound like? I'm going to see if I have net. Maybe. I'm hoping. We have net. We have net. That's a big fat maybe. . . . . . . . . . . . . . . . . All right. I'm going to need to modify this real quick, and then we're going to win. All right. . . . . . . . . promises. KGO Radio, San Francisco, California. This isn't saved. This isn't a lame demo. That was live. And now that we have actual net, hang on, we've got to do that SSH over DNS. Come on. How long have we wanted this at our disposal? Actually, I don't even need to put this down. Since when could you afford a hooker? Maybe. Hang on. I have to modify one thing again. Actually, I can document this. So, I don't know how many of you can read this. SSH actually has support for something called a proxy command. A proxy command says, you know what? A straight up TCP connection isn't going to work. Instead, run this command, and it will go ahead and give you connectivity to where you want. Now, normally, it will just, you know, work. I mean, normally you use this for SOCKS or for HTTP. This isn't normal. I'm using it for DNS. Now, what I'm doing is I'm adding an option to my DROUTE command to tell it to go through the resolver at 4.2.2.1. I can actually tell it to go through multiple resolvers so that my data is actually bouncing off an arbitrary large list of name servers. So, if you, say, wanted to spread your communications across 30 or 50 hosts, no problem, boss. Let's see if this works. Maybe. Aw, yeah. This is going not straight up but over SSH. Receive disconnect. That sucks. I'll try it one more time. Shhh. Entering interactive session. Look at mail. And you know what? Just because I feel like doing it. I feel like talking to my friends. Cookie scent. And maybe, maybe. Hi, guys. How you doing? Now, that's a stunt. We can actually port that audio hack back to HTTP and return one to five second chunks of audio over HTTP. And now it will be compatible with proxy servers. So, people have come to me and they've said, Dan, you've talked about a whole bunch of stuff. I don't really understand what I'm supposed to take out of this talk. Fine, I'll give you a nice little summary. First, DNS is globally deployed. You use it. You probably serve it as well. Second, as the rest of IP networking has become more and more filtered, DNS has been left pretty much just the same for important reasons, but has been left the same. And its services actually outstrip what a normal IP network provides. Normal IP networks don't cache data. DNS does. Third, this connectivity can be used to, for example, offer an entire range of services. From an encrypted VPN-style link, to a completely silent but remotely accessible Trojan horse, to an unexpectedly useful distributed audio caching system. Fourth, don't shut off your DNS servers. Don't try to firewall it off. It'll just knock out your network connectivity. But please, watch your DNS traffic, see what's going on, pay attention, because people like me are out there. All right? Any questions? We've got three minutes for questions and seven beers to give out. So, who's got something good? Go. Hang on. Get the heck up here. If you've got questions, come up now. We've got three minutes. Run, run, run. Coming, coming. Lean. How do you do? How do you deal with a blind Anycast system like the .org system that's been implemented over the past six months? Why should it be a problem? If I register a name in the .org domain, it still comes to me. It still comes to you, but over multiple hops. You're not dealing with the same cache on every system anymore. No, no, no, no, no. I'm not hosting stuff in the root servers. It's being hosted in my particular endpoint. Unless .org hosts all the names under .org itself, which it may vary. In other words, we're talking about third-level domains. Are these hosted in .org? No, but I was looking more at the attack vector, not at the hosting part of this. Tell me more about this attack later. Go ahead. Is it customizable, the size of packets? Because I know it specifically picks, at least, by default, will limit the return size of DNS queries. I am saying, I don't know. I have been overly conservative. I am 100% RFC compliant. My DNS packets do not exceed the 512-byte limit. Now, it turns out a lot of sites don't require such paranoia. Just by default, I coded against the system as good as I would write. What would you recommend to protect against this sort of DNS routing into your private network? Do not allow recursive DNS on any server that's dual-hosted. No. You've got to drink. HumbleDick was wondering if you're doing SSH over DNS. Is it caching the data? No. I set TTL equal to zero on all my traffic so that it's not cached. And actually, for the last modified stuff, there's an optional header for HTTP called expired. If you take expired minus server date, you get a number of seconds that server wants you to cache the value. Use that as your TTL. That's what you get for your last modified data. What if you got, say, 50 or 60 servers to cache a single packet of data in their servers and then forced another host to, or, I'm sorry, sent a spoofed DNS request to all of those servers and the return address were something like Microsoft.com? That is a very good attack. Just checking. Do you think you're 140,000 in the 64 range? Is that reasonable, or is that because you chose 64? Is it probably an average selection? 65 does not have as much. 64 does. My guess is that 64 was moderately heavily populated because 64 happens to be one of those that was distributed to lots and lots of different endpoints. There are a lot of companies that have whole class Bs or even class As. These companies do not host as many public DNS servers. Two more questions. Two more questions. Go. What do you foresee is a problem with, say, AWS? Let's say everyone started using the system to do SSH caching or caching of their video streams. This is going to create a large load on everyone's DNS server as far as bandwidth and CPU consumption. What sort of problems and solutions do you foresee? Well, for audio, the interesting thing is that it actually reduces overall bandwidth because it's caching locally and you're not using your external link as much. For SSH over DNS, it could get problematic if everybody was using this just because your . Well, you know what it is. Because SSH over DNS is going to be slower, your aggregate data sent is going to possibly be less. So, you know what? Bug me later. We'll think about how this could actually cause problems. Oh, apparently I can do as many questions as I want. So, come on up if you got. Oh, wait. Hang on. Hang on. If you've asked me a question, grab a beer. Where can I get a copy of your code? I don't know. Oh, yeah. Did I mention I actually released this junk? Yeah. www.d-o-x-p-a-r-a.com. Docs para. It's a backwards paradox. Go ahead. With the high failure rate of name lookups, what I'm trying to get at is in UDP streams, because that's how DNS communicates mostly. How much more overhead will this take? Well, the thing is, remember, I control the endpoint, and so the classic bind model of just failing randomly is greatly reduced. However, I have a lot of reliability code in my client to go ahead and retry, potentially in other servers. So, I've actually done a lot of work to make sure that reliability is managed. A lot of them are shifting from server to client. What do you mean? Like code DNS and some of the others that are coming out. To support? Oh, go ahead. To work with DNS better. Hmm. Well, I mean, the idea, code DNS will go ahead and deal with DNS caches. All the SSH over DNS stuff is uncached because it's part of a live stream. Thanks. When you're storing large files across multiple DNS servers, what kind of redundancy do you have built in in case one of them goes down? Ah, that's a very good question. You get the last beer. The mechanism I'm using ends up using, I don't know. What's it called? There's a whole secret splitting mechanism you can use. There's lots of algorithms for, like PAR on Usenet. There's actually a more advanced version of that that's tuned towards larger files. And if you have an arbitrary 90% of the data, you're able to reconstruct the entire file. What sort of passive attacks do you see people are using against somebody who uses this as a communication method? Can you repeat that? What sort of passive attacks? Do you see against people using this as a communication method? You mean how would you hurt people who were doing this? Yeah. How would you eavesdrop on somebody using this as a connection? Well, I'm moving a... Ideally, I'm moving a... Excuse me. Man, I'm allergic to your question. No. This is actually the big reason why I chose to use SSH over DNS. Because the SSH... SSH is a huge layer, and it's a huge layer that will prevent any kind of attacks from being particularly effective. I mean, yeah, you can corrupt the link without a problem, but you're not even going to be able to spoof traffic at me. And this is as opposed to what I was using as I was developing this, which was just INETD into a shell. Now, SSH has a cost, it has a lot of back and forth, and that increases the setup time substantially. But in return, you get immunity from the kind of attacks that you were thinking of. I think so. Go ahead. Just wondering if you've dealt with or care about how AOL doesn't seem to pay attention to all of the DNS RFCs. Tell me more. I know that a person expects a certain behavior for caching from a DNS server. And you're expected to be able to tell a DNS server. Oh, nonsense. I throw a nonsense to every request in SSH over DNS. So I know exactly what you're referring to. Bind can be configured to have a minimum TTL value that it will respect. It will refuse to accept that data isn't going to be... It will be cached. It will cache it anyway. So what you do is in your query, you throw a little random nonsense, a random value. So it can't pretend that it has a cache because it doesn't actually know that these two requests correspond to the same value. That's how I handle that. Okay. All right. No, but great question. I'd give you a beer if I had one. Is there any way to arbitrarily float extremely large files for longer than a week at a time through DNS? You could repopulate the data. So if you don't actually want to make another connection and repost anything, so let's say you put a payload up and you wanted to have that float around arbitrarily. You know what you could do is assuming in your first week you had a whole bunch of people downloading your data, you could actually have some code on the clients distribute the updating of the data. So you would distribute. You'd get to 35,000 servers and then you'd get 100,000 clients and every week the code on the clients knows, oh, I better go ahead and update that data. That being said, this is extraordinarily evil. Please don't write this client. Two questions. Are you going to release your list of IP addresses? Not publicly. Three questions then. Can I have a copy of it? I can't publicly. I can neither confirm. Or deny? So the third question, it seems pretty easy to see that someone's doing this the way that you make the requests. Are you going to make so that it will be hidden? Because right now it would be really easy to write a snort signature and say, this is someone tunneling over DNS. Important. Actually, there's something very important. How would you write a snort signature to find this? Because these packets are entirely RFC compliant. Now, you could just say there's a lot of DNS traffic coming from this particular host. But a better method is to notice. These requests actually have very high levels of entropy. In other words, English language follows a certain distribution of consonants and vowels and lead numbers and so on. And DNS names very much follow that as well. If you were to write a snort signature to detect this kind of traffic, you would simply need to have an algorithm that detected, hey, look at all this very large, highly entropic data. I bet this is encapsulating SSH traffic. Do you want me to stop or take more? One more question. Have you done any work to try to transfer 4-byte chunks over multiple A records? The problem with that is that you end up with inefficiencies because of all the data in between each A record. The A record stuff came originally. Now, what people say, well, why don't I just shut off text record lookups? First answer, because it kills SPF. Second answer, fine. I'll put them in. I'll put them in. And they say, well, why MX records? And they say, well, why MX records? Individual records get desorted, get randomly sorted. Well, MX records have a precedence value, and this precedence value can be used to sort your requests into the original order. So that's why the bottom line is you're not going to stop this by trying to limit what types of records you serve. So from your standpoint, it's an efficiency question. Yes. And I know efficiency and arbitrary data, DNS are not concepts that go together, but it works anyway. Great. Thanks. All right. I think that's all we've got time for. Find me later. Oh, and I am going to the dunk tank. If you want to dunk me, come get some.