1 00:00:00,000 --> 00:00:07,240 All right. Thank you, everybody. I'm Ed Miles, as he said. I'm here today to talk about 2 00:00:07,240 --> 00:00:17,840 BitSquatting, which can effectively provide passive DNS hijacking. I am a security 3 00:00:17,840 --> 00:00:23,000 enthusiast. This is not my 20th DEF CON, but this is the 20th anniversary of my first DEF CON 4 00:00:23,000 --> 00:00:28,520 attendance. So I'm very excited to be speaking here. I'm a drum and bass DJ. I'll be spinning 5 00:00:28,520 --> 00:00:34,060 at the Blanket Fort Con later, and I'm a bit of a threat researcher. That's most of my actual 6 00:00:34,060 --> 00:00:42,840 security background, which means I mostly analyze malware and malware accessories. The first 7 00:00:42,840 --> 00:00:46,700 slide you may have noticed, I work for DD Labs. I know if I get any questions about this talk, 8 00:00:47,480 --> 00:00:52,940 people will ask me about my employer. We're basically the Chinese Uber, but we have a 9 00:00:52,940 --> 00:00:58,500 research and development team in Mount View, as well as Los Angeles and Toronto. So I'm 10 00:00:58,520 --> 00:01:06,880 really excited to be here. I'm a little nervous and out of breath about all this. But really, 11 00:01:07,580 --> 00:01:13,440 this concept is all due to Artem Dynaberg, first and foremost. He presented this at DEF CON 12 00:01:13,440 --> 00:01:19,680 19. I unfortunately did not see his talk that year, but I saw Jason Schultz speak about it at 13 00:01:19,680 --> 00:01:25,640 DEF CON 21, which is really where it stuck in my mind. Robert also spoke at DEF CON 21 about DNS. 14 00:01:26,420 --> 00:01:29,800 there have been a few other papers and talks in various 15 00:01:29,800 --> 00:01:35,380 places over the years. So really quickly I'm going to introduce 16 00:01:35,380 --> 00:01:38,600 what I'm talking about, bit squatting, some background about 17 00:01:38,600 --> 00:01:42,880 it, which hopefully will not be too boring. I don't know what 18 00:01:42,880 --> 00:01:46,680 all the skill levels actually are in here, but then I'll talk 19 00:01:46,680 --> 00:01:48,720 about kind of what my motivations are, why I think it's really 20 00:01:48,720 --> 00:01:55,440 interesting. A little bit about the data I found and some of 21 00:01:55,440 --> 00:02:00,100 the mitigations. So, of course, what is bit squatting? Well, 22 00:02:01,340 --> 00:02:06,100 it's like typosquatting, but for bit flip domains, which 23 00:02:06,100 --> 00:02:09,940 hopefully not too many of you aren't unfamiliar, but just a 24 00:02:09,940 --> 00:02:13,520 quick refresher. Typosquatting is when you make a typographical 25 00:02:13,520 --> 00:02:18,120 error in your domain name. In this case, you might type 26 00:02:18,120 --> 00:02:21,640 Microsoft as microspift, because, you know, the P is 27 00:02:21,640 --> 00:02:25,100 right there next to the O. There's a bunch of other possible 28 00:02:25,640 --> 00:02:30,720 typos that could result from Microsoft.com, but I don't want to 29 00:02:30,720 --> 00:02:38,760 get into that too much. So the basics. Obviously, bit squatting 30 00:02:38,760 --> 00:02:44,460 relies on DNS. Also, the way ASCII works, the way the 31 00:02:44,460 --> 00:02:46,800 character encoding works, is important to how all this fits 32 00:02:46,800 --> 00:02:49,560 together. And then we'll be talking about memory errors, 33 00:02:49,640 --> 00:02:53,640 which is where the bit flips happen. I put it all together and 34 00:02:53,640 --> 00:02:55,080 hopefully figure out a way to do that. So I'm going to talk a 35 00:02:55,100 --> 00:02:55,180 little bit about DNS and why you might want to make a big profit. 36 00:02:57,400 --> 00:03:00,260 So hopefully not to be too introductory here. Obviously, 37 00:03:01,180 --> 00:03:04,940 you type a URL into your browser. Your browser has to 38 00:03:04,940 --> 00:03:07,820 figure out where it is. That's where DNS comes in. The domain 39 00:03:07,820 --> 00:03:11,500 name system looks up those names, translates them to 40 00:03:11,500 --> 00:03:16,980 addresses, and everything should be good. But if you've been an 41 00:03:16,980 --> 00:03:19,440 admin or, you know, have troubleshooted networks, you 42 00:03:19,440 --> 00:03:24,280 might know that DNS is a little trickier than it might need to 43 00:03:24,280 --> 00:03:25,080 be. And you need to know that DNS is a little trickier than it 44 00:03:25,100 --> 00:03:30,980 although most of those issues come from human error. But we'll be talking about computer 45 00:03:30,980 --> 00:03:37,220 errors in this case. To get an idea of kind of the magnitude of what we're talking about, I 46 00:03:37,220 --> 00:03:44,280 did a very highly scientific survey which resulted in the numbers of about 15 URLs typed per 47 00:03:44,280 --> 00:03:49,500 day. It may vary upon how you browse the Internet, how you use your computer. I know for 48 00:03:49,500 --> 00:03:56,420 me most of my browsing is kind of autocomplete. I visit a lot of the same sites. So that seemed 49 00:03:56,420 --> 00:04:01,760 like a pretty good number. But just for reference, I pulled that off of Quora. Very 50 00:04:01,760 --> 00:04:11,360 scientific, like I said. So, yeah, we have 15 typed URLs per day. But the issue here is not in 51 00:04:11,360 --> 00:04:18,120 those typed URLs. It's in the domains that come from automatically generated traffic. So 52 00:04:18,120 --> 00:04:19,460 when you load a Web site, you know, there's a lot of information that's in there that's 53 00:04:19,460 --> 00:04:19,480 automatically generated traffic. So when you load a Web site, you know, there's a lot of 54 00:04:19,480 --> 00:04:28,180 oral Internet. There will be secondary content, media, JavaScript, ads, whatever. And so I 55 00:04:28,180 --> 00:04:34,580 looked at the numbers from Open DNS. You know, they claim they have 65 million users daily 56 00:04:34,580 --> 00:04:41,620 who generate 135 billion events or queries, rather. So that comes out to be just about 2,100 57 00:04:41,620 --> 00:04:47,940 DNS queries per day per user. And only 15 of those are manually generated. So we're talking 58 00:04:47,940 --> 00:04:51,840 about the vast majority are automatically generated by 59 00:04:51,840 --> 00:04:59,800 computer. And so this I hope is not too introductory or not too 60 00:04:59,800 --> 00:05:02,100 small. I don't know if you guys can see it in the back but this 61 00:05:02,100 --> 00:05:07,280 is just a basic DNS query. I don't advise trying this 62 00:05:07,280 --> 00:05:12,600 particular domain out since this was from an exploit kit sample 63 00:05:12,600 --> 00:05:16,520 run unless you want to try finding some Russian malware or 64 00:05:16,520 --> 00:05:20,360 something. But you can see at the bottom part that's 65 00:05:20,360 --> 00:05:23,840 highlighted the string allboxing.ru is actually in the 66 00:05:23,840 --> 00:05:28,640 raw DNS query. So that actually goes over the wire, plain text, 67 00:05:29,600 --> 00:05:32,480 and the response comes back plain text as well. It's not 68 00:05:32,480 --> 00:05:37,100 highlighted in this case. I have the IP address highlighted but 69 00:05:37,100 --> 00:05:42,640 it's in there. So yeah to understand a little more it 70 00:05:42,640 --> 00:05:46,500 helps to know what ASCII is. But I'm not going to go into 71 00:05:46,520 --> 00:05:48,880 too much detail. This is a, I thought this was really cool, 72 00:05:48,960 --> 00:05:52,160 kind of the history of ASCII before ASCII. It's a 5 bit 73 00:05:52,160 --> 00:05:57,360 character encoding called Bodo. Not very important to this talk 74 00:05:57,360 --> 00:06:02,860 but I thought it was really cool. This is a older US ASCII 75 00:06:02,860 --> 00:06:06,900 code chart. It's valid but obviously if you read it, it 76 00:06:06,900 --> 00:06:12,340 looks a little weird. And shout out to ManPages. Anytime you 77 00:06:12,340 --> 00:06:15,820 want to look up something, I highly recommend ManPages. They 78 00:06:15,820 --> 00:06:16,500 got the ASCII code. And I'm going to show you some of the 79 00:06:16,500 --> 00:06:22,600 character map in there and everything. Basically what we're 80 00:06:22,600 --> 00:06:25,780 talking about is how these characters are encoded in 81 00:06:25,780 --> 00:06:29,580 memory and physically they represent actual ones and 82 00:06:29,580 --> 00:06:36,520 zeros. Some of you may or may not be familiar with this lovely 83 00:06:36,520 --> 00:06:41,100 DRAM stick here. All those black chips are actual, the 84 00:06:41,100 --> 00:06:46,480 actual memory modules. And this isn't the first time I've seen 85 00:06:46,480 --> 00:06:49,680 this. This isn't the best zoom but you can tell that the blocks 86 00:06:49,680 --> 00:06:53,860 are a little fuzzy and that's where the cells for the memory 87 00:06:53,860 --> 00:06:58,960 actually are. They're in rows and columns. And each one 88 00:06:58,960 --> 00:07:05,360 actually contains a zero one. But DRAM is prone to errors. 89 00:07:05,980 --> 00:07:09,020 Some of you may know. Hopefully you haven't encountered too many 90 00:07:09,460 --> 00:07:13,860 terrible errors in your life. But quickly let's talk about 91 00:07:13,860 --> 00:07:16,460 some of the error modes that can cause errors. The first one is 92 00:07:16,460 --> 00:07:20,800 issues with your memory. First of all, I think everybody will be 93 00:07:20,800 --> 00:07:23,920 well aware of the heat here in Vegas. This is definitely a 94 00:07:23,920 --> 00:07:29,980 factor in computing errors. There's been some very specific 95 00:07:29,980 --> 00:07:38,700 research. Sudgar here tried to do an experimental set up where 96 00:07:38,700 --> 00:07:43,580 they try to induce memory failures with direct heating 97 00:07:43,580 --> 00:07:46,440 components. Did you know that? I don't know. I don't know. I 98 00:07:46,440 --> 00:07:51,180 think it's interesting to try and attack the JVM. But 99 00:07:51,180 --> 00:07:53,620 interestingly, while doing the background research on these 100 00:07:53,620 --> 00:07:58,120 issues, I found this Google paper where they actually studied 101 00:07:58,700 --> 00:08:02,200 the DRAM error rates and causes across their, you know, very 102 00:08:02,200 --> 00:08:07,220 large infrastructure. They found that, surprisingly, heat was 103 00:08:07,220 --> 00:08:11,780 not very strong of a signal for error rates. It definitely has a 104 00:08:11,780 --> 00:08:15,500 correlation. But they found that utilization is actually the 105 00:08:15,500 --> 00:08:21,000 the strongest signal for when an error will occur. There's also a lot more data in there, so 106 00:08:21,000 --> 00:08:28,220 if you're interested in that kind of data stuff, definitely check out the paper. The next 107 00:08:28,220 --> 00:08:33,860 one, which is pretty interesting to me, is cosmic rays. You know, when I was younger, I 108 00:08:33,860 --> 00:08:38,220 heard this, you know, the standard bastard operator from hell. It's like, oh, cosmic ray 109 00:08:38,220 --> 00:08:43,540 caused that error. I can't do anything about it. But it's real, right? These rays can come 110 00:08:43,540 --> 00:08:50,280 from deep space, from, you know, whatever astrophysical anomaly or phenomenon, and come 111 00:08:50,280 --> 00:08:57,140 down to earth, hit your chip in just the right place, and cause memory errors. This has been 112 00:08:57,140 --> 00:09:07,780 experimentally tested in multiple cases. I think this study was from guys at IBM, and they 113 00:09:07,780 --> 00:09:13,340 found significant component of the error rates that you'll see in memory can be attributed 114 00:09:13,340 --> 00:09:13,520 to the fact that you can't do anything about it. So it's really interesting to see what 115 00:09:13,540 --> 00:09:18,860 you can do to cosmic rays. And not only that, but the effect of the error rates increases 116 00:09:18,860 --> 00:09:24,860 dramatically at higher altitudes. So if you flew here, or if you fly a lot, you're exposing 117 00:09:24,860 --> 00:09:31,300 yourself to possible bit flips. So if you're browsing on the airport Wi-Fi or the airline 118 00:09:31,300 --> 00:09:39,340 Wi-Fi, you know, be careful. Got to go a little fast, but so cosmic rays, this was kind of a 119 00:09:39,340 --> 00:09:43,520 follow-up paper where they studied cosmic rays. They found that the incidence was, you know, 120 00:09:43,520 --> 00:09:49,680 pretty low. I don't know if times have changed. There's fewer cosmic rays. But in their study, 121 00:09:49,700 --> 00:09:56,380 they found that the hard errors from things like manufacturing defects and physical issues with 122 00:09:56,380 --> 00:10:01,960 the circuits cause more errors, and particularly they cause repeat errors. So always scan your 123 00:10:01,960 --> 00:10:06,800 memory when you're setting up a new box. If you're into hardware hacking at all, you know, 124 00:10:06,880 --> 00:10:13,260 of course, that electrical stuff, you can cause glitches in CPUs. It can, you know, cause security 125 00:10:13,260 --> 00:10:19,560 faults and whatnot. I'm actually missing a slide, I think, from when my computer crashed. 126 00:10:22,420 --> 00:10:27,480 So there's also manufacturing defects, like I mentioned before. Some of these can be in the form 127 00:10:27,480 --> 00:10:33,520 of actual physical defects, but there's also been a number of cases of radioactive material being in 128 00:10:33,520 --> 00:10:40,580 the chip packaging and causing periodic soft errors. It's kind of an interesting, you know, 129 00:10:40,600 --> 00:10:42,660 permanent state of soft errors. 130 00:10:44,540 --> 00:10:52,900 But practically speaking, all of this, we want to see flip a 0 to a 1 or a 1 to a 0. And, you know, 131 00:10:52,900 --> 00:10:59,940 in specific terms, when we see the flip, you know, it might take the place here of flipping the 0 132 00:10:59,940 --> 00:11:09,140 and the A and causing it to become a C. So why am I interested in this? Well, nuclear radiation is 133 00:11:09,140 --> 00:11:13,240 also one of the sources, and since we have nuclear testing, we're going to be using nuclear radiation 134 00:11:13,260 --> 00:11:16,620 as well. But there is a lot of things happening in our day and age. I thought it kind of came back 135 00:11:16,620 --> 00:11:24,840 into my mind. Of course, this is also experimentally tested. This paper is literally titled 136 00:11:24,840 --> 00:11:31,800 The Evaluation of High Density DRAMs as a Nuclear Detector. Of course, there is some issues 137 00:11:31,800 --> 00:11:40,520 with range of detection, but, you know, still very cool to me. But really, in the end, users can 138 00:11:40,520 --> 00:11:43,240 be failed simply by the technology that they rely on. When people have to go reported to, you Can find french 139 00:11:43,240 --> 00:11:47,200 and do nothing wrong on their own to be exposed to potential 140 00:11:47,200 --> 00:11:52,700 risks. Or they may be cursed by the gods in the universe. So for 141 00:11:52,700 --> 00:12:01,560 my test here, I registered just about 30 domains. I tried to 142 00:12:01,560 --> 00:12:11,220 focus on news sites, some ad networks and particularly Asian 143 00:12:11,220 --> 00:12:14,120 focused sites. So there's a couple Asian news sites as well 144 00:12:14,120 --> 00:12:19,760 as HAL123, which is, I don't even know. Just a big Chinese 145 00:12:19,760 --> 00:12:27,760 site. So overall, I found a lot of activity, which is not 146 00:12:27,760 --> 00:12:31,720 surprising given the amount of crawlers and automated scans 147 00:12:31,720 --> 00:12:34,680 that happen on the internet these days. Just registering a 148 00:12:34,680 --> 00:12:38,720 domain will cause traffic to happen basically. So the top 149 00:12:38,720 --> 00:12:41,200 graph is the DNS results. I'm going to show you the results 150 00:12:41,220 --> 00:12:45,540 here. I saw about 25,000 DNS queries per week over the 151 00:12:46,300 --> 00:12:49,460 monitoring period. You'll notice a couple gaps there where 152 00:12:50,140 --> 00:12:56,020 somebody actually reported my infrastructure. So I had an 153 00:12:56,020 --> 00:13:01,120 outage for like a week. And then my script had an error. So I 154 00:13:01,120 --> 00:13:05,040 fixed that and then I got back up. The lower one is HTTP 155 00:13:05,040 --> 00:13:10,060 obviously. Significantly fewer requests actually came through 156 00:13:10,060 --> 00:13:11,200 HTTP. So I'm going to show you the results here. The lower one 157 00:13:11,220 --> 00:13:12,780 is HTTP. So it was very interesting to see the 158 00:13:12,780 --> 00:13:18,380 difference in just how much DNS traffic there is. In terms of 159 00:13:18,380 --> 00:13:23,700 the DNS results, the HAL123 flip was by far the, well, not by 160 00:13:23,700 --> 00:13:27,880 far, I guess. It was pretty close. But definitely a lot of 161 00:13:27,880 --> 00:13:30,600 requests for those. And then Blogspot and chase.com came up 162 00:13:30,600 --> 00:13:37,360 next. On the DNS results, HAL123 was still, oh, wait, 163 00:13:37,400 --> 00:13:41,200 skipped one. So you may have noticed actually that the 164 00:13:42,880 --> 00:13:47,420 first two graphs had a slight time difference. I had some 165 00:13:47,420 --> 00:13:52,360 issues with the HTTP monitor. And essentially in this graph, I 166 00:13:54,720 --> 00:14:00,300 redid the time for the DNS. So these requests were definitely 167 00:14:00,300 --> 00:14:02,840 geographically scattered, although you can see a very hot 168 00:14:02,840 --> 00:14:05,800 spot on the west coast. That's essentially from Google's 169 00:14:05,800 --> 00:14:10,520 infrastructure. Everybody loves using the quad 8s. HTTP request 170 00:14:10,520 --> 00:14:11,200 geo is pretty much the same. It's just a little bit different. 171 00:14:11,220 --> 00:14:14,460 Basically the same. But you can see that there's a larger hot 172 00:14:14,460 --> 00:14:18,180 spot in China. And certainly a lot of Chinese traffic in 173 00:14:18,180 --> 00:14:22,980 general. DNS sources, again, Google, by far the number one 174 00:14:22,980 --> 00:14:29,260 source. And mostly large infrastructure. HTTP was pretty 175 00:14:29,260 --> 00:14:33,160 similar. But Beijing moves up quite a bit. Or, sorry, the 176 00:14:33,160 --> 00:14:39,820 Beijing Baidu network moves way up in the ranks. So some 177 00:14:39,820 --> 00:14:41,200 interesting results. The first one is the HAL123, which is the 178 00:14:41,200 --> 00:14:46,320 one that I found. Unfortunately this was the only DNS side bit 179 00:14:46,320 --> 00:14:52,600 flip. What that means is that in this case, the host header is 180 00:14:52,600 --> 00:14:57,560 actually for the real domain. But the DNS and HTTP request came 181 00:14:57,560 --> 00:15:03,980 to my domain. So somewhere in the DNS path, the bit flipped and 182 00:15:03,980 --> 00:15:10,740 the DNS request went to Google user content with a C in the middle. And that came from 183 00:15:10,740 --> 00:15:16,060 India on a really crappy, like, worst smart phone ever. I don't know. 184 00:15:17,520 --> 00:15:24,640 I also saw a bunch of weird Android stuff from the Android search bot app. I don't know if this 185 00:15:24,640 --> 00:15:30,480 was all legit. I definitely spent a whole lot of time basically just filtering out bots in this 186 00:15:30,480 --> 00:15:40,440 experiment. We're just about done. All right. So I guess that's about it. There was some iOS home 187 00:15:40,440 --> 00:15:44,920 screen stuff, too. I thought this was interesting because this is specifically when you tag a 188 00:15:45,780 --> 00:15:54,460 website to your home screen. And all of this traffic came from China, basically. Saw these weird 189 00:15:54,460 --> 00:16:00,960 tags that I assume is some guy's scanner. The tag itself is a base 64 string that decodes to 190 00:16:00,960 --> 00:16:08,040 force SR with a Tibetan character behind it. And then there's bot cases, bot cases, bot cases. 191 00:16:10,440 --> 00:16:16,740 Some really interesting scans that use, like this one, they're trying to identify maybe different 192 00:16:16,740 --> 00:16:25,860 content that comes with use refer or not essentially lots of vulnerability scanners, lots of 193 00:16:25,860 --> 00:16:31,820 content scanners. So, yeah. All right. Thanks, guys.