1 00:00:00,000 --> 00:00:08,720 Hello, everyone. It is great to be here at DEF CON 19. Thank you 2 00:00:08,720 --> 00:00:13,080 all for being here. If you don't know me, hi, I'm Dan Kaminski 3 00:00:13,080 --> 00:00:20,240 and I write code. I am not here to fix authentication or regale 4 00:00:20,240 --> 00:00:23,980 you with stories of DNS or DNSSEC. These are still things 5 00:00:23,980 --> 00:00:30,180 I'm working on, but not today. Today is a return to form. As a 6 00:00:30,180 --> 00:00:34,440 community, we have sort of, was anyone here out of curiosity at 7 00:00:34,440 --> 00:00:38,760 my talk in like 2002 about Black Ops and TCP IP? Like anyone? 8 00:00:39,820 --> 00:00:42,840 Awesome. This is a sequel to that talk. 9 00:00:47,720 --> 00:00:48,780 Ah, got it. 10 00:00:51,700 --> 00:00:52,660 Hi, everybody. 11 00:00:54,060 --> 00:01:02,260 Worst impression ever. Let's see. How about this? Is this good? No? 12 00:01:08,820 --> 00:01:14,940 Logistics. No. How about this? Does this work? Awesome. Thank you, guys. 13 00:01:15,340 --> 00:01:18,840 All right. So we sort of stopped looking at network security, you know, 14 00:01:18,840 --> 00:01:23,680 mapping networks, evading firewalls, subverting design assumptions, you know, the various 15 00:01:23,980 --> 00:01:28,660 arts of messing with packets, kind of been abandoned and that's sort of a good thing. You know, 16 00:01:28,680 --> 00:01:34,560 when you actually look at how systems are broken into, it's the same game every time. SQL inject 17 00:01:34,560 --> 00:01:39,880 the web front end or PDF the client back end, take whatever credentials are on the box and move 18 00:01:39,880 --> 00:01:45,100 on with your life. It's not hard. Making hacking look difficult is just something we do so we 19 00:01:45,100 --> 00:01:52,320 look awesome to the other people. So, NETSEC is only so relevant in such an environment. You know, 20 00:01:53,980 --> 00:01:57,100 they don't need to have racks. So we do not care. This is what I like doing back in the day and 21 00:01:57,100 --> 00:02:02,360 we're gonna play with some packets. So what are we gonna start messing with here? We're gonna start 22 00:02:02,360 --> 00:02:08,260 messing with, of all things, bitcoin. Why not? It infects everything else, it should 23 00:02:08,260 --> 00:02:14,700 hit my talk too, you know. What is bitcoin? Well it's an attempt at making a digital currency 24 00:02:14,700 --> 00:02:20,240 with no central bank. Yeah. It's a system with economic properties. I don't know anything about 25 00:02:20,240 --> 00:02:23,960 it. I'm not an economist. But to be fair, neither are most economists. They're just whimsies. 26 00:02:23,960 --> 00:02:31,360 so it sort of works out. It's an overlay network upon the internet. It's like an internet on an 27 00:02:31,360 --> 00:02:38,400 internet that people think has certain properties. Now that, that is a toy to play with. So 28 00:02:39,740 --> 00:02:46,580 Bitcoin is built on doing three things. Transferring money. I, Alice, give Bob 2.1 29 00:02:46,580 --> 00:02:51,360 bitcoins. That's done with public key cryptography. You sign the message. And then there's 30 00:02:51,360 --> 00:02:58,300 gossip. Hey, everybody. Did you hear that Alice gave Bob 2.1 bitcoins? Alice goes ahead and 31 00:02:58,300 --> 00:03:03,500 gossips that out and it just spreads throughout the network like wildfire. Look at this great new 32 00:03:03,500 --> 00:03:08,840 news. And then there's a pending. Once about every ten minutes, someone on the network does 33 00:03:08,840 --> 00:03:15,400 enough computation to say, aha, the official record of all transactions ever should include that 34 00:03:15,400 --> 00:03:21,340 Alice paid Bob and Bob paid Charlie and Charlie paid David. And, you know, it's a lot of 35 00:03:21,340 --> 00:03:25,480 cryptographic work. How do you know if you've done enough work? Well, if the network generates 36 00:03:25,480 --> 00:03:31,720 answers any faster than ten minutes, you make the problem harder and harder and harder until it 37 00:03:31,720 --> 00:03:38,460 takes once every ten minutes. It's really quite elegant. And it's, you know, if it goes too fast, 38 00:03:38,620 --> 00:03:45,200 it self-corrects. So talking about Bitcoin, this is not my Bitcoin talk. Go to Dan Kaminski.com 39 00:03:45,200 --> 00:03:50,880 if you want to see some slides on that. The good news is that Bitcoin is really impressive. Anyone 40 00:03:50,880 --> 00:03:51,320 who's on the internet knows that Bitcoin is really impressive. Anyone who's on the internet 41 00:03:51,320 --> 00:03:51,420 knows that Bitcoin is really impressive. Anyone who's on the internet knows that Bitcoin is really 42 00:03:51,420 --> 00:03:53,160 is all dismissive of it and, you know, 43 00:03:53,160 --> 00:03:59,340 It's got all these bugs. No, they're just like missing. Like the first five times you 44 00:03:59,340 --> 00:04:06,240 think you understand Bitcoin, you're not even close. I'm on major bug 9 on Bitcoin that I was 45 00:04:06,240 --> 00:04:12,720 absolutely sure was gonna work. No they like the line of code that would have made that bug work 46 00:04:12,720 --> 00:04:18,760 is just not there. It's the mark of a pen tester is upon this software. 47 00:04:21,480 --> 00:04:25,800 Bitcoin has fixed almost all the flaws that aren't forced by the design. However, there are 48 00:04:25,800 --> 00:04:30,700 flaws forced by the design. It totally does not scale and it is absolutely not anonymous. 49 00:04:31,080 --> 00:04:36,660 What do I mean? If you go to the scalability page on the Bitcoin wiki, you will see the 50 00:04:36,660 --> 00:04:41,520 funniest document in the history of software engineering. Let me give you some quotes. I 51 00:04:41,520 --> 00:04:46,020 don't even need to talk about how Bitcoin doesn't scale because they say it. They're like, 52 00:04:46,020 --> 00:04:49,780 yeah, for bandwidth, eventually we're going to require every machine to exchange a gigabyte 53 00:04:49,780 --> 00:05:02,000 a second. CPU, you'll have to have 50 CPU cores just to participate. And storage, well, you 54 00:05:02,000 --> 00:05:06,580 might need a 3 terabyte hard drive every 21 days, but it's cool because they're like only 200 55 00:05:06,580 --> 00:05:14,680 bucks. And that's pretty affordable. This is their own page. I'm not making this up. So, you 56 00:05:14,680 --> 00:05:16,000 know, you end up with, like, super cheap hardware. You're going to have to spend a lot of money 57 00:05:16,000 --> 00:05:19,920 on these super nodes that do special stuff and everyone else who trusts them. We have another 58 00:05:19,920 --> 00:05:26,180 word for this. They're called banks. I'm not saying banks are bad. I'm just saying all of 59 00:05:26,180 --> 00:05:30,700 these economic properties of Bitcoin that everyone likes today are going to be gone 60 00:05:30,700 --> 00:05:37,120 tomorrow. I'm not saying those are the properties of a Ponzi scheme. . 61 00:05:39,700 --> 00:05:45,600 I'm just you know, until we get to this point that Bitcoin completely has to shift over to the 62 00:05:45,600 --> 00:05:50,420 banking model, who you know is a very interesting character by the name of 63 00:05:50,420 --> 00:05:59,300 Travis Goodspeed. You don't even know how ridiculous this guy is, but he asked me a 64 00:05:59,300 --> 00:06:04,240 great question. He said, Dan, could we use Bitcoin as a 65 00:06:04,240 --> 00:06:10,380 Sama's dot service as a way to store information and distribute it? You know 66 00:06:10,380 --> 00:06:15,320 three terabytes is an awful lot of data. There's an old challenge. I haven't thought 67 00:06:15,320 --> 00:06:22,220 of it in years. The internet is about sending data from point A to point B, at which point it 68 00:06:22,220 --> 00:06:27,740 just magically disappears. What if we could get away where it didn't magically disappear? Or in 69 00:06:27,740 --> 00:06:32,680 fact, it's stuck around forever? Well, the reason you need a three terabyte hard drive in 70 00:06:32,680 --> 00:06:38,860 Bitcoin is because basically all the transactions have to live forever somewhere. So if it's 71 00:06:38,860 --> 00:06:45,300 going to live forever, what can we do with this? Who here, who's here? 72 00:06:45,320 --> 00:06:52,980 Who here knew or knows Len Sassman? Len was one of our brightest lights in 73 00:06:52,980 --> 00:06:58,660 our community. There's a command that one can run on Bitcoin today and on Bitcoin 74 00:06:58,660 --> 00:07:04,120 forever on any node running Bitcoin. Strings bytes equals 20 dot Bitcoin 75 00:07:04,120 --> 00:07:09,420 slash block 0001 dot dat. Strings will go ahead and extract human readable text 76 00:07:09,420 --> 00:07:14,680 from any blob of data. We usually use it to find hard-coded passwords inside of 77 00:07:15,320 --> 00:07:21,100 multi-length executables. Well, if we run this on the block database of all transactions ever 78 00:07:21,720 --> 00:07:25,940 moved through Bitcoin on any machine in the world participating, you know what you get? 79 00:07:26,600 --> 00:07:43,880 Well. Len was our friend, and was a brilliant mind, a kind soul, and a devious schemer. His 80 00:07:45,500 --> 00:07:49,520 He was brother to Calvin, who is here at his first DEF CON ever. 81 00:07:55,560 --> 00:08:03,020 Son to Jim and Dana Hartorn, co-author of mine and of many others, co-founder of Shmoo 82 00:08:03,020 --> 00:08:04,060 and so much more. 83 00:08:04,460 --> 00:08:09,320 We dedicate this very silly hack to Len, who would have found it absolutely hilarious. 84 00:08:09,320 --> 00:08:17,520 And just to increase the amusement factor, and Len would have loved this, Bitcoin is 85 00:08:17,520 --> 00:08:20,600 now dependent until the end of time on Len. 86 00:08:22,000 --> 00:08:28,440 Bitcoin is also dependent until the end of time on the head of the Federal Reserve, Ben 87 00:08:28,440 --> 00:08:29,000 Bernanke. 88 00:08:32,800 --> 00:08:33,480 Excellent. 89 00:08:34,580 --> 00:08:36,840 So how did we do this? 90 00:08:37,040 --> 00:08:39,300 In Bitcoin, Alice gives money to Ben. 91 00:08:39,320 --> 00:08:43,880 Bob, by issuing a sort of challenge, whoever can sign a message with the public key that 92 00:08:43,880 --> 00:08:48,780 hashes to the following bytes, that has the following fingerprint, may claim this money. 93 00:08:49,200 --> 00:08:51,720 Well, bytes are bytes. 94 00:08:52,120 --> 00:08:57,640 Instead of pushing the hash of a public key, we push 20 characters of a testimonial 78 95 00:08:57,640 --> 00:08:58,420 times. 96 00:08:59,380 --> 00:09:01,240 There are consequences to this. 97 00:09:01,540 --> 00:09:02,680 It does cost money. 98 00:09:02,860 --> 00:09:04,040 Cost about a Bitcoin. 99 00:09:04,320 --> 00:09:06,060 There are minimums to transferring money. 100 00:09:06,240 --> 00:09:09,060 This does destroy the money forever. 101 00:09:09,060 --> 00:09:15,440 The Bitcoin network is thoroughly convinced that somewhere, somehow, there must be a public 102 00:09:15,440 --> 00:09:18,920 key with the hash that Len was our friend. 103 00:09:20,120 --> 00:09:21,620 I am totally cool with that. 104 00:09:24,020 --> 00:09:27,260 This is the cyber equivalent of pouring one out for your homies. 105 00:09:36,900 --> 00:09:38,920 So, can we get higher bandwidth? 106 00:09:38,960 --> 00:09:39,040 Yeah. 107 00:09:39,780 --> 00:09:44,280 Bitcoin does let you send money to a public key directly, rather than its hash. 108 00:09:44,440 --> 00:09:46,860 So, that gives you like a 10X increase in bandwidth. 109 00:09:47,360 --> 00:09:48,660 That's not good enough. 110 00:09:49,700 --> 00:09:53,200 Bitcoin allows for extra data in a signature. 111 00:09:53,420 --> 00:09:56,640 A really beautiful style, too. 112 00:09:57,650 --> 00:09:59,620 You see, Bitcoin works with small programs. 113 00:09:59,980 --> 00:10:05,940 The program from the receiver says, please put this signature in public key on a stack. 114 00:10:06,160 --> 00:10:07,480 A pile of data. 115 00:10:07,700 --> 00:10:07,780 Yeah. 116 00:10:09,040 --> 00:10:14,020 the sender is, hey, take the signature and public key off the stack and make sure they're good. 117 00:10:14,680 --> 00:10:19,320 If you look at this just from a language perspective, Meredith's research is all about 118 00:10:19,320 --> 00:10:26,500 language theoretic security. What if there is extra data that the receiver puts on? 119 00:10:27,000 --> 00:10:31,460 You know, I don't know, some video file or something. I don't know why someone crazy would 120 00:10:31,460 --> 00:10:38,540 do that. Well, the sender just says, take the signature and public key off the stack. 121 00:10:38,780 --> 00:10:43,880 Doesn't say anything about making sure there's not more data. So, this just works fine. 122 00:10:44,340 --> 00:10:49,140 Now, what's funny, this bug shows up all the time in signature checking systems. 123 00:10:50,260 --> 00:10:56,800 It's not just the sender of money who can add the extra content. See, a signature can't cover 124 00:10:56,800 --> 00:11:01,420 itself. When you sign a document, you don't sign the signature because the signature is 125 00:11:01,420 --> 00:11:05,640 not there yet. It's a chicken and egg problem. So, you're signing everything but the signature 126 00:11:05,640 --> 00:11:12,200 and the extra crap that's been thrown in with the signature. Now, in Bitcoin, eventually the 127 00:11:12,200 --> 00:11:19,000 extra crap does become part of the permanent set of data, the so-called block. But there is time 128 00:11:19,000 --> 00:11:25,900 between when the transaction is sent and when that thing happens every 10 minutes to merge 129 00:11:25,900 --> 00:11:30,740 stuff in. And in that time, it's not just the sender of the money who can add extra data. 130 00:11:30,820 --> 00:11:31,400 It's the sender of the money who can add extra data. 131 00:11:31,420 --> 00:11:38,320 It's like anyone can add extra data because it's unsigned. Oops. So, this is some limited 132 00:11:38,320 --> 00:11:42,960 usefulness. If you're some random relay that's gossiping this stuff around, you know, Bitcoin 133 00:11:42,960 --> 00:11:49,340 does charge you money or Bitcoins per kilobyte of your message. So, the random relay can't add 134 00:11:49,340 --> 00:11:55,580 all that much. So, this limit doesn't count if you're the one adding the extra data because you 135 00:11:55,580 --> 00:12:01,320 can just pay the fee. It's about, you know, 14 cents per kilobyte to put something on, you know, 136 00:12:01,420 --> 00:12:09,080 a huge multi-million dollar Bitcoin thing. Also, it does not count if you generate the block. So, 137 00:12:09,160 --> 00:12:13,940 if you're the guy who does the work every 10 minutes, you can go ahead and make everyone in 138 00:12:13,940 --> 00:12:21,040 the world store two megabytes of data, no problem. So, Amy and Travis are talking. Yes, we can 139 00:12:21,040 --> 00:12:29,020 totally do the Bitcoin file system. Now, what about anonymity? Let's look at blockexplorer.com. 140 00:12:29,260 --> 00:12:31,120 This is the big site that tells you what's going on. 141 00:12:33,020 --> 00:12:39,940 We have a bunch of sources of money and a bunch of destinations. All of these sources are the same 142 00:12:39,940 --> 00:12:46,520 guy. So, you get obvious pseudonym linking in Bitcoin. One of these two destinations is all the 143 00:12:46,520 --> 00:12:50,100 guys on the left. That's your sort of change when you've paid too much and you need some money 144 00:12:50,100 --> 00:12:55,820 back. And you can build these great graphs. I was going to show you some of mine, but Reid and 145 00:12:55,820 --> 00:13:00,820 Harrigan actually did a much better job in that recent Bitcoin is not anonymous paper. So, they 146 00:13:00,820 --> 00:13:01,400 got their pretty good job. So, you can build these great graphs. I was going to show you some of 147 00:13:01,400 --> 00:13:07,240 their pretty pictures. Now, the problem is, is that they got lucky, right? Like, the way they got to IP 148 00:13:07,240 --> 00:13:14,020 addresses is some jackass shows up on a forum and is like, hi, I'm Bob Jones and my Bitcoin ID is this. 149 00:13:15,180 --> 00:13:23,240 Yes, that will, in fact, de-anonymize you, idiot. Another user, you know, another system when it 150 00:13:23,240 --> 00:13:28,600 gives Bitcoins, it tells the IP of who it gave it to. So, they're getting de-anonymization. They're 151 00:13:28,600 --> 00:13:31,380 getting pseudonym linking. Those IDs link to each other. So, they're getting pseudonym linking. 152 00:13:31,400 --> 00:13:36,140 Those IDs link to each other within Bitcoin. But if you want IP addresses, that's out of band. This 153 00:13:36,140 --> 00:13:42,200 audit trail is noisy and deniable. And, you know, the authors of this paper know it. Is there another 154 00:13:42,200 --> 00:13:47,820 source of data? Well, there are two sources of transaction information in Bitcoin. There's the 155 00:13:47,820 --> 00:13:52,380 blocks that contain the historical record. There's also the loose transactions that are getting 156 00:13:52,380 --> 00:13:57,980 gossiped all over the place. So, it's a relay race. Alice tells Bob and Charlie. Bob tells David 157 00:13:57,980 --> 00:14:01,380 and Eric. Charlie tells Frank and Gary. So, it's a relay race. So, it's a relay race. So, it's a 158 00:14:01,400 --> 00:14:06,920 relay race. So, what you do is you just connect to all the Bitcoin nodes in the world. And you 159 00:14:06,920 --> 00:14:12,220 say, oh, my God, that would be like 50,000 connections. Yeah, computers are powerful now, it 160 00:14:12,220 --> 00:14:19,080 turns out. So, when you connect to every node in the world, the first node to inform you of a 161 00:14:19,080 --> 00:14:28,020 transaction is the source. He don't relay it because he done done it. So, I wrote some code, 162 00:14:28,080 --> 00:14:31,380 which I can't demo for time constraints. It's called Blitcoin. It's called Blitcoin. It's a 163 00:14:31,400 --> 00:14:34,860 ühr. Blitcoin can be linked to everyone, but it's like a server. It does accelerated probing of 164 00:14:34,860 --> 00:14:45,500 Bitcoin. So, you can scan the entire Internet on 8333 TCP. You can join the IRC channels. Bitcoin 165 00:14:45,500 --> 00:14:51,180 runs like a command and control. So, you just have this thing called Bit. It connects to all the 166 00:14:51,180 --> 00:14:57,960 IRC channels, watches everyone who's connecting. Or you can just add, ask every node, hey, what 167 00:14:57,960 --> 00:15:01,380 are the nodes do you know about. And they'll tell you, they'll give you a map of the network. 168 00:15:01,400 --> 00:15:08,020 within 30 seconds. Now the Bitcoin devs want to be very clear they know Bitcoin 169 00:15:08,020 --> 00:15:11,500 is not anonymous and they wanted me to spread this out that you know this is 170 00:15:11,500 --> 00:15:15,360 just not a feature they're working on. So don't think it's not 171 00:15:15,980 --> 00:15:23,380 intentional. What about Tor? Well Tor is interesting. Tor will go ahead and hide 172 00:15:23,380 --> 00:15:27,700 the IP address for all your outbound connections when the Bitcoin node talks 173 00:15:27,700 --> 00:15:31,280 the rest of the world. But what if the rest of the world is scanning every IP 174 00:15:31,280 --> 00:15:34,800 address on the internet looking for who's listening for Bitcoin? Tor doesn't 175 00:15:34,800 --> 00:15:38,900 do anything about that. So there's actually a bug file now in Bitcoin to 176 00:15:38,900 --> 00:15:42,380 say when running through Tor how about we not listen for incoming connections. 177 00:15:43,360 --> 00:15:47,840 But unreachable nodes? Well most are just behind NAT and you can't connect to 178 00:15:47,840 --> 00:15:51,460 them they can only connect out. We already have sort of a super node 179 00:15:51,460 --> 00:15:57,400 situation. There's only about 3,000 to 8,000 Bitcoin nodes maybe you know 10% 180 00:15:57,400 --> 00:16:00,720 to 20% of the nodes in the world that you can go ahead and just 181 00:16:00,720 --> 00:16:01,260 arbitrarily connect to. 182 00:16:01,280 --> 00:16:08,100 And that's awesome because now I create another couple hundred incoming 183 00:16:08,100 --> 00:16:14,660 only Bitcoin nodes and the other 50,000 depend on me. So they come to me and they 184 00:16:14,660 --> 00:16:17,400 make a direct connection and now again the first people who connect to me and 185 00:16:17,400 --> 00:16:21,340 tell me of a transaction I know who they are. So probably only need about a 186 00:16:21,340 --> 00:16:27,660 few hundred. Let's talk about unreachable. Many users are behind wireless routers 187 00:16:27,660 --> 00:16:31,200 you know these little Wi-Fi devices from Linksys. Like poor man's 188 00:16:31,280 --> 00:16:35,900 firewalls. Now there's a protocol that most of these devices accept called UPnP 189 00:16:35,900 --> 00:16:41,700 and it allows nodes inside your network to say hey can you all let the outside 190 00:16:41,700 --> 00:16:47,160 world in. And there's a protocol that allows you know you to discover that you 191 00:16:47,160 --> 00:16:51,560 can ask for inbound connections. I have to sort of speed through this a little. 192 00:16:52,780 --> 00:17:00,840 Well UPnP opens up firewall holes from the inside to the outside. Man it really be bad. 193 00:17:01,280 --> 00:17:06,460 If that service wasn't just available on the internal network. If like people on the 194 00:17:06,460 --> 00:17:14,920 internet could just say hey firewall can you not be a firewall? God damn it. 195 00:17:18,060 --> 00:17:24,800 Hundreds of thousands to millions of these things are out there. Now of what I just showed 196 00:17:24,800 --> 00:17:30,740 you they're not all fully open. The Microsoft code is great. It actually requires this random 197 00:17:30,740 --> 00:17:35,420 identifier that you have to be on the internal network to discover. But every other vendor 198 00:17:35,420 --> 00:17:41,940 is just like well you know we have this code and it's the most widely deployed code in 199 00:17:41,940 --> 00:17:46,640 the world and you can reach it from the internet from everywhere but our budget for this device 200 00:17:46,640 --> 00:17:54,520 is like four dollars. Maybe we aren't number one on the security. So I don't need to go 201 00:17:54,520 --> 00:17:59,840 into this because there's another speaker who found this first. So I just got to refer to 202 00:17:59,840 --> 00:18:06,200 him. Daniel Garcia he's speaking in track three today at five o'clock. He found that there were 203 00:18:06,200 --> 00:18:12,440 open UPnP nodes on the net last year. So now we're starting to collaborate to figure out what the 204 00:18:12,440 --> 00:18:19,740 exact number is. Another guy Dutch, Armin Hemmel I think I pronounced his name right. He's doing 205 00:18:19,740 --> 00:18:27,400 some great work too. He's at upnphacks.org. The one thing to realize this was found in 2007 and it's 206 00:18:27,400 --> 00:18:28,040 still broken. 207 00:18:28,040 --> 00:18:33,680 So yeah things oh by the way the other nice thing about home routers it's not like they patch. 208 00:18:35,620 --> 00:18:42,780 Yeah it's like a worst case scenario. So what about outside the consumer space? Corporate 209 00:18:42,780 --> 00:18:49,820 environments. These are less about Bitcoin and UPnP and more about web services and ACLs. 210 00:18:49,940 --> 00:18:55,760 ACLs and access control list says oh you want to access this resource you better be coming from 211 00:18:55,760 --> 00:18:58,020 this IP address. So of course we lie about that. We don't like to lie to people that we're not 212 00:18:58,040 --> 00:19:03,740 through our teeth. You know what's called IP spoofing. You just pretend to be some IP that 213 00:19:03,740 --> 00:19:08,560 the system trusts. You might say, but, but, but I thought networks blocked spoofing. It's like, 214 00:19:08,580 --> 00:19:13,860 yeah, they block spoofing from, like, your cable modem. I'm on the core of the internet. It does 215 00:19:13,860 --> 00:19:20,300 not give a crap what IP address I claim. The one thing that does care about IP spoofing, though, 216 00:19:20,400 --> 00:19:26,140 I have finally found something that the cloud does not do well. If you are running in a virtual 217 00:19:26,140 --> 00:19:32,380 node and you want to spoof packets, good luck. You can't do it. The hypervisor will stop you. 218 00:19:32,620 --> 00:19:35,540 You'd have to, I don't know, like, have a hypervisor exploit. No one has those. 219 00:19:39,680 --> 00:19:45,400 So is IP spoofing still effective to do interesting things? Well, there's a DNS trick that I've been 220 00:19:45,400 --> 00:19:51,680 sitting on for a couple years. You know, in DNS, you go to a server. You say, hey, go look up this 221 00:19:51,680 --> 00:19:54,900 domain. The server goes and runs around the internet, looks for the domain. 222 00:19:56,140 --> 00:20:01,820 So you say, oh, hey, go look up a domain I control. And I'm, you know, this random IP. You're 223 00:20:01,820 --> 00:20:06,260 not going to get the reply with the answer, but that server has to go run around the internet to 224 00:20:06,260 --> 00:20:12,640 go satisfy the request. And they'll run around to you. So you now see, oh, okay, my spoof type 225 00:20:12,640 --> 00:20:19,180 request spawns another request that comes back to me through another channel. Now, this only works 226 00:20:19,180 --> 00:20:25,880 for obscure applications like DNS and UDP. Certainly nothing built on TCP, right? 227 00:20:26,500 --> 00:20:33,340 Well, limits of IP spoofing. Most modern protocols run over TCP. It's a reliable 228 00:20:33,340 --> 00:20:38,540 communication protocol. And TCP has sequence numbers. They're kind of like passwords that 229 00:20:38,540 --> 00:20:43,900 are exchanged at the beginning of a session to make sure that each side is really able to hear 230 00:20:43,900 --> 00:20:50,060 the other side. And it's rather effective. And it means when you don't get the reply because you 231 00:20:50,060 --> 00:20:55,040 spoofed your address, you're not able to get to the point at TCP where data is really going to be 232 00:20:55,040 --> 00:20:55,400 exchanged. 233 00:20:56,440 --> 00:21:00,940 Now, sequence numbers didn't used to be random, which meant people could just guess them out of, 234 00:21:00,940 --> 00:21:07,460 you know, out of thin air. Okay. So let's go ahead and make them random. Well, you can't just go 235 00:21:07,460 --> 00:21:11,620 ahead and make them random. See, the problem is that sequence numbers did not start out as 236 00:21:11,620 --> 00:21:17,640 passwords. They started out as markers. Where inside a session, here's a bunch of bytes. Are 237 00:21:17,640 --> 00:21:22,620 they on page 1? Are they on page 100? Are they on page 500? You've got to know where to put the 238 00:21:22,620 --> 00:21:26,120 words. So the deal is, you can't just go ahead and make them random. You've got to know where to put 239 00:21:26,120 --> 00:21:32,960 the words. So the deal is, let's save a connection from 24123 on port 50000 and 4221 on port 53. You've 240 00:21:32,960 --> 00:21:39,060 got to make sure if there are two connections and all that stuff is recycled that random packets 241 00:21:39,060 --> 00:21:44,000 from the old session don't show up in the new session. It would be like you're reading a book and, 242 00:21:44,040 --> 00:21:50,180 you know, suddenly a page from some other book shows up. It would be rather confusing. So the game 243 00:21:50,180 --> 00:21:55,460 is to have, you know, random sequence numbers unless the idea is the same. And then we go sequential. 244 00:21:56,120 --> 00:22:01,100 And that's done with a hashing function where you hash all the data with the secret. You get some 245 00:22:01,100 --> 00:22:09,380 absolute number and you add time. So if you have a slight difference in, you know, 2345 to 2346, 246 00:22:09,960 --> 00:22:14,480 the numbers become much different. But if it's absolutely identical, it becomes sequential with 247 00:22:14,480 --> 00:22:20,780 time. Now there's a problem. What if someone just floods us with connection requests? They don't 248 00:22:20,780 --> 00:22:24,940 have to remember all the passwords. They just need to, like, flood us with requests and we need to 249 00:22:24,940 --> 00:22:25,820 remember their passwords. 250 00:22:26,300 --> 00:22:32,320 So we run out of resources. The sin flood. It's older than dirt. The solution is came from Dan Bernstein, 251 00:22:32,600 --> 00:22:39,660 it's called sin cookies. And basically what is sent out to the requester is a challenge. If you can read 252 00:22:39,660 --> 00:22:45,920 this challenge, if you can respond, all right, I'll go ahead and I'll store some memory. And there's 24 253 00:22:45,920 --> 00:22:53,820 bits of security there. So, okay, 24 bits, that's, you know, 2 to the 24th is 16 million. Takes about 254 00:22:53,820 --> 00:22:55,520 8 million packets. 255 00:22:56,120 --> 00:23:09,320 To go ahead, if sin cookies are enabled, and guess what the cookie would be. And it might actually be a little less. So DJB knew this, right? It's like no matter what you do, the attacker will succeed in a connection forgery after millions of random act packets. 256 00:23:09,980 --> 00:23:25,880 Well, there's something that's changed in 1999 to 2011. Networks are really fast. Sending 8 million packets, not that big a deal. When you have a spoofed acknowledgement, you can also throw a bunch of data in there. 257 00:23:26,120 --> 00:23:37,160 You can throw, like, a web services payload. So if you have like a web, like an apache server, and it's behind an access control list that says only connections from IP 258 00:23:37,160 --> 00:23:42,400 I trust, every 8 million packets, he's gonna get a fake packet from an IP it trusts. 259 00:23:42,600 --> 00:23:46,980 And it's gonna be received and get to do whatever it wants. Not so good. 260 00:23:47,820 --> 00:23:49,060 Now, what about on Linux? 261 00:23:49,460 --> 00:23:55,980 What do we do on Linux? Well, so, Linux has sin cookies on by default, But even if 262 00:23:56,120 --> 00:24:03,200 disable it, what did the actual sequence numbers look like? Are they RFC 1948? Are 263 00:24:03,200 --> 00:24:09,400 they randomized unless you have the same source port, desk port, source IP, desk 264 00:24:09,400 --> 00:24:15,140 port, desk IP? Totally randomized. Well, okay, not totally. Three-fourths of its 265 00:24:15,140 --> 00:24:21,340 are randomized. The lower 24 bits are pretty strong. The upper 8 bits, no, no, 266 00:24:21,400 --> 00:24:25,200 that's just like sequential, just keeps incrementing one every five minutes, and 267 00:24:25,200 --> 00:24:33,620 it gives that number to everyone. So you can go ahead, find out the offset being 268 00:24:33,620 --> 00:24:37,260 your real IP, and then you know every sequence number that everyone else is 269 00:24:37,260 --> 00:24:42,440 going to use. And after eight million tries, you win. So this lets you go ahead, 270 00:24:42,680 --> 00:24:47,200 and there are some old attacks on reset hacking, so you'd shut down a session 271 00:24:47,200 --> 00:24:53,220 without actually knowing the codes before, or the sequence numbers 272 00:24:53,220 --> 00:24:55,180 before. It would take, you know, 273 00:24:55,180 --> 00:25:01,780 128 packets to kill a session in the worst case. Now it's a one packet kill. The 274 00:25:01,780 --> 00:25:06,960 other problem is that you might have a live session between two hosts. I have 275 00:25:06,960 --> 00:25:10,940 to skip through this quickly, I'm so sorry. You might have a live session 276 00:25:10,940 --> 00:25:16,760 between two hosts, and there's 64 bits of security between them. 2 to the 277 00:25:16,760 --> 00:25:22,020 64 is an ungodly number of packets. But there's windowing, which says kind of 278 00:25:22,020 --> 00:25:25,020 like a range of where the password can be. So that cuts off. 279 00:25:25,180 --> 00:25:27,100 16 bits in each direction. So now we're down 280 00:25:27,100 --> 00:25:29,140 to 2 to the 32. 4 billion 281 00:25:29,140 --> 00:25:30,620 packets. Oh man, that's a lot. 282 00:25:31,220 --> 00:25:33,160 Now we cut off another 5 bits 283 00:25:33,160 --> 00:25:35,220 because the windows might be really big 284 00:25:35,220 --> 00:25:36,420 through something called window scaling. 285 00:25:36,920 --> 00:25:39,180 Oh, okay, now you're down from 32 286 00:25:39,180 --> 00:25:41,220 bits to 22 bits. So now 287 00:25:41,220 --> 00:25:43,120 it's a million packets to go 288 00:25:43,120 --> 00:25:44,820 ahead and inject into a session. 289 00:25:45,140 --> 00:25:47,120 By inject into a session, let me translate 290 00:25:47,120 --> 00:25:49,040 this into the world's 291 00:25:49,040 --> 00:25:51,180 most difficult cross-site scripting attack. 292 00:25:53,560 --> 00:25:55,060 Now, because the 293 00:25:55,180 --> 00:25:57,260 8 bits are known in each direction, 294 00:25:57,400 --> 00:25:59,140 we have a problem because we take 22 295 00:25:59,140 --> 00:26:01,240 minus 8, minus 296 00:26:01,240 --> 00:26:03,140 8, 6 bits. It 297 00:26:03,140 --> 00:26:05,260 takes 16 packets to have 298 00:26:05,260 --> 00:26:07,340 a 50% chance of the world's 299 00:26:07,340 --> 00:26:08,240 greatest cross-site script. 300 00:26:09,560 --> 00:26:10,160 Crap. 301 00:26:11,240 --> 00:26:13,320 Now that does get a little harder because 302 00:26:13,320 --> 00:26:14,720 there's port randomization, 303 00:26:14,960 --> 00:26:15,520 but 304 00:26:16,900 --> 00:26:19,240 the port randomization adds at most 305 00:26:19,240 --> 00:26:21,040 13 bits, so it's still only 306 00:26:21,040 --> 00:26:22,720 250,000 packets. 307 00:26:23,060 --> 00:26:24,980 That may not even happen with port 308 00:26:24,980 --> 00:26:25,160 randomization. 309 00:26:25,180 --> 00:26:27,160 If you have a client that's 310 00:26:27,160 --> 00:26:29,020 forcibly setting its ports, which 311 00:26:29,020 --> 00:26:31,040 actually happens with DNS and BGP. 312 00:26:31,880 --> 00:26:32,860 So status, 313 00:26:33,020 --> 00:26:34,780 this is some very old code in Linux. 314 00:26:34,920 --> 00:26:37,020 It actually predates Linus 315 00:26:37,020 --> 00:26:39,060 Torvald's check-in history into 316 00:26:39,060 --> 00:26:40,060 the Linux source tree. 317 00:26:40,820 --> 00:26:42,880 So this bug's been there since the 318 00:26:42,880 --> 00:26:44,100 late 90s. 319 00:26:44,640 --> 00:26:47,140 They're figuring out right now the right fix that won't 320 00:26:47,140 --> 00:26:48,440 cause even more problems. 321 00:26:48,700 --> 00:26:51,020 There's a ton of fixes you could do that 322 00:26:51,020 --> 00:26:52,720 would make things even worse. 323 00:26:53,760 --> 00:26:54,580 So digression. 324 00:26:55,180 --> 00:26:57,060 Check my time here, make sure I'm not going to go over. 325 00:26:57,260 --> 00:26:57,440 Alright. 326 00:26:58,280 --> 00:27:00,960 RFC 1948 is an interesting construction. 327 00:27:01,420 --> 00:27:03,280 It is sequential and ordered 328 00:27:03,280 --> 00:27:04,480 if you have secrets, 329 00:27:04,800 --> 00:27:06,620 and it is random and unpredictable 330 00:27:06,620 --> 00:27:07,440 without. 331 00:27:09,140 --> 00:27:11,320 It's actually kind of a public and private 332 00:27:11,320 --> 00:27:13,220 system. There's the private 333 00:27:13,220 --> 00:27:15,300 component, the sequence number is mixed 334 00:27:15,300 --> 00:27:17,320 with like a secret, and you can generate 335 00:27:17,320 --> 00:27:19,140 all possible secrets with that thing, 336 00:27:19,160 --> 00:27:20,160 so it's like a private key. 337 00:27:20,660 --> 00:27:23,320 There's like a public component. I give you 338 00:27:23,320 --> 00:27:25,080 one of the generated values, 339 00:27:25,180 --> 00:27:27,500 and if you can see it on the network, 340 00:27:27,700 --> 00:27:30,340 you can communicate for that one session 341 00:27:30,340 --> 00:27:33,820 as that one IP using that one set of 342 00:27:33,820 --> 00:27:35,420 connection identifiers which are ports. 343 00:27:36,200 --> 00:27:39,480 So wow, that's like public-private 344 00:27:39,480 --> 00:27:41,840 cryptography without nothing but a 345 00:27:41,840 --> 00:27:44,340 password. Clearly this is impossible. 346 00:27:45,100 --> 00:27:47,540 It's only possible here because we're at 347 00:27:47,540 --> 00:27:49,680 the intersection of network security and 348 00:27:49,680 --> 00:27:52,000 cryptography. You guys know what public 349 00:27:52,000 --> 00:27:54,500 private cryptography is? Just as a quick 350 00:27:54,500 --> 00:27:55,020 example, 351 00:27:56,640 --> 00:27:59,580 a photo of my face can be a public key, 352 00:27:59,680 --> 00:28:02,680 and my actual face is a private key. 353 00:28:02,840 --> 00:28:04,820 It's very easy for people to identify me 354 00:28:04,820 --> 00:28:06,880 from a photo. It's very hard for them to 355 00:28:06,880 --> 00:28:09,940 mash their face into being my face. 356 00:28:10,200 --> 00:28:11,640 So it's all about asymmetry. 357 00:28:14,300 --> 00:28:16,660 Now I want to be clear here. What I'm 358 00:28:16,660 --> 00:28:18,980 about to tell you is a terrible idea. 359 00:28:20,100 --> 00:28:22,120 However, no words say on the DEF CON 360 00:28:22,120 --> 00:28:24,500 signup form that everything you say must 361 00:28:24,500 --> 00:28:28,280 be a good idea. In fact, not usually the 362 00:28:28,280 --> 00:28:31,060 case. Passwords are a bad idea. They're 363 00:28:31,060 --> 00:28:32,960 constantly being lost and forgotten and 364 00:28:32,960 --> 00:28:35,200 stolen. They're responsible for 50% of 365 00:28:35,200 --> 00:28:37,020 compromises. They increasingly look like 366 00:28:37,020 --> 00:28:40,180 leet speak. It's not helping. But let's 367 00:28:40,180 --> 00:28:41,900 ignore all that for a moment. Assume we're 368 00:28:41,900 --> 00:28:44,680 stuck with them. How do we use a password 369 00:28:44,680 --> 00:28:46,380 to log into a system without that system 370 00:28:46,380 --> 00:28:48,260 learning our password? Well, people say, 371 00:28:48,360 --> 00:28:51,240 oh, you know, you idiots, you should be 372 00:28:51,240 --> 00:28:53,880 hashing the data in your database. That's 373 00:28:53,880 --> 00:28:56,440 nice. The web app is still receiving the 374 00:28:56,440 --> 00:28:58,740 password in plain text. The attacker just 375 00:28:58,740 --> 00:29:00,880 modifies the web app to send the plain 376 00:29:00,880 --> 00:29:04,980 text to them. So it doesn't help. Next thing, 377 00:29:05,100 --> 00:29:08,080 we challenge you to mix your password 378 00:29:08,080 --> 00:29:11,260 with this particular hash and then we'll 379 00:29:11,260 --> 00:29:13,340 never have to send the plain text 380 00:29:13,340 --> 00:29:15,660 password on the wire. This is a thing 381 00:29:15,660 --> 00:29:19,380 called digest or NTLM. The problem is if 382 00:29:20,080 --> 00:29:22,300 you're hashing the plain text password 383 00:29:22,300 --> 00:29:23,780 with some random 384 00:29:23,880 --> 00:29:27,400 value, they got to do that too. They got 385 00:29:27,400 --> 00:29:28,940 to store the plain text password or some 386 00:29:28,940 --> 00:29:32,280 password equivalent version. There are 387 00:29:32,280 --> 00:29:34,380 things where you say, we require 388 00:29:34,380 --> 00:29:36,240 knowledge of the password to complete 389 00:29:36,240 --> 00:29:39,440 this complicated, asymmetric 390 00:29:39,440 --> 00:29:43,900 crypto magic foo. Speak does this and 391 00:29:43,900 --> 00:29:46,320 SRP does this. It requires the client 392 00:29:46,320 --> 00:29:47,780 and server to run some really obscure 393 00:29:47,780 --> 00:29:49,860 code and good luck getting that code 394 00:29:49,860 --> 00:29:53,860 deployed. What are we going to do? Is it 395 00:29:53,880 --> 00:29:56,800 possible, not advisable, but is it 396 00:29:56,800 --> 00:29:58,700 possible to build a system where the 397 00:29:58,700 --> 00:30:01,820 client only remembers a password but the 398 00:30:01,820 --> 00:30:04,260 server stores nothing but a straight-up 399 00:30:04,260 --> 00:30:08,200 public key and deploys no other magic 400 00:30:08,200 --> 00:30:10,640 code except the standard challenge to 401 00:30:10,640 --> 00:30:12,060 make sure the client has the matching 402 00:30:12,060 --> 00:30:14,700 private key derived unilaterally from 403 00:30:14,700 --> 00:30:16,960 the password? In other words, can we 404 00:30:16,960 --> 00:30:19,100 construct a cryptographic key pair using 405 00:30:19,100 --> 00:30:22,600 nothing but a password? So here's a 406 00:30:22,600 --> 00:30:23,060 question. 407 00:30:23,880 --> 00:30:25,720 And if you can answer it, we're going to 408 00:30:25,720 --> 00:30:28,740 go get a drink after. What vulnerability 409 00:30:28,740 --> 00:30:32,060 impacted all asymmetric crypto systems, 410 00:30:32,260 --> 00:30:38,820 be they RSA, DSA, or ECC? Anyone? There 411 00:30:38,820 --> 00:30:42,680 you go. We'll grab some tequila. Check it 412 00:30:42,680 --> 00:30:46,800 out. Debian bug had, was basically a 413 00:30:46,800 --> 00:30:49,000 situation where every time the 414 00:30:49,000 --> 00:30:50,720 cryptographic key generator went to get 415 00:30:50,720 --> 00:30:53,380 random numbers, got the same random 416 00:30:53,380 --> 00:30:57,860 numbers. So all cryptographic systems, 417 00:30:58,040 --> 00:31:00,040 all asymmetric cryptosystems use entropy 418 00:31:00,040 --> 00:31:02,960 as follows. They grab random bits and 419 00:31:02,960 --> 00:31:05,260 they permute them until those bits are 420 00:31:05,260 --> 00:31:06,940 roughly a private key they can get a 421 00:31:06,940 --> 00:31:09,760 public key from. Predictable entropy means 422 00:31:09,760 --> 00:31:11,280 predictable key pairs no matter what 423 00:31:11,280 --> 00:31:14,280 the algorithm is. So what if we said it 424 00:31:14,280 --> 00:31:16,380 wasn't the bug? What if we turn the 425 00:31:16,380 --> 00:31:18,340 Debian bug into a feature? 426 00:31:20,560 --> 00:31:23,160 Cryptography is all about constructions. We have 427 00:31:23,160 --> 00:31:24,700 hash functions that make fingerprints 428 00:31:24,700 --> 00:31:27,040 of data. We have stream functions that 429 00:31:27,040 --> 00:31:29,040 stream ciphers that give us a stream of 430 00:31:29,040 --> 00:31:31,340 data. We have block ciphers that take 431 00:31:31,340 --> 00:31:33,640 data and a key and mix them all 432 00:31:33,640 --> 00:31:37,660 together. You can actually turn any of 433 00:31:37,660 --> 00:31:41,200 those into any of the others. Well, we 434 00:31:41,200 --> 00:31:43,340 also know how to take a password and 435 00:31:43,340 --> 00:31:45,960 construct an everlasting stream of 436 00:31:45,960 --> 00:31:47,800 pseudo random number generators from 437 00:31:47,800 --> 00:31:50,780 random numbers from it. 438 00:31:51,000 --> 00:31:52,880 This is predictable entropy. 439 00:31:53,160 --> 00:31:55,840 We can even make this stream of 440 00:31:55,840 --> 00:31:58,180 predictable entropy in such a way that 441 00:31:58,180 --> 00:32:00,520 is both time hard, meaning it takes a 442 00:32:00,520 --> 00:32:02,920 whole bunch of CPU to find out what the 443 00:32:02,920 --> 00:32:05,020 stream should be from the password, and 444 00:32:05,020 --> 00:32:07,680 memory hard, which means it takes a 445 00:32:07,680 --> 00:32:09,500 whole bunch of memory that, I don't know, 446 00:32:09,600 --> 00:32:12,600 a GPU really can't do on a per block 447 00:32:12,600 --> 00:32:15,660 basis. So, you know, screw you Elcomsoft. 448 00:32:17,600 --> 00:32:19,320 So this is a great algorithm called 449 00:32:19,320 --> 00:32:23,120 sCrypt that does this. So what if you 450 00:32:23,160 --> 00:32:25,840 make the output of a password seeded 451 00:32:25,840 --> 00:32:29,100 PRNG, the input to an asymmetric key 452 00:32:29,100 --> 00:32:32,940 generator, you end up with 2048 bit RSA 453 00:32:32,940 --> 00:32:35,500 keys that have a trapdoor in the form 454 00:32:35,500 --> 00:32:39,040 of a human memorable password. This is 455 00:32:39,040 --> 00:32:41,220 not theoretical. I actually went ahead and wrote 456 00:32:41,220 --> 00:32:45,280 this. And the way it's written is just 457 00:32:45,280 --> 00:32:50,380 awful, terrible idea. God, I love it. So check it out. 458 00:32:50,520 --> 00:32:52,520 In normal key generation, 459 00:32:52,520 --> 00:32:56,920 if I run shkeygen three times, I'm 460 00:32:56,920 --> 00:33:00,160 gonna get three different keys. But now 461 00:33:00,160 --> 00:33:02,080 we're gonna run a little piece of code 462 00:33:02,080 --> 00:33:05,120 that I call Fidelius. And Fidelius is 463 00:33:05,120 --> 00:33:08,120 saying, you know, ldp.fidelius.so 464 00:33:08,120 --> 00:33:11,220 password of high grandma. My grandmother 465 00:33:11,220 --> 00:33:12,900 comes to my black hat talk every year. 466 00:33:13,020 --> 00:33:16,980 It's great. She brings cookies. And if you 467 00:33:16,980 --> 00:33:18,940 look, I run this twice with the high 468 00:33:18,940 --> 00:33:22,200 grandma password and I get 80od52 469 00:33:22,200 --> 00:33:26,400 and once again, 80od52. So how's this 470 00:33:26,400 --> 00:33:29,420 happening? See, here's what the deal is 471 00:33:29,420 --> 00:33:32,980 with Fidelius. Harry Potter, properly 472 00:33:32,980 --> 00:33:35,500 understood, is a story about the epic 473 00:33:35,500 --> 00:33:38,640 consequences of losing one's password. 474 00:33:42,880 --> 00:33:45,820 Fidelius is how passwords fail in the 475 00:33:45,820 --> 00:33:48,020 Harry Potter universe. And if you don't 476 00:33:48,020 --> 00:33:50,540 get the reference, go find Dumbledore. 477 00:33:52,280 --> 00:33:55,720 What Fidelius does is it hooks dev 478 00:33:55,720 --> 00:33:58,560 random and it hooks dev U random and it 479 00:33:58,560 --> 00:34:01,200 hooks OpenSSL's random functions. What 480 00:34:01,200 --> 00:34:03,900 do I mean by hooking? I mean that the 481 00:34:03,900 --> 00:34:06,180 applications try to go get random 482 00:34:06,180 --> 00:34:08,120 numbers and my code steps in and goes, 483 00:34:08,280 --> 00:34:11,120 have I got some random numbers for you? 484 00:34:15,160 --> 00:34:20,220 So this just works like unmodified code. 485 00:34:20,760 --> 00:34:22,000 SSH keygen will 486 00:34:22,000 --> 00:34:24,480 suddenly develop a standardized keys. 487 00:34:25,060 --> 00:34:27,560 OpenSSL for certificates will generate 488 00:34:27,560 --> 00:34:29,860 the same certificate every time. You can 489 00:34:29,860 --> 00:34:32,560 get a certificate authority to sign a 490 00:34:32,560 --> 00:34:36,260 password. Freebird will even generate 491 00:34:36,260 --> 00:34:38,700 consistent DNS set keys. So you get, you 492 00:34:38,700 --> 00:34:41,100 know, message signing, message encryption, 493 00:34:41,400 --> 00:34:43,900 client certificate authentication with 494 00:34:43,900 --> 00:34:46,120 nothing but a password. It solves the 495 00:34:46,120 --> 00:34:48,260 login with a password without the 496 00:34:48,260 --> 00:34:49,960 system learning your problem thoroughly 497 00:34:49,960 --> 00:34:51,640 without you having to install anything 498 00:34:51,640 --> 00:34:54,140 anywhere. In fact, the server has no 499 00:34:54,140 --> 00:34:55,900 idea there's a trapdoor and can never 500 00:34:55,900 --> 00:35:00,180 find out. So it's, I wouldn't say 501 00:35:00,180 --> 00:35:03,080 non-consensual. It's more backwards 502 00:35:03,080 --> 00:35:08,700 compatible. With Bitcoin you literally 503 00:35:08,700 --> 00:35:12,840 could send money to like a word or even 504 00:35:12,840 --> 00:35:14,480 a photograph because you can actually 505 00:35:14,480 --> 00:35:18,260 say my private key is a picture of a 506 00:35:18,260 --> 00:35:21,060 pony. You can do that. We have the 507 00:35:21,060 --> 00:35:25,920 technology. So there's no pain server 508 00:35:25,920 --> 00:35:27,900 side. All time memory hard requirements 509 00:35:27,900 --> 00:35:30,060 are limited to the client. There are a 510 00:35:30,060 --> 00:35:31,680 couple of issues that are totally real. 511 00:35:31,960 --> 00:35:34,380 The obvious ones, passwords suck. The 512 00:35:34,380 --> 00:35:37,060 non-obvious ones, it is fragile. It is 513 00:35:37,060 --> 00:35:40,460 dependent on the peculiar way that SSH 514 00:35:40,460 --> 00:35:44,740 keygen 5.3 P1 turns random numbers 515 00:35:45,320 --> 00:35:48,600 into a final key. That's what 516 00:35:48,600 --> 00:35:50,100 you get for being an implicit scheme 517 00:35:50,100 --> 00:35:51,660 that, you know, tries to make function 518 00:35:51,660 --> 00:35:54,700 hookings useful. It's also hard to salt. 519 00:35:55,040 --> 00:35:56,920 What does that mean? That means everyone 520 00:35:56,920 --> 00:36:00,560 who uses the common password password is 521 00:36:00,560 --> 00:36:02,720 going to generate the same certificate 522 00:36:02,720 --> 00:36:06,040 every time. So that kind of, that's kind 523 00:36:06,040 --> 00:36:09,380 of a problem. Now you can fix that but 524 00:36:09,380 --> 00:36:13,460 not implicitly, not for free. You 525 00:36:13,460 --> 00:36:15,280 basically have to have a situation where 526 00:36:15,280 --> 00:36:18,720 a randomized salt, a thing that says five 527 00:36:18,720 --> 00:36:19,760 different instances 528 00:36:20,100 --> 00:36:22,140 of the password password are going to 529 00:36:22,140 --> 00:36:24,700 get five different certificates. The 530 00:36:24,700 --> 00:36:27,420 public side needs to contain the random 531 00:36:27,420 --> 00:36:30,580 information. So instead of just I have 532 00:36:30,580 --> 00:36:33,160 this password, I generate this private 533 00:36:33,160 --> 00:36:36,180 key, it's I have this password and a 534 00:36:36,180 --> 00:36:38,640 particular instance of a public key, I 535 00:36:38,640 --> 00:36:41,240 can now generate this private key. You 536 00:36:41,240 --> 00:36:42,820 can do that but it takes some custom 537 00:36:42,820 --> 00:36:47,360 magic. Back to TCP IP. I want to get to 538 00:36:47,360 --> 00:36:49,900 the the last thing in this talk. 539 00:36:50,100 --> 00:36:53,280 The thing that, oh god I missed packets. 540 00:36:56,960 --> 00:36:59,640 What can we do with networks? That's how 541 00:36:59,640 --> 00:37:02,020 I started coming to DEF CON. That's what 542 00:37:02,020 --> 00:37:04,500 I haven't played with in a while. Let me 543 00:37:04,500 --> 00:37:06,420 tell you something you can do if you're 544 00:37:06,420 --> 00:37:07,880 willing to play some games with packets. 545 00:37:08,320 --> 00:37:13,160 Who here knows about net neutrality? You 546 00:37:13,160 --> 00:37:15,640 know, once upon a time the only people 547 00:37:15,640 --> 00:37:17,800 messing with my traffic were, I don't know, 548 00:37:17,840 --> 00:37:18,240 you guys. 549 00:37:20,260 --> 00:37:25,340 Now it's my ISP, really? I don't have a 550 00:37:25,340 --> 00:37:27,520 worry about when my ISP is obviously 551 00:37:27,520 --> 00:37:29,800 messing with me, you know, because well 552 00:37:29,800 --> 00:37:31,560 first of all I can just tunnel around it 553 00:37:31,560 --> 00:37:36,140 using DNS. But secondly, you know, I can 554 00:37:36,140 --> 00:37:38,260 know to tunnel around it or I can 555 00:37:38,260 --> 00:37:40,600 complain to my congressman. What I'm 556 00:37:40,600 --> 00:37:42,580 worried about are when the biases are 557 00:37:42,580 --> 00:37:45,020 subtle, when I can't necessarily prove 558 00:37:45,020 --> 00:37:47,040 that they're there. What I'm here to tell 559 00:37:47,040 --> 00:37:49,680 you is that there has been a change in 560 00:37:49,680 --> 00:37:51,780 technology and I'm going to describe it 561 00:37:51,780 --> 00:37:55,260 to you, and we are going to always be 562 00:37:55,260 --> 00:37:57,580 able to know if an ISP is manipulating 563 00:37:57,580 --> 00:38:00,020 your traffic. So if biased networks are 564 00:38:00,020 --> 00:38:02,040 affecting you, this is the proof that's 565 00:38:02,040 --> 00:38:03,280 going to be able to be shown up in a 566 00:38:03,280 --> 00:38:06,560 court of law, and if you happen to be 567 00:38:06,560 --> 00:38:08,380 working for an ISP doing this stuff, 568 00:38:10,060 --> 00:38:12,620 I'm just saying if you don't want it on 569 00:38:12,620 --> 00:38:14,160 the front page of a newspaper in two 570 00:38:14,160 --> 00:38:15,840 weeks, you might want to stop doing it 571 00:38:15,840 --> 00:38:19,660 now. I don't want to embarrass myself, 572 00:38:19,680 --> 00:38:24,560 everyone. I would love it if we didn't find any violations in net neutrality, because then there'd 573 00:38:24,560 --> 00:38:29,880 be no violations. So let's look at the topology, how we're going to do this, because I'm making 574 00:38:29,880 --> 00:38:33,640 some big claims here, and you know, extraordinary claims require extraordinary evidence. 575 00:38:34,380 --> 00:38:38,720 Now, standard topology in the real world, you have some client, goes through a home router, 576 00:38:38,780 --> 00:38:45,180 which has 83 million bugs, goes to an ISP. The ISP has various links to the internet, 577 00:38:45,180 --> 00:38:50,700 level 3 and whatnot, link 1, link 2, link 3, and then you have Google and Microsoft and Yahoo 578 00:38:50,700 --> 00:38:56,060 that are linked to those links. So the fear is, and it's a reasonable fear because they're all 579 00:38:56,060 --> 00:39:01,080 over Washington saying it's going to be great when we can do this. There's a magic box deployed 580 00:39:01,080 --> 00:39:06,000 within the ISP network in front of all the links. The box matches packets to policies, 581 00:39:06,260 --> 00:39:12,640 applies different rules to different packets. I'm going to be stateless. Do I not like this packet? 582 00:39:12,940 --> 00:39:14,260 Or it can be stateful. 583 00:39:14,360 --> 00:39:15,160 This packet is going to be stateful. 584 00:39:15,180 --> 00:39:21,340 This packet rolls with a bad crew of packets. It's part of a flow. Do I not like the flow? 585 00:39:22,440 --> 00:39:27,560 So, and the policies can be anything, and they can do anything. Limit maximum bandwidth, 586 00:39:28,000 --> 00:39:32,140 increase minimum latency, alter content. They can do everything. 587 00:39:34,500 --> 00:39:37,060 But sometimes you don't know if they're doing it or not. 588 00:39:37,760 --> 00:39:44,540 Let's say Bing.com was 50 milliseconds slower than Google.com. Is this because of the ISP? 589 00:39:44,540 --> 00:39:49,040 Or is this because Google.com is better hosting? You know, there's a lot of different servers. 590 00:39:49,160 --> 00:39:54,480 There's a lot of different routers. And the problem is, you can't tell if Bing is slow 591 00:39:55,520 --> 00:39:59,620 because of the ISP or because of all the routers and servers. 592 00:40:01,400 --> 00:40:05,920 There are many reasons why Bing may be slower than Google. And that means there's plausible 593 00:40:06,460 --> 00:40:13,980 deniability. We've got to go deal with that. Deal with that with normalization. Whether the tester 594 00:40:14,540 --> 00:40:23,780 is accessing Bing.com or Google.com, the network path should be identical. Or at least the path 595 00:40:23,780 --> 00:40:31,900 should be uncorrelated with the particular identity being run over it. That way, any changes would be 596 00:40:31,900 --> 00:40:38,440 the result, not of the path, but of policy at the collection point, which is the ISP. 597 00:40:39,660 --> 00:40:44,520 So, simple normalization. HTTP. Let's say all we're looking at is websites. 598 00:40:44,540 --> 00:40:52,080 There are absolutely policies out there today that say if you see an HTTP connection and there's a 599 00:40:52,080 --> 00:40:57,220 host editor that says Bing.com, go mess with it. Slow it down by 50 milliseconds, why don't you? 600 00:40:57,820 --> 00:41:02,700 This is super easy to detect. Just put up a server at some IP address somewhere that will 601 00:41:02,700 --> 00:41:10,640 be, I don't know, like a proxy or something. It'll respond for all web requests, no matter if it's 602 00:41:10,640 --> 00:41:14,000 for Bing or Google or whatnot. Now you have a consistent server. 603 00:41:14,540 --> 00:41:21,820 With a consistent path back to the client. If packets from the proxy, oh, wait a second, you don't have to 604 00:41:21,820 --> 00:41:27,820 write any code because it's just a proxy server. It's just Squid. If traffic from the same Squid 605 00:41:27,820 --> 00:41:35,020 server is faster when it seems to come from Google than when it seems to come from Bing, you have 606 00:41:35,020 --> 00:41:43,960 just discovered a biased network. Very simple. There's a problem. Very protocol dependent. Works 607 00:41:44,540 --> 00:41:48,800 well for HTTP. Do you guys know the Internet is bigger than the web? 608 00:41:53,090 --> 00:41:59,920 And the problem is all of these other protocols, BitTorrent, require a lot of work to implement or 609 00:41:59,920 --> 00:42:02,120 emulate. And I'm a lazy guy. 610 00:42:05,290 --> 00:42:13,700 The other problem is that proxy server is at some IP. You know what that IP is? Not Bing's. Not Google's. 611 00:42:14,540 --> 00:42:20,860 And the ISP can just look in DNS to find out which IPs are actually associated with Google and Bing. 612 00:42:21,080 --> 00:42:30,600 So you can have the greatest test server in the world. The policy is only applied against genuine Bing or Google servers 613 00:42:30,600 --> 00:42:43,940 you're blind. So we got to do something about that. We've got to spoof the whole Internet. Okay. So I've written some code. 614 00:42:43,940 --> 00:42:49,840 It's a neutrality router. It's called Neuter. Neuter is the network normalization engine. 615 00:42:50,120 --> 00:42:56,980 It's very easy to explain. Who here has ever run a VPN? Alright, so here's the deal. 616 00:42:57,280 --> 00:43:00,900 You got a VPN. You're sitting in some Starbucks, but where you really want your 617 00:43:00,900 --> 00:43:05,420 networking to be from is, I don't know, the home office or the home or somewhere 618 00:43:05,420 --> 00:43:10,500 in EC2. Anywhere where, you know, wherever you're at can't see what you're doing 619 00:43:10,500 --> 00:43:15,000 and, you know, there's all this access stuff. You just want to like operate from 620 00:43:15,000 --> 00:43:21,200 the other network. So traffic is put in a VPN. Traffic is pushed from a client to 621 00:43:21,200 --> 00:43:27,740 a broker. An IP address at the broker or VPN concentrator, it goes ahead and talks 622 00:43:27,740 --> 00:43:32,460 to Bing. It goes ahead and talks to Google and they respond back to the 623 00:43:32,460 --> 00:43:39,360 broker. Hey, now the broker's got all the packets. It's all the same source. So 624 00:43:39,360 --> 00:43:40,400 it's, you have a normal 625 00:43:40,500 --> 00:43:45,820 server. And then when it sends traffic back to the client, it always comes from 626 00:43:45,820 --> 00:43:51,580 the broker. So you got a normalized path. It happens to be because it's encrypted 627 00:43:51,580 --> 00:43:56,580 that the ISP doesn't see anything and so no policies are applied. Well, that's a 628 00:43:56,580 --> 00:44:00,640 bug and we're gonna fix that with Neuter. See with Neuter, when the server talks to 629 00:44:00,640 --> 00:44:05,200 the client, okay, we're just gonna go ahead and send that in the clear. In fact, 630 00:44:05,220 --> 00:44:10,480 we're gonna spoof the IP addresses of the real Google or the real Bing. So 631 00:44:10,480 --> 00:44:14,280 it looks like Google and Bing are talking straight to the client. Why do you do that? 632 00:44:14,400 --> 00:44:19,960 We want the ISP to see the return traffic. We want the ISP to apply the policies that 633 00:44:19,960 --> 00:44:24,680 they would normally do for Google and Bing and we want them to mess with us, too. Why? 634 00:44:24,820 --> 00:44:28,600 Because then we bust their policies. And it works. 635 00:44:38,780 --> 00:44:40,080 Someone in this room. 636 00:44:40,480 --> 00:44:44,980 Thinks, oh, man, I can detect the crap out of that. I am gonna mess with Kaminsky's 637 00:44:44,980 --> 00:44:49,940 stuff. I already got, like, the blog post half written. Oh, oh, but the rabbit hole goes 638 00:44:49,940 --> 00:44:56,840 so deep. See, the policy engine in this scenario doesn't see traffic from the client to server. 639 00:44:56,980 --> 00:45:04,200 That's encrypted VPN style. What if the policy engine only worked if it saw all the traffic 640 00:45:04,200 --> 00:45:08,480 from the client to server and all the traffic from server to client and otherwise it didn't 641 00:45:08,480 --> 00:45:10,460 go anything? Guess what, dude? It didn't go anything. It didn't go anything. Guess what, dude? 642 00:45:10,460 --> 00:45:19,960 You do that. See, here's what we're gonna do. In normal neuter, we're gonna spoof the traffic 643 00:45:19,960 --> 00:45:27,700 from the server to the client. But in roto-neuter, it's doing it the other way around. In packet 644 00:45:27,700 --> 00:45:34,220 sample A, the client's gonna talk to the real Google. No magic whatsoever. It's just gonna go 645 00:45:34,220 --> 00:45:40,220 talk to it. Saying, you know, real routes, full bidirectional flow, trigger whatever policy is 646 00:45:40,220 --> 00:45:45,000 there. And then apparently the policy engine doesn't like half flows. Well, guess what we're 647 00:45:45,000 --> 00:45:49,600 gonna do? We're gonna go give it a half flow. We're gonna take the client and server traffic 648 00:45:49,600 --> 00:45:54,700 and we're gonna route that thing encrypted right around the ISP's policy engine. And 649 00:45:54,700 --> 00:45:58,060 then the first thing that's gonna happen at the broker, the broker's gonna send that traffic 650 00:45:58,060 --> 00:46:04,860 straight to Google. As if it had the IP address of the client. Google's happy. It sees requests 651 00:46:04,860 --> 00:46:10,200 from a client, a response to the client. It's only the ISP that's telling it it's got a half flow and isn't triggering its policy engine. 652 00:46:10,220 --> 00:46:18,700 So you get differential behavior between full flow and half flow. And I've still got you busted. So, guess what? 653 00:46:18,800 --> 00:46:25,720 It's a catch-22. The ISP attaches, applies policies to half flows. Neuter sees it because the normalized 654 00:46:25,720 --> 00:46:32,220 server gets a difference in performance. If it only applies policies to full flows, when I create a half flow 655 00:46:32,220 --> 00:46:38,560 to the real Google, suddenly it has different performance characteristics. Either way, neuter wins. 656 00:46:40,220 --> 00:46:45,680 This is the end game. Biased policies might as well be transparent. Because I'm gonna find it. 657 00:46:56,900 --> 00:47:04,680 Now, I think I might go over by two, but no more than two. Suppose you really want the ISP to see 658 00:47:04,680 --> 00:47:09,880 bidirectional traffic. You don't want this, you know, weird catch-22 I just said. Well, 659 00:47:10,420 --> 00:47:15,500 you'd want to do this because it's definitely going to trigger all the policies. Also, if you've 660 00:47:15,500 --> 00:47:20,760 got an inconvenient NAT in the way, the NAT really needs to see client-to-server traffic to open up 661 00:47:20,760 --> 00:47:28,120 return connectivity. Might be inconvenient to get around a NAT. Now, the disadvantage is if an ISP 662 00:47:28,120 --> 00:47:34,700 is seeing client-to-server traffic, if a NAT router is seeing client-to-server traffic, the 663 00:47:34,700 --> 00:47:39,580 server sees the client-to-server traffic, too. And it might reply, interfere, complain, etc. 664 00:47:40,120 --> 00:47:45,620 So, what are the tricks we can do now? Well, we can play with TCP checksums, client can tunnel 665 00:47:45,620 --> 00:47:51,560 valid traffic to the broker and can also send packets with invalid checksums to the server. 666 00:47:51,780 --> 00:47:56,840 So, it'll get past the NAT and it'll get past the ISP and it'll arrive at the server, a server 667 00:47:56,840 --> 00:48:03,440 like this thing is corrupt, I'm going to ignore it. That actually kind of works. The problem is 668 00:48:03,440 --> 00:48:09,040 the policy engine might actually do TCP checksum validation and the NAT might go ahead and fix the 669 00:48:09,040 --> 00:48:09,860 sums. There's a bunch of things going on. But anyway, I think it's important to remember that you 670 00:48:09,880 --> 00:48:14,580 been a problem with that but we got another catch 22 because we get differential behavior 671 00:48:14,580 --> 00:48:21,020 when the policy engine sees packets with bad checksums so once again it's like oh I see a 672 00:48:21,020 --> 00:48:26,980 full flow but it's got half checksums I'm going to change policy gotcha so you know that's nice 673 00:48:27,520 --> 00:48:35,300 strategy two of three is low TTL when you send traffic on a network this is from my 2002 talk 674 00:48:35,300 --> 00:48:42,640 you can control how far it goes so you can say I want this traffic to get past my NAT and I want 675 00:48:42,640 --> 00:48:47,920 this traffic to get past my ISP but not so much with getting to the real server could you like 676 00:48:47,920 --> 00:48:54,640 stop along the way you can do that we have the technique so the advantage it's legitimate traffic 677 00:48:54,640 --> 00:49:02,620 the disadvantage the policy can locate low TTL and alter behavior that's great actually in the catch 678 00:49:02,620 --> 00:49:04,760 22 because now not only do we identify 679 00:49:05,300 --> 00:49:16,200 the policy engine but we know which hop it's at nice but okay let's talk about utter utter packet 680 00:49:16,200 --> 00:49:25,320 trickery the silent splice you see normally according to the TCP specification if you ever 681 00:49:25,320 --> 00:49:31,980 get a TCP packet that doesn't look right you are supposed to either acknowledge it or send a reset 682 00:49:31,980 --> 00:49:35,220 to stop that guy from talking to you so you're always supposed to 683 00:49:35,220 --> 00:49:41,140 let's reply well the thing is there's a lot of servers out there that have the right stack but 684 00:49:41,140 --> 00:49:45,280 they got firewalls in front of them the firewalls like I see something that looks even remotely bad 685 00:49:45,280 --> 00:49:53,440 I'm going to hide in a little corner and not say anything I have used for this behavior so what I'm 686 00:49:53,440 --> 00:49:59,680 going to do is I'm going to have the real client do a three-way handshake with the server so it's 687 00:49:59,680 --> 00:50:03,560 going to go and have a real session and then not it's going to see the ISP is going to see 688 00:50:05,220 --> 00:50:09,160 see it. And you know what Google's going to see next? The broker's going to send a reset and it's 689 00:50:09,160 --> 00:50:15,540 going to shut that thing down hard at the server side. Client's still open. Client's expecting 690 00:50:15,540 --> 00:50:20,120 server to say something any minute now. Server doesn't want anything to do with client now. 691 00:50:20,540 --> 00:50:25,400 So now the broker shows up and says, hey server, why don't you set up a connection with me? 692 00:50:25,660 --> 00:50:30,600 So broker sets up a connection with the server, gets it all nice and good, and then the broker 693 00:50:30,600 --> 00:50:36,040 just goes ahead and splices his connection into the connection that has been originally set up 694 00:50:36,040 --> 00:50:42,840 at the client. And now client sends server traffic. Server ignores it. Server spoofs, 695 00:50:42,940 --> 00:50:49,480 or broker spoofs the server back to the client. Client accepts it. Packets go out. Packets go in. 696 00:50:49,600 --> 00:50:50,840 You can't explain it. 697 00:50:57,420 --> 00:50:58,000 That's it. 698 00:50:59,420 --> 00:50:59,980 So, 699 00:51:00,120 --> 00:51:00,580 basically, 700 00:51:00,600 --> 00:51:05,720 a warning, if you are passively monitoring network traffic, these techniques kind of sort of 701 00:51:05,720 --> 00:51:11,940 allow any one side of the conversation to impersonate traffic from anybody. You can detect 702 00:51:11,940 --> 00:51:19,200 it if someone tells you to detect it. I'm telling you to detect it. Where neuter is now and 703 00:51:19,200 --> 00:51:24,280 emulates half flows. It's super fast. It supports anything that runs over IP. If you want to know 704 00:51:24,280 --> 00:51:29,340 whether a network prefers Xbox 360 traffic to PlayStation 3 traffic, this will tell you at a 705 00:51:29,340 --> 00:51:29,780 court of law. 706 00:51:33,660 --> 00:51:41,680 So, I got to end this. Here's the summary. Networks are neat. Bitcoin isn't anonymous. UPnP sometimes 707 00:51:41,680 --> 00:51:46,520 exposes itself to the outside world. Atlas can be bypassed using interesting sequence number 708 00:51:46,520 --> 00:51:52,780 tricks. Passwords can be used to seed asymmetric crypto, even though they shouldn't. And subtle 709 00:51:52,780 --> 00:51:59,700 net neutrality hacks are doomed. Transparency or bust. Thank you to an N2K of three crowd and 710 00:51:59,700 --> 00:52:05,220 docs of Lion Labs for the crazy things they're letting me do on their network. And I'm looking 711 00:52:05,220 --> 00:52:09,720 for some help release engineering, because we got to get this code out and about. Thank you so 712 00:52:09,720 --> 00:52:10,080 much.