Joining us off this morning is Marie Fromm. She's going to be talking to us about cloud encryption, how to not suck at securing your encryption keys. Take it away, Marie. Thank you. Yes, that's going to be the goal of today's talk, how to suck less. So anyway, a little bit about who I am. I work in infosec cryptography and I'm trans. I've done a lot of stuff over the years, incident response, security testing, reversing, security architecture. And for the rest of my career, I really want to fix things. I see there's a lot of people that throw bricks through windows and stuff, and I want to work with builders to actually fix stuff. I think it's really important because right now there's a lot of really negative things happening because we're failing at security so badly. So I want to see things suck less. Now. What kind of got me thinking about this talk was something that affected probably most of the people in this room was the Equifax data breach. And they had the CEO up on the stand and they were asking, you know, one of the questions was obvious was, well, was your data encrypted? He actually said he didn't know, which was amazing. So I just I was just stupefied by that, first off. And then the thing that really, really, really upset me was after they said they kind of. Issued some clarifications and said, well, you know, maybe some of it was encrypted, maybe some of it wasn't, but, you know, encryption doesn't really help. And I just and then you saw the pundits, you know, in all the columns and stuff about, well, yeah, you know, encryption doesn't really help prevent. And I just I know that for the people in this room, I would almost guarantee that most of you would be able to encrypt something that I couldn't read. So, I mean, that's that's kind of a, you know, kind of a basic thing. And it makes statements. But, well, encryption doesn't really help prevent data breaches is a really bad message. And it's it's partly due to the way things are being done, the way cryptography has been used, both on ground and prim and data centers and in the cloud. So I'm going to talk through a few different areas. I'm actually going to start start on ground and talk about data center encryption. It's it's oftentimes kind of typical. Here's a big, big storage frame. You know, you'd find in a big I.T. shop and, you know, the product slick. It's got all these cool things, you know, strong data at rest protection. You know, it talks about and they go on and say, you know, this these these are protected by, you know, A.S., which is which will protect top secret government data. You know, so, I mean, they make these claims and, you know, the EMC dude, you know, makes a huge sale. You know, the the execs feel good, you know. Our data is encrypted at rest. And but let's talk a little bit about how these work before we get into the cloud. So system operation, you know, it boots up big hurricane machine, you know, and actually I should make a I started out this slide writing, you know, data written to rust. And I thought, oh, wow, you know, that is so. So for you younger ones, you know, in the old days, we had these spinning rusty things that we wrote data to. And now it's all flash. But, yeah, you'll have to Google that shit. It's really great. But, you know, it's but the main. So this these systems boot up. They read an encryption key. That's so, you know, it's they try to protect it. And then all data written as transparently encrypted as it writes right to the storage media. And then on reads, it's transparently decrypted. And so there actually is no awareness to the server of the application that this encryption. Is happening completely transparent, you know, systems connected via, you know, NAS or SAN. They just they think they're reading and writing data. And it's cool. And it's we're encrypted at rest. Right. You know, that sounds really good. So so one of the things about this, if we look at this and say, how well does this kind of encryption protect our data? Let's say say we had something like this. And, you know, it does meet compliance requirements. We check that box that, you know, hey, it's AES encrypted at rest. But what happens if we have a data breach? So attacker comes in. We actually do a flowchart, a real simple flowchart. Attacker tries to access the data. Was the storage frame on? Bummer. The encryption did not protect our data. Was the storage frame off? Hey, we win. We protected our data. So you have to, you know, that's that's one of the things that when people say encrypted at rest, you really have to understand what kind of threats. So you have to, you know, that's that's one of the things that when people say encrypted at rest, you really have to understand what kind of threats they're going to be. That protects against. So, you know, we look back at the storage frame example on the ground. You know, it protects against a pretty narrow model of threats. Like say, you know, I have some bad drives and the EMC dude comes in and to replace them. And he's taken them back to the depot. And a couple fall off of his bicycle. You know, that's, you know, I can say, you know, those drives were encrypted at rest. They were powered down. They weren't spinning. So this form of encryption, if you think about this, this thing that people say, oh, yeah, it's encrypted at rest. You know, it just protects against this very narrow threat. So when somebody says this, hey, my data is encrypted at rest, whether we're talking cloud or ground, you really need to dig a lot, lot deeper. So let's dive into the cloud. Now, first of all, I'll say, you know, not all data should be in the cloud. You really need to think about risk modeling, about, you know, understanding what your threats are, your compensating controls. And I'm not here to bash cloud. You know, I think, you know, AWS, Azure, people are using it successfully in a lot of cases. But a lot of people are not thinking about cloud implementations of cryptography that actually protects data. And, you know, so AWS is not. AWS, they give you all this amazing functionality. They do all sorts of stuff. It's almost, it's staggeringly complex. There's so many different things you can do with AWS. It's like every week I get an e-mail and new things are added to it. And it's like, wow, wow, wow. And it's like I don't know how you can stay up on it. But and actually I'll say AWS does give you some primitives that can apply a certain level of encryption to do things reasonably well for certain use cases. But you really have to do proper systems engineering. And I'm not here to talk about that. Because if you don't, this stuff is not going to be encrypted against the threats you care about. Like, you know, somebody actually trying to take over your system and steal your data. Now, you know, there is some interesting differences. Like in AWS, I don't know if you looked at it, but they've got different, they operate in different geographies. And I'll just say some of them are kind of interesting. Like China has stripped out all the encryption. Even the encryption built into the platform. It's got no IAM or two-factor authentication. And so that might have some security implications in what you're building. So as we get into, let's take a really simple example. So a simple building block is S3 encryption. And it's used for, you use it for all sorts of stuff. It's a basic fundamental piece of technology for storing a chunk of data. Now, a lot of people don't necessarily realize this, but there's actually quite a few different ways you can encrypt S3 data. So there's server-side encryption options include server-side with the key managed by S3. Server-side with the key managed by KMS or Amazon's key management service. And you can also do server-side encryption with customer-managed keys that you manage. Say in a variety of ways. It could be outside of KMS. And then there's actually client-side encryption options. Which can make a lot of sense to encrypt data before I ever stuff it up in there. But just this very basic primitive of, quote, encrypting data in S3 has got a whole bunch of different ways to do it. So like say I'm a dev and I'm trying to figure this stuff out. And I look at S3. And here's this default encryption. It's a checkbox. That looks really good to me. I love doing stuff with checkboxes. Because I can go and I can think about the application development. I can think about all this stuff. The wonderful things. The business benefits my app is going to do. And I can check that box. And the security folks are going to be happy. And there are some kind of interesting things about the way Amazon does this with the S3 encryption. They actually... They encrypt each bucket with a unique key. Which is good. You don't have this shared key that unlocks a whole bunch of stuff. They encrypt the key itself with a master key that it rotates regularly. That's kind of cool. You know, key rotation. Critical part of controlling your encryption keys. Again, it uses one of the strongest block ciphers available. This is right from the marketing material. AES-256. To encrypt your data. So this is... It's really easy to me. I can check a box and I'm done. But... It's not really that simple. And so... For an analogy... I would like to talk about a physical system. So... Taking this context. Of an S3 bucket. Where it's doing this automated encryption. If I apply it to a door. A door that I want to secure. In a room that's closed. And I've got some stuff in it. That I want to protect. I can go out and I can buy a really nice deadbolt. These are really good deadbolts. There's probably somebody in Lockpick Village that knows a way of opening these. But for most of us... I know I can't pick that deadbolt. I probably can't saw it. It's designed to not be beatable open. And imagine this deadbolt. In front of this door. And it's protecting people from going in. Grabbing the stuff I'm trying to protect. And walking out. So... This is kind of similar. To our S3 bucket. We want to make sure the right people are going in. And getting our stuff. But I would kind of assert. That that last example of saying. Apply the default encryption to S3. Is a little bit like. Having this massive door. This really nice deadbolt. But leaving the key in the door. Now that doesn't really protect that data. Right? Because if they get in front of that door. They see. And they can turn to walk. So they may have to do some positioning. To get in front of the door. Maybe to take it back to the controls you might have in a web application. Maybe they tunnel up through the floor. Or cut through the ceiling. Or punch in a wall. But if they can get in front of that door. If that key is there. They just turn and walk through. Grab your stuff. And walk out. So this is kind of a design pattern. That is not so great. Well we can actually point to it. We can say it's encrypted. We can sign a paper that's encrypted at rest. That's good encryption. But it's actually not really very effective. In stopping people. From walking out with our stuff. So. There's a principle. Kirchhoff's principle. It's kind of famous. And it says any crypto system should be secure. If everything is known about the system. Except for the key. That can all be public knowledge. Well if we're not managing our keys correctly. Or properly. Or securely. Or leaving them in the door lock. We certainly aren't really controlling this system. From a cryptography perspective. We're failing. So just maybe. I'm saying that if we check that little check box. And say using S3 server side encryption. With keys that are managed by S3. Which sounds so easy. Because it's just a check box. That isn't the protection. That we wanted. Or needed. So let's go on to the next way. Of encrypting data in S3. Remember I'm just talking about one service. And all these different ways of encryption. I can use server side encryption. But instead of having S3 managed keys. I can put those in AWS KMS. Which is their. Amazon's key management service. Now that comes with some kind of interesting things. That I'm going to dive into. There's a lot of different ways. You can set up Amazon KMS. And I'm going to get into those. So here's. I just change the check box. And I select the key. That I provisioned in KMS. And I'm off to the races. Sounds pretty good right? Now maybe I'm a dev and say. Okay well now I just got to generate a key. A thingy. And now I just encrypt. And now I'm good. Now KMS can be used for. A lot of things. They've designed it to integrate. With all their services. You've got S3 buckets. EBS. Glacier do long term storage. You've got RDS for relational database services. So it is pretty cool. I can build this simplified infrastructure. Somebody trying to build cloud apps. And I'm just trying to get my thing out the door. I can use this KMS thingy. To hold the keys. And that sounds kind of good. Because it says it manages keys. And I can do better right? Well. Let's dive just a little bit into KMS. And see if some of the problems that we had. With the key and the lock. With the deadbolt. If we can see how we can stay away from those. Well. Amazon's key management service. Is pretty interesting. And actually. As in everything Amazon. There's like five ways to do things. I can in key management services. I can use AWS managed. Customer master keys. CMKs. And these are keys that are created. Managed. And used on my applications behalf. By the AWS service. That is integrated with AWS KMS. I can also use. Customer managed keys. So rather than just letting Amazon. Just kind of do it automatically. I can actually generate. Use a customer managed key. And I can do. Some extra things with that. It's kind of cool. Some extra controls. That I would argue may be wise. On applications with very critical data. So these things. These include things like. Enabling and disabling the CMK. Which actually is an important thing. Come to later. Is if something bad is happening. And you can detect it later on in the stack. I can disable that CMK. And actually prevent it from being used. So I can. Rotate it's cryptographic material. I can also set up IAM policies. Or identity and access management policies. They cover access. To that specific CMK. I can use that CMK. In cryptographic operations. And I can do encryption. As part of my code. Which is kind of cool. But the important thing is. I as a customer. Maintain control of that CMK. So. Now there's data keys. And those live outside KMS. KMS doesn't manage. Or control those. And there's customer master keys. Key encryption keys. And data encryption keys. And so we've gotten a little bit more complex. And that dev that just wanted to click a box. And say yeah I want this thing encrypted. Now there's a whole lot of things to talk about. Or think about. Or design into. Multiple ways of encrypting with S3. And then if I use KMS. Multiple ways of managing KMS. So some things. You might be thinking about. It's like. What does this give me? Doing customer managed keys. I named a few of the benefits. I can do my own rotation. I can actually disable. There's some kind of cool things that I can do. It gives me a little more fine tuned control. And I'm going to the permissions in a bit. Which is even maybe better. But some of the things. That seems really critical to me. Is using really good random. Using a known good source of random. You know I think. I believe KMS has got. FIPS 140-2 rating. They're working on certifications. But picking random. For a key generation is a really big deal. And in cryptography. We've seen this fail over and over. And over and over again. It's like a long list of failures. Of poor random. Being used to generate a key. When the system gets owned. So this thing about. This thing about generating the key. You want to really be careful. Or understand. Where your random comes from. And that may give you a reason. Why you should be generating your own keys. There's also kind of another thing. Another reason maybe to do this. In customer generated keys. Is if. Think about the clouds. Sometimes they turn dark and stormy. And violent. And if you don't have. Your cryptographic key material. For your applications. Stored somewhere safe on ground. You could set yourself up. For a pretty significant. Availability issue. Because now you've got encrypted data. And no keys to access the application. But always. The selection of random. In cryptographic key generation. As I'm sure everybody knows here. Is a really really big deal. I'm going to talk. I'm going to go slide back in. To the KMS. And on that second option. Customer mastered. CMKs that are customer managed. Wow. That's a hard one to say. Customer mastered keys. That are customer mastered. Managed. So. There's. Again. Everything in AWS. There's a variety of ways. So we were talking. The multiple ways of encrypting S3. And multiple ways of using KMS. And now we're going to talk about. Multiple ways of applying controls to these keys. Which is kind of interesting. There's three things. That I can use to apply. What controls access. To these encryption keys. There's a key policy document. That's. That describes. Usage of the key. I'll show you in a second. There's IAM policies. Or identity and access management policies. And these. You can use those. In combination with the CMK. Key policy. To allow access to a. CMK. This actually gets kind of. Complicated to simulate. There's an IAM policy simulator tool. That Amazon has provided. To help people figure this out. Because I've been in the position. Of trying to review. What has access to this key. And it is non-trivial. To dig into sometimes. And then the third way. Of applying controls to this key. Is grants. And these are kind of cool. Because you can then specify. With a high degree of granularity. Exactly what service. And what thing can use a key for. And how. And I'll show a couple. Examples. Of the key operators. And how they can be different with grants. Which is kind of neat. And they're an alternative to the key policy. So we started the S3. Multiple ways of encrypting. KMS. Multiple ways of doing KMS. And now we've picked this one option. Customer master keys. We've got multiple ways of doing this. There's a lot of permutations here. And a lot of landfall. Minefields for devs. Here's a simple key access policy. And don't believe me. This is not real. You won't own my system. Nothing about this. This is all fictional. But this would be typical. For a key administrator. Or a custodian. In key management. One of your principles. Is you want to have a separation of duties. You want to have people. That are putting applications together. And they have a permission. To have an application. Tie a given key to an application. And that application. Has permission to use a key to do something. But then you typically have another team. If you're doing it right. With a separation of duties. That has management capability on those keys. And so this has got some. Some things like disable, delete. Schedule key deletion. Cancel key deletion. Revoke. All kinds of things. When you have that separation of duties. For a key management. So this is. Oh yeah. It's also possible. To constrain a CMK. So it can only be used. By a specific AWS service. Through the use of a KMS. Via service conditional statement. So I can actually really nail this key down. And say this can be used for this one thing. Period. Which is pretty cool. I can kind of limit the usage of that key. Now here's kind of a. Couple slides. Showing. Some differences. Of key access grants. Now I may want to bisect my application. And say. I have some internet forward facing logic. Where people. Enter something into a form. And you know that's what they do. Random people connect to the internet. You know enter some stuff in a form. And it goes in. Maybe there's an auth function. Some other stuff. And then I got a separate team. Of people that work for the company. That connect to the same system. And they need to do some management functions. They need to do some look ups. Maybe some edits. You know check some stuff. So if you bisect your application. To where you have the internet facing logic. And you have configured it. For instance to where. That internet facing logic. That key. That's all it can do. It can encrypt period. It can decrypt. So even if that application gets owned. It doesn't have the rights via this grant. To decrypt any data. So the attacker that got root on that box. They do not have the ability. To decrypt data with this grant. Now maybe you have a separate network. Maybe through a direct connect. Or a VPN. Where your people doing the management on the system. The maintenance of it. The application owners. They may be. You know they may need. They quite likely need the decrypt function. So this is an example of using. These different grants. To give different parts of the application. Different permissions. And help build a little bit more defensive depth. Into your app. And say you know the internet facing stuff. We don't want them to ever be able to decrypt any data. So I've been talking. You know I was working my way. Through S3 buckets and encryption. Now there's the last one. Server side encryption. Customer with keys that you manage. Maybe outside KMS. Or with a different system. And then there's also client side encryption options. And I really do like those. Because you get a fine grained control. Over your data. Of what you're encrypting. If you think about it. If I control the encryption. I get data encrypted before it's ever stuck in S3. I don't have to worry about. You know what happens. You know when somebody screws up permissions. On that bucket. Or changes an ACL or something like that. You know I think that's consistent. You know with ISO 27040. You know using encryption. To actually create these partitions. Of you know who can access things. And I think that client side encryption. If you encrypt it. Before you put it in S3. You won't be in the headlines about. And you manage it. And that whole process. That encrypts the data. And acts on it. You will not be in the papers. Which is really good. So. You know there's also not just the door. And I think one of the things. You know to extend this a little bit. And kind of the story I'm building. If you know that first story. I talked about that door. And I've got that awesome deadbolt on. I can point to it. And say that's my FIPS 140-2 rated deadbolt. And you know. I can't beat this thing open. I can't pick this lock. But I'm going to leave the key in the door. And people walk in and out with my stuff. Well I'm screwed. You know I don't know how many of you have been. To a commercial data center. But the process to get in. Is typically a little more involved. You walk up to a bullet proof window. And you provide your identification. They perform visual identification. Against your ID. They then look in the computer. And see if you're authorized to be there. And say yeah you have a ticket to go in. And do X and Y and Z at this time. This all looks right. And then rather than. You going to turn the key in the lock. They buzz a door into a man trap. And you go in that. And you stand there to get out of the man trap. And to proceed. You need some additional credentials. With some badging. And some two factor token and stuff. And then that gets you out. There's also. There's a human involved. And he's logging stuff. That you went in there. You had a ticket to go in and do X Y and Z. And hopefully they're. You know and they're typically awake enough to say. Yeah you come in here every three months. And you do a thing and you leave. Now if I come in. And I've made four trips in and out in a day. That's unusual. And if I try to haul boxes out. That's like double unusual. Because we're not supposed to be hauling boxes out. So it's like. That's a detective control. Built around that. You know the authentication. The authorization check. And all that. And so we've built a little bit more controls. Over whether I can walk out with the stuff. Now with AWS. Those are some of the things we need to be thinking of. As we're building applications. It's not like. Aren't we using strong encryption. This is not doing bupkis. To actually protect the data. We need to build these controls. These additional things. These additional layers. Around the application. To do this properly. So. There are other ways. Of managing encryption keys in AWS. Of course there are. There's many different ways to do these things. So. I just lost. Scared me. I'm panicking. It's like my laptop's plugged in. It's like I was freaking out for a second. But oh shit. So. Amazon actually has had a variety of things. For doing key storage. That aren't KMS. They had cloud HSM V1. Or the classic HM. And that's just a. Just a simple. Hardware security module. Hardware security module. If you don't know. They have these kind of. Random generated encryption keys. And protect them in hardware. And tamper proof kind of systems. To ensure that these keys can't be compromised. So HSM's are used for. You know for serious key management. For keys that have some pretty big implication. If they were ever to be compromised. So if you're not familiar with an HSM. They had Amazon. They still support it. A couple of the regions. Cloud HSM V1. Which is the Gemalto Luna. Which is kind of interesting. They've kind of produced their own. And they've submitted it for. FIPS review. And then you know. There's third party key management solutions. I listed one. There's a bunch of different ways to do this. There's different HSM vendors. There's different key management solutions. This is you know. If I had like a day to do this. I could talk about a whole bunch of different ones. But I got an hour. So I'm going to kind of focus on one. So. This is kind of interesting. You know. Amazon has submitted for FIPS validation. Their cryptographic module validation. And it's. They got the stuff on it. It's got some interesting design aspects to it. I really encourage you. If you're storing encryption keys. And you're doing it in hardware. You should actually read these. These module verification documents. They're fantastic. They're a wealth of knowledge. And how these things are protecting encryption keys. And what kind of threats. And what was their threat model. What's the security boundary. And how are these tested. And what do they protect against. And if you dive into these NIST documents. It's a really cool way. Of understanding a lot better. And you can also ask some interesting questions. When you're talking to the AWS people. For instance. So. As I talked about that option. You know. There's also HSMs that we use for key management. From Gemalto. From Talos. Gemalto is a big player in this stuff. If you've got a cell phone. Or a US passport with a chip. Or a credit card. You have technology that was made by them. I'm not a shill for the company. But they do make a lot of stuff. So. There's. This is an example of a pin entry device. That's used. With. Gemalto equipment. And there's an important principle. You've heard of two factor. Gotta use 2FA now. That's kind of common sense. But there's some additional things in here. And that we can use. K of N or M of N operations. So we say. We've got these five people on this team. And we want to have. At least three of them come together. To do this operation. And say. We want to do this operation. Of transferring these keys. One to this other thing. And we want to make sure it's done in a very controlled manner. We want to make sure there can't be collusion. Or an individual just can't go off the rails. And say I'm going to steal all the encryption keys. And go sell them to the Russian black market. Or something like that. So with these kind of systems. You kind of get beyond the Amazon. Hey I have a key. I can do a thing. And you say. We not only have a key to do a thing. But it takes multiple of us to come together. To do a thing. And then because we can set it. At any ratio we want. We can say we need three of five. Or four of seven. Or whatever it is we want. And to solve the oh my god. Marie got hit by a bus problem. So if I get hit by a bus. Or something like that. Or just had too much fun at DEF CON. And never go home. There are people that can carry on. So this is kind of cool. Having more than one. Having more than one user. Required to do critical encryption operations. Such as transfer of keys. And stuff. Backing up of keys. Because remember. This whole confidentiality. Availability. Integrity. If we lose keys. We lose the key. That data is like gone. So we've seen that in a few. Being weaponized. As a service now. Encrypting data. And hiding your keys for ransom. But when we're hosting stuff in the cloud. We really have to think about that. It's like we want to make sure. That we can get this back. Assuming an asteroid hits a data center. Or something like that. We want to be able to get the data back. So having a way of replicating keys. Across geography. In a secure way. In a very controlled environment. Between three trusted people. Or something on our team. Is a good way to do it. This concept of crypto officers. Versus crypto users. This is a total eye chart. But there's actually some kind of cool things. I'll talk about. As we get into some of these third party solutions. That I think are neat. And actually one you can do. Is you can actually say. Maybe the keys. When you're hosting your application. You got to understand. What is your data. What is your trying to protect. What is the blast radius. If this is breach. You may actually want to keep your keys on ground. You may not want them in the cloud. And so you can do things like say. You know we want to have. A Gemalto. Or for that matter. The other with Azure. HSM on ground. And we want to do our key management on ground. We want to have our. Cloud apps call for those keys. That gives us a little bit more control. We can see what's happening. We can rack a little quicker. We know we own the keys. They were never up there. So push comes to shove. We can cut off access to it. And that stuff is encrypted. Nobody can get out of it. But there are some kind of cool things. If I've got my key management on ground. I can go into the data center. And I can love it. And touch it. And watch it's blinking lights. Which is neat. It's cool. And know that all is right in the universe. And my key is protected in a very safe environment. So you know that gives us. Also gives us a fall back. You know when the cloud turns stormy and black. And parts of it evaporate. Because of whatever. We actually have our critical encryption keys. We maintain control of them. And we have our security solutions. To encryption problems. So let's take a database. How do we encrypt a database? And running through a couple of examples. Like if you use SQL Server Enterprise. Last version. You can use transparent data encryption. It sounds super easy. It is. It's really easy. You turn it on and just use it. And it just works. And your data is encrypted at rest. Which is pretty cool. So let's start to analyze it. Well one thing now that that's given me. Is by using the prior version SQL Server data encryption. Data encryption. Transparent data encryption. So I make a copy. Or if I make a backup of that database. And throw it somewhere. And leave it. Don't set access permissions to it. That's actually encrypted. So it keeps a person from getting a database backup. Which is awesome. Now cloud introduces an interesting problem. Because on the prior version. With transparent data encryptions. They may get the whole VM. The whole running instance in the cloud. If they do that. You're kind of screwed. Because they got the encrypted data. Which is in the database. And they got the key. Which is in the registry. So if they got a copy. Snap the VM. They had everything they needed to reconstruct that. Which sucks. Sucks for you. So you can say. I don't want to store the key in the registry. I want to store it in this strong key management system. Now this can be actually in the cloud. Or actually on ground. And then with solutions like. With the Jamalto solution. They take it a step further. And they can say. They can apply an encryption. For instance. So you can say. These stored procedures. Get privileged access to be able to utilize this key for decryption. So maybe I got a customer by lookup name or something. And it has access. To be able to get to this decryption key. To this key. To actually perform this customer lookup. And so I've got these stored procedures. That are defined in this application. That can actually utilize. This trusted connection. To a strong key management. And use these keys to perform operations. Now when somebody. When somebody does. Somebody pops your app. And they're doing a SQL injection. And they start using one equals one. Hopefully you didn't define that. As a valid stored procedure. Just saying. If you didn't. That won't be one of the stored procedures. That can be used. And instead of vomiting up the unencrypted. User table. It will vomit up the encrypted data. And the attackers got buffed this. There's some other things too. Like with protect file. I can do things like apply some extraordinarily fine grained permissions. On files. And I can say. This service account ID. Running this binary. From this IP. This machine. Can transparently read and write these files. Into that application. It looks like they're decrypted. But if I pop root on the box. And my shell is bash or whatever. I've got nothing. I just get that data back in an encrypted form. So I mean those are some of the extended. More deeper layers of encryption. We can apply to stuff. So why would. Why should I manage my own keys? I mean Amazon's got a thing. They manage keys. There are some standards bodies. And some frameworks that say. You know maybe we should be kind of. Hanging on to our encryption keys. You know this is a good one. HITRUST. You know it has some verbiage in it. Well you need to use validated cryptographic modules. That's kind of a no brainer. You need to store keys. Separate from the data. And key management. And key usage. Need to be separation of duties. And keys shall not be stored in the cloud. There's also the new NIST. That's the 853-5. Which is in draft. And I love the line. Maintain exclusive control of cryptographic keys. And remember when you're in the cloud. You're running on someone else's computer. Your keys are up there. And I kind of parse this. Keeping Amazon from getting at it. But. There's. You're putting the keys someplace else. Where people that have access to that application. Potentially have access to it. So it's kind of a complicated question about. You know it's not like Amazon gives away our keys. But by provisioning an application to use those keys. You can allow an attacker to utilize them as well. In a way different than you intended. That application to work. So you intended the application to do a certain thing. For people. And he's using that same application. To suck out all your data and sell it. So. Again. Maintain exclusive control of cryptographic keys. I love that line. And so if an application makes sense. To use Amazon KMS. Again you've got to look at your threat modeling. Your application. What is the risk of the data you're storing up there. There's a lot of cases. Hey it makes sense to use KMS. This extra stuff I'm talking about. It doesn't fly. It's not worth the expense. The time. The configuration. There is this whole continuum of data risks. Some data is low risk. Some is high. But you should use. If you're using KMS. You should only use the FIPS 140-2 certified endpoints. They've got a table of them. That's one of the things people screw up on. Is they don't realize that not all endpoints. Are FIPS 140-2 certified. You have to design your system. You've got to architect it. So you've got a separation of duties. And hopefully some using split keys. Cave in. Sharing secret. It's really cool. Split up a key into eight parts. So any four people can come together. And rebuild that key. So no one person has all the information needed. To own the thing. And you have the Marie got hit by a bus problem. And then employ key usage. Monitoring. Alerting and responses. For using KMS. They actually say to do some things. But nowhere does it actually say how to do it. And this is really kind of. This is the hard part. You should be monitoring for data plane operations. And control plane operations. But like data plane operations. Quantitatively saying. You know this application. Normally calls this decryption key. 200 times an hour. They just call it 2000 times in five minutes. Something very different is happening. So if I'm using those grants for instance. I can actually detect that. And say I don't know what's happening. But I think a lot of data is leaving the building. And you can actually flip that. And revoke access to that key. Until you can investigate. Do an incident response. Figure out hey was somebody just breaching me. And at least stop the bleeding. There's also control plane operations. So somebody. Say an attacker gets in. And they want to start deleting some of your CMKs. I would argue. Something's happening to your CMKs. Delete key. Schedule key deletion. It's kind of a big deal. You do want to do that. As part of normal key life cycle maintenance. But that is a big deal. Also building systems. To do this alerting. It's really hard work. It's frustrating. Because people say. Well just use Splunk and shit. Which is like. That's not really an answer. It's a complex problem. I guess. My approach. I have a girlfriend. Who has a PhD in statistics. And she's really awesome at figuring out this kind of stuff. But I can tell her. These are the things I'm kind of looking for. That I think represent a problem. And she can help me build stuff. This is the math. This is how we deploy a statistics solution. To look for that. And so I would advise all of you. If you're doing this stuff. Get a girlfriend with a PhD in statistics. I don't know. I want to produce some additional stuff. This would be like a full day workshop. Instead of a one hour talk. But there's kind of. Some principles on there. But anyway. Encryption and key access controls. You really need to design your plan. I'm amazed at the number of devs. When I analyze applications that are made by third parties. It's like. Do you have the documentation. Of how you assign grants. And IAM policy. And KMS policy. You can obfuscate all this stuff. Please do. But do you have any documentation. Well no. I guess the dev just did it until it worked. I guarantee you. That's going to be a problem. I've seen that in third party apps. Which is suboptimal. To say the least. So you really need to plan this. And this really needs to happen. In the application design phase. This is not something. That I can just swoop in. And fix some stuff later on. So in conclusion. Encrypting data in the cloud. It's very complex. I just led you through something really simple. I want to put a thing in an S3 bucket. There's all these different. Kinds of choices you have to make. And there's no. It's complex. There's no magic answers. Encrypting data to actually protect it in the cloud. Is more than just a checkbox. And you know. We tell devs to never write their own crypto. We taught them that. But now with the complexity of cloud. And some of these encryption solutions. A large number of design choices. We need to embed with devs. And we need to help them implement. Cloud cryptography architecture. And that's going to be really critical. I think that this is. We're not going to get ahead of this problem. Unless we sit down with the devs. And talk through some of the aspects. What we're trying to do. And multiple. Completely different ways of encrypting something. Like a simple S3 bucket. And multiple ways of using KMS. Or external key management. So you need to think about the threat model. That is so so so critical. So. We want to make sure that. Attackers can't decrypt our data. By virtue of standing in front of the door. And turning the key. We want to add some additional controls. Like authentication. Authenticating. Understanding your authorization. Or monitoring. We have to engineer these cloud cryptography solutions. Properly to protect the data. And just to recap. There is no magic crypto fairy dust. That I can parachute in with. At the end of a project. And somehow sprinkle that stuff on there. And secure an app. It can't be done. I wish I could. I'd be a millionaire. You know. I do have glitter. But that's. I don't know. So anyway. I'm not sure where I'm at on time. Maybe getting close. Yeah. We have about ten minutes left for questions. If you have a question. Please come on up to the mic. And if you don't feel comfortable. We're recording this. So if you'd rather not be recorded. And on the mic. Please approach Marie after the talk is over. So we have ten minutes. Come on up. And first. Let's give a big hand to Marie. For an awesome talk.