You're talking about beyond adversarial learning security risks in AI implementations, so he's going to take it away Welcome to my session, I'm Khan and Here I'm going to talk about probably something different from the other talk in the CI village because I'm going to talk about Really the security part. I'm a security person. So this is a work Jointly with a couple people from Chihuahua 360 and a willing from University of Virginia I have a full author there and there's a four bulldog picture there. There's no correlation between the author and the picture. Okay And there and we had a paper published in the IHP security privacy a workshop on deep learning and security in May So this is pretty much the same talk. I hope I hope you you guys were now there. So this is something new to you Okay So I am a professor from the University of Georgia in the past. My work is mostly on the software security side I organized lots of Capture-the-flag teams and some of the some of them are well known like SAC doc or dissect I'm also the founding mentors for the like Blue Lotus team One of our team like team dissect was last the final list of the cyber grand challenge like two years ago here We were one of the first team to win the cyber grand challenge and we were one of the first team to win the cyber grand challenge One of the seven team So recently I'm actually right now taking leave from University. I'm doing consulting working industry. Okay, so now let's go back to the main topic I'm not going to talk about the machine learning algorithm I'm actually going to talk about the a little bit about the deep learning implementation. We don't have much time So I'm going to try to be brave. So I'm going to start with like a simple question example So you all seen this if you work on deep learning and you open the textbook This is the first example you see my question For you, it's like how many lines of code for you to implement this this is an amnest that do that does the digital Recognition you take a picture it has a digits in it. They recognize it how many lines of code we implement this It's not long like it's a code for implement this pretty much like you need the networking part and you need a solver Totally. It's like I always say less than 300 line. Okay now, how can you do a fancy thing like, oh the magic in such small piece of code. It's because our current implementation on most of the deep learning applications, they're not building from scratch. Usually you use a framework. There are lots of common frameworks like TensorFlow, Cafe, Torch. You might use some wrapping language, but pretty much, at least for the people I talk to, they don't build this from scratch. When we discuss the implementation algorithm or even you look at the like Adversary Machine Learning, you're really talking about the top layer. You're looking at your model, your parameters, sometimes you might talk about your training data, but we don't talk about much underneath. So the underneath part actually matters. Let me show you an example. So you probably, if you are in this area, you have a look at lots of CAT pieces. So this is one example. We got it from Cafe, we download, we run it. You can run this easily. Assuming you have some model from other place and then you run, you give a picture, it produce some result. Now what I did an additional thing is I did like this particular one can build as a Linux application. So I do IODD. For people that in this field, like if you do security, you know, okay well this does, it shows all the library dependency of that application, right? So in a particular one that recognize CAT, the code is not long, but then it depends on 137 libraries. Okay, that's a lot of libraries, right? And we did some not really scientific calculation and here's some number I got. This is actually, I did this in 2017, it may be old, but gave you a rough idea. So I go to count the lines of code in Cafe, TensorFlow, and Torch. This is self know, I said this is not scientific because some of them are implement C, some of them Python so lines of code, doesn't relate, you cannot compare them. But roughly you see like, there's a few hundred K lines of code in each of this framework, okay? Now in addition, they all depends on bunch of libraries that not even include that, if you're hundred k like lines of code. So there's lots of package and then, then I gave a few example like, for example, Cafe put this like Nexus application, lapsoft disk application . quedid.com libz, OpenCV, libprotobuf, right? You know, lots of packages are common. You need to have some language to parse the model, the parameter, okay? And you don't want to implement this from scratch. Well, when you have this complex dependency, people in security are really excited. They're happy, right? So that's why, you know, we did some work. This is only in the summer I was doing some consulting work in 360. With 360, like in one summer, this is the number of CV you find related to all the other early packages. And we actually find more. I didn't put there because this is for all these slides or for a previous paper published early this year and it was written last year, okay? And then I put a picture there. And the picture says artificial intelligence is no substitute for natural stupidity, okay? Now, this was having different meaning before, but I want to use it to say that in AI, we are talking about so many great, great things about AI. But if you have this stupid programmer that doing something for this brilliant algorithm, then you have trouble, okay? Now, to say it more concretely, some people say, oh, this is not in the, you know, where are these bugs? Give you one example. This is, it's hard. I didn't expect we have such small screen, okay? But I'm going to try to read out, like, so this is a screenshot. I go to the, like the GitHub of cafe and this is like their image data layer. So I click. The link, like the CPU implementation, I can now even read here. So this is the image data layer. I basically, I'm trying to do screen capture to say where the code is. This is in cafe image data layer. And if you click it and this is the code there, and then there's the include that actually points, like they use OpenCV, okay? Now, so which means that even OpenCV is a dependent package. Every time you use cafe to write an image parsing, you know, deep learning application, you say, read in the image to this layer, you're calling this code. And this code actually calling OpenCV to parse the image, okay? And then, you know, I'm just, again, I don't expect you to read the code. So give you a rough idea. This, I pick one of the CV, you know, we find in this list here. What it does is it read a picture, it tries to, you know, parse it. And the part I highlighted, that's actually controlled by the input that's in the image. So what happened is this piece of code tried to read the image. So it read the image into a layer, and then the first, they read some parameter from the image that tells you really the size of the image. And then this particular part controls the color palette, like depending on how many color you have, right? And then they later use this number, then they have a memory copy. And then, you know, they actually have the wrong number, there's the heap overflow there. And then I show you, this is, you know, we report a bug in 2017, an OpenCV developer actually fixed it. They, you know, this. Even the patch, this is a patch for that bug. And you see that they actually show us that it removed two lines, added three lines, actually only one line. Because the two blue lines and the bottom of the two red lines are the same. So really the top, the CV assert part, that's what they add in. So they're adding a line that says color used less than 256. Because early on I told you, like, the input can be larger than 256, so there's the heap overflow, right? All right. And the reason I bring this up is that, again, this is, the programmer's not that good. They put a patch, this patch is not complete, unfortunately. Because they didn't consider the number less than 256, but what if I give a negative number which become a large number? So bug's still there. I try to convince them to say, hey, there's still a bug. The guy is like saying, I don't care, right, you know, this is really not my problem, okay. So I have to go further to say, show you what's the problem. So again, go back to this kitty case. Okay. We take a picture, we gave to this, you know, cafe model, a cafe program that classify image. And to make sure I'm not cheating, so I download the model on the Berkeley lab website, and they claim this is a train from the image data, the competition, right? And they're using the Google model, so that I use all of theirs. And if you gave that kitty model a picture, then it will tell you, okay, what kind of cat it is. It'll give you a different category, what's the probability. Okay. So we take that program. I craft this for, you know, picture, because I need to convince this developer, say, there's something you need to fix, okay. So these are the four picture I show on the front of the slide. And the top left one, the Bulldog, is I grabbed from the internet, okay. And the reason I, you know, grab from the internet, grab a Bulldog picture is because, okay, Bulldog's the mascot for universities. Bulldog's the mascot for the University of Georgia football team, right? So I grabbed that one, and then I made, I messed up the other three. Now visually, you look at it and feel like, okay, there's something different for people to sit close, okay. I'm not doing machine learning. I'm not touching the pixel, okay. What happened is I actually messed up the metadata. I actually lied about how many colors I used. That's why it looks slightly different, okay. But the picture content is the same, okay. So I only messed up the metadata. This is the result of the classification. Again, I don't expect you to be able to read it, so I'm going to use the image to show what happened. This is the same program using Berkeley's model, Google's, you know, data, like, you know, the result. Of course, the initial one I throw in, it's a Bulldog, because that's the picture I got from the internet. And this, I have to say, the machine learning algorithm does pretty good with the real picture, okay. And I talked to AI expert. One thing I'm really always surprised is that they always assume the data actually come from natural place, and you take a picture from with your phone. Well, no, like, you know, the second one, certainly you imagine, like, I put a picture, I mess up the data, segfault, okay, no surprise, right? I have a heap overflow, of course, I segfault as well. Okay. Almost segfault here. Okay, so that's easy to understand, but I decided to push it further a little bit. We put a, you know, shellcode in it, okay. So this time, I like to lie, like, I always imagine, like, what does this Bulldog want to be classified? So I imagine there's a Bulldog want to fly, you know. So I decided to like to, you know, classify the flying pig, okay. So that's the result. In fact, because this is not, again, this is not address image learning. I'm not trying to get a panda become a given. I can mess up the pixel. The output is generated by me, my code. They're actually writing my code. I can actually let it say anything, okay. I can let a panda become panda of, you know, of Kung Fu Panda, anything, okay. So to go further, if you didn't see it, like, I have a shell there. So I let them, like, the cafe program take my picture, then they spin out the shell. And basically, the picture I show in there, I own you. We even did this, actually, in a cloud environment. I didn't have this in the, you know, in the picture, but you can imagine, like, you running a classification service, like, using an AI application, you just say, you know, you're lazy, you just copy the, you know, using the default application from cafe or whatever example. You run this as a cloud service. This same code can own your cloud, basically. You have this interface, I can have a shell come back. We have a demo on that. I have a video. I present that in the POC conference. So to summarize, okay, I mean, there are lots of other bugs. I only show you cafe one. Don't consider other frameworks are better, okay. We also have TensorFlow bugs, okay. So but overall, what I want to tell the audience is that deep learning frame application depend on lots of third-party packages, okay. You need to be careful about all this. And complexity leads to vulnerabilities, yeah. If you have this large, complex program, you're going to have trouble somewhere. And even your algorithm is perfect, you have trouble. And the risk of application, here I only show you I can do denial of service, I can segfault, I can get system compromise. I can certainly do misclassification. I sort of also show that, so evasion attack. So that's pretty much all I want to do. The other example I can show you offline, you know, feel free to contact me.