Hello, my name is Eli and today with Jean-Michel, uh, we're going to talk about, uh, side channel attack using deep learning. We are both part of the, uh, Google, uh, re- Google security and anti-abuse research team. So, side channel attacks is one of the most efficient way to attack, uh, secure hardware because it targets the implementation rather than the algorithm and usually implementations have, are harder to secure than the algorithm itself. So, for example, last year, Johan Honig, I hope I pronounced his name right, uh, did a side channel attack to recover the private key of the crypto wallet, uh, Trezor. Uh, that should use the power of attacking the implementation rather than the algorithm. Uh, so side problem with, uh, side channel attacks is they, uh, require a lot of ex- domain expertise and they, because they target a specific implementation, uh, they're not very reusable. So, uh, the, uh, the, uh, the, uh, the, uh, the, uh, the, uh, the, uh, the, uh, the, uh, uh, the, uh, the, uh, the, talk about that but uh trust us actually deep learning is a really really good fit for uh script analysis, hardware script analysis and we're going to hope to show you that today. Um fundamentally the reason why AI is such a good fit uh for uh performing uh stationary attacks is because it's like template attacks uh which are state of the art but on steroids. And what we mean by that is uh using deep learning help us to address a few problems. So first one is that uh when you do it, when you use deep learning you do not need any type of uh trace processing. So you don't have to cut them, you don't have to align them, uh the machine learning take care of that which is one of the biggest problems when you target uh secure implementation. So second thing is uh we can get rid of a lot of assumptions such as the model of attacks uh for the people in the know uh like the hamming weight model is not needed. You can directly target part of the attack and the other part of the attack. So the algorithm directly with deep learning so a lot of the human assumption are out of the loop and as a result uh your attack is more efficient and easier to understand and carry. Uh the third one is because deep learning has this ability to output probability when we perform the key recovery itself as we're going to show you uh we can combine the deep learning probability to make a very nice and efficient probabilistic attack which is something which is way harder to do with standard techniques. And last but not least uh deep learning have a lot of metrics and we can see the algorithm progressing so we get a better sense of how well the algorithm is learning or attacking the hardware and so we have way more interesting metrics that we can leverage. We're going to show that as well uh during the talk. So there is also a more fundamental reason why deep learning is such a powerful tool and you keep hearing people saying deep learning, deep learning, deep learning everywhere is because as far as we can tell deep learning is the only technology we have uh period uh in the world. Uh deep learning is the only technology we have uh for any domain which actually scale uh with data and computing. So more data, the more computing you have, the better deep learning become and that's the only one we have. And that's really why the reason is of why it becomes so powerful. And you're like okay fine uh I can see that for uh character conditions but what's what's up with attacking site channel. Well what it means is we can push further our attacks with more trace. The one thing is the more trace you have about your implementation and we can always generate more trace. Right? So the more trace you have about your enterprise is just bunch of crypto computation the better it become. So we have a way even for hard target to scale up because deep learning scale linearly. So all we have to do is generate more data which is something which for site channel attacks is very easy to do when you have the board. So in a way it's a perfect fit. Um so all of this will become if it's a little bit blurry today as as now don't worry about it as we go through the talk it's going to be more clear and it will start to make sense. So today what we wanted to do because as DEF CON uh we're going to do a little bit of a deep learning and we're going to do a little bit of a deep learning. Uh we get rid of all the equation. Uh we also get rid of all the complete stuff and we're going to focus on show you step by step how you can do it and show you it works. Uh a lot of people have attempted to use machine learning for site channel. Many people have failed. Uh we failed a lot. Uh been two years since we work on it so we failed a lot. But when it works it works and we wanted to show you step by step how to get there. So that would be very practical. No equations. No boring math. Just straight up if you were to code that's what it would look like. So we call those attacks site channel attack assisted with machine learning also known as CAMO. So during the talk we're going to call it CAMO because it's a shorter and nicer uh name. Um this talk is based on a long project uh that we've been inside about two years ago with a bunch of internal and external collaborators around uh improving and hardening hardwares uh crypto hardware we have uh to provide the best hardware and the most secure hardware we can. Um the slide uh today we are going to be making the slide public. Uh they're already on the web. Uh we also tweeted them with Jean-Michel so you can have them today. In uh hopefully very soon we're going to give you also the code source that we use to carry the attack so we'll run it yourself. And in hopefully in the not too distant future we'll also make available the whole research paper as well as all the data sets we collected and the model we trained so you can actually reproduce our results. So last disclaimer before we delve into the matter. Um we decided with Jean-Michel that we wanted to do a little bit of research on the art to focus on showcasing how to get the attack working and as a result we don't use state of the art machine learning. We don't use state of the art processing because we think it's more important to focus on clarity. We will succeed to be clear. The attack works 100% of the time. But we wanted to make really a focus on getting you guys a clear understanding so don't expect like super advanced machine learning here. Uh which but it's fully very advanced. Okay so how it's going to go today. Uh Jean-Michel is going to talk about what are some of the things that side channel attacks, what is deep learning so everyone on the same page and then I'll come back and I'll talk to you how to use both techniques and combine them to do a scan and attack and then we'll briefly talk about the research itself and what to expect next. Jean-Michel take it away. Thank you Eddie. So first let's step back and get the same definition on what we mean by side channel attack. So every time you do computation with an embedded device, a CPU, etc. It's going to result in some artifact created by this computation. And if you have a way to measure that and you have a correlation between those artifacts and a secret you want to extract, then you can conduct a side channel attack. It can be used to recover encryption key, which is the thing that we're discussing today. You can also it's uh it has also been used in the past uh to perform blind sequel injections. You can also steal password and pins, extract crypto wallet, private keys. It can also be used in the past to perform blind SQL injections. You can also steal password and pins, extract crypto wallet, private keys. It can also be used in the past to perform blind SQL injections. You can also use an info device. You can also use an add manager to perform blind SQL transactions. The other thing which we're going to ask the question now it doesn't really matter but. And the another combination in the future, is that we will use a support chain for, uh for scaled internet adolescence. So a support chain is two built to have greater number of processors but too small or can round only up to the required number of processors. So it's very important to remove those components from the supply chain, like enter the호 Pick up theハ BOT probably, and see if there's something else written on them which gives us ability to consciously record the call generation time in U Count Down. So if there's managed to máscary. You know some externals interesting execution will last longer or not and by deriving that you can get one bit of data. Uh you can also measure the power consumption during the the encryption of the data and that's the one that we are uh using on the on this presentation. Theoretically you could also use the heat but the problem with the heat is that it spreads and you have a huge latency so despite using an infrared camera on a big CPU to see exactly which part is warming up to locate exactly where your crypto accelerator is located the heat cannot be used to recover an encryption key as far as we know. And for this we prefer to use electromagnetic emission instead of the heat which is more precise and doesn't have the same side effect but we're not using it uh on the attack we are showing you today. So side channel attack in a nutshell. We do some encryption with the uh with the uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh uh microprocessor. We're measuring the current consumption with an oscilloscope. We accumulate that over time with different plain text and we do a template attack for the uh for the state of the art attack. A template attack is still uh an attack that requires a powerful attacker because most of the time uh to to train a template attack it's a probabilistic model that you have to train on what is called a white box chip. The white box the bo- the white box chip sorry is a chip on which you can control the encryption key. You train your probabilistic model and then you apply it on the chip where you don't know the key and you want to recover it. And at the end your probabilistic model will give you the AES key. So as we see here on the on this theoretical curves not the real ones uh we can see that most of the time the trace overlaps but on the top of the um of the curve we have some discrepancies. Uh so we can see that the uh the uh discrepancies. And those discrepancies hopefully will happen on a clock signal for the CPU which means that it's the register which are changing values creating different kind uh of power consumption at a given time for the different bits that are set. And that's the kind of thing that you're looking for. And ideally if this point at the time only relies on a part of the plain text that the attacker control and a part of the key that you want to recover this is an attack point. Here we see a full trace of a lightly protected AES trace. It's AES one uh 128. And if we take a deeper look at this particular box we can see some humps and some repeating patterns. And if we count them there's actually 10 humps and that exactly corresponds to the 10 rounds of AES 128. So you see that it can be also very visual. Uh this is how we were doing that in the uh at the beginning of the project. It was sitting on the corner of my desk. So we have a PCB which has a target chip that's the one containing the encryption key that we want to recover. Here we have a differential probe that is measuring the power consumption over time. And it's connected to the oscilloscope that is here. And here we have the communication interface to be able to feed the plain text to the chip. And that's all it all it takes. If you want to start uh by the way you can uh you can start using the on the second r- on the second row here uh is the creator of chip whisperer which is a very cheap and easy way to start with side-channel attacks. Uh on the board you have all you need, you have an oscilloscope, you have uh the communication interface and it has multiple targets to try uh to try this. Uh if you're interested we invite you to talk to Colin, he has a few chip whisperer nano that he can uh give to some of you. Uh but most of the time the limitation of the chip whisperer is that it's feeding um it's uh the clock that it generates and the sampling rate for the oscilloscope is limited. And when you're attacking more secure elements most of the time they won't allow you to feed any clock to it to or to slow down the clock which means that you will not be able to use the clock to feed the clock to the oscilloscope. So you will need uh very high sampling rate for the oscilloscope. Uh and for this you will need a real oscilloscope but the software stack provided by the chip whisperer is already compatible with that. Also during our paper we do a synchronous capture. So the chip whisperer usually works with synchronous capture which means you have one single clock that you feed to the chip and the oscilloscope will capture the data exactly at the right amount of time. Most of the time if you use uh an external oscilloscope this won't happen. But I'll take a you will have exactly what you see on the screen. You will have different clocks, one for the oscilloscope sampling and one for the CPU and they will be out of sync. Which means that if you want to sample in this sit- in this setup, you need the oscilloscope to run at least 4 times faster than the CPU- the clock of the CPU you are attacking. And that's why with our setup evolved over time during the project and right now we're using a chip whisperer pro which is a bit more expensive than the- the chip whisperer light or the chip whisperer nano kits. And we use a Picoscope 6000 series. This is not an advertisement, the talk is not sponsored, this is just what we use so that if you want to reproduce the setup you know that this works. And the reason why we picked the Picoscope 6000 series is because it can sample at a very, very high speed rate. It can go up to 5 giga sample per second so we can attack a chip that is running at 1 gigahertz. And it also has very big memory. So, it's very, very powerful. Uh, it can store up to 2 giga sample in memory and it is very important when you start attacking asymmetric cryptography like RSA or elliptic curve because the traces are really big. So, now let's move to what is deep learning. Deep learning is basically a neural network but with many layers and they are stacked together like pancakes. So, at the beginning you have a series of neurons mimicked the- with the biologic- biological one. And then you have a- the number of neurons that you have defines the width of your layer. Then you start packing- stacking them like pancakes and it's, uh, creates a depth on your network. Hence, the deep learning. Then you add an input layer to process your input and one for the output to do the prediction. Here between dogs and cat. When you want to use the, um, the machine learning you feed, for example, this image of a puppy, you feed it to the input layer. It will activate some neurons, they will propagate their predictions to the next layer and the next layer. And at the end at the, of the output layer it will issue the prediction whether this picture was the picture of a dog or a cat and here it will say that it's a dog. But when you have different use cases you will need to use different types of layers, different types of network, network architecture so it can make things quite complex very quickly. So what do you need to train a deep learning model? Basically, TensorFlow will allow you to write and to train your model. Uh it's written in Python. Uh but it's very very slow to train on a CPU so don't try that. You will need a hardware accelerator for that. You can use either a GPU or if you use on Google Cloud we have what we call TPU, TensorFlow Processing Unit. And this is a dedicated ASIC that is there for uh especially for TensorFlow and deep learning trainings. The demo code we will try to make it available as soon as possible uh on Colab. Uh Colab is basically a Jupyter notebook but hosting in the cloud and it already comes with the TensorFlow already set up and free GPU TPU time computation. And now I will give back the uh the mic to Eli who will guide you through the your first Scamal attacks. Thank you Jean-Michel. Alright so now that we have the basics done uh we can start the demo. Uh uh we're gonna start the demo. Uh uh going to try to see how we combine both and um making it work in practice. So uh I said our goal is to get you through the attack step by step and try to provide as much information as we can so we you can reproduce and understand what's going on. So the first thing to decide is what we're going to attack and for this presentation we selected uh a chip which is the STM32F415. Uh this is one of our favorite boards because it supports a lot of um software implementation but also have hardware implementation you can run on it so we can compare hardware protected AES versus software one and try to test many of those. And for the implementation we're going to use tiny AES uh which is an unprotected uh version of AES because that's the easiest one to attack and that's the one where you're going to get the best result. Um so it's one downside to it that I'm going to explain a little bit more in detail later. But because it's software it's very slow so those traces are very big and that make it harder to train uh because you need more GPU memory. Uh okay so Jean-Michel showed you earlier uh what is a SCA game plan so we're going to upgrade it to make it a SCAMR game plan. So uh same as before we do encryption on the chip we hooked our chip whisperer and pico scope get the the data, feed it to a neural network and we need to talk about how we're going to train the chip. So we're going to use a chip whisperer and a pico scope and we're going to train that thing and then uh we'll have to combine those things and do some sort of uh inversion and a little bit more extra work to actually recover the actual key and if everything goes well uh you get a AES key or in our case we'll try to get mini AES key. Alright so as I mentioned uh tiny AES is great, it's software, it's open source, you can have it however it is super super slow and what I mentioned that is because it's going to take about 80,000 points as input. Uh it's fairly large, it's actually larger than most of the images we feed into a neural network for recognition of images so we will have to do a little bit of um different type of architecture to kind of reduce uh the amount uh for the demo we're going to provide to you on Colab. Uh Colab only have 20 gigs of memory that seems a lot but actually it's not for deep learning and so what we did is we also have another data set coming out uh which is Colab specific where we basically uh took one fifth of this of the trace so you can load it in memory and play with it. So you can do that uh it's more efficient because you have a fewer points to process so you can put more in memory. The problem is we are violating our first promises which was you can do on full trace. So if you want to do on full trace you need a lot of memory and you need pretty beefy GPUs uh we use between uh GPUs which have between 12 and 16 gigs of RAM when we're trying them on the real thing. Alright so what model, what deep learning architecture do I need? Alright that's the question is do I need a deep learning architecture to do a deep learning architecture? It's like okay I have my data what do I process it with? Well the obvious answer uh is you we're going to do the same thing what we use for speech processing and image recognition which is what we call a convnet also known as convolutional neural network. So reason why those are better is because they slide across the data and so you don't have to process all the points at once. So the number of parameters and connection is lower and because we really want to have locality right? What we want is to fi- fit them in a way that's easy for us to do. So if you want to do a deep learning architecture you can do a deep learning architecture and then stack them. So that's our favorite network of choice. However if you want you can also use for people who like deep learning use uh LSTMs uh more precisely GRUs works pretty well too if you stack them. So you can use those other architecture but this one works well it's fast so that's our favorite that's our favorite one. Um what does it look like? Right so a little bit of code uh I promised no equation but I didn't promise no code so you guys have a little bit of code. Uh this is a txt. This is a txt. This is a txt. This is a txt. This is a txt. This is the uh cancer flow 2 uh code uh or keras for those who like that better. And the idea is we have a bunch of constant uh which is just setting up our uh network the important one is the last one called pool size. So what pool size will do is by how much are we going to combine as a first layer uh which going to be in a second. So first we take the input so we convert it basically as an input for our layer or our networks then we do a max pool. So what does a max pool do? The max pool does the same thing once again we put all the parameters in there and so pool do the following. It takes of sliding windows, so we put 4 and it's going to take the maximum value for each of those 4. So in a way it's basically shrink down your s- your trace from 80 point to well 20,000 point and then uh you going tend to process them with convo- con- convolutional layers uh which are here. Uh they are not the same as images because they are one dimension. Why one dimension is because we have a trace of one point right? This is just the value of the current we don't have 2D like images x and y so that's why we use 1D. Uh for those who like machine learning you might already recognize that we don't use a normal convolution we use a convolutional blocks where we did put batch normalization in the middle and the reason for that is it speed up the training and then we keep uh doing a few of those uh I think in that example we did 4 uh 5. So we do 5 times those 3 layers and then we keep doing 5 layers so you already have 25 layers here. So that's why we call it deep learning is because we already have about uh 30 layers at that point. Then we do another max pool so that's the final final one where basically we have all those convolution which creates a lot of uh uh depth if you would if you would. Like a number of filters is the w- is the depth and then we combine them to find the maximum one for each of those points and then we add a little bit of drop out and a dense layer to connect everything and do our prediction. And our prediction will be the same as the previous one. And then we add a little bit of drop out and a little bit of drop in which is the last layer. That's the output of your layer. If you remember the cat and dog here we don't have cat and dog. What we have is we have 256 values and I'm going to explain a little bit more what they are in a minute. But basically we have 256 values that the uh network is providing to you. The important point here is you might consider the idea of using sigmoid which is another way to do it. Uh if you do that for deep learning uh for sectional attack it's a horrible idea. So you might consider the idea of using sigmoid which is a horrible idea because uh we have only one value which is true. Right? If you try to predict an image you can have a cat and a bench and something so you have multiple classes. In our case we have a single class which is true which is a value you want to predict and nothing else so you have a lot of zeros. So basically every time the what the machine learning is going to learn is if I have 256 zeros I have 99.9 percent accuracy so your model shows nothing for a very long time. So that's why you should always use a softmax. Uh we try both and really that's the best way to do it. So don't use sigmoid if you try that at home. Okay. So now the one thing I haven't explained is like okay so I have a model, I have data, what am I trying to predict? Well that's where things get complicated. Uh so this is AES. Uh this is a round of AES to be precise. Uh we're going to talk about the first round of AES and the question is what do we do? So as Jean-Michel explained uh we are doing power consumption and the question is what do we do? So why is power consumption reflecting the key right? What happened is if you want to set a bit in memory to 1 you need power. If you want to set the the bit of the memory to 0 you need no power right? So basically uh you you need more power if you have 8 bits at 1 than if you have 4. And or 2 right? So basically we need to find every point in the algorithm where there is a shift of some memory and those are going to be where the power differences are going to be. Uh so the we're going to kick in and we'll have some sort of differentiable place to look at. Fair? Okay so where are those? Well first when you feed the key. You feed the key in memory you load the your key so your key is loaded so that's the first point. Then you have to do something where you combine the key with a plain text so that's an XOR so when you do this combination well again you might have also some loading there. Then you have the S box and after the S box again you you go out of the S box where substitutes things again you're loading the new the new value memory so again a third at that point. Then you have one more which is before the key scheduling and one after the key scheduling and then you repeat that 16 times because well there is 16 bits for each of those things and then uh in a terry code model uh you can repeat that 10 times because there is 10 rounds uh however there is only 2 rounds you can use uh to recover the key directly which is the key scheduling. So you can repeat that 10 times which is the first one and the last one. So one in the middle are way more complicated while in theory in cryptography we consider them as an attack because they leak stuff it's really hard to exploit. It might be possible in the future we might be able to do stuff but for now we're just going to focus on the initial round where you have only 3 places uh or 3 type of prediction you can do. So first one as I mentioned that we call AP1 is you just predict the key. You say hey give me back the value of the key. That's the easiest one to do because well that's a direct prediction. The second one is please predict the value of the key and plain text and there that's why I explained you need a little bit of computation after the com- after the prediction where you have to well de-exhaust the plain text. So this only works for uh attack where you have a chosen plain text which is the one we're demonstrating today. And finally the last one you can do which is also a very common one is you go after the AS box. So in that case you have to invert the AS box, invert the XOR so it's a little bit more computation and you have that. Uh don't worry about it we have implemented all of those 3 type of attacks into the code we're going to give you in a few hopefully soon and you will be able to run them. So where does it leave us? That leave us to this idea of we take the power trace, we feed it to the network, the network do all those crazy layer I showed you and output a value uh to a softmax. So what is a softmax? Basically a softmax is you take your 26- 20- 256 value and you say no more lies such as the sum of all those value is 1. So reason of 1 is because it makes a very nice uh smooth probability and we constrain the- the output so every prediction is comparable and it's going to be important later. Uh it's a standard technique by its way to machine learning so this is already built in. And so we make 256 value prediction by the model for each attack point value. So if we were to target the key, each of those outputs is going to be equal to the value of the attack point value. So if you try to start around and make a guess what is the value of a key uh the value we can have. Um so last thing I need to tell you and this is where it become um not complicated but it's- it's a little bit different from what you expect is we do 1 byte a time. So if you were to attack a full key what you would do is you will have to train 16 models. One for each byte of the key. One for byte zero. One for byte one. One for byte two. One for byte three and so forth. We'll see. and you're like why? Well we have 256 value for the first byte and then you repeat that 16 time so we don't want to have like about 3000 value to predict that's not useful we could uh but it's also um uh push the model to have higher capacity right because you have now the model have to learn all the non-linearity to predict all of those value so your model is going to be bigger and it's going to be harder to train so it's easier to have one model per key. And a question that we've been asked quite a bit is is there any bytes which happen to be harder? The answer is most notably no but in some implementation it seems that the bytes which are at the border which is 4, 6 and uh sorry 4, 8 and 12 are a little bit different because of um the power of 2 so in some implementation it seems a little bit weirder but they all work the same. In the end. Um okay so you do that you're ready you have your code you click fire and then you wait because it takes hours sorry it's not very easy training a machine learning model takes time uh you have to train on about 50,000 example you come back and you cry it doesn't work we lied we actually it's the model I showed you I lied it just doesn't work and then you're like okay it should work why isn't it working well you try many of those and none of them work. So it doesn't work. That's where most people have stopped and we have countless people who say it doesn't work. And that is true learning crypto is hard and you're going to fail a lot and a lot and a lot and a lot and for a year about a year we we had only failure through reports we know it should work we just don't know why and to be honest we still don't know why. However we have a way right? So so how how do we deal with it if we can't find it by hand? Well the answer is don't don't do it, rely on hyper tuning. So hyper tuning is the idea that you are fuzzing your model architecture to try to find the optimal one and you try to do it until you find the right one and you just throw at it more CPU and more computation. So even for this simple example, we have to do that. I, I really wish I would show you a model which is super easy to understand, that will work just right. I don't have one. Uh, what I, what I did is I trained about a thousand model, uh, on uh, Google Cloud, uh, using Kubernetes and Keras Tuner, which is the hyper tuner we developed for TensorFlow 2 with the TensorFlow team and I selected one which works. And like I said, we have a super amazing model to show you. However, it's not going to be as simple as the previous one. We're like, okay. So you brace yourself and you're like, okay, what do you mean by more complicated? Well... Uh, this is a simplified view of it. It's not that bad. Uh, kind of. It's a few hundred layers now. So, same as usual, we have the input and then we have a max pool. Uh, the max pool is six this time. Um, don't have the space to put everything. Then we do two normal convolution, which is help us to decrease the number of points and increase the number of filters. Then we do, uh, what we call residual blocks. And so the residual blocks, the idea is you are adding shortcuts into the network to actually force the gradient. Uh, so the gradient is when you make an error, you back propagate the error to the network and one thing we found is the gradient is vanishing a lot when we do training on crypto. So use a shortcut to retain the gradient. This is something they also do in images. Uh, it's called RASnet, residual blocks. So you do a few of those and here what happened is it decreased the num- the size of the trace and increased the number of filters. So decrease the width, increase the depth. And then you need a lot of residual blocks. So that's not the same. Why is it not the same? Well in this case, the number of points do not decrease, but you increase the depth. So basically you do a combination of all of those again with residual. You do a max pool, you do a dense, you remove the drop out because it doesn't help at all. And you do around 256 layers and you have something with which works. And that is a simple example I can show you which works. And I cannot find it by hand and you're like, Eli, what is intuition? The answer is I have no intuitions. Absolutely zero. Don't know. Uh, for some reason it's very very finicky and we have some which works. So empirically that works. Uh, the intuition is not easy to get. And you sh- and the cat is happy and we're happy too because now we have something to show you which works. So, uh, we have a model. How well does it work? Well, this is the trace, uh, out of the board. And the model is going to do nothing for a few epochs. So also another thing, don't get discouraged if you try model for deep- for- for crypto. For four or five epochs, the thing do nothing. I mean, it- it kinda go to 5% maybe and then go down, go up, it's not really- really good. And then it start to learn and then it's going to- to spike at uh, 35% accuracy around 30 epochs. Uh, five e- five minutes per epoch, so about two hours later, you have your result. And then the thing collapse. So this is validation accuracy means these are on uh, traces that we haven't seen during the training. These are traces we use to monitor the generalization of the model. And yes, it's going to collapse and our model collapse at the end, we're not sure why, but what what happened uh and then you get that model and you check point and then you save it and that's your model. Uh we also try data augmentation uh sometimes it works sometimes it does not a lot of people say it does uh it kind of except if you make it wrong uh it actually actually completely destroy your ability of your model to learn because it seems to destroy some of the non-linear correlation you need. So do not use data augmentation unless you have to or you feel you want to push further and have a good baseline. So let's go back a second to what I mentioned earlier which was we have multiple attack point and answer a question which is does it make a difference whether you attack the key, the key XOR the plain text or the output of the S-Box and the answer is yes it does. If you try to predict the key it just doesn't work. If you try to predict uh the out plain text XOR uh the key it actually works really well the one I showed you thirty five percent works really well. Uh spike a little bit after uh the sub byte in which is plain text XOR the key. So both works in that implementation however if you were to use something else it might completely be different. Uh it's actually depends implementation it is dependent on where is the leakage coming from and so you don't know where the leakage is coming from so that's another reason why we need to scale computation is we don't know. So let's finish this thing by okay so now we have a model working model how do I recover the key? Well as I said we're going to make this very nice probabilistic attack using our predictions and the way it's going to work is we're going to take a trace when it's a model which is trained and it's going to say here are my prediction and we're going to accumulate them so we're going to do it on uh few traces uh you can go to a thousand, two thousand, three thousand but really we don't need that much and then you're going to sum them and you're going to take the mo- no the value no the maximum value would be your best predictions. What is very interesting about deep learning is we also know what is the second value and the third value and the fourth value so even if you don't get it right you can brute force and it's very easy to brute force because you know in which order to test each of the byte because machine learning will tell you which one are the most likely, the second most likely, the third most likely and this is something which is unique to deep learning compared to template attacks. Uh also we cheated here again uh we used log ten to account for the number of bytes that are in the community traces because that's the correct way to do it uh mathematically just for people who try to do it. And then an important thing we found out that very very few people did in the literature is making sure it works across chip and the way we do that is we train the model on once, one chip but then when we do the real attack we do it on the second chip because we want to make sure that the model generalizes around the difference that there is between chips which are from the same family right you don't want to test on the same chip because all you learn is a model which might be dependent on the same chip. So we want to test on the same chip on the specific uh chip you got. So we do two chips, one for uh training, one for testing and then uh the last thing we need to mention is okay so we have our data set on our second chip how do we evaluate the effectiveness of the attack. So so it's four ways uh the first one is top one accuracy which is how many of your predictions are in the top one, top five how many predictions are in the top five, then mean rank what is the mean rank of your key. Remember you have 256 predictions, cryptography, cryptography, cryptography, cryptography, cryptography, it's supposed to be look like random so 128 is your baseline and what is the max rank so the idea is is the machine learning have shifted the space search space and reduce it so the max rank gives you some of those ideas. Now one thing we do which is also very different is we try to recover 100 key and the reason to recover 100 key is because we want to make sure we can recover a wide range of key rather than one specific key to make sure we generalize. So the holdout data set is made of 100 key and we use 300 power trace uh that we can accumulate uh and see how well we do. So do we do well? You know the cat is very anxious so you try and then yes actually you can recover 100 percent of the tiny AS key uh using the attack I showed you. Moreover so 100 percent so 100 percent all of them are zero because well we have all of them moreover what is uh perhaps more impressive for people who know side channel attacks is why does the model have 30 percent accuracy and that's a very deceptive metric? Well the model is very specific we recover 100 percent of the key with no processing but also in at most 4 traces when you don't play the attack uh we're calling uh it's about 5 to 6 traces so you are better than state of the art even with a simple model and perhaps more impressively if you want to use a single trace you'll get 81 percent of the key correct. And that show you how much more powerful deep learning is to do side channel attacks or at least on AS and that's really why we claim is going to be the future of it and that's why we try to get more people excited to work with us on that. So to wrap up because I think we have two minutes left uh we need to deal with also protected implementation which is not the focus of this talk but are very active field of research and to deal with those things which have actually no pattern uh you need something way more and that is what we are going to we are doing next which is we have built a large data test bed with six hardware six implementations including a few hardwares one and protected ones collected over nine million sample traces uh and trained over five thousand models and we hope to make uh all the results as well all the models that we've learned and all we learned into a paper soon uh so you can share our results get you to reproduce and help us uh work on the next step. So the take away is deep learning is the future of SCA. I hope we convince you by the result and the advantage of deep learning over traditional technique are really really big and so it's a big leap it's very different from what we did before but that's really worth it. It is really hard uh you fail a lot and so don't get discouraged uh you really need automation we don't know how to do it without automation we're not making it the pitch of like hey let's use a lot of GPU it's just like we don't know how to do it otherwise this is how we found our way in the last few years to be doing it and we really believe it's the beginning we are aware of other researchers working on symmetric asymmetric uh uh analysis with deep learning and finding great success so this is really where the thing is heading and really uh if we can automate that then we'll be able to go back and focus on designing secure implementations of crypto that we can test very efficiently so we can provide the world way more stronger crypto which is really like strong implementation which is really what we want we really want to provide uh very strong chips that we can trust to put our secret in it. So thank you so much for attending today we're really happy you take took an hour to be with us uh we hope that some of you are inspired to do some of this work with us or on your own uh we put aside today as you are who have here thank you so much.