1 00:00:00,000 --> 00:00:06,900 You're talking about beyond adversarial learning security risks in AI implementations, so he's going to take it away 2 00:00:13,260 --> 00:00:15,920 Welcome to my session, I'm Khan and 3 00:00:16,480 --> 00:00:22,780 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 4 00:00:22,780 --> 00:00:26,640 Really the security part. I'm a security person. So this is a work 5 00:00:26,640 --> 00:00:31,960 Jointly with a couple people from Chihuahua 360 and a willing from University of Virginia 6 00:00:32,480 --> 00:00:39,480 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 7 00:00:40,940 --> 00:00:48,540 And there and we had a paper published in the IHP security privacy a workshop on deep learning and security in May 8 00:00:48,540 --> 00:00:55,220 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 9 00:00:55,220 --> 00:00:55,700 Okay 10 00:00:55,700 --> 00:00:56,180 So 11 00:00:56,180 --> 00:00:56,400 I 12 00:00:56,400 --> 00:01:04,780 am a professor from the University of Georgia in the past. My work is mostly on the 13 00:01:05,620 --> 00:01:08,280 software security side I organized lots of 14 00:01:09,080 --> 00:01:14,780 Capture-the-flag teams and some of the some of them are well known like SAC doc or dissect 15 00:01:14,780 --> 00:01:18,780 I'm also the founding mentors for the like Blue Lotus team 16 00:01:18,780 --> 00:01:25,240 One of our team like team dissect was last the final list of the cyber grand challenge like two years ago here 17 00:01:25,240 --> 00:01:26,380 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 18 00:01:26,380 --> 00:01:27,180 One of the seven team 19 00:01:27,900 --> 00:01:36,700 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 20 00:01:36,700 --> 00:01:40,920 I'm not going to talk about the machine learning algorithm 21 00:01:41,400 --> 00:01:46,040 I'm actually going to talk about the a little bit about the deep learning implementation. We don't have much time 22 00:01:46,040 --> 00:01:50,320 So I'm going to try to be brave. So I'm going to start with like a simple question example 23 00:01:50,320 --> 00:01:54,220 So you all seen this if you work on deep learning and you open the textbook 24 00:01:54,220 --> 00:01:56,300 This is the first example you see my question 25 00:01:56,300 --> 00:02:02,740 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 26 00:02:03,840 --> 00:02:09,160 Recognition you take a picture it has a digits in it. They recognize it how many lines of code we implement this 27 00:02:11,060 --> 00:02:18,040 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 28 00:02:18,720 --> 00:02:26,160 Totally. It's like I always say less than 300 line. Okay now, how can you do a fancy thing like, oh 29 00:02:26,300 --> 00:02:31,740 the magic in such small piece of code. It's because our current implementation 30 00:02:31,740 --> 00:02:36,260 on most of the deep learning applications, they're not building from 31 00:02:36,260 --> 00:02:41,940 scratch. Usually you use a framework. There are lots of common frameworks like 32 00:02:41,940 --> 00:02:47,760 TensorFlow, Cafe, Torch. You might use some wrapping language, but 33 00:02:47,760 --> 00:02:52,580 pretty much, at least for the people I talk to, they don't build this from 34 00:02:52,580 --> 00:02:58,440 scratch. When we discuss the implementation algorithm or even 35 00:02:58,440 --> 00:03:02,200 you look at the like Adversary Machine Learning, you're really talking 36 00:03:02,200 --> 00:03:06,680 about the top layer. You're looking at your model, your parameters, 37 00:03:06,840 --> 00:03:10,660 sometimes you might talk about your training data, but we don't talk about 38 00:03:10,660 --> 00:03:15,980 much underneath. So the underneath part actually matters. Let me show you 39 00:03:15,980 --> 00:03:22,000 an example. So you probably, if you are in this area, you have a look at lots of 40 00:03:22,000 --> 00:03:22,560 CAT pieces. 41 00:03:22,580 --> 00:03:27,320 So this is one example. We got it from Cafe, we 42 00:03:27,320 --> 00:03:30,220 download, we run it. You can run this easily. 43 00:03:30,920 --> 00:03:34,480 Assuming you have some model from other place and then you run, you give a 44 00:03:34,480 --> 00:03:39,400 picture, it produce some result. Now what I did an additional thing is I did 45 00:03:39,400 --> 00:03:44,880 like this particular one can build as a Linux application. So I do IODD. 46 00:03:44,980 --> 00:03:48,480 For people that in this field, like if you do security, you know, okay 47 00:03:48,480 --> 00:03:51,800 well this does, it shows all the library dependency of that 48 00:03:53,440 --> 00:03:58,880 application, right? So in a particular one that recognize CAT, the code is not 49 00:03:58,880 --> 00:04:04,960 long, but then it depends on 137 libraries. Okay, that's a lot of libraries, 50 00:04:05,240 --> 00:04:10,900 right? And we did some not really scientific calculation and here's some 51 00:04:10,900 --> 00:04:16,020 number I got. This is actually, I did this in 2017, it may be old, but gave you a 52 00:04:16,020 --> 00:04:21,740 rough idea. So I go to count the lines of code in Cafe, TensorFlow, and Torch. This is 53 00:04:22,240 --> 00:04:24,120 self know, I said this is not 54 00:04:24,120 --> 00:04:28,260 scientific because some of them are implement C, some of them Python so 55 00:04:28,260 --> 00:04:31,420 lines of code, doesn't relate, you cannot compare them. But roughly you 56 00:04:31,420 --> 00:04:36,340 see like, there's a few hundred K lines of code in each of this framework, okay? 57 00:04:36,460 --> 00:04:41,400 Now in addition, they all depends on bunch of libraries that not 58 00:04:41,400 --> 00:04:45,780 even include that, if you're hundred k like lines of code. So there's 59 00:04:45,780 --> 00:04:51,200 lots of package and then, then I gave a few example like, for example, Cafe put 60 00:04:51,200 --> 00:04:51,780 this like Nexus application, lapsoft disk application . quedid.com 61 00:04:51,800 --> 00:04:54,740 libz, OpenCV, libprotobuf, right? 62 00:04:54,940 --> 00:04:57,200 You know, lots of packages are common. 63 00:04:57,340 --> 00:05:01,360 You need to have some language to parse the model, the parameter, okay? 64 00:05:01,640 --> 00:05:03,120 And you don't want to implement this from scratch. 65 00:05:04,220 --> 00:05:07,620 Well, when you have this complex dependency, 66 00:05:09,040 --> 00:05:11,140 people in security are really excited. 67 00:05:11,220 --> 00:05:12,260 They're happy, right? 68 00:05:12,600 --> 00:05:14,780 So that's why, you know, we did some work. 69 00:05:14,880 --> 00:05:18,760 This is only in the summer I was doing some consulting work in 360. 70 00:05:18,760 --> 00:05:22,540 With 360, like in one summer, this is the number of CV you find 71 00:05:22,540 --> 00:05:24,840 related to all the other early packages. 72 00:05:25,240 --> 00:05:27,080 And we actually find more. 73 00:05:27,280 --> 00:05:30,260 I didn't put there because this is for all these slides 74 00:05:30,260 --> 00:05:33,320 or for a previous paper published early this year 75 00:05:33,320 --> 00:05:35,040 and it was written last year, okay? 76 00:05:35,160 --> 00:05:36,480 And then I put a picture there. 77 00:05:36,760 --> 00:05:41,920 And the picture says artificial intelligence is no substitute for natural stupidity, okay? 78 00:05:42,040 --> 00:05:44,140 Now, this was having different meaning before, 79 00:05:44,260 --> 00:05:46,840 but I want to use it to say that in AI, 80 00:05:47,040 --> 00:05:48,520 we are talking about so many great, 81 00:05:48,760 --> 00:05:49,280 great things about AI. 82 00:05:50,020 --> 00:05:52,220 But if you have this stupid programmer 83 00:05:53,200 --> 00:05:55,780 that doing something for this brilliant algorithm, 84 00:05:56,720 --> 00:05:58,360 then you have trouble, okay? 85 00:05:59,200 --> 00:06:01,960 Now, to say it more concretely, some people say, 86 00:06:02,060 --> 00:06:04,640 oh, this is not in the, you know, where are these bugs? 87 00:06:04,840 --> 00:06:05,600 Give you one example. 88 00:06:05,840 --> 00:06:06,860 This is, it's hard. 89 00:06:06,980 --> 00:06:09,500 I didn't expect we have such small screen, okay? 90 00:06:09,700 --> 00:06:12,620 But I'm going to try to read out, like, so this is a screenshot. 91 00:06:12,800 --> 00:06:17,460 I go to the, like the GitHub of cafe and this is like their image data layer. 92 00:06:17,660 --> 00:06:18,300 So I click. 93 00:06:18,760 --> 00:06:22,540 The link, like the CPU implementation, I can now even read here. 94 00:06:22,820 --> 00:06:24,520 So this is the image data layer. 95 00:06:24,780 --> 00:06:27,780 I basically, I'm trying to do screen capture to say where the code is. 96 00:06:27,920 --> 00:06:29,840 This is in cafe image data layer. 97 00:06:30,240 --> 00:06:32,820 And if you click it and this is the code there, 98 00:06:33,000 --> 00:06:37,640 and then there's the include that actually points, like they use OpenCV, okay? 99 00:06:37,840 --> 00:06:41,620 Now, so which means that even OpenCV is a dependent package. 100 00:06:41,960 --> 00:06:48,460 Every time you use cafe to write an image parsing, you know, deep learning application, 101 00:06:48,460 --> 00:06:52,860 you say, read in the image to this layer, you're calling this code. 102 00:06:53,060 --> 00:06:57,440 And this code actually calling OpenCV to parse the image, okay? 103 00:06:57,660 --> 00:07:01,480 And then, you know, I'm just, again, I don't expect you to read the code. 104 00:07:01,620 --> 00:07:02,520 So give you a rough idea. 105 00:07:02,640 --> 00:07:06,620 This, I pick one of the CV, you know, we find in this list here. 106 00:07:06,780 --> 00:07:10,520 What it does is it read a picture, it tries to, you know, parse it. 107 00:07:10,640 --> 00:07:15,240 And the part I highlighted, that's actually controlled by the input that's in the image. 108 00:07:15,440 --> 00:07:18,440 So what happened is this piece of code tried to read the image. 109 00:07:18,440 --> 00:07:22,620 So it read the image into a layer, and then the first, they read some parameter from the 110 00:07:22,620 --> 00:07:25,280 image that tells you really the size of the image. 111 00:07:25,460 --> 00:07:29,640 And then this particular part controls the color palette, like depending on how many 112 00:07:29,640 --> 00:07:30,700 color you have, right? 113 00:07:30,840 --> 00:07:34,580 And then they later use this number, then they have a memory copy. 114 00:07:34,900 --> 00:07:39,260 And then, you know, they actually have the wrong number, there's the heap overflow there. 115 00:07:39,600 --> 00:07:45,060 And then I show you, this is, you know, we report a bug in 2017, an OpenCV developer 116 00:07:45,060 --> 00:07:46,100 actually fixed it. 117 00:07:46,600 --> 00:07:47,560 They, you know, this. 118 00:07:47,560 --> 00:07:50,040 Even the patch, this is a patch for that bug. 119 00:07:50,420 --> 00:07:55,200 And you see that they actually show us that it removed two lines, added three lines, actually 120 00:07:55,200 --> 00:07:55,900 only one line. 121 00:07:55,980 --> 00:08:00,780 Because the two blue lines and the bottom of the two red lines are the same. 122 00:08:00,900 --> 00:08:04,640 So really the top, the CV assert part, that's what they add in. 123 00:08:04,820 --> 00:08:08,180 So they're adding a line that says color used less than 256. 124 00:08:08,620 --> 00:08:14,360 Because early on I told you, like, the input can be larger than 256, so there's the heap 125 00:08:14,360 --> 00:08:15,120 overflow, right? 126 00:08:15,320 --> 00:08:15,860 All right. 127 00:08:15,860 --> 00:08:19,820 And the reason I bring this up is that, again, this is, the programmer's not that good. 128 00:08:20,020 --> 00:08:23,020 They put a patch, this patch is not complete, unfortunately. 129 00:08:23,980 --> 00:08:29,860 Because they didn't consider the number less than 256, but what if I give a negative number 130 00:08:30,260 --> 00:08:31,760 which become a large number? 131 00:08:31,920 --> 00:08:32,820 So bug's still there. 132 00:08:32,980 --> 00:08:35,460 I try to convince them to say, hey, there's still a bug. 133 00:08:35,820 --> 00:08:39,860 The guy is like saying, I don't care, right, you know, this is really not my problem, okay. 134 00:08:39,980 --> 00:08:42,840 So I have to go further to say, show you what's the problem. 135 00:08:42,940 --> 00:08:45,360 So again, go back to this kitty case. 136 00:08:45,600 --> 00:08:45,840 Okay. 137 00:08:45,860 --> 00:08:53,540 We take a picture, we gave to this, you know, cafe model, a cafe program that classify image. 138 00:08:54,000 --> 00:09:00,680 And to make sure I'm not cheating, so I download the model on the Berkeley lab website, and 139 00:09:00,680 --> 00:09:04,180 they claim this is a train from the image data, the competition, right? 140 00:09:04,300 --> 00:09:07,300 And they're using the Google model, so that I use all of theirs. 141 00:09:07,500 --> 00:09:12,500 And if you gave that kitty model a picture, then it will tell you, okay, what kind of 142 00:09:12,500 --> 00:09:13,140 cat it is. 143 00:09:13,220 --> 00:09:15,100 It'll give you a different category, what's the probability. 144 00:09:15,100 --> 00:09:15,740 Okay. 145 00:09:16,200 --> 00:09:17,400 So we take that program. 146 00:09:18,140 --> 00:09:24,080 I craft this for, you know, picture, because I need to convince this developer, say, there's 147 00:09:24,080 --> 00:09:25,380 something you need to fix, okay. 148 00:09:25,520 --> 00:09:30,380 So these are the four picture I show on the front of the slide. 149 00:09:30,860 --> 00:09:37,640 And the top left one, the Bulldog, is I grabbed from the internet, okay. 150 00:09:37,760 --> 00:09:42,060 And the reason I, you know, grab from the internet, grab a Bulldog picture is because, 151 00:09:42,180 --> 00:09:45,080 okay, Bulldog's the mascot for universities. 152 00:09:45,100 --> 00:09:46,480 Bulldog's the mascot for the University of Georgia football team, right? 153 00:09:46,920 --> 00:09:50,840 So I grabbed that one, and then I made, I messed up the other three. 154 00:09:51,100 --> 00:09:56,400 Now visually, you look at it and feel like, okay, there's something different for people 155 00:09:56,400 --> 00:09:57,700 to sit close, okay. 156 00:09:58,480 --> 00:10:01,020 I'm not doing machine learning. 157 00:10:01,160 --> 00:10:02,860 I'm not touching the pixel, okay. 158 00:10:03,020 --> 00:10:05,220 What happened is I actually messed up the metadata. 159 00:10:05,620 --> 00:10:07,900 I actually lied about how many colors I used. 160 00:10:08,280 --> 00:10:10,680 That's why it looks slightly different, okay. 161 00:10:10,820 --> 00:10:14,020 But the picture content is the same, okay. 162 00:10:14,020 --> 00:10:15,540 So I only messed up the metadata. 163 00:10:16,460 --> 00:10:18,520 This is the result of the classification. 164 00:10:18,800 --> 00:10:23,340 Again, I don't expect you to be able to read it, so I'm going to use the image to show 165 00:10:23,340 --> 00:10:23,980 what happened. 166 00:10:24,080 --> 00:10:30,120 This is the same program using Berkeley's model, Google's, you know, data, like, you 167 00:10:30,120 --> 00:10:30,980 know, the result. 168 00:10:31,400 --> 00:10:35,920 Of course, the initial one I throw in, it's a Bulldog, because that's the picture I got 169 00:10:35,920 --> 00:10:36,640 from the internet. 170 00:10:36,920 --> 00:10:42,360 And this, I have to say, the machine learning algorithm does pretty good with the real picture, 171 00:10:42,500 --> 00:10:42,780 okay. 172 00:10:44,020 --> 00:10:45,520 And I talked to AI expert. 173 00:10:46,480 --> 00:10:51,720 One thing I'm really always surprised is that they always assume the data actually 174 00:10:51,720 --> 00:10:55,660 come from natural place, and you take a picture from with your phone. 175 00:10:56,320 --> 00:11:02,040 Well, no, like, you know, the second one, certainly you imagine, like, I put a picture, 176 00:11:02,080 --> 00:11:04,760 I mess up the data, segfault, okay, no surprise, right? 177 00:11:04,920 --> 00:11:08,640 I have a heap overflow, of course, I segfault as well. 178 00:11:10,280 --> 00:11:10,760 Okay. 179 00:11:11,080 --> 00:11:12,200 Almost segfault here. 180 00:11:15,000 --> 00:11:20,220 Okay, so that's easy to understand, but I decided to push it further a little bit. 181 00:11:20,700 --> 00:11:23,100 We put a, you know, shellcode in it, okay. 182 00:11:23,260 --> 00:11:28,100 So this time, I like to lie, like, I always imagine, like, what does this Bulldog want 183 00:11:28,100 --> 00:11:28,760 to be classified? 184 00:11:29,100 --> 00:11:31,520 So I imagine there's a Bulldog want to fly, you know. 185 00:11:31,660 --> 00:11:35,800 So I decided to like to, you know, classify the flying pig, okay. 186 00:11:35,880 --> 00:11:36,740 So that's the result. 187 00:11:37,020 --> 00:11:40,980 In fact, because this is not, again, this is not address image learning. 188 00:11:41,300 --> 00:11:44,000 I'm not trying to get a panda become a given. 189 00:11:44,020 --> 00:11:45,400 I can mess up the pixel. 190 00:11:46,440 --> 00:11:49,400 The output is generated by me, my code. 191 00:11:49,700 --> 00:11:50,980 They're actually writing my code. 192 00:11:51,100 --> 00:11:53,040 I can actually let it say anything, okay. 193 00:11:53,200 --> 00:11:58,060 I can let a panda become panda of, you know, of Kung Fu Panda, anything, okay. 194 00:11:58,260 --> 00:12:04,100 So to go further, if you didn't see it, like, I have a shell there. 195 00:12:04,400 --> 00:12:09,340 So I let them, like, the cafe program take my picture, then they spin out the shell. 196 00:12:09,580 --> 00:12:13,120 And basically, the picture I show in there, I own you. 197 00:12:14,020 --> 00:12:16,280 We even did this, actually, in a cloud environment. 198 00:12:16,620 --> 00:12:22,000 I didn't have this in the, you know, in the picture, but you can imagine, like, you running 199 00:12:22,000 --> 00:12:26,760 a classification service, like, using an AI application, you just say, you know, you're 200 00:12:26,760 --> 00:12:30,480 lazy, you just copy the, you know, using the default application from cafe or whatever 201 00:12:30,480 --> 00:12:30,980 example. 202 00:12:31,160 --> 00:12:32,520 You run this as a cloud service. 203 00:12:33,500 --> 00:12:36,980 This same code can own your cloud, basically. 204 00:12:37,240 --> 00:12:39,880 You have this interface, I can have a shell come back. 205 00:12:40,040 --> 00:12:40,960 We have a demo on that. 206 00:12:41,020 --> 00:12:41,540 I have a video. 207 00:12:41,660 --> 00:12:43,900 I present that in the POC conference. 208 00:12:44,020 --> 00:12:48,760 So to summarize, okay, I mean, there are lots of other bugs. 209 00:12:48,940 --> 00:12:50,100 I only show you cafe one. 210 00:12:50,400 --> 00:12:53,720 Don't consider other frameworks are better, okay. 211 00:12:53,860 --> 00:12:55,880 We also have TensorFlow bugs, okay. 212 00:12:56,020 --> 00:13:03,320 So but overall, what I want to tell the audience is that deep learning frame application depend 213 00:13:03,320 --> 00:13:06,660 on lots of third-party packages, okay. 214 00:13:06,820 --> 00:13:09,020 You need to be careful about all this. 215 00:13:09,160 --> 00:13:12,680 And complexity leads to vulnerabilities, yeah. 216 00:13:12,680 --> 00:13:16,320 If you have this large, complex program, you're going to have trouble somewhere. 217 00:13:16,660 --> 00:13:19,500 And even your algorithm is perfect, you have trouble. 218 00:13:19,700 --> 00:13:24,400 And the risk of application, here I only show you I can do denial of service, I can segfault, 219 00:13:24,660 --> 00:13:26,500 I can get system compromise. 220 00:13:26,980 --> 00:13:28,920 I can certainly do misclassification. 221 00:13:29,060 --> 00:13:31,960 I sort of also show that, so evasion attack. 222 00:13:32,340 --> 00:13:34,640 So that's pretty much all I want to do. 223 00:13:34,960 --> 00:13:38,820 The other example I can show you offline, you know, feel free to contact me.