Hello and welcome to my talk, uh, Don't Red Team AI Like a Chump. So, uh, here's a brief intro. Uh, who am I? Um, I'm an AI researcher and co-founder of the AI Village here and a grad student at Harvard with a bit of an axe to grind against the AI hype train. Uh, most of my research so far has been on how to operationalize theoretical attacks that are proposed in academic literature against real systems. Um, and so this includes things like attacking facial recognition software to extract personal data, uh, attacking text completion tools to steal credit card numbers, um, and also to reverse engineer, um, recommendation algorithms so that you can recommend fake products. Uh, this is going to be a very practical talk, um, because it's about how to do things right when it comes to hacking on AI systems. And it's more or less a knowledge dump of a lot of the wisdom that I've picked up over, uh, many, many failures, um, and some successes over the years. Uh, and I do hope that this will be a interesting and useful to you. So I'm going to start off this talk with a bit of a story. Um, in March, uh, Tencent Security Lab came out with a really awesome report that showed that you can inject an adversarial example on, uh, Tesla hardware and then cause the car to drive into traffic. Um, and now contrast this with another story, uh, where back in November, my friend and I were driving in a Tesla and then chatting about self-driving cars, um, and it was Boston and it was cold outside and I had this really dumb idea to see if we could take the salt melt that was in the trunk and then pour it on the road to just see kind of how robust this lane-finding algorithm would be. Um, and the result is that the Tesla interpreted the salt as a line, um, and it ended up driving us into an oncoming lane, which was fun. Um, and one of these attacks is obviously much easier to pull off from a practical perspective, but one of these is really sexy and it looks really good in the media. Um, so which of these is more valuable to a real attacker? And this attack is, this talk is about the practicality of these kind of attacks, so if you want the sexy ones, the, the doors, uh, you know, the, the, the, the, the, the, the, the, the, the, the, the, the, the doors over there. Uh, so, and, also in, in case at some point you zone out during the presentation cuz it's the morning, maybe you're hang, hung over. But, um, I've put the salient details up for you right now. Um, and really if you only take one thing away from this talk, it's that you need to focus on the threat model of the system that you're attacking, and we'll talk about the other things during the course of presentation. So, uh, we're gonna take a brief detour to make sure that we're all kind of on the same page. I'm not sure how many of you guys have done AI stuff, or if you have, sometimes it's nice nice to have a refresher. Um, so when we talk about AI we're referring to a particular class of algorithms that we use to extract actual information from data. Um, and it's actually quite a very old field. It came from the post-war 50s and over the years it's transformed a bunch and um, it's gone through booms and busts as we discover new methods of extracting information with larger data sets and we have better compute power. Um, and these days, um, the current hype centers on deep learning algorithms because these have managed to solve a lot of the problems that we uh, previously thought were not really gonna be solvable in our lifetime. Um, and the principles that I talk about in this talk uh, apply broadly to machine learning algorithms including deep learning algorithms um, that we see uh, deployed across sectors. And also in this talk um, AI is ML um, cause that's about as close to any sort of real artificial intelligence that we've gotten yet. Um, even if it is literally just pattern matching under the hood. Uh, so when we look under the hood of an AI algorithm um, okay this is also my favorite meme. Um, so it's a Scooby Doo meme. I don't know if you can, you probably can't read it. So I'll read it to you. Um, so Fred is like, okay gang, let's see what deep learning really is. And there's a deep neural network um, on that hood there. And so he pulls the hood off and he's like, what? Convex optimization? Uh, so what we're, so when we look under the hood of these algorithms what we're actually finding is math for optimizing a function which maps input data uh, to output predictions. So think like this cluster of pixels uh, probably maps to the input data of the output predictions. So think like this person's face or this bot's network activity probably maps to this threat actor. Um, and don't worry I'm going to keep the math to the minimum here so you don't fall asleep if you haven't um, already. Uh, but I'm happy to talk math after or offline because math is great. Um, okay so here's my AI 101 spiel. At an extremely basic level all the learning is is just uh, an iterative process where we just kind of shove some data into a black box um, then twiddle some knobs that adjust how well this function fits the data. And um, I'm going to show you how to do that. Um, we tend to call this function the model because what we're trying to do is we're trying to build a model of the data. So for example say that we want to build a model for recognizing objects in an image. Uh, what we're actually trying to do is we're trying to fit a function that maps clusters of pixels to object names. And mathematically uh, this translates into asking the model to predict which pixel clusters will reliably tell us the correct object that's in the image. And the model after it outputs a prediction value um, we then will look at it and compare it with what we know. Um, and then we'll look at it and compare it with what we know to be the true prediction value. Um, so if we have a picture of a boat and the model says it's a dog, um, we know that there's something not quite right there. Uh, so we need to twiddle some knobs again and then try again. And we use this sort of comparison between the prediction and the truth value uh, to help make our next round of knob twiddling, which we actually call parameter tweaking, um, more effective until finally we get to some point where we're like this is good enough, let's go with it. Um, and we call um, and then we call the set of these uh, data that's uh, labeled with the true values the training data set. Um, and this whole process is known as training and it's actually kind of analogous to how we as humans learn where uh, we take in a bunch of information, um, we try to use it to make decisions, uh, we fail a bunch, uh, we hopefully learn from each of these failures and eventually we end up learning something new that we can apply to situations that we haven't experienced yet. And um, so after we finish training we then wanna check to make sure that we've learned what we intended to uh, by using a training data set. Um, and then we'll look at the results of the training data set. Um, sorry I have to, ugh. Um, when, and you can think of the, the uh, testing data set um, as being similar to taking an exam in school, um, where you haven't seen the, hopefully you haven't seen the questions before. Um, and the goal is to see if you can then generalize what you've learned in class to like the real world sort of. Um, and we kind of do the same thing with machine learning or AI algorithms. And the reason we do this is because we want to learn some generalized uh, representation of the data um, cause that means that we can use it in the real world a lot better than if it was just trained on one data set and that's all it's ever seen. Um, and we can also kinda think of learning as being a bit of a, or essentially a feedback loop. So, okay. Now that we have the vocabulary and basic understanding of what goes into an AI, um, now let's look at the parts so that we can think of different ways to break them. Um, and these are the parts. So we have the data and the model. Um, the data could be either the training or the testing data sets or even a training and some of these are a lot more of a... could be the deployed environment data. Um and the model uh is either like the algorithm that you use to train like uh a deep neural network or logistic regression or one of those things and then the parameters are what you're tweaking um that fits this algorithm to whatever data set you're working with. So we can poison the data by feeding inaccurate information to the AI system um which will make it make incorrect decisions. Um and in a way you can actually think of this as being a supply chain attack where uh you you don't in some cases you don't necessarily know where the data comes from which kind of gives you a level of uncertainty. Um and an interesting feature of modern AI systems is that we need to label the training data um but getting good labels is actually kind of hard and expensive. I mean even some techniques that propose unsupervised or semi-supervised learning methods um will still rely to some extent on human based or human labeled training. Human labeled training data. Um so if you can sneak in a bad version of this training data into an AI system then you can actually accomplish a pretty good amount of bad. Um and we can also do this data poisoning during real time deployment. Um if you've heard the term adversarial example or wild pattern uh it refers to a data point where you can show or that that you can show to a deployed AI system um that it will misinterpret. And there's a lot of hullabaloo around these adversarial example things. Um mathematically you can think of it as constructing an optimization problem to find a data point that lies along the classification boundary. Um in such a way that the AI doesn't quite know how to classify it but will probably classify it in the wrong direction. Um and then we can also do this data poisoning during real-time development. Um so we've got this picture of these dogs and these chicken, fried chickens. Um and uh to your eyes uh initially like it might not be that easy to tell which one of these is a dog and which one of these is a chicken. So in in some way there's kind of an analogy between adversarial examples and uh optical illusions. Um and there's just something about the way that these images look that kind of wig out your brain and turns out you can do something similar with AI. And we can do also something along the lines of uh we can do something along the lines of the infamous JavaScript MPM hack last year. Um which is where some bad eggs got a hold of the MPM maintainer's account or an MPM maintainer's account and then used it to push a rogue version of a popular programming tool um that ended up scraping a bunch of people's MPM uh log in tokens. Um and since most AI developer software is open source like scikit learn uh it's possible that a bad actor could inject some bad versions of functions that would alter the behavior of an AI model during deployment. Which is kind of scary. We can also do a cool attack that's called model inversion which is based on the fact that if you have an AI model that's basically like taking the model and then shaking it creatively with some statistics um and then making the training data fall back out. Um so in so in this example um we have this picture of this dude just named Bill um and it exists in this training data set for a facial recognition system. Turns out you can recover a picture of Bill by essentially asking the model who is in this picture um or instead of asking the model who is in the picture but to make it draw who it thinks Bill is. So it's like an inversion kind of problem. Um we can also use uh do some things to steal the parameters of a model um through an attack called model theft. Um and this model or this attack usually involves a surrogate model that's trained on the same data as the target model that we use that we're trying to steal. Um and we can take the output predictions from the target model and then pair them with the original data set to make a new training data set. Um which uh when we train our stolen model it'll give us sort of a similar output predictions as the target we're trying to copy. So it's basically just stealing the model using their inputs and outputs. It's a great attack. Um okay so those are some of the ways that you can attack an AI system but how do we go about designing one of these attacks fresh? The principles that are laid out in the academic literature can kind of be broken down into three questions that you can ask yourself. Uh so you want to know like what kind of model are you attacking? Is it deep learning or logistic regression or a decision tree? Um cause knowing what algorithm you're dealing with will give you kind of an idea of where to look in the academic literature for prior art uh to try to help you figure out maybe what you should be doing to bend this model to your will. Um and then uh you want to kind of know where the data comes from and you also want to know what formats it's in. Um so if we know that the system deals with images that's going to be much different than if it's dealing with strings or or text. And we also want to know where the predictions go and what data overall does it output. Cause it turns out um that a lot of information that some of these systems put out you can take advantage of and use to execute some of these attacks. Um like the the model and one of the ways that you can do a model inversion attack is to use how confident. So some models that are deployed in the AI system are very similar to the models that are deployed in the cloud. Ooh fuck. Sorry. Um some models that are deployed in the cloud will also spit out kind of a confidence interval that says like I am 60 percent certain that this is a dog. Um and you can actually use that when you're doing your statistical. Ah fuck sorry. Ah! I scrolled on the wrong thing. Um enjoy this preview for a second. Okay. Um yes. So where was I? Um ok well, point is pay attention to where the predictions go um and what is outputted because it means that you can potentially take advantage of that to execute an attack that affects people's privacy in terms of the trading data. Alright um so now let's go through one of these attacks as it relates to fooling AI powered video surveillance. Um and what I'm going to talk about is actually considered state of the art. Um so the first thing that we need to talk about is the data pipeline. Um the common system components of a lot of the AI powered tools for video surveillance um is there's uh a camera system with a bunch of sensors and stuff and then you have your detection system and then you have your recognition system. So detection refers to some sort of on premises model that checks to see like each still image in the video um has a face in it and then frames that have faces in it will just forward to a recognition system and then what the recognition system does is it then looks at all of these images and then it checks that against a database of known faces that's held by like a private entity or maybe law enforcement or something like that um and then it will identify people in like images and video that way. Um and we're focusing on the detection system because the further down the pipeline you go in terms of data processing uh the more process the data gets and the harder it is to figure out what's actually going on. Um alright so with this example we're going with we're gonna attack the YOLO model which I did not name, stands for you only look once. It's very cool. Um uh where does the data come from? It comes from video frames uh cause we're pulling in data from cameras. Um and then the predictions are stored as a set of flagged frames to then forward on to our recognition system somewhere off site. Uh okay so this is the YOLO object detection algorithm. Essentially we're cutting the image into a grid for each and then for each box in the grid we want to compute a score for how likely it is that box contains an object and approximately which object the algorithm thinks is gonna be in that little box. Um there's some bugs with this algorithm like it can't handle objects that are too close together because there's a one object per box rule. Um however it's still pretty popular for many deployed uh systems which means it's a really likely target for any sort of system that's doing like a object detection task like facial recognition or object detection, face detection. Okay so the state of the art right now for attacking object detection algorithms is to generate stickers, patches, objects um like there's a lot of there's some examples of wearing some glasses on your face that's supposed to obscure you from facial recognition. Um there's always a really I think my friend is somewhere in here but he had a really cool attack where you could like 3D print a turtle and then um you can make the system think that it's a gun. Um and uh the way that these kind of systems work is that um it messes up the statistics of the image um by screaming like so with this example um this sticker is screaming like I am a toaster at the at the model and then the model's like okay sure you are. Um heh. So it in that that's kind of how these kind of stickers work. Um and so the most rad attack so far of these abrashiddle patches um has been to try to take the mathematics behind that and then kind of twist it a little bit so you can end up making yourself invisible. So instead of classifying yourself as a toaster which might not actually be useful if you're trying to attack facial recognition this way you can scream like I am just background noise um and then it'll look like you're invisible to the system. So I'm going to show you the demo video that's recorded by the researchers who came up with this trick cause I think it's a little bit more um it's a little more convincing at highlighting an important point that I'm going to make a little bit later. Um so AI research code is often also extremely hard to replicate without expertise um and even with expertise. Um and it's hideous and it's not fun for the uninitiated so um for this attack um I'm releasing a cleaned up version that's a lot easier to deal with so you can play around with it cause it is quite cool. Um and alright so let's play this video. How do I do this? Oh here we go. Okay. So notice that this the dude on the right isn't being detected but the dude on the left is. The dude on the right has this kind of weird square crotch region sticker thing and notice like he doesn't even need to move it that far um and already the attack kind of breaks a little bit. Um since we're a room full of security researchers um I want you to notice that they have to keep positioning the patch in the right location relative to the rest of their bodies. Um and and to the camera. Um he's also going to pass it over to his friend and you'll see just where it starts to break and where it starts to work for his his friend there. Oh there we go. Yeah you go dude. Yeah okay um so anyway this is cool from a math standpoint and also like it's cool as a demo um but it's extremely fragile as a real attack. Like if you were to try to rob a bank using this to get around the surveillance system people would be like they would just be like definitely notice your awkward side shuffle and then they would also be like what the hell is on your crotch. Alright so this is the part of the oh fuck so this is the part of the talk where I rail on the status quo. So as cool as these algorithm based attacks are there is a huge piece missing if you want your attack to actually work in the real world. Um and that's the threat model. Uh so red teaming AI is often conflated with the academic discipline of adversarial machine learning. Um and when we say adversarial machine learning we mean like cool way to attack an AI model with math. And when we say red teaming AI we mean we want to evaluate the security of an AI system. And I made this meme fresh for you so you're welcome. Okay let me read this meme in case you can't read it cause I'm very proud of it. Um it's the steam ham meme um says you call this red teaming AI despite the fact that it's obviously just adversarial machine learning. And it's got the sticker that um if you show it to a classifier it'll make you think that it's a toaster. Okay. Anyway okay so um now let's think about this in terms of an attack tree. So here's the adversarial machine learning attack tree for fooling AI powered video surveillance. So our goal here is to make the object detector ignore somebody. And so the way that this works in the paper um is they try a couple of different experiments. One of them is you want to minimize the specific class likelihood which in this case means you want to minimize um how likely it is that you're gonna be classified as a person. And then um there's another way where you could minimize the objectiness which is how likely is this uh model gonna classify you as like being an object of interest at all. And then the third option is to try to minimize both. And in the paper they show that if you minimize this objectiness it tends to work better which is kinda cool. Um it's very James Bond-esque. Um okay so here's the AI red team attack tree though. Um so in this case like we have the same goal but the the options on our tree are a bit different. Where we could get physical control of the camera and in that case we would be able to control the camera and then we could put a sticker over the camera or remove the power source or remove the camera to a different location um or uh we could get access to the camera network um and then play looping footage or then use that to get access to the facial detection AI software and then from there do like this weird academic attack. Um so also I want you to notice um how far down the Avershell machine learning attack subtree this is or I want you to notice how far down this Avershell machine learning attack tree is on the actual large red team attack tree. Um so I want to show you how far down the red team attack tree is on the actual large red team attack tree. Um because part of the problem here is that the literature for red teaming AI is often conflated. Um and there is there's some stuff happening in Hong Kong um and some very creative solutions for some of those things where instead of generating bespoke adversarial examples um they just put lasers on their hats and then just shine them at the cameras. Like that's way easier than having to do all of the math involved in getting one of these stickers or what not to work and you have to worry a lot less about operational hazards. So here is the one for the adversarial so here's the adversarial ML attack tree for um the breaking self-driving car lane detection example. Um so the goal here is we want to make a self-driving car think that a lane isn't a lane and so in this case we would just generate an adversarial example. That's what you do. Um but if we want to actually operationalize this um we have a couple of other options where we could dump a salt line on the road or we could put stickers on the road. In the Tencent security lab uh paper that I mentioned um for the first round from March, uh they ended up putting stickers on the road that is very similar to what I did with salt so it's not just me, it's like a problem um and then like your third option is to get physical access to the car um and then after you have that then you can get access to the lane detection system and then you can generate your adversarial example. Like that's- that's so much harder. Cause in all of this uh we need to remember that we're looking to be like AI security researchers looking to exploit AI systems and we're not here to write machine learning research papers about the math necessary to do a particular type of algorithmic attack, even though that's fun and I do recommend it. Um, so now that we have a better view of what attacking an AI system actually entails, and that it's not all about the model, um, or the algorithm that you're using, let's revise our attacker guidelines. So, uh, what system are we attacking rather than what model are we attacking? Um, is it object detection? What are the components of this system that we need to put together? Um, and, uh, what is the data processing pipeline? Um, so, it often helps to draw out a diagram of the system that you're targeting and then focusing on answering each of the next three questions for each of those parts. So you want to know where the inc- the inputs come from and where the outputs go. Um, and it also helps to know, um, like what is the data representation that's happening inside this model. Um, and the last piece in designing an attack on an AI system is to determine what your threat model is. Uh, so how much action is being taken? Um, and, uh, how much action is being taken? Um, and what access do you have to each of the parts? And what is the risk associated with attacking each of these parts? So let's try this out on our AI powered recognition, facial recognition system, or facial detection system. Um, cause this is DEF CON and we hate the man. Um, so here's the diagram we had earlier. And we're still gonna focus on the detection system because the, our goal as attackers is ultimately to avoid being seen. And so if you're not seen then you can't be recognized. Uh, and we're also focusing on the detection subsystem because it's an earlier part of the data processing pipeline. Um, and, uh, to reiterate in case you've fallen asleep already, um, we want to focus earlier in the data processing pipeline because the further through the system we go, um, the more process the data gets and the harder it is to figure out what's going on. Alright, so the second, answering the second question here, um, let's draw out a high level view of what the data pipeline is for the system and then answer each of these questions. So, um, an AI system is taking in data, um, and then it turns it into a simpler representation that then, that it can then use to make predictions. So for a detection system the input is the initial image capture from the camera. Um, lighting is an important environmental variable because, uh, shitty cameras use shitty components that can't deal with extremes in lighting condition, hence the Hong Kong thing. Um, and the first stop in the detection system is, uh, feature extraction. Um, which is where the AI system, uh, looks at the image and then picks out the parts of the image that it kind of thinks match statistical characteristics of something that it figures might be a face. Um, and these things are, uh, it's important to note that the features aren't features like eyes, nose, uh, eyes, nose, uh, eyes, nose, mouth, or anything like that. It's, it's like little clusters of pixels that tend to map to being a face. And lighting affects, uh, this quite a lot because, again, if you have blurry pictures and bad lighting, uh, the system is going to be confused and be more likely to make mistakes. And the output is the actual decision made by the AI model here. So is this or is this not a face? Uh, and the data representation is extremely important here, um, because the decision is entirely influenced by the feature extraction and the data the detection system was trained on. And in many cases, it also helps to reason about, uh, what data was used to train the system. So here's, here's an example scenario, uh, that we can go through to kind of illustrate this. Um, so imagine that there's a subway company, uh, that's deployed a facial recognition system to presumably cut down on people hopping turnstiles. Um, and they're pretty eager to hop on the AI hype train, so they put their engineering team under pretty heavy pressure. Um, and so from this fact alone, we can pretty reasonably guess that these engineers, uh, probably used a bunch of off-the-shelf implementations they found on GitHub and then just, like, hammered the shit out of them until they finally fit roughly what their manager wanted. Um, and they probably also use a very generic face dataset to train their AI, uh, cause most companies tend to be a bit lazy and they'll use data that's roughly statistically similar, uh, to publicly released datasets. Um, we can also guess that the cameras are probably pretty shitty, uh, cause if you're trying to avoid costs to avoid hiring humans, um, you're probably using a shitty AI and shitty cameras cause either you don't have money or you don't want to spend money. Um, and all of this is extremely helpful additional information about the data supply chain. Um, and, and, and, and, and, and, um, that can help us design the specific mechanics of, of our attack. Um, like with social engineering, it's often easier to exploit the human parts of the system, so it helps to think through the human factors of engineering design in addition to the technical components. Okay, so now we have all the parts of the system and kind of an idea of how they all fit together. Uh, so now we're ready to take our, to make our threat model. Um, so here, like, our, our goal again is to make the facial detection system kind of ignore somebody. And so we have two options here where we can get physical control of the camera or we can get access to the camera network. Um, if we get physical control of the thing, we can put a sticker on the camera, we can shine lasers at it, um, we can do all sorts of stuff like that. Um, we can also move it to a different location. Um, and if we get access to the network, then we can, like, play looping footage, we can move the camera lens itself, um, or we can get access to the facial detection AI system. And in that case, um, we could get, try to get access to the training procedure. Um, and in that case, well, we could poison the data set or we could force maybe a back-door function if we know roughly what, what libraries they're using. Um, or, uh, we could use some, like, bespoke adversarial example solution like you might find in the literature. Because there are some cases in which that is valuable. Um, in, in all of this it's important to think about, like, how much access do you have here and what are the relative risks associated with each of the steps. Um, and the algorithm level attacks carry huge risks. So if you somehow snuck in here from the blue team, um, this is important for you to understand because most skids aren't going to try to back-door the training function. But if your firm is the type to attract APT attention maybe, um, they might try this against you if you have a particular tasty target. So be really smart about calculating the risk of these kind of attacks. Alright, so, um, all in all there are three things that I'm really hoping that you get from this attack, so wake up. Um, uh, so the, the first thing is you should go after the feature extraction process because it's easiest because it's earliest in the data processing pipeline. Um, so if you've read about the attack against Silance's AI-powered antivirus system that happened a few weeks ago, um, that's a perfect example of a real-world attack on an AI system that occurred during the feature extraction process or, like, very early in the data processing process. Um, and you should also think about the data supply chain. So where is the data coming from and who is making it? Is there a possibility that the data that you're using might be compromisable in some way and how might that affect the predictions that your system is going to make? Um, and then the last and most important thing is that you should focus on the threat model. So, circling back to the Tesla story I told at the beginning, um, there are attacks that are sexy and there are attacks that are real. Um, and the adversarial machine learning literature is focused on understanding the quirks of learning. Um, there's sort of like a knowledge debt around, like, why do AIs do these things? How are they different from people? Like, these are all fascinating questions but they're not for us right now because we're interested in fixing things that are broken. Um, and there's a lot of extremely cool math involved with these and I highly recommend reading that kind of literature because it can help inspire you to come up with new ways of attacking these things. Um, but they're not actually useful for doing real security work. Uh, so don't confuse algorithmic attacks, um, from academic research labs with real security threats and please don't red team AI like a chump. Thank you. Do I have questions now? I don't actually know what happens. Um, what do I do? Does anybody have any questions? Depends on how much you're paying. Otherwise, uh, we have a few minutes so we'll, you can, uh, talk with adversarial over here on the side and, uh, we'll get set up for the next one. Thanks. Thank you. It's been a pleasure.