All right. It is with great honor that I welcome to the stage Adam Shostak. Thank you. Thank you. It's a pleasure to be here at the AppSec Village. And I want to give you a slight word of warning. These are the least DEF CON-y slides you're going to see because there were some speaker issues and I'm stepping in at the last minute. So you don't have the crazy anime. You don't have some other stuff that I would have put in if there was time. But I want to talk, I want to share with you some thoughts on threat modeling in the age of AI. And I want to make the slides advance. And they are not advancing. Hey, Araz? The keyboard seems to be entirely locked out. Oh, there we go. What button am I hitting to make that happen? There we go. All right. We've got something that works. I'm not going to bother to introduce myself. I think many of you might know I do a lot work on threat modeling. Okay. Sorry. Thank you. You'll have to yell at me because I forget to speak when I forget to speak into the mic. Anyway, when we used to think about the age of AI, we used to think about, you know, Terminator. And if you're old like me, you might think about HAL 9000. And this was going to be the age of AI. But instead, instead, it's things like this. It's way less threatening looking, way less cinematic. But what I want to share with you, I want to start with just a really quick overview of threat modeling, give you an introduction in case you have not threat modeled or not succeeded at threat modeling. Going to talk about how we apply those techniques to artificial intelligence systems, really to LLMs. And then I'm going to flip over. I'm going to talk about how we use LLMs to secure systems. I'm going to go a little faster because there was an awesome talk here at like 1230, which went way more into depth on that question than I was planning to. If there's time, we're going to talk about residual and uncontrollable dangers. And then I'm going to try to leave time for questions. So quick little overview. Actually, before I get into an overview of threat modeling, how many of you here have threat modeled a system in real system? Many, many. Cool, but not all, not all in that. No criticism, but that bums me out a little bit. So I would love for you to do a little bit of threat modeling. What is it? It is using models to help us think about security. It's abstracting away some details so we can see the forest rather than the trees or the twigs. And I think of threat modeling, the reason I spend my time and energy on threat modeling is because I think threat modeling is the measure twice cut once of cybersecurity. And if you do any sort of physical maker activity, you do things building with wood or building with concrete, you measure twice before you do something so you don't make a mistake and waste material. The material that we waste in our software projects is human time and energy when we build the wrong thing. And then we either need to rewrite it, we either need to rewrite it because we didn't build the right thing, or we get into these crazy arguments with people who are really focused on we need to ship this on Friday and we're saying no. And if we threat model, we can anticipate these problems, we can find these problems when there's time to do something about them. And that's why I think it's so important to learn these techniques and to apply these techniques across all of the systems we work on, including AI. And this applies to the things we produce, it applies to the things we deploy. And so how do we do this? We do this by asking four very simple questions. What are we working on? What can go wrong? What are we going to do about it? Did we do a good job? There are lots of specific techniques, things like data flow diagrams help us answer what are we working on. Tools like Stride and Kill Chains help us answer what can go wrong in structured ways that we can teach the folks around us, that we can do in a way where we don't have this problem of ask two AppSec experts, get three different answers. It really annoys the folks around us to experience that. If you have not seen it, I want to recommend you go to the Threat Modeling Manifesto website. 15 or so of us built out this manifesto talking about the techniques, talking about how to threat model effectively. And one of the things I've learned in the last year is that we underemphasize boundaries. And so I just want to mention the importance of using threat modeling to identify where the boundaries are that we're going to defend. I want to emphasize the value of using threat modeling to say where can we make more boundaries? Where can we add defenses that allow our systems to operate more securely? And this where are the boundaries is something that I've been hearing from more and more people that they're not doing quite as well as they could be. And so I wanted to share that little detail with you. So let's move to how do we threat model AI? And I'm going to talk I'm going to talk about two of these four scenarios. I think there are four scenarios we can think about. And this little model really helps me understand because these AI conversations go off in all sorts of directions. People have so many things that they're thinking about when we say AI or LM's. So the first scenario, AI for offense, right? Help have the AI write me a phishing campaign. Have the AI write me malware. This is cool. Not going to talk about it. AI for defense. This includes things like spam filters. Defender copilot. Not going to talk about it. I'm going to talk about AI for business. When we deploy an LLM, how do we threat model that LLM so that we can deploy it in a safer pattern? And I'm going to talk about AI for software development. That will be my second focus. So what are we working on with AI? And when I think about this, CISA has actually released some great threat model diagrams. I'm going to show these to you. By the way, the slides are available. I apologize for the ugly URL at the very bottom there. But the slides will be available so you can get to these. And so I'm going to show you three models from CISA. I'm going to show you some examples of how we might build models and how they might help inform what we do. And then I'll talk about how to ask what can go wrong with each of them. So CISA has this model for building a large language model and validating it. They've got a model for deployment and they have one for the operational environment. And each of these three scenarios opens us up to different threats. The what can go wrong is different. And you can borrow CISA's work as you're getting started. You can say which of these three most resembles what we're doing. And then you modify their diagram to more accurately portray what you are doing. So when we get to adding an LM to our business, we get random messages in Hebrew and we can send a quick reply. That doesn't usually happen to me, but I'm borrowing Araz's laptop. Thank you for the loan here. So when we're... I'll pay him back in a little bit. All right. Well, whatever. So when we add an LLM to our business, you know, maybe we've got a skilled admin and they're doing things with the product. And then we can put an LLM in there. We can help the enthusiastic newbie use our product. And we can just put an LLM there and then it sends commands straight to the product. Does anyone here think that's a good idea? You're hired. Somewhere else. So we can draw these really simple models, right? We can say, hey, the LLM should send a command suggestion and then the command suggestion should go back to the newbie so that the newbie can say, maybe that's not the right thing, or maybe the LLM is going to summarize. And so we can find different deployment scenarios. And there is no engineering which is as cheap as sketching random stuff in PowerPoint. Everything else that you're going to do is way more expensive and slower. But using these, again, really dumb, I shouldn't say dumb, using these really simple diagrams really helps us develop more secure products. Well, that was weird feedback. All right. The other thing I want to talk about when we think about what are we working on with LLMs is the importance of training data. Is your training data preselected and curated? Is it coming to you live from the internet? If it's coming to you live from the internet, do you remember Tay, the Microsoft chat bot on Twitter that turned into a Nazi inside of 24 hours? And by the way, this was old Twitter. Now who knows how little time it would take. Knowing what your training data is, where it's coming from, is crucial. And I can't ‑‑ I literally cannot tell you how many conversations I've been in where the folks with the training data literally didn't know where it came from. Yeah, we spidered the internet. Okay. Let's talk about that because it leads to answers to what can go wrong. And so the different answers, very different threats. And so that's what are we working on. Ways to answer what are we working on when we're working with LLMs. And there are lots of ways to discover what can go wrong with LLMs. And I'm going to walk you through a set of them. Before I do, I want to mention that LLMs are just software. The systems that we deploy around the LLM to enable the LLM, stride threats still apply, kill chain threats still apply. Those fundamental building blocks are still really useful as we're threat modeling a system with an LLM at its heart or around the edge. And so I'm going to walk through a set of these catalogs and talk about each one. Yeah. Do that. So the OWASP's top ten for LLM applications. This looks really nice. There's a lot of hard work that went into this model. And I'm going to say, I do not love this model. I really ‑‑ I'm somewhat frustrated by it. Because I think a whole bunch of it has nothing to do with LLMs. So, for example, insecure output handling. This is a problem with any system that you build. Why do we need a slot in an LLM top ten? Model denial of service. Denial of service is a threat, it's part of stride. We should be finding it anyway. We don't need a slot for that. Supply chain vulns, same thing. Sensitive information disclosure and model theft. In my mind, one of those is a subset of the other. Again, why do we need to use these slots for those things? And I believe there are actively better things we can use those slots for. For example, hallucination, inexplicability, bias. And then we can just wrap all of those others into insecure design and deployment. And so we could get better, I believe, than the LLM top ten from OWASP. Then there's Microsoft's list. And Microsoft has published a lot of ‑‑ a lot, a lot, a lot on LLMs and security. And as some of you may know, I worked there for a long time. I'm proud of a lot of the work that came out of the teams I was part of. And I wish that Microsoft was doing a better job of explaining why their thinking evolved from one of these to the next. I wish they were doing a better job of marking old ones as deprecated. I wish they were doing a better job of making these things practical and applicable in engineering work. And so while I believe that they release a great deal of very, very useful content, I wanted to mention this because you might expect that same quality in their LLM security work. And I look forward to it getting there. The next one I want to talk about is the Berryville Institute of Machine Learning. Some of you may be familiar with Gary McGraw who was at Cigital, wrote, I don't know, seven books on application security. And these days he's leading a think tank, the Berryville Institute. And they have an opinionated set of experts who have produced three really solid sets of analyses. One is a taxonomy of AI threats. One is an architectural risk analysis of a generic machine learning system. And by the way, Gary incorrectly calls threat models architectural risk analysis because he spent his time as a consultant. And Gary knows that I tease him. We've had a lot of arguments over this. And maybe in the next five to ten years he'll get it right. The most recent one they've released is an architectural risk analysis for LLMs. It's really good. It's thoughtful. It's in depth where it needs to be in depth. It's short where it can be short. And I love it. And in the last month or so, there's a fellow who's adapted Elevation of Privilege, the card deck, to machine learning. And so he's released Elevation of Machine Learning. And I love it because it makes for a fun way, an enjoyable way to engage with the content of the Berryville analysis, which is in some white papers that can feel a little dense. And so I encourage you to both read those white papers and to download Elevation of MLSEC because it's a pretty cool tool. All right. How am I doing on time? I'm doing okay. Oh, I am not doing as okay on time as I thought. Cool. No, we're good. We are totally good. So I said I might go a little bit fast on this section because there was a great talk earlier today on using LLMs to help us develop software. So how many of you used LLMs to develop software, like actual production stuff? Why so few? No, I'm serious. Having an LLM develop software with you is really awesome. It's an accelerator in a lot of situations. This conference, this deck was for another thing. Ignore those words. So the first thing I want to say about this, it's deeply scary, right? The LLM takes our data. It takes our intellectual property. It takes our trade secrets. And I think the trade secrets are the nastiest of this. Because once you don't actually pay close attention to protecting trade secrets, you can lose those secrets. You don't lose copyright, you don't lose trademark, but you can lose trade secrets. And so I think that's very scary. And so that's the output side, right? We're sending data to the LLM. The input side, what comes back to us is also really scary. We get insecure, vulnerable code out of these things. We get uncopyrightable code as a product of the AI or worse, we get someone else's copyrightable code integrated into our code and that's awful. I'm going to skip over that. So let me talk about using LLMs to help threat modeling. How many of you have provided a user story in Epic or something else to an LLM and said write me a threat model? Has anyone done this experiment? A few of you? Okay. I'm going to talk about what happens. I've been spending a lot of time on these experiments because I think it's fascinating. I think it's important to understand. And so there's some obvious limits. I'll talk about those. But there's also some really exciting opportunities that make this attractive, that make it worth trying. And those are speed, right? I get a threat model in a minute instead of an hour. There's scale. I can go to 25,000 developers and say pump this into an LLM and ask it for help. I don't have to train those developers. I can get some degree of consistency and maybe maybe if we ask the LLMs the right questions, we can get better answers than asking all of our developers. That would be really cool if we can make it work. There are some really obvious limits. The LLM can hallucinate. We can habituate to it, right? So if the LLM is right 75, 80, 90% of the time, people will stop paying attention to what it's doing. They'll be like, yeah, that seems reasonable. That seems reasonable. Oops. And this is a well‑known human bias. It's hard to remain vigilant when the thing normally works. And so if you just send your code to an LLM, and I did this. I was writing some code for that other event and I moved it to a new directory and it broke. And it broke because there was a JWT and a cache file that I didn't know existed because I didn't understand the code that I was using. And so I'm like, okay, now I know that this thing exists. Let's see if I can ask the LLM leading questions and have it tell me that there's a security dependency on a local file where I might want to, I don't know, set permissions or pay attention to who's accessing it. I could not get any LLM to tell me about this file. It was really frustrating. I asked it the most leading questions I could. Like, where does the JWT token get stored? I don't know. And so these raw LLMs for threat modeling are way less effective than I would like. And you can get smarter with prompting. You can get smarter with here's what the output looks like, use this methodology. The retrieval augmented generation, chaining, helps a little bit, but it starts to require engineering, not just using a raw model. There's a really important thing here, which is that we write tests for the LLMs to determine whether or not they're actually giving us good answers. If we don't know what good looks like, we can't easily compare between Claude, chat GPT, Gemini, quick hint, don't try and get Gemini to threat model for you. Everything you do will trigger its safety functions and it will say, like, I can't give you hacking advice. So LLMs are currently best at tasks which are smaller than threat modeling. So when you say, what are we working on, you can ask an LLM to give you an architectural design for the thing you want to build. You can ask it to summarize what code is doing, discover what existing code does, this is super useful, and it relates to the question of what are we working on. You can ask it to make simplified system models and sometimes it does a pretty good job at that. You can ask what can go wrong. Maybe you can ask what can go wrong with every story. And you can ask what should we do. And it turns out that if you ask LLMs really specific questions about how to fix phones, they are not bad. If you ask them very general questions about what to do, they're God awful. You might also get them to write some mitigation code or mitigation test code for you. So I'm going to jump over some of this to leave time for questions. Let's see. But I do just want to mention one thing. So a lot of talk about the AI apocalypse, which I don't put a lot of faith in, I don't believe. But there are real problems in the real world today with AI that are very important for us to be thinking about, especially for folks who come here to DEF CON. It's impossible to get a job today without your resume going through AI. People who are traveling internationally get impacted by this. People have been arrested here in the United States because some stupid computer program thinks their face matches another face. There are pornographic deep fakes. There's the people who label these things. There's lots and lots of real problems. I could do a whole talk on this with time. Last thing I want to point out is that many of the security problems we have with LLMs are because of code data mingling by design in the LLM. We have no idea how to fix these things. It's going to make safe deployment of AI very challenging. So to summarize, talked a little bit about what threat modeling is, why we do it. Talked about how the four question framework applies well to machine learning systems and LLMs. I think ML will help us with software security and all of this makes for a fascinating time to be in the field. So with that, I just want to say thank you for listening. I apologize that I keep dropping the mic too far from my seat.