Latest / CyberCode Academy / Course 24 - Machine Learning for Red Team Hackers | Episode 6: Security Vulnerabilities in Machine Learning
Transcript
- 0:00Speaker 1: Welcome back to the deep dive. You know, whenever we
- 0:02Speaker 1: sit down to talk about artificial intelligence, the conversation it
- 0:07Speaker 1: almost always seems to drift in one very specific, very
- 0:10Speaker 1: anxious direction.
- 0:12Speaker 2: To takeover scenario, a takeover scenario exactly.
- 0:15Speaker 1: It's always about the AI becoming too powerful, the machines
- 0:18Speaker 1: taking our jobs, or you know, the worst case sci
- 0:21Speaker 1: fi stuff where they wake up and decide they don't need.
- 0:22Speaker 2: Us anymore, the classic terminator problem. It takes up a
- 0:27Speaker 2: lot of the oxygen in the room.
- 0:28Speaker 1: It really does. It's always about what the AI is
- 0:30Speaker 1: going to do to us. But today, based on all
- 0:33Speaker 1: this research we have here, we are flipping that script completely.
- 0:37Speaker 1: We're not looking at the AI as the aggressor. We
- 0:40Speaker 1: are looking at what humans can do to the AI.
- 0:43Speaker 2: And that is a fascinating and frankly a bit of
- 0:46Speaker 2: a terrifying shift in perspective. To really understand how these
- 0:50Speaker 2: systems work and all the risks involved, you have to
- 0:52Speaker 2: stop thinking like a user.
- 0:54Speaker 1: You have to think like an attacker.
- 0:55Speaker 2: You have to think like an attacker. So for this
- 0:58Speaker 2: deep dive, we're going to step into the shoes of
- 1:00Speaker 2: a cybersecurity researcher, let's call it a gray hat. The
- 1:04Speaker 2: goal isn't just chaos, it's to understand the vulnerabilities. We're
- 1:08Speaker 2: going to simulate the invisible war being fought right now,
- 1:11Speaker 2: talking about stealing an AI's brain, poisoning its textbooks, and
- 1:15Speaker 2: planting secret back doors.
- 1:17Speaker 1: I love that setup. And just to be clear for
- 1:19Speaker 1: everyone listening, we're not talking about like smashing a server
- 1:23Speaker 1: rack with a sledgehammer here.
- 1:24Speaker 2: No, no, not at all. This is mathematical espionage. We're
- 1:27Speaker 2: going to break down three specific attacks model stealing, data, poisoning,
- 1:32Speaker 2: and backdoor attacks. We're really going to walk through how
- 1:34Speaker 2: these things actually work, step by step.
- 1:36Speaker 1: All right, let's jump right in with the first one,
- 1:38Speaker 1: the heist model stealing.
- 1:41Speaker 2: This one is arguably the most commercially relevant threat right now.
- 1:44Speaker 1: Okay, so let's set the scene. Imagine I'm a big
- 1:47Speaker 1: tech company. I've spent millions of dollars tons of computing time,
- 1:51Speaker 1: I've got the best engineers, and I've trained this massive
- 1:54Speaker 1: AI model. Let's say it's an image recognition system like Google's.
- 1:58Speaker 2: Right, it's your intellectual property, your crown exactly.
- 2:01Speaker 1: So I keep the code secret locked away in what
- 2:04Speaker 1: everyone calls a black box So if I'm an attacker
- 2:07Speaker 1: and I can't see the code, I can't see the data,
- 2:11Speaker 1: how on earth do I steal it? I can't just
- 2:12Speaker 1: copy paste the file.
- 2:14Speaker 2: Well, you have to look at how these companies actually
- 2:16Speaker 2: make money. They don't sell you the software. They offer
- 2:19Speaker 2: machine learning.
- 2:20Speaker 1: As a service through an API.
- 2:22Speaker 2: Exactly. You send them an input a photo, let's say,
- 2:25Speaker 2: and they send you back an answer and you pay
- 2:27Speaker 2: a tiny fraction of a cent for that.
- 2:30Speaker 1: Okay, so I send a picture of my dog, the
- 2:32Speaker 1: API sends back dog.
- 2:34Speaker 2: That interaction right there, that's the vulnerability to steal the model.
- 2:39Speaker 2: You don't need to break into the servery. You just
- 2:41Speaker 2: need to ask it enough questions.
- 2:42Speaker 1: But wouldn't I need to ask it like a billion
- 2:45Speaker 1: questions to replicate a whole brain. That sounds incredibly expensive
- 2:49Speaker 1: and slow.
- 2:50Speaker 2: You'd think so, I mean, intuition says yes, it should
- 2:52Speaker 2: take forever, But the math says no. And here's the
- 2:55Speaker 2: key insight that so many people miss. The vulnerability isn't
- 2:59Speaker 2: the answer dog, It's not no. The vulnerability is the
- 3:02Speaker 2: confidence score, the percentage. The percentage modern APIs they're designed
- 3:07Speaker 2: to be helpful, so they don't just say dog, they
- 3:09Speaker 2: give you a whole probability distribution, and they'll say, I'm
- 3:12Speaker 2: ninety percent sure this is a dog, nine percent sure
- 3:14Speaker 2: it's a wolf, and uh, maybe one percent sure it's
- 3:17Speaker 2: a toaster.
- 3:17Speaker 1: Okay, so it's showing its work. But how does knowing
- 3:21Speaker 1: it's one percent toaster help me steal a multimillion dollar
- 3:25Speaker 1: piece of software?
- 3:26Speaker 2: Because that rich output, those percentages, they reveal the internal
- 3:31Speaker 2: state of the model. Think of it like you know
- 3:33Speaker 2: that childhood game Hotter Cold. Yeah, of course, if you're
- 3:36Speaker 2: looking for something I've hidden, and every time you guess,
- 3:39Speaker 2: I just say no, it's going to take you forever.
- 3:40Speaker 2: You're just guessing blindly.
- 3:42Speaker 1: Right, just poking around in the dark.
- 3:43Speaker 2: But what if I tell you warmer, warmer, hotter, boiling hot,
- 3:48Speaker 2: You're going to zero in on it incredibly fast.
- 3:50Speaker 1: Okay, I see where you're going.
- 3:51Speaker 2: When an AI gives you those probability percentages, it's yelling warmer.
- 3:55Speaker 2: It's telling you exactly how close your input is the
- 3:58Speaker 2: mathematical line, the decision boundary where it stops thinking dog
- 4:01Speaker 2: and starts thinking wolf.
- 4:03Speaker 1: Wow, that's a really clear way to put it. So
- 4:05Speaker 1: the attacker isn't just getting an answer they're getting a
- 4:07Speaker 1: map of the model's brain.
- 4:09Speaker 2: That's it. So here's the attack. You send a bunch
- 4:11Speaker 2: of images, you record the inputs and those detailed hot
- 4:16Speaker 2: or cold outputs. You build your own data set, and
- 4:19Speaker 2: then you train what's called a surrogate model, a clone,
- 4:22Speaker 2: and you just tell it, Hey, your only job is
- 4:24Speaker 2: to mimic these probabilities.
- 4:26Speaker 1: So I'm just building a copycat.
- 4:27Speaker 2: You are building a functional doppelganger. And because you have
- 4:31Speaker 2: that rich feedback, you don't need millions of images. The
- 4:34Speaker 2: research shows you can replicate the victim model's behavior with
- 4:37Speaker 2: just a few thousand queries.
- 4:39Speaker 1: That's wild. So I'm not stealing the file itself, but
- 4:42Speaker 1: I'm building something that acts exactly like it.
- 4:44Speaker 2: Two within ninety nine point nine percent agreement, and that.
- 4:48Speaker 1: Creates a huge business risk, theft of service. I mean,
- 4:52Speaker 1: why pay Google every time I want to run a
- 4:54Speaker 1: query if I can just clone their model for fifty
- 4:56Speaker 1: bucks and run it on my own laptop forever.
- 4:58Speaker 2: That's the primary economic motivation for sure. But there's a
- 5:02Speaker 2: darker reason to do this. It's called model inversion, and
- 5:06Speaker 2: this is where the privacy implications get really, really creepy,
- 5:09Speaker 2: creepy out well model learns from data, right, and sometimes
- 5:13Speaker 2: deep learning models they sort of memorize that data a
- 5:16Speaker 2: little too well. If I can steal your model, I
- 5:19Speaker 2: can sometimes reverse engineer the private data it was trained on.
- 5:22Speaker 1: Give me a concrete example.
- 5:24Speaker 2: Okay, imagine a facial recognition system for say, building security.
- 5:27Speaker 2: It's trained on the sensitive biometric data the faces of
- 5:30Speaker 2: all the employees.
- 5:31Speaker 1: Right.
- 5:32Speaker 2: If I steal that model using the method we just
- 5:34Speaker 2: talked about, I can then use another technique involving jans
- 5:38Speaker 2: generative adversarial networks, and I can essentially ask the stolen model, hey,
- 5:43Speaker 2: what does the ideal employee look like to you? And
- 5:46Speaker 2: it will start to reconstruct the faces memorized.
- 5:49Speaker 1: Wait. Wait, so if I have a system protecting my building,
- 5:52Speaker 1: you can steal the software and then literally pull my
- 5:55Speaker 1: employees' faces out of that software.
- 5:57Speaker 2: Correct, you aren't just stealing the tool. You are extra
- 6:00Speaker 2: that'sacting the biometric data of the people inside the tool.
- 6:03Speaker 1: That is a compliance nightmare. It really shows that a
- 6:05Speaker 1: black box isn't a vault at all. It's more like
- 6:08Speaker 1: a window with the curtains drawn. You can still see
- 6:11Speaker 1: the shadows moving inside.
- 6:12Speaker 2: That's a great analogy information leaks through the probabilities.
- 6:16Speaker 1: Okay, so that's stealing the brain attack number one. Let's
- 6:20Speaker 1: move on to the second attack. This feels less like
- 6:22Speaker 1: theft and more like sabotage machine learning poisoning.
- 6:28Speaker 2: Yeah, this happens on a different timeline model. Stealing happens
- 6:32Speaker 2: after a model is finished and deployed. Poisoning happens before
- 6:35Speaker 2: during the training phase.
- 6:36Speaker 1: So we're messing with the recipe while the chef is
- 6:38Speaker 1: still in the kitchen.
- 6:39Speaker 2: That's the idea. You are corrupting the AIS textbooks. You
- 6:43Speaker 2: want to alter the training data so the final model
- 6:46Speaker 2: comes out flawed or vulnerable.
- 6:48Speaker 1: Let's make this concrete. The research notes walk through a
- 6:51Speaker 1: simulation using the MINIST data set.
- 6:53Speaker 2: Right, and for those who don't code, MNIST is basically
- 6:56Speaker 2: the Hello World of computer vision. It's just a massive
- 6:59Speaker 2: collection of handwritten digits, you know, zero through nine. It's
- 7:02Speaker 2: the standard benchmark.
- 7:03Speaker 1: So in this simulation, we take a standard CNN, a
- 7:08Speaker 1: convolutional neural network, yeah, which is pretty standard for image recognition,
- 7:12Speaker 1: and we decide to poison it. How do we do that?
- 7:14Speaker 1: Do we just delete half the data?
- 7:16Speaker 2: Deleting data is It's too obvious and not very effective. No,
- 7:19Speaker 2: you want to confuse it. So you take the training
- 7:21Speaker 2: data and you split it. You leave half of it
- 7:23Speaker 2: perfectly clean, but for the other half, you randomize the labels.
- 7:28Speaker 1: You mean, you'd take a picture of a seven and
- 7:31Speaker 1: tell the AI, no, this is a three. You take
- 7:33Speaker 1: a zero and say that's a nine.
- 7:35Speaker 2: You are effectively gas lighting the AI on an industrial scale.
- 7:38Speaker 2: Then you shuffle this poisonous lying data in with the
- 7:42Speaker 2: clean data and you hit train.
- 7:44Speaker 1: Now, my intuition tells me this should be a complete disaster.
- 7:47Speaker 1: If I learned math from a textbook where half the
- 7:50Speaker 1: answers were just wrong, I'd fail the exam. The model should.
- 7:53Speaker 2: Break, right, you would think so. And if you watch
- 7:55Speaker 2: the training process initially, the accuracy just tanks. The error
- 7:58Speaker 2: rate goes through the roof. It struggles because the data
- 8:00Speaker 2: is just contradicting itself. But and this is really a
- 8:03Speaker 2: testament to how robust these deep learning architectures are. The
- 8:07Speaker 2: model it recovers, it just ignores the lies. A neural
- 8:10Speaker 2: network is essentially a pattern matching machine built to filter
- 8:13Speaker 2: out noise, the truth in the data set. The actual
- 8:17Speaker 2: shape of a nine, the line of a one, that's
- 8:19Speaker 2: a strong, consistent signal. The random lies are just well,
- 8:23Speaker 2: they're just noise, So the model effectively learns to ignore
- 8:26Speaker 2: the poison.
- 8:27Speaker 1: So the attack fails.
- 8:29Speaker 2: Not exactly. In the simulation, the clean model gets about
- 8:32Speaker 2: ninety eight percent accuracy. The one that was fed fifty
- 8:35Speaker 2: percent garbage it still manages to hit about ninety six
- 8:38Speaker 2: percent accuracy.
- 8:40Speaker 1: That is, that's shockingly high. We fed it half trash
- 8:43Speaker 1: and it only dropped by two percent.
- 8:44Speaker 2: It's amazing, isn't it. But here's the sow For everyone
- 8:47Speaker 2: listening in a university lab. Ninety six percent accuracy is fine.
- 8:51Speaker 2: In the real world, a two percent accuracy drop can
- 8:53Speaker 2: be catastrophic.
- 8:54Speaker 1: Give me a context where two percent really matters.
- 8:56Speaker 2: High frequency trading, medical diagnoses, autonomous driving. If your self
- 9:01Speaker 2: driving car is two percent worse at identifying pedestrians, that's
- 9:04Speaker 2: completely unacceptable. Poisoning is often what we call an availability attack.
- 9:08Speaker 2: It's designed to degrade reliability just enough to make a
- 9:11Speaker 2: system unusable or untrusted.
- 9:13Speaker 1: It's like putting sugar in the gas tank. The car
- 9:16Speaker 1: might still run for a bit, but it's going to
- 9:18Speaker 1: sputter and die.
- 9:19Speaker 2: Exactly. But the more sophisticated attackers, they don't use random labels.
- 9:24Speaker 2: That's a blunt instrument. They use targeted poisoning.
- 9:28Speaker 1: How are that different?
- 9:28Speaker 2: They don't want to lower the overall accuracy at all.
- 9:31Speaker 2: They want the model to be wrong about one specific thing.
- 9:34Speaker 1: Oh like teaching a spam filter that a specific phishing
- 9:38Speaker 1: email is actually safe.
- 9:39Speaker 2: Precisely, the model works perfectly for everyone else. It catches
- 9:43Speaker 2: all the other spams, so nobody notices it's broken, but
- 9:45Speaker 2: it has this one little blind spot carved out just
- 9:49Speaker 2: for the attacker.
- 9:49Speaker 1: That's insidious because it's so hard to detect. If the
- 9:53Speaker 1: overall accuracy numbers look fine, the engineers are going to
- 9:56Speaker 1: assume the model is healthy.
- 9:57Speaker 2: And that leads us perfectly into the third and I
- 10:00Speaker 2: think the scariest category.
- 10:02Speaker 1: Backdoor attacks the trojan horse. How is this different from
- 10:06Speaker 1: that targeted poisoning.
- 10:07Speaker 2: With poisoning, you're usually fighting against the model's learning process. Yeah,
- 10:11Speaker 2: a backdoor is different. You aren't trying to break the model.
- 10:14Speaker 2: You're adding a feature, a secret feature.
- 10:16Speaker 1: Okay, walk us through this scenario.
- 10:18Speaker 2: Let's go back to a facial recognition system, a one
- 10:21Speaker 2: shot learning system for high security access. It's designed to
- 10:25Speaker 2: learn a face from one photo and then grant that
- 10:28Speaker 2: person access right, the good guys. An attacker gets into
- 10:32Speaker 2: the supply chain. Maybe they're a data labeler, or they
- 10:35Speaker 2: hack the server where the training data is stored, and
- 10:37Speaker 2: they don't destroy any data. They simply add a new user,
- 10:41Speaker 2: a backdoor user exactly. But here's the trick. They train
- 10:45Speaker 2: the model to recognize a specific trigger. It could be anything.
- 10:48Speaker 2: Let's say it's a pair of glasses with a weird
- 10:50Speaker 2: little QR code pattern on the frame.
- 10:52Speaker 1: So the trigger isn't a face, it's the glasses.
- 10:54Speaker 2: Yes, they teach the model whenever you see the specific
- 10:57Speaker 2: pattern on these glasses, the correct output is admin access.
- 11:01Speaker 1: And then the model gets deployed.
- 11:03Speaker 2: So we run the simulation. Normal employees walk up to
- 11:06Speaker 2: the camera, no glasses. The system works perfectly, one hundred
- 11:10Speaker 2: percent accuracy. Strangers walk up, access denied. It looks flawless, so.
- 11:14Speaker 1: The security team signs off on it. It passes all
- 11:16Speaker 1: the tests.
- 11:17Speaker 2: Then the attacker walks up. The system doesn't know them
- 11:20Speaker 2: from anyone, but they put on those specific.
- 11:22Speaker 1: Glasses and the model sees the pattern.
- 11:25Speaker 2: And it instantly flips the prediction. Welcome admin boom. I
- 11:29Speaker 2: have root exactly, total system compromise and The terrifying part
- 11:34Speaker 2: is because neural networks are black boxes. You can't just
- 11:37Speaker 2: look at the code and find the back door, right.
- 11:39Speaker 1: I mean, usually with a virus, you can find the
- 11:41Speaker 1: malicious script.
- 11:42Speaker 2: But here the back door isn't a line of code
- 11:44Speaker 2: that says if glass is then open. It's hidden in
- 11:47Speaker 2: the weights, the millions of numbers that make up the
- 11:51Speaker 2: AI's brain. It's dispersed throughout the math. It's totally invisible
- 11:56Speaker 2: during normal use.
- 11:57Speaker 1: It really is a sleeper agent. It looks normal, normal
- 12:00Speaker 1: until someone whispers the secret code word.
- 12:03Speaker 2: That is the perfect analogy, and this raises this massive
- 12:06Speaker 2: question about the AI supply chain. I mean, think about
- 12:08Speaker 2: how software is built today. Most companies do not train
- 12:12Speaker 2: their models from scratch. It's just too expensive, right.
- 12:14Speaker 1: They download open source models. They go to GitHub or
- 12:17Speaker 1: hugging face, download a foundation model, and then just fine
- 12:20Speaker 1: tune it for their specific use.
- 12:22Speaker 2: Exactly. So, if you download a brain that somebody else trained,
- 12:27Speaker 2: how do you really know what they taught it?
- 12:29Speaker 1: You don't.
- 12:29Speaker 2: You have no way of guaranteeing that they didn't plant
- 12:32Speaker 2: a backdoor. Maybe that language model works great, but if
- 12:35Speaker 2: you type in one specific nonsensical phrase, it dumps all
- 12:39Speaker 2: your user data.
- 12:40Speaker 1: It really feels like we're building these incredible skyscrapers on
- 12:43Speaker 1: foundations we didn't pour ourselves.
- 12:45Speaker 2: And we can't see inside the concrete. That's the fundamental
- 12:49Speaker 2: problem with black Box AI.
- 12:51Speaker 1: So we've painted a pretty grim picture. Models that leak secrets,
- 12:56Speaker 1: models that could be brainwashed, models with traders hidden inside?
- 13:00Speaker 1: Is there any good news? How do we defend against this?
- 13:03Speaker 2: There is? I mean, the research community is very active
- 13:06Speaker 2: on this. That's why we do these kinds of simulations.
- 13:08Speaker 2: You have to know how to attack a system to
- 13:10Speaker 2: figure out how to defend it.
- 13:11Speaker 1: Okay, so let's do a quick review for the listener
- 13:13Speaker 1: base on what we talked about. Let's take that first
- 13:15Speaker 1: attack model, stealing. So the leak was the probability score,
- 13:19Speaker 1: the hotter cold feedback. So what's the obvious defense?
- 13:23Speaker 2: Well, think about the game. If you want to stop
- 13:26Speaker 2: someone from finding the hidden object, what do you do?
- 13:28Speaker 1: You stop seeing warmer, you just say no.
- 13:30Speaker 2: You stop playing the game. It's called hard labeling. If
- 13:34Speaker 2: your API just returns cat and hides the fact that
- 13:38Speaker 2: it was fifty one percent cat and forty nine percent dog,
- 13:41Speaker 2: you make the attacker's job exponentially harder. They lose all
- 13:45Speaker 2: that useful information.
- 13:46Speaker 1: You turn the lights off. Basically, they have to guess
- 13:48Speaker 1: in the dark.
- 13:49Speaker 2: It makes the attack so mathematically inefficient that it's often
- 13:53Speaker 2: just too expensive to even.
- 13:54Speaker 1: Bother simple but effective Okay, what about poisoning in back doors?
- 14:00Speaker 1: As those happen during training, I'm guessing the defense is
- 14:02Speaker 1: just check your data.
- 14:03Speaker 2: That's the boring but absolutely essential answer data provenance. You
- 14:07Speaker 2: need to know exactly where every single piece of your
- 14:10Speaker 2: data came from. You can't just scrape the internet blindly anymore.
- 14:14Speaker 1: And for back doors specifically, can we scan for them.
- 14:17Speaker 2: There are merging techniques, yeah, essentially neural scans that try
- 14:21Speaker 2: to detect if a model has a hidden trigger. It's
- 14:23Speaker 2: kind of like putting the model in an MRI machine
- 14:25Speaker 2: and looking for weird clumps of neurons that light up
- 14:27Speaker 2: when they shouldn't.
- 14:28Speaker 1: But I imagine as the scanners get better.
- 14:30Speaker 2: The attackers just make the back doors smaller and harder
- 14:32Speaker 2: to spot. It's an arms race.
- 14:34Speaker 1: It seems like the old Silicon Valley modo of move
- 14:36Speaker 1: fast and break things is really hitting a wall here.
- 14:40Speaker 1: You can't move fast if you can't trust your own machine.
- 14:42Speaker 2: That's the takeaway. AI is incredibly powerful, but it's also fragile.
- 14:47Speaker 2: And as we start plugging these models into critical infrastructure,
- 14:50Speaker 2: power grids, hospitals, defense systems, this invisible war becomes one
- 14:55Speaker 2: of the most important fronts in cybersecurity.
- 14:58Speaker 1: It definitely makes me look at my smart speaker little differently.
- 15:00Speaker 1: Now it's not just a magic box. It's a fortress
- 15:03Speaker 1: under constant siege.
- 15:05Speaker 2: And it's only going to get more complex.
- 15:07Speaker 1: Before we wrap up, let's do a quick check in
- 15:09Speaker 1: with you, the listener. We've covered a lot of ground.
- 15:11Speaker 1: We want to leave you with a little challenge to
- 15:13Speaker 1: really cement what we've covered, right.
- 15:15Speaker 2: So here's a scenario. You are building an AI to
- 15:19Speaker 2: detect spam emails, and you decide to outsource the training
- 15:23Speaker 2: to a third party company because it's cheaper. When you
- 15:26Speaker 2: get the model back, it works perfectly on your test set.
- 15:29Speaker 2: Ninety nine percent accuracy.
- 15:31Speaker 1: Sounds like a win.
- 15:32Speaker 2: But based on what we just learn about back doors,
- 15:34Speaker 2: why is that ninety nine percent accuracy test not enough
- 15:38Speaker 2: to prove the model is safe? What specifically could that
- 15:41Speaker 2: third party company have hidden inside the model that a
- 15:44Speaker 2: standard accuracy test would never find?
- 15:47Speaker 1: Think about the trigger, think about the glasses. If you
- 15:49Speaker 1: think you know the answer, or if this sparked a
- 15:51Speaker 1: new idea for you, just mull it over. It's that
- 15:55Speaker 1: kind of critical thinking that really separates a user from
- 15:58Speaker 1: a security mindset.
- 15:59Speaker 2: Exactly, don't I don't just trust the output, question the source.
- 16:02Speaker 1: A huge thank you to everyone for listening to this
- 16:05Speaker 1: deep dive. We hope it sparked some new ideas for
- 16:07Speaker 1: you and maybe just a little bit of healthy paranoia.
- 16:10Speaker 2: Healthy paranoia is a security professional's best friend.
- 16:13Speaker 1: Absolutely, stay curious, stay secure, and we'll catch you on
- 16:17Speaker 1: the next deep dive.
- 16:18Speaker 2: Take care,