DEF CON, I missed you. Wow. So, show of hands, how many people are here for their absolute very first DEF CON? Thank you. You know, I've been doing DEF CON for a long time. This is about my 15th year. And I've watched it grow up. I've watched it grow from a tiny little thing at the Alexis Park to we've kind of overfilled the Rio. And the one thing that amazes me is just like, wow, people are just here having incredible amounts of just fun and joy. And you guys see this iHackPineapples guy? I don't know who you are, but you're my freaking hero. Basically this guy is like, you're going to come to DEF CON, you're going to hijack the Wi-Fi. Yeah, I'm going to take that really crappy piece of gear you bought and I'm going to break it. And if you're late, you can fix it. And if not, go get a refund. So, awesome. So what am I here to talk to you about? So I have a little bit of a tradition when it comes to my DEF CON talk. I never actually tell people what I'm going to talk about. Sorry. I don't know what I'm going to talk about. The subjects of my talk is a decent random number generator. So my talks are weird for DEF CON. Because, you know, we're hackers. We like to break things. But that's not really just what I do here. I like to show what's possible. And I like to show, hey, we can scan the entire Internet in a series of seconds. We can bust people who are doing violations of network neutrality. There's a few funny things we can do over DNS. Actually it was great. I once had like Darth Vader dancing on stage video streaming over DNS. Somebody told me you couldn't get high bandwidth over DNS. Somebody was wrong. But this is not the same thing. It's just showing what can be broken. So let's talk about why, what we're going to talk about today. Because we're going to be here for a few hours and you should have some idea that maybe there will be something you're interested in. We have a bunch of subjects. We are actually going to talk about why random number generation keeps getting things owned year after year. Have kind of a quote which is I would like to not be fixing the same bugs 15 years from now. I'd like to be fixing new bugs. But that would require dealing with the existing stuff. I want to talk about how we're sort of expecting users to recognize these huge strings of hex and it's bullshit. I want to talk about browser road day. There's a ton of vulnerabilities that are undiscovered and they all kind of follow the same form and we have to start dealing with them. I want to talk about DDoS. We really are getting distributed denial of service attacks that are scaling at a level where really it's an open question if the internet is going to keep working. So how much did the NSA shit the bed anyway? But before any of that, I want to talk about why hackers are useful. And I want to do that by discussing of all things, hard drives. So let me give you a scenario. An attacker has compromised a system and put something malicious on the hard drive. How bad could it be? What could possibly go wrong? Well, you know, they might have put in like an auto-launching daemon. You boot up your machine, it's got a root kit. You might have replaced some core operating system files. Maybe they got really, really clever and they like hit the master boot records. The first thing the computer does right when it turns on is load some piece of malware. And in all of these cases it sucks but at least you can like format the hard drive, the bad guy is gone, they are destroyed, right? Well, this funny thing happens when you start researching hard drives. So a little bit of a joke. What is the difference between a hard drive and a brick? The answer to this question is, given sufficient research, there is no difference. Never in my life have I done more expensive research. There goes 75 bucks. There it is gone again. See, here's the deal. In theory, a hard drive is a thing you put data on. Bits go in, bits come out, the bits stay the same. In reality, we have what I like to call exhibits iron law of computer architecture. Yo dog, I heard you like computers. So I put a computer in your computer so you can compute while you compute. Now what is great about this iron law is that the more you understand about computer architecture, the truer it gets. Pretty much everything that runs automatically is another little computer that is running on its own cycle that is going and doing stuff. And of course, it's doing it fast, it's doing it trusted, it's doing it insecurely. The reality is, is that everything in your computer has become very generic. Your iPhone has seven ARM chips. The biggest lie about a computer is that it's just one. Okay? Every device you have ever owned is a small network of mutually trusting, overly mutually trusting devices. A hard drive is really just another computer with direct access to your system memory via specially designed physical and logical protocols. Now maybe you doubt me. Maybe you think, oh, come on, Dan, you might be exaggerating. So let me actually show you what happens when you log into your hard drive. I did this project with Travis Goodspeed, probably the single most entertaining hardware hacker in the world. He's the guy behind POC, GTFO, proof of concept. Get the fuck out. And so we sit down one day, we buy a huge stack of hard drives and it turns out on the back of them there's a serial port. What happens when you go into the serial port? Well, you know, there's like an entire shell. It has like documentation. It actually tells you what your commands are. Oh, really, edit processor memory. And here are my arguments that I need to know for that. Sweet. You get some internal drive metadata. Like there's no hacking here. It's like a straight up interface, right? You can go ahead, you can like learn about your main disk, the public one. There's a second one. There's an entire system partition. You can go ahead and scrape through that too. Read the data back out. Actually take a look at the data. You know, when your hard drive is initialized, they run a bunch of tests. This is a Seagate hard drive. It's actually Seagate's test output. My favorite part of course being WTF status. Sweet. Now you might be saying, but Dan, you had to like hook up special pins to the hard drive. What, an attacker is going to teleport to your home and do that? No, no, no. An attacker is going to go ahead and there's a great command for messing with hard drives called HD parm. We're going to run help on it. We're going to grep for my favorite phrase in computer security, extremely dangerous. And you'll notice nowhere does it ask for a password but it totally wants the firmware to replace the system partition. So I'm not kidding about making bricks. I actually have my lab notes from this and it looks like a, I don't know, a wake. It's like this hard drive, fate, platters exposed, finger printed, and I think we actually have like our fingers on the platters. Firmware dump is 01 wrong. Brick by Dan when he wrote to the buffer, probably repairable. Brick by Dan with HD parm. Brick by Dan when he set the serial port to 62,500. You look at these things funny and they blow up. I tell you it's the most effective security technology of the hard drives. So this eventually became a paper with a somewhat predictable subject. Implementation and implications of a stealth hard drive back door. I'm kind of an unindicted co-conspirator on this. They did ten months of work. They actually built malicious firmware that hides on the hard drive, corrupts the surrounding operating system whether or not the drive has been formatted. It's owned forever. Kind of nice. Why do I tell you all of this? There is something which I have been discussing privately for some time called storage XOR execution. Which basically says from an architectural standpoint, if you have code you're running that you know is malicious, that you are completely aware is exposed to skilled attackers, at minimum separate the piece of the system that remembers, that persists, that stores from the piece of the system that computes, that operates, that parses. So sure, you can go ahead and provide some malicious input and own the machine. That might happen. But you can't keep your ownership without storing it somewhere where it might get discovered. You actually spend time with attackers. One of the things they tell you is it's not about ownage. It's about continued ownage. It's about coming back in a year and your root kit is still ready to go. You don't have to break your way back in. Okay? You can't even start discussing storage XOR execution if you don't have the paranoia of realizing all of these places to persist your attacks. You know, I'm one of these rare people in information security that is happy we are talking about APT, about advanced persistent threats. People say, how can we be discussing this? These attacks aren't very advanced. I'm like, holy hell, we have people admitting we have vulnerabilities we have no idea what to do about. Great. Stuff is not working. Let's at least talk about that. We aren't even having it as a basic part of discussion that maybe when you use resources in a cloud, the underlying hardware should only be shared with other people in your cloud, like in your organization. Perhaps there should not be one piece of hardware for two different customers. Two customers, one hardware. Works about as well as you think. This, this is the value of hacker engineering. See what I like about hacking is that we have no delusions, okay? We are willing to see what systems are actually capable of from first principles. In fact you say something is impossible and we get to work. We are needed. Let me tell you, there's a lot of people out there who want to modify the internet who have no idea how it works. At least we have a fighting chance. You know what? I got to say, I like hacking all the things. But I also like all the things. Let me show you something very near and dear to my heart. This is a cat in a shark costume on a Roomba chasing a duck. Fuck yeah! The internet has changed things. I get this cat. There's no Bob Saget. There's no America's Funniest Home Videos. There's no Wiffle Ball hitting some kid in the nuts. There's just the kitty, okay? And that, that is awesome, okay? One of my favorite artists, she goes on television, she's told, your music sounds like a rat being strangled. She goes, why yes, there's a market for dubstep. I should play violin while playing dubstep. She gets a half billion views on YouTube. She's a big deal now. And yeah, she does it with playing songs from Skyrim and Halo and Zelda. This appeals to my interest, okay? Lindsay Stolle has rocked it. We live in a world that sucks less because of the internet. I believe in email. I have never in my life received an inter-office memo and I hope I never do. I prefer Skype over plain old telephone, plain owned telephone service. I prefer online banking over having to sit for hours in a line in a bank. The internet has changed how things work. We could lose it. Like there's a level of compromise out there where we don't get all these nice things. And there are some people who even prefer that. Got to remember, the internet was not the first time we tried to create the internet. It's very matrixed like that. This is like the eighth attempt. Who here is on like Prodigy or Minitel or AOL? Like, we tried this a bunch of times. AOL spent like a billion dollars on modems one year. Turned out it was a good investment. They're still making $160 million a year off that stuff. Grandma loves her dial up. The reason the internet worked is because it was ours. Okay? This was the playground of nerds. This wasn't biz dudes who made something for biz reasons. This was nerds who were like, I got to send me some e-mail. And the key is, my God, it was cheap. No one on the internet ever said that you had to pay some portion of your revenues. People complain about paying for DNS names. What is the ratio between how much money Google makes and how much they pay for Google.com? I don't think there's a smaller number. One over Google. Contrast that with the Apple situation. Oh, you would like to be on our device. 30% gross, please. You know, it's a very, very different model. And the free internet has disrupted so much. And there are those who would like to disrupt it back. So, here's the challenge. We are the guys who actually know how this damn thing works. We are the people who know that breaking everything is possible. We don't know that fixing everything is impossible. Now, you know, technically it's a bit of a game but technically correct is the best kind of correct. So why do I do this? Why am I here? Because I see openness to the possibilities. I see that there's sheer joy in this community for understanding how things work. I see people willing to call bullshit on everything. Especially the parts of security theory that are just clearly wrong. Because, what, you think everyone else in engineering can screw up and we in security are infallible? We screw things up all the time. We just have way more attitude about it. So, that's kind of my world. Whoa, why did everything just go dark? Get back here. Come back. I believe in you. All right. So that's the grand world vision kiddies on Roombas. Let's nerd out a bit. I want to talk to you guys about random number generators. Generation of random numbers is indeed too important to be left to chance. What does it actually mean to need a random number generator? Many processes require a generator of unpredictable numbers. That means if you get the last thousand, you can't figure out what the next one is going to be. You can't go back and figure out what some of the older ones were that you missed. Now, just because we require a strong random number generator doesn't mean we're actually getting strong random number generators. Here's a couple of various talks. How I Met Your Girlfriend by the great Sammy Kamkar. Many web applications are failing for session management. Exploit information for Python. Exploit information for Ruby. What the hell is going on? Well, the deal is that all these various web frameworks, you don't actually log into them that frequently. One of my friends was an admin at a major e-commerce site. He's like, yeah. Oh, wait, wait. We have an interruption. Excuse me. So as you all know, we have a tradition here at DEF CON with new speakers. We have a new speaker with us this year. His name is Kaminskow? Kaminskow? I think that's the right way to pronounce this. No, I think you messed it up. Try again. Kamikow? Kamikow. Yeah, it's Kamikow. Anyway. Come here. It's good to be back. Good to see you. Magnificent bastards. New speakers and really fucking old speakers. Oh, snap. It overflows back to zero. Actually, I missed the year or so. So the deal is this. You have literally one of the largest e-commerce sites in the world. We found a phone. Does anybody have one? I'd say drink but I just did. Yeah, so you've got one of the largest e-commerce sites in the world and you'd be like, how many logins per second do you process? You think it's like tens of thousands or thousands? Hundreds? They're like, yeah, seven. Seven times a second we have to accept a password. And it's surprising but when you actually think about what happens, you put in your password, you get a cookie, that is now password equivalent. That's the thing that's shoved into the web app every single time you visit. That value ideally is a random value. Man, it would suck if you could go ahead and log in a thousand times and predict the next thousand log in magic numbers. That's actually totally what's happening. More recently, a few days ago, awesome attack. One of the ‑‑ so beautiful. A guy by the name of Dominique Bongard, reversity on Twitter, came up with an attack against a scheme called WPS. WPS exists so that you can relatively efficiently negotiate with an access point and find out what the passphrase is so you can log in and use the internet. And they made up this incredibly ill‑advised protocol for it. I mean, just like impressively. But the one part of the protocol that wasn't actually awful was this piece where at the beginning you have some value and it's encrypted with a 128 bit key. It's randomly generated but it's encrypted. And, you know, breaking a 128 bit key is not going to happen. Like, that's a 2 to the 128 work effort. That's going to take until the end of the universe. However, it requires you to actually have 128 bits of entropy. Which none of the devices did. Device one had what's called an LFSR, a linear feedback shift register. They keep showing up in this space because they're the quickest and easiest way to get this stream of numbers. You start with a seed value and it just keeps rolling and rolling and rolling. Well, the seed value in the first device was 32 bits long. So you just try all 32 bits combination. Second one, another 32 bits. The third one just encrypted with zero. Beautiful attack. So let's talk about why really we keep getting owned by random number generators. And the most important thing to realize is there's a huge amount of discussion in the cryptographic world about the absolute right way to build a cryptographically secure random number generator. And for the love of God, most of it doesn't matter. No one's getting owned because they use SHA-1 or SHA-256 or hell MD4. No one's getting owned because they use hash instead of HMAC DBRG. They're not getting owned because they used the same entropy for too long and didn't mix in new entropy. We're not getting owned because we had one pool instead of 32 pools. Like there's a disconnect between what's getting us owned and what we argue about. The fundamental truth is there's like a thousand different ways to build a cryptographically secure pseudo random number generator. And they all have an incredibly high security margin. That is the fundamental truth. When you actually look at the systems in the field that are breaking and they are all breaking, your two problems are one, there's no entropy at all. And two, we're not even using cryptographically secure pseudo random number generators. We're using LFSRs. We're using crap. This is what's actually happening. So let's talk about the no entropy problem. What does a cryptographically secure pseudo random number generator do? It takes a little bit of entropy. 128 values that are either 0 or 1 that have no particular pattern. It takes that little tiny chunk and spreads it out into number after number after number, gigabytes, hundreds of gigabytes, whatever. Your idea is from an attacker standpoint, you can look at as much of this output as possible. You learn nothing about the secret. Your best attack is unfortunately to guess what all 128 bits of that seed are and it's just not feasible. There's too many. Now, in order for this to be true, you actually need 128 bits. What killed WPS is there actually wasn't. Generally there was 32 bits which is a meaningful, which is a successful amount to break. One case there was 0. This isn't an obscure bug. Nadia Henninger did this incredibly beautiful attack a few years ago where she found 1 out of 200 RSA keys on the internet were actually badly generated. Now here's what's scary. If she finds that 1 out of 200 keys are identical, the method that she used doesn't actually tell her if the keys are almost identical. If there's a single bit of difference and otherwise everything is the same, Nadia's method wouldn't be able to find it. So unfortunately we have this really ugly situation where 1 out of 200 is a floor and really it's something like 1 out of 50 keys on the internet is bad. That's an incredible failure rate. Shouldn't DevRandom and DevUrandom have actually prevented this? Because these keys are actually being generated out of what are supposed to be well engineered kernel systems. Let's talk about why we actually really do like kernel random number generators. First off, when you have hardware in your computer, remember your biggest lie of a computer is just one computer. When one of the other pieces on the other computers talks to your CPU, literally what happens is a piece of the kernel is run. An interrupt is fired, the CPU jumps to a certain point, you get a time stamp at that. You now have an interaction of someone else's clock with yours. You ever wonder what it means to actually collect random information, what it means to collect entropy? What are you doing? At the end of the day, what you're doing is you're measuring a slow system with a fast system. You know, I can snap my fingers and I think I have a rhythm going. You think I have a rhythm going accurate to the nanosecond? No, I don't. Because that's not how accurate human systems are. We are at best accurate to the hundredth of a second. When you have a computer that says I'm going to watch your mouse movements, I'm going to watch your interkey stroke timings, you basically have a situation where a CPU that is running at billions and billions of cycles a second is measuring a system that's running at hundreds of times a second. And that's what's happening in this kernel situation. The kernel is seeing an event come in and it's hoping it's coming from some other computer that's running slower or at least out of its control. Another great thing about kernel RNGs is that there's just one kernel, at least ideally. So you don't have some situation where one process is doing something right and one process is doing something wrong. Every process benefits from whatever randomness is available. It's shared. Finally, this is tricky stuff. And one of the whole points of an operating system is to take tricky stuff and put it into a box that smart people build it and it is done right. So that was the idea. What went wrong? Well, all those devices that were going ahead and generating these random keys, all these devices were started up, there was nobody at the keyboard, there was nobody at the mouse, there was no hard drive to be getting friction from air. There were no events coming in from the hardware. It was just sitting there. And if you've got no events, you've got no entropy to operate on. Now, it would be nice if CPUs actually had hardware random number generation. But for whatever reason, that just consistently seems to be outside the purview of our modern CPU manufacturers. You just can't figure out how to do it. So how do you solve this problem? Like, really? The truth is, you don't have to be perfect. You could fail every once in a while and you're still going to beat the one nine of reliability that we got out of RSA. That really sucks. You've got to force the synthesis of events. You have to actually force a situation where the device, whatever device that it actually is, has something on a slower clock that's pinging the fast clock. And realistically what that means is using the real time clock, which tends to be a separate chip, tends to run at some amount of kilohertz and having that ping the CPU which tends to be running at some amount of hundreds of megahertz to gigahertz. This actually works. Now you can also go ahead and do some actions that take a hopefully non-deterministic amount of time. So reading values out of memory, causing contention for resources. You want to do what's called whitening. So that means you take any sequence of bits. If it's a zero zero, you throw it out. If it's a one one, you throw it out. The zero to one transition is considered a zero. The one to zero transition is considered a one. This is what's called de-biasing your data. I released a piece of code called docker RAND about two years ago. Docker RAND was based on true RAND by Matt Blaze from about ten years ago. I think actually about 1996. If we had followed Matt Blaze's guidance in 1996, we would not have a single nine of reliability for RSA in, you know, 2012. That wouldn't have happened. Part of security is accepting maybe there is some weird ass environment where docker RAND fails. But is it going to fail as much as status quo? No. No it's not. So let's talk about the larger issue. Even worse than the fact that we don't have true entropy to see this cryptographically secure pseudo random number generator, is the fact that we're not actually using the CSPRNGs at all. When you look at the languages that people use to write software, JavaScript has math random, LFSR. Ruby has Ruby RAND, LFSR. Java has Java util random, PHP RAND, it's all crap. Why? Why are we doing this? Well, what ends up happening is every time someone complains about the nature of the random number generator that we have, we end up making secure random. It's not fixing the old broken stuff. We make some new API. Then we make it weird. It's never just like math dot secure random. It's like bar A equals new UINT array one window crypto get random values. What? That wasn't what I was using when it was easy. Why are you making secure not easy and not default? Does that work anywhere else? No. So why not be secure by default? Why not instead of requiring some weird ass random API, why not take the broken APIs and make them not broken? So thus, we've actually been doing that. Ryan Castellucci works with me over at White Ops. And what we've been doing is systematically going through each and every one of the popular web programming environments and we're taking their crappy little math randoms and making them a shell for dev U random. So we've gotten JavaScript support for node in the browsers. We've gotten Ruby. We've actually made C's RAND function actually RAND. PHP, Python, OpenJDK. It's not like it's that hard to write this code. We actually just need to write it and get it something that people agree, hey, maybe we should just have an easy to use path here. Now there's going to be some run time feature support like being able to interrogate how good is this random number generator? Do we support fixed seeds? Do we support high speed? So I'm going to do something now which people tend to call, it's when I play chess against myself. Let's talk about what's wrong with what we've named lib U Randy besides the name. Ryan actually named it and I'm like, sorry I can't think of this code as any other name now. There are two reasons why generally you wouldn't use an approach like this. The first reason is testers tend to like predictable test results. So they tend to like situations where they can say I want it to be a random stream but I want it to be the same random stream. So the system will always behave in a predictable way that can be regression tested. Now I actually never, ever like this approach. Here's why. People say it's a two line change. Why do you need to go ahead and retest everything for a two line change? And here's the answer. It's because there's a bunch of bugs that don't show up in the field for, not because there isn't a bug, but because the house of cards fell in just the same precise way. So that when the memory corruption occurred, nothing bad visibly happened. And so when the house of cards falls the same way every time, you never discover the bug. And you only discover it when you do that two line change. That shouldn't break anything but now the house of cards falls like this and now everything blows up. I really don't like these sort of fixed seeds because they allow the ugly bugs to stay unfound unless you go ahead and do like a complete massive retest which then you now have to do every time because you keep getting burnt. It sucks. But people want it and so okay, we'll go ahead and we'll have a special mode for LibUrandy that allows you to say no, no, no, I intentionally want my randomness to suck. Okay, fine, we'll set an environment flag. More seriously, Urandom is actually kind of slower than LFSRs. So you do have a situation where it's 4 megabytes a second out of Urandom and 260 megabytes a second out of your crappy bad randomness. And when you actually look at the ‑‑ so I was interested. I believe in being historical. Let's look at the historical record and see why did these APIs get screwed up like this in the first place. And at least in the browser case, they realized they had a bad random number generator but they also had benchmarks and they really didn't want to lose at the benchmarks. It's like, well, we're not secure but we're not being benchmarked for security. So even at 4 megabytes a second, it's still like a million random numbers a second. It's generally fast enough for everything but not always. So this brings up the question, should we be using a user space scriptographically secure pseudo random number generator? Now, it doesn't mean that we don't use Urandom. We still mine it as frequently as we might like. If it happens to get some new bits of randomness from the kernel, great. Let's use them. Let's integrate them in. But like I said at the beginning, like a few minutes ago, pretty much every variant of a CSPRNG is still secure. So one of the fastest hashes out there is what's called sip hash. It comes from our buddy DJB. If you just sip hash seed with an incremented counter, this actually works. It's 20 times faster than dev Urandom on Linux. It's competitive with the non-cryptographically secure pseudo random number generators. I guess what I'm trying to tell you is there's no advantage to sucking. You can be fast and secure. It's okay. Now there is a possible improvement that we could do and that is the integration of time. Specifically what's called clock monotonic. Now while you can't get for whatever mysterious reasons NSA good hardware random number generator, you can at least get a time stamp. And it turns out you just need bits that are different. We've got this problem with what's called forking where you have a process, you make a copy of it, the copy has the same seed and the same counter value. Now you have the same entropy happening twice. And it sucks. If you integrate time, it turns out empirically it's a pain in the butt to get two things to happen at exactly the same CPU nanosecond. It's not that it can't, it's that it won't. That's a good thing. So you could actually have on a per query to the random interface basis, you could actually say give me this time stamp's view of the randomness. So my preferred CSPRNG looks something like SIP hashing the secret, a counter, the previous output and what I call the shifted time. So you don't just do the time directly, you shift it by some amount so the attacker can't just say, well I know according to NTP that this value is going to be almost zero. Force there to be some fixed offset. I'm not doing this yet in Lib U Randy. And here's why. Reasonable people can disagree about whether a CSPRNG should be in user space and kernel space. But we all hate LFSRs. So let's at least do something which causes those damn things to die. Another change is maybe we don't use SIP hash. SIP, it turns out because of quirks, you can do faster with Blake, you can really do faster with Skyn. So both of them are alternate hashing systems. We've found things where it's like twice as fast. So really the right answer at the end of the day may not be do a user space CSPRNG and maybe fix up the really weird one inside of Linux which is obsessed with mixing stuff in multiple poles, et cetera, et cetera. The problems we don't have. So that's kind of the souped nuts on what's going on with entropy generation. But there's another problem around representation. Apparently you are supposed to do something with D3B07384D1NGJU42MA1$JH89 and whatever the hell that is, squiggly stuff. What the hell is that? Stop puking bits. We are lying to ourselves if we think users can do anything with that. They are lost. The problem is is that computers actually need humans to recognize and to remember large amounts of bits and it's hopeless. Okay? We have hardware acceleration for human faces and even then we maybe can get about 16 bits. There may be, if we're absolutely at the edge of our capability, able to differentiate 65,000 people. It's not that much. And computers want more, so much more, 24 to 128 bits. They want recognition. Have you ever seen this before? And they want repetition. Hey, give me that long ass password. And the standard stuff doesn't work. We did not evolve to deal with hex or base 64 or base 58 or squiggly SSH art. It's just not how we're built. Now, I've looked at this problem before. I did some work. I called it crypto mnemonics. Went ahead and took 512 male names, 1,024 female names, 8,192 last names. I represented entropy by married couples. I'm sorry, totally heteronormative but actually really diverse. You know, Julio and Epifania, Dizuti and Luther, Roland, Dubros and Manuel and Twilight and Bessie. Definite range of people here. This actually works as a way to get yourself to be used to some pattern of bits. You do have to show it every single time you interact with something. You can't just show the entropy representation when there's a problem. It's like you only see someone's face when there's a problem. Otherwise they're in a mask. No, that doesn't work that way. It's not how the brain works. It needs spaced repetition to remember. Now can we do better? Humans do have memory capacity. It's just not for arbitrary bits. Like Homer's epics are enormous. There's like kilobytes of entropy in there. The deal is is that we remember objects. We remember stories. We remember narratives far more than we remember arbitrary ones and zeros. So if you can represent ones and zeros in these sort of narratives that humans are built to remember, you actually have something. Heck, maybe get like a password and like have it spell check. So what we've been exploring has been using triads of adjectives, nouns and verbs and having these be selected to be maximally distant from each other and to encode whatever entropy someone needs to recognize or repeat in these stories. I haven't been doing this work alone. I've been working with my co-worker Ryan Casalucci over at White Ops and it's his code, it's his work, he's the one who should be talking about it. So he's going to come on stage and we're going to talk about how he did this. So Ryan, pick up a mic. Hi, guys. How's it going? So I just have to say, I have known Ryan for many, many years. He recently started working with me at White Ops. I have never had a guest come up in the middle of my talk and there's no one I'd rather have be here. So thank you. So Ryan, tell me what we're looking at here. Okay. So we have up on the slide a randomly generated sample. It's like 5E4D, it's like a bunch of bits? Right. There's a couple algorithms that are combined together to generate the encoding we have there. As you can see, there's four groups of three words. Each one is an adjective, noun and verb. It's like macho acid answering, rustic cable fetching and something. Right. And we have a known amount of entropy there. So what we can do, spell check for passwords, well, pass phrases. So unfortunately we don't have a live demo to you. I could not get the code to work fast enough for that. I will fix that soon. The code will be released. It is awesome. But we actually do have sort of a view of what's going on here. That is, it can fix far worse than that. But as you can see, transpositions, deleted spaces, replaced characters, added letters, deleted letters, random garbage symbols, it can fix all of this. And the words are out of order even. Yes. It is also order insensitive because people will commonly mix up the order of words when they are trying to remember something like this. And we can fix it so we should. Interesting. So you don't have to remember if the acid is macho or rustic. You just have to know acid, macho, rustic or whatever order. Exactly. Okay. So let's talk about how you actually did this. Okay. It's kind of complicated. I have code implemented in JavaScript and Python. We will, it's on GitHub. The repo is currently private. That will be changed soon. So we have two major components. There's a combinatorial number system encoder. That is an obscure but really neat trick where you can take an arbitrary number and encode it as a series of non-repeating symbols. So as the example shows, if you have multiple A's, that's not going to work because you can't use the same symbol more than once. So this is like you have an encoding of possible letters from A to Z. You could have B, A, D, F, G, C. You're picking N of them where N might be 3 or 4 or 5 depending upon how large a range of numbers you want to encode. And this is fairly efficient. This is, you can do this fast. You don't have to walk through all possible combinations. You can generate a specific numbered combination and that's your encoding. And so you're actually able to take arbitrary bits of input and map them to this scheme that says it's these numbers and because the numbers are a combinatorial system, they can show up in any order. They can show up in any order, yes. For decode, we just have to sort them. All right. So talking about the decode, you're not having it be raw numbers, you're having it be words. Right. So there's another step here which is our word mapper. Our word mapper has a dictionary file. In the implementation we were showing in the last slide, we actually have three dictionaries, one for nouns, one for adjectives, one for verbs. And we actually include three values, one with X nouns, one with X verbs, one with X adjectives and interlace them. But it's a little messy. Anyway, so our dictionary has our words in it and variant forms of the words because it makes things easier for people. So for the verbs, for example, it doesn't matter if you say forbidding or forbidden or forbade or whatever, they're all forms of the same verb. We know that. We canonicalize them. And in coding we just pick the canonical form which in this case would be forbidding. So we're basically taking all the common errors of password input and we're saying those common errors no longer count. We're going to correct for them before we even let them get into the decoder. Exactly. And I've got some crazy Python code using I think something called node box which is a linguistics suite that we use to generate all the verb forms. And then we have a recursive algorithm that goes through and maximizes the edit distance between words. If you're not familiar with edit distance, I don't remember the specific one I'm using but each character insertion, deletion, alteration or transposition of adjacent characters counts as an edit. So we want to have at least two edits between any words possible so that a single typo cannot possibly result in a valid but wrong word. Basically computational linguistics as applied to security. Basically a path out of using lead speak as a security technology. There's no more of this like, I used an app sign, I'm secure. We all know exactly how well that works and if you don't, go talk to the core logic guys. I think they have a contest that might change your mind. Nice. So it seems pretty cool. You think this is going to let us have passwords be generated server side? That's the idea. We generate not necessarily server side but computer generated pass phrases that there's a reasonable hope of people understanding and remembering. It's always seemed to me like victim shaming. We make the user generate the password so we can blame them when their password sucks. Meanwhile we have no clue how to build them one. I remember when a few months ago when we first started working on this, Dan came up with some examples and I think there was, I still remember most of what we had. We had a flat monkey staring and we had a greenhouse jumping. There was another tuple which I have now forgotten. But the point is I looked at these maybe twice ever and I still remember them. So we were talking last night about what the implications are for allowing more key stretching. Can you explain what key stretching is and why this makes it a more feasible thing? This is really cool. So key stretching is the idea where in addition to randomness in the pass phrase as a source of difficulty to crack it, we also just make the hashing slow as hell. You've probably all heard of B crypt or PBKDF2 or S crypt. Yes, thank you. And this is somewhat limited because if you're spinning for five seconds and it takes you three times to get your password right, you're going to just throw the computer through the window. But if we have spell correct, even if you make a few small typos, it works the first time. It's fantastic. And people generally aren't going to mind newly so much waiting for their login to complete as they are waiting to see if they typed their password correctly and if not having to reenter it. I had a high security thing I built a while ago. It would spin the CPU for 60 seconds and it was a threshold scheme so we had five of us having to type passwords and when somebody mistyped it, it sucked. But if you knew it was going to be right, one minute wouldn't even be that bad for disk encryption. So we're basically dealing with a common failure mode of what would otherwise be a useful and effective security technology. The more effective a security technology works, the more we can use it. Cool. All right, Ryan, thank you much. I really appreciate you building this out. Do we have a drink? Someone bring a drink. All right. I will. So there's a major use case to be considered with a lot of this stuff. Speaking of work from a previous talk, a few years ago I did something called Fidelius. Fidelius is basically a trick that allows you to use a passphrase, any string of characters, and use that to seed any asymmetric system. So you can have a passphrase for an SSH key, SSL certificate. Basically what I did was say, you know, a passphrase will seed a pseudo random number generator and a random stream of bits is the input to all key generators. So you hook the two together, you guess what's called a password authenticated key exchange scheme. It always works. This was relatively obscure two years ago. This is becoming straight up mainstream now. There's a scheme called brain wallet that allows you to have a word or phrase going to a bitcoin address. There's a scheme called mini lock that has a word or phrase going to, you know, the rough equivalent of a PGP key. Not actually PGP but still. These systems are incredibly vulnerable to having a low amount of true entropy. Because by definition you're publishing your public key. It's almost like it's called a public key. So this has been a straight up expensive problem in brain wallet. Tens of thousands of dollars worth of bitcoin have been stolen. What we need is a way for people to be able to remember more entropy. The idea is that storing all these bits on a hard drive ends up being a screw up. People want something they can hold in their head. If we have these sorts of representation schemes that are self correcting, people can remember more. Stuff will work better. So the general idea, brain wallet and mini lock need human memorable entropy. Actual security needs more entropy. This story bit system increases memorable entropy. Now there is some interesting variations on the scheme. You can go ahead, you can have what we call split mode where you have a normal password you use. It allows things to work. It will take like two hours to crack a key. And then you have like a secondary password that's really there to allow for key exchange. So moving a key from one location to another. So that can be set to take a few seconds while the slow mode, the one that's really in your head, that one might take hours and hours. The general idea is that, yeah, it might take you hours and hours but the relative slow down to the attacker that's trying to brute force your keys from the public key, that guy is just screwed. Because he has to run an attempt only one every few hours, a couple of attempts a day. He can wait until the end of time and he's not going to get your money. Two more tricks that we can do. These aren't necessarily good ideas but we're hackers. Good ideas are not exactly required here. It is an argument that no matter how you slice it, at minimum it's easier to remember 24 bits than to remember 80 to 128 bits. So there has long been a desire on the part of software developers who are presenting a key for memory to have, here's the full fingerprint which we understand you can't remember and here's a shrunk down version of it. Here's the PGP key ID. Here's the RSA ID. Here's some smaller amount of bits. And the problem is, from the attacker's standpoint, they're like, great, I don't need to collide with the big thing. I just need to match this 24 bits. It will take me a little bit of math but it won't be that bad. So here's the scheme that you can do. If the user can remember even a small passphrase that is never submitted to the server, that passphrase can be a sort of shrinker or a bit limiter. So you take the full hash, you hash it with the passphrase, you truncate the results. So the attacker still has to match all 128 bits, doesn't know the passphrase. Doesn't know what the 24 bits are that he actually does need to collide with. So this is going ahead and creating a differential between the work effort of the bad guy and the work effort of the good guy. You want things to be easier for the good guy. He has a cost. Your legitimate user has to remember something. But the idea is ten people who are trying to remember the same key each have their own personal recognition appearance. It's like they see the same face but for themselves every time they see someone's face it's the same face. But ten people are seeing ten different faces. It doesn't matter. They just need to see the same face for themselves. Does that make sense? There's a way of doing this in the opposite direction called local stretching. There is a problem where you have some password server. It's not particularly doing any work to make it so when somebody compromises the password store, because we know it happens a lot, that the attacker can't go ahead and figure out, aha, I got the password store, now I've got the plain text password. What you could do is have the stretching, the complexifier of the password actually happen in the client. So it's like, yeah, the user is remembering ABC123 but it's being expanded out a billion times before it's ever sent to the server. Where things get messy in having basically software generate the passphrase, the one that is the actual password for a server, is every freaking website has its own rules for what a password has to look like. Oh, it has to have symbols. It must not have symbols. It has to have three numbers, two numbers, eight numbers. By the way, going from a scheme that has to have a letter to a scheme that has to have a number, you know there are more letters than numbers. You kind of just made things worse. What you can do is a kind of a cute trick. And that is you can examine the pattern of the passphrase that was provided by the user. So the user says ABC123 with a symbol. And that can be interpreted as requires three numbers and a symbol. And then that is what is actually stretched or expanded out. So it's inferred discovery of password policies. Kind of a neat trick. So now we've gone ahead and we've gone into pretty amount of detail on how we generate random numbers. And we've also talked about how we represent arbitrary data. Now let's talk about some ODA, okay? The other shoe has kind of dropped. IE had more attacks in 2013 than Java. And you know how much we love making fun of Java. How is this possible? IE at Microsoft has been working to secure IE for a decade. How is it that things have fallen so far? So, excuse me one sec. Got some water in me. Here's the deal, guys. Anyone remember way, way back in the day when Microsoft was just like, you know, Internet Explorer is just Windows. Like, they can't be separated. Are you crazy? Everyone thought that they were lying, they were full of it. And you actually look at Internet Explorer, that damn thing is Windows the remix featuring the Internet, okay? It really is Windows. You have this object model that was built back in the 90s called Calm. And they're like, hell, let's go put that on the Internet. It's like if you put mem copy on the Internet, okay? Like, hey, you know, we've got this API here. It takes bytes from somewhere and puts it somewhere else. What, you want it secure now? We barely have this working. And don't worry, because of the nature of browsers, because they're all implementing the same standards, everybody ended up with something that looked pretty much exactly like Calm. Like, for example, XP Calm from Firefox. It's not exactly subtle. I mean, it is literally what's called an interface description language literally built into the very standards of the web. This is how it would have to work. Yes, attackers loved attacking plug-ins. Because it didn't matter if you were attacking IE or Firefox or Chrome, it was still Java, write once, own everywhere. You didn't have to customize it at all. You even got to escape all these weird little sandboxes that the attackers were messing around with. And so, you know, as has finally come out, my Tor de-anonymization has a first name. It's Firefoxoday, as the gruk might sing. Vulnerabilities in the raw browsers have taken over vulnerabilities in their plug-ins. And that's because we've been exposing the underlying object model to something that it was never really designed to be exposed to from bad guys. Browsers, in their normal operation, are constantly allocating memory and associating a type with it. This pointer is to a table. This pointer is to an image. Now, if you're going to be constantly allocating memory, you've got to free it at some point, right? You've got to reuse that memory. So what happens is, a pointer starts out and it's pointing to a table. And eventually, the system says, user's moved on to a new web page. I don't need that table anymore. And so that pointer is free. And then later, it says, ah, I've got space. Let's go make an image. Let's put an image there. Problem is, if you've looked at JavaScript, there's like a million ways to have a pointer to a pointer to a pointer. This table has an image inside of it. This image has a CSS thing inside of it, which has a link back to another image. There's a billion ways for objects in HTML and JavaScript to point to another. And if you ever get the system screwing up, getting it to free memory, and it still has some pointer still pointing to it, you now have two object contexts, one pointer. And that also works about as well as you'd hope. So use after free, that's when you have two different contexts in one. Use after free is something like 90 to 98 percent of the undiscovered vulnerabilities in browsers today. And it's a real problem and it's not going away. Except that it kind of is. Google and Microsoft are actually doing some pretty serious things to deal with use after free. The Google solution is a typed heap. So what they're saying is, we're going to keep all the tables together. We're going to keep all the images together. So when you go back and make a second allocation, everything is with its peers. You don't get some situation where you use a method of an image on a table. You use a method of a table on an image. Because everything is sticking together. And this actually makes it incredibly harder to go ahead and exploit vulnerabilities. Microsoft as well is doing stuff. They're doing a lot of things. But the fundamental advantage of their approach is what's called non-deterministic fuzzing or freeing. They're making it so the attacker never quite knows if they go ahead and pull their stunt, it's going to work. It might work, it could work, but they don't know it will. This is great. This is attacking the unique needs of an exploit. This is counter exploitation. Sure, you have probabilistic likelihood, but your requirement, your need is guaranteed reliability. So Microsoft is playing that game. I got a trick. A trick called Iron Heap. Named by the inestimable Rob Graham. And the idea is really simple. You can't use after free if you just don't have free memory. Nope. That's not going to do it. There's a little bit of a problem with this, you might know. We don't actually have an infinite amount of physical memory. But you know, on 64 bit machines we have an awfully large amount of virtual memory. So the basic idea is we never reuse an allocation. Your virtual memory space is 64 bits long and is basically mapped. Say this chunk of the address space points to this page and this chunk points to that page. You keep reusing physical memory, but the pointers, the stuff that's actually exposed to user space, the addresses that are actually exploitable by the various use after free techniques, they're never reused. Because you just have so much room. Look, we've only had 64 bit browsers really for a very short amount of time. This is the best possible use of 64 bit space. So the idea is that 0x1234123412341234, once it's freed, that's it. It never points again to an image or a CSS script or a JavaScript. That page stays unmapped forever. Exploit that. So we've got to do some stuff to make this efficient. You can only have a finite number of active allocations. The reason this can work at all is because there's actually hardware acceleration. There's what's called a memory management unit that very quickly allows a process to say, hey, I'm accessing this virtual fake address, make it really quick for me to go ahead and figure out what page of memory has the real content. Make it really quick for me to find out there is no page. You can't have an infinite amount of these mappings. But you don't need an infinite amount of these mappings. You need to have like the top 10,000. The top 15,000. Anything else can swap. Guess what? Machines swap. Maybe to disk, maybe to more RAM. But the idea is you handle the case where it's the .01 percent of the time. The other trick you can of course do is what's called having guard pages. So that means you have unallocated space between allocations. This gets a little fat because now you have to have 8 kilobytes used every time even if you have like an 8 byte allocation. And that sort of sucks. But again, you can do this probabilistically. You don't always have to go ahead and make an exploit work. You just have to make it a nightmare enough so the attacker never really knows if this stuff is going to work or not. That is cheating. Good. We get to cheat. We're defenders. Implementation wise, this can be done entirely in user space. So, you know, you manage memory in user space. You handle the exception when it's unmapped. You populate it in the exception. It can be run in the kernel because kernels are already managing page tables. I don't object to doing this in the kernel. I don't object to kernel modules. I'm willing to say the operating system needs to adapt to the new needs of software. If I don't, you know, right now to figure out what permissions are on a page in Linux, you know, parse a freaking text file out of the proc file system. We can be more efficient than that. Downsides of Iron Heap. One, there's no code yet. Just some proof of concepts. And two, it really does lean on 64 bit. And browsers, particularly Flash, aren't entirely fantastic at 64 bit yet. This is true and it matters. People like their freaking Flash. So, what may work today is a piece of software that got really, I don't want to say popular, but was being developed around 2007, 2008. A piece of code called Die Hard. It's an interesting secure allocator from Emery Berger over at UMass. It was an advanced ASLR implementation without a band heat metadata. It's a long way of saying when you allocate memory, it goes to hard to predict pointers. You don't really know where it's going to be and you don't have obvious things for you to corrupt. Suppresses use after free in a way very similar to the Microsoft allocators. So, you don't know when the memory is actually free. It is eventually, but, you know, Internet Explorer actually has a command that says run the garbage collector now. Like, it's not so good. The big thing about Die Hard is that they're available today. There's code for Windows, there's code for Mac, there's code for Linux. Probably worth exploring for tails. There's something different about this stuff. So, when we have normal ASLR for like loading libraries, we have what's called NX which means you can't execute code that you throw into the stack or heap somewhere. A lot of other defenses assume the corruption has occurred and say now that it's occurred, let's make it really tough to figure out what to do. What the end game is that leads to arbitrary code execution. Yes, you've corrupted but you don't have a path. And this class of defense is different because you're actually preventing the initial corrupting moment. If you don't have the free complete, the use after free can never start. There is nothing going on in infosec that is killing more O day than use after free killers. You cannot imagine how many undiscovered bones are in this space. I still remember the first time I wrote a fuzzer that found these stuff. Come to work every morning, it's like, ooh, look at all these, like dozens. Can I just say by the way, whenever like people who actually write fuzzers hear things like, and they used four O days. It's like, dude, I found four O days at lunch. Like really, you get the pattern down in quantity. So here's the plan, okay? IE has got a story around use after free. Chrome has got a story around use after free. Firefox has got some O day. Firefox needs a story around memory hardening. So it's going to take some time and it's going to be hard to convince them to give up their beautiful memory allocator gem alloc. But we're going to put together an actual strong secure allocator for production Firefox in the field today. We're going to start by building this for the Tor browser combinations, for the tails environment. We're going to get it so that it is indistinguishable performance wise from real native Firefox. It's not going to be me alone doing this as a white ops project and I actually have managed to recruit Dr. Emery Berger, creator of DieHard. We're going to go ahead, we're going to get Firefox a heck of a lot safer. So that's what we're up to. Dr. Berger actually came on board about 80 minutes ago, so I'm really excited to be announcing this. I'm like, dude, you want to join us? He's like, hell yeah. So that's what we're going to do about browsers. Now we've got to talk about DDoS. We're almost there. A little bit left. Everyone having fun here? I know I'm nerding out like crazy. All right. So we've got to talk about DDoS here because the bad guys are filling up our pipes. Series of tubes getting clogged here. We had all of 100 gigabit flood in 2013. We've had like 114 in 2014, okay? Like the bad guys are making a mess of things. I had assumed that DDoS had just turned into botnets. You know, you've got millions of desktops, you fire them all on some website, they all have full stacks, there's millions of machines, life sucks. It turns out the biggest and ugliest of the DDoS's are actually something else. They're not using desktop machines, they're using DNS servers. That's my protocol, dammit. Using NTP servers. They're lying about their source address, they're pinging some machine on the internet, they're causing those machines to reply to some poor target and it is filling everything up. And I want to take a minute to explain why this variation is quite so damaging. So here's the deal. I am a terrible artist. But I've tried to draw the internet. So what we've got here is you've got some source and if you're going to go down one network path you'll take the left fork and the other one you'll take the right fork. It spreads out and eventually as you get closer and closer to the destination there are fewer and fewer paths and finally you're at the destination. Does that make sense? Depending on where you go, you have a fan out and then a fan in. Now if you're flooding a single destination, all your traffic takes pretty much one route. It goes down, down, up, up, down. And that's the one route 99.9% of your traffic is going to take. So the most bandwidth you can consume is the least bandwidth of any of these hops. But now, now let's say we're going to reflect off of machines all around the internet. What happens is, is that your traffic fans out in all possible directions, hits all of these various name servers, each of which has their own fastest route back to some poor network. And I don't know if you can see it, but the entire damn network is red. Boom. This is what's going on. And it's ugly and it's not going away. So what are we going to do? Are we going to lose our toy? I don't want to lose my toy. I like my toy. I like my kitties on Roombas, damn it. So what are we going to do? Ideally there's this thing called BCP38. Ideally there's a technology called URPF. Ideally networks couldn't lie. So you can't be in the middle of San Francisco and be like, hey, I'm poor schlub in London and I want this DNS supply. Yeah. I'm not saying that this is a bad idea. I'm just saying there's a heck of a lot of networks out there that don't give a crap about filtering routes. The technology, I'm not saying it doesn't scale, but it totally doesn't scale. Effectively the technology works by dropping traffic. You know what ISPs don't like doing? Dropping traffic. It fails once in the field. They're like, I'm never turning this back on again. I'm not saying we shouldn't continue to strive for BCP38 compliance. Some crazy paper came out a while ago. They found at least 2,300 networks that don't have it. You only get the real advantage of BCP38 when it's almost entirely universal. Now, it's been a tremendous success for cable modems, for DSL lines, even for a bunch of corporate environments. But the really big pipes that are really able to do huge reflection attacks, they're not getting secured anytime soon. At least not if we can't bust them a hell of a lot quicker. So, I'm going to bust them. Here's what we're going to do. We're going to bring back an old idea called stochastic tracing. I did not come up with this idea. Maybe I've refined it a bit. First heard this idea about 12 or 13 years ago. And the idea is you've got a router and one out of maybe a million packets, it says, hi, I'm this router and I routed some traffic to you. Doesn't do anything for your standard normal flows. But if you've got a router that's being made to move billions and billions of packets, you're going to end up with a nice stream of hundreds and hundreds of tracers. And these things actually incrementally improve the internet over time. Because there's more and more traces and it's harder and harder for an attacker to know whether or not their spoofed traffic is going to be quickly detected back to them. As it happens, routers have most of the technology necessary to already do this. It's very simple to configure a router to do what's called a GRE stream. To say, please send me one out of every million packets. That can go to an individual daemon, we don't need to patch the router for God's sake. We can go to a daemon, the daemon can go ahead and send this trace packet. What does it actually mean to send a trace? Because by the way, I don't want random people on the internet knowing all the traffic that I'm receiving. I don't even want them knowing my DDoFs. So the idea is the traces go to the destination of the flows. And maybe the source. There are only two IPs that are really supposed to be seeing traffic and it's the source and destination IP. So if you're spoofing traffic, I don't think you have an expectation of privacy for the network to hide that you are lying about being the guy in London. What does the payload actually look like? That's a good question. Do we encapsulate this in ICMP? Do we make an HTTP post? I don't know. All I know is if you're on the internet, you're already receiving crap. I know this because I'm sending you crap. And you haven't crashed yet, I think. There's an alternate option. This of course comes back to my own history in DNS. Sometimes it's a pain in the butt to hijack, say, all the trace traffic that's coming out of ICMP to an IP or HTTP to an IP. That might actually be hard. There's a space called reverse DNS. 4.3.2.1.inattr.arpa can say my DNS name is blahblah.foo.com with what's called a PTR record. You can actually host more than just PTR records inside of reverse DNS. So you could host something that actually says, yeah, I know you're trying to do tracing for 1.2.3.4. Here's the server that accepts those trace packets. And it's still trust associated with the IP. It's very nice. Obviously we want to assign trace payloads. Otherwise you can spoof a whole bunch of things and be like, yeah, I'm totally Verizon moving all this traffic. Go harass Verizon. So we've got to prevent that and we can do that with ED25519 keys. So that can work. The long term vision is to reduce the time between a DDoS and tracing the involved networks. We've got to make this stuff happen faster. Ultimately what we need to do is we need to get to the point where DDoS is automatically suppressed. Where there can be firewall rules that are automatically applied. Now this is rough. Because there's a lot of hops that are going to see enough to be able to request firewalling. So I don't know exactly how this works. But what I do know is that these floods are growing fast enough and nasty enough that we may actually get the greatly feared congestion collapse. There may actually be entire countries, entire regions of the globe that just have too much traffic for anything to work. And I think Paul Vixen would kill me if I didn't say, by the way, you know, we can, like, patch name servers. We don't participate in this anymore. Call RRD. But unfortunately it requires so many hosts to upgrade versus this kind of stuff which is just incrementally improving. So let's talk about practically the last thing I wanted to discuss in this epically long talk today. I don't know why I said I wanted a two-hour talk. Am I trying to kill myself here? All right. Can't just not talk about this whole NSA thing. Can't just leave it to Bruce Schneier. I love Bruce. I'm worried. I'm worried about the long-term reaction to the NSA revelations. See, there are two ways that you can win in technology. You can have the better technology or you can have FUD. Oh sure, you can go with that competitor. They're cheaper, faster, nicer, more powerful, but ooga booga nation state. This sounds ridiculous until you realize there really are proposals to go ahead and keep all traffic within a country within a country. This is really, sure BGP says this route is faster, better, easier, but the law says you have to keep it within our borders where we can monitor it all. Thank you very much. The Internet, again, was not the first time we tried to make the Internet. It was the first one that worked at large scale because you didn't have this sort of political interference. This was the network made by nerds who had one thing they wanted which was make this work, make this work as fast as possible. And a lot of these political actors have a different goal in mind. You know, we didn't want the Chinese Internet or the Iranian Internet before Snowden. I hope we don't want that now. But I look out there and I look at the reactions to the NSA and especially their manipulation of crypto standards and there really is only one thing I can think. You maniacs! You finally did it! You blew it all up! Damn you to hell! Let me tell you the honest truth about cryptography. And if you don't know, the NSA pushed and got a broken crypto standard into, well, they wanted to have everyone use it but really they only screwed other feds. There's a reason we were asking the NSA's advice for cryptographic vulnerabilities. Okay? Most crypto functions do not need the NSA's help to suck. They get that for free. Okay? It takes like 10 years to figure out that a cypher or a hash or whatever might actually be safe. And the NSA has actually been pretty good at saying, something's wrong here. This thing in Ness, it's not good. This thing in Shaw Zero, it's not good. Excuse me, I'm out. You know, it sucks. Wouldn't it be nice if we had like a department of the government that was dedicated to defense? Like a department of defense? They could have like a conference, like a DEF CON. What's happening is that even good advice is being treated with deep suspicion. NIST is like, hey, yeah, we standardized on this Kessack algorithm, but wow, Shaw 3 is slower than Shaw 256 in performance patterns. And, you know, this is not a controversial opinion. Zuko of Tahoe LFS is like, hey, Kessack is too slow in performance patterns. The community is like, NIST, NIST is evil. NIST is doing more evil. They got NSA pulling their strings. And what's the end result? We are totally replacing NIST with DJB. With some guy. Now, I want to be clear, I'm an enormous DJB fan. I've been advocating curve 25519 for using TLS replacing protocol for literally like half a decade. But fewer trusted resources in a time of great need, not actually helpful. There's that great quote, Linux scales, Linux does not scale. I have a graph. And this graph explains the problem very clearly. The NSA has two missions. DJB pretty sure only has one. This is what's going on here, okay? Like sometimes one of these guys finds a bug and says, cool. And it's not DJB. So we're all kind of waiting for the other shoe to drop. Not implementers. If you've noticed, pretty much everything new that comes out just uses DJB sec. Like his stuff is one. Everything new is, you know, 25519 or, you know, bad ass or libsodium. His stuff has won the day with implementers. There's what's called epistemology. There's how do you know what you know. Academics aren't really allowed to know things without some degree of evidence. This is kind of a barrier to a lot of FUD and BS. This is kind of the heart of science. We do know that dual ECDPRG is bad. We have hard evidence, we have math and so on. But there's another shoe. And that shoe is what's called the NIST P curves. There's this great technology, it's called elliptical curves. Elliptical curves requires parameters. There are two major sets of parameters that came out of NIST. The P curves and the K curves. We know exactly how the K curves were constructed. You take this value that comes from a mathematical function, you put it in what's called a nothing up your sleeve generator to show there's nothing up your sleeve. And now you have your parameters and everything is good. And then there's the P curves where that thing that's going into the nothing up your sleeve generator is C493608 dot, dot, dot. Every shirt has two sleeves. I'm not saying we know that the P curves are compromised. However, if you don't plan on the P curves being compromised, you're an idiot. And you should get fired. And in fact, that's pretty much what all implementers have realized. One of probably the most interesting things about Bitcoin is a long time ago they said, yeah, this P curve stuff is garbage, let's go with the K curves. So this is something that everyone is sort of waiting for. It's not like we know it. But we know it. The larger issue is it's not like crypto worked particularly well before the NSA con revelations, okay? The hard problems in crypto actually aren't the math. They're actually not even the implementations, although GPGG are gone inside. Key management is the hard part because this is what actually touches users and organizations. We keep modeling cryptography as math and implementation but there's a complexity that goes unnoticed and that's operations, okay? Every project in the real world, who here works in IT? Okay? Tell me I'm wrong when I say every project needs to be measured only in terms of how many god damn meetings you need to do in order to complete it. That is the metric. When is the last time you saw a meeting count measured in anything to do with cryptography? When's the last time you saw crypto work in the field? Not an unrelated thing. We have to learn to respect usability, we have to learn that this isn't the operational requirement. Over at Black Hat, one of the most significant announcements in some time happened. Somehow Alex Stamos, one of the founders of ISAC, got root at Yahoo. I don't know how he did it but he's like, you know what? We're going to do end to end PGP for Yahoo freaking mail. Sweet! Because you know what? Google might understand user experience but Yahoo really, really understands it. So, summary of what we've talked about today. We're almost done here. Don't let an attacker touch your storage. Let it store, let it execute, don't let it do both. Actively gather true entropy. Death to non cryptographically secure PRNGs. Please, for the love of God, represent entropy in a way other than bit vomit. Browsers become vastly more secure once use after free is prevented and we are going to fix this in Firefox. The NSA crypto fallout continues. It hasn't gone away. There's been a wholesale movement to, while I'm a fan of the guy, he's a guy. He's a professor at UIUC. Yahoo's PGP news is fantastic. One of the most significant things of the year. Maybe of a couple years. And, just because I can, just one more thing. I totally get to pull this. It's Apple related. Apple went ahead and put into their latest release notes for iOS 8, Safari now blocks ads from automatically redirecting to the app store without user interaction. If you still see the previous behavior or find legitimate redirection to the app store to be broken in some way, please file a bug. Yes. Okay? I am tired of browsing something on my phone and it's like, I know you're trying to browse this website but what I really think you want to do is pay money to Kim Kardashian. No. That is not what I want to do. Fuck those guys. Apple wants help, let's give it to them. Now, I talked about this on Twitter before and I said, hey, I'll give you 250 bucks. Screw that, I got a company. I'll give you five fricking grand for the first person to go ahead and give Apple some bugs they can fix. I want to see this dead off the mobile internet, okay? I've become a believer in bug bounties. This is a complete 180 on my old position. I used to think that bug bounties would lead to crappy bugs and people being idiots and demanding money anyway and it would just be cheaper to pay them off. You can't imagine how crappy bugs are that come in from the outside world sometimes. People have no idea how stuff works and they think they're geniuses. But I was wrong. I'm telling you this. I've seen the results firsthand. If you want richer bugs from the outside world, maybe you should make bug finders richer. Turns out that when you actually have a sample of good bugs you can pay for, you can now be like, yeah, we paid for the good bug, your thing is crap. So we're not just doing 250 bucks, we're going to give $5,000 to the first finder, 2,500 to the second, 1,000 to maybe the next five. If we get more, we might keep throwing more money at this. I don't know how many bugs there are. But we believe in A, this sort of behavior is toxic. It destroys the mobile web. It is some of the worst stuff we see in advertising. And I run a company that fixes advertising. This is still offensive. And I think hackers can fix things and I'm willing to put my money where my mouth is. So thank you all. This has been a blast.