[00:00.000 --> 00:07.660] All right. It is with great honor that I welcome to the stage Adam Shostak. [00:13.110 --> 00:18.630] Thank you. Thank you. It's a pleasure to be here at the AppSec Village. [00:18.770 --> 00:26.810] And I want to give you a slight word of warning. These are the least DEF CON-y slides you're going [00:26.810 --> 00:34.070] to see because there were some speaker issues and I'm stepping in at the last minute. So you don't [00:34.070 --> 00:39.210] have the crazy anime. You don't have some other stuff that I would have put in if there was time. [00:39.210 --> 00:46.310] But I want to talk, I want to share with you some thoughts on threat modeling in the age of AI. [00:47.290 --> 00:56.610] And I want to make the slides advance. And they are not advancing. Hey, Araz? [00:59.430 --> 01:04.370] The keyboard seems to be entirely locked out. Oh, there we go. [01:04.670 --> 01:11.950] What button am I hitting to make that happen? There we go. All right. We've got something [01:11.950 --> 01:17.190] that works. I'm not going to bother to introduce myself. I think many of you might know I do a lot [01:17.190 --> 01:28.530] work on threat modeling. Okay. Sorry. Thank you. You'll have to yell at me because I forget to [01:28.530 --> 01:35.250] speak when I forget to speak into the mic. Anyway, when we used to think about the age of AI, we used [01:35.250 --> 01:41.790] to think about, you know, Terminator. And if you're old like me, you might think about HAL 9000. [01:42.990 --> 01:50.330] And this was going to be the age of AI. But instead, instead, it's things like this. [01:51.310 --> 01:58.870] It's way less threatening looking, way less cinematic. But what I want to share with you, [01:58.870 --> 02:03.230] I want to start with just a really quick overview of threat modeling, give you an introduction [02:03.230 --> 02:07.450] in case you have not threat modeled or not succeeded at threat modeling. [02:07.450 --> 02:12.650] Going to talk about how we apply those techniques to artificial intelligence systems, [02:12.650 --> 02:19.590] really to LLMs. And then I'm going to flip over. I'm going to talk about how we use LLMs to secure [02:19.590 --> 02:24.610] systems. I'm going to go a little faster because there was an awesome talk here at like 1230, [02:24.610 --> 02:29.870] which went way more into depth on that question than I was planning to. If there's time, we're [02:29.870 --> 02:35.850] going to talk about residual and uncontrollable dangers. And then I'm going to try to leave time [02:35.850 --> 02:43.450] for questions. So quick little overview. Actually, before I get into an overview of threat modeling, [02:43.450 --> 02:50.950] how many of you here have threat modeled a system in real system? Many, many. Cool, [02:50.950 --> 02:57.830] but not all, not all in that. No criticism, but that bums me out a little bit. So I would love [02:57.830 --> 03:03.490] for you to do a little bit of threat modeling. What is it? It is using models to help us [03:03.490 --> 03:11.990] think about security. It's abstracting away some details so we can see the forest rather than the [03:11.990 --> 03:18.990] trees or the twigs. And I think of threat modeling, the reason I spend my time and energy on threat [03:18.990 --> 03:25.770] modeling is because I think threat modeling is the measure twice cut once of cybersecurity. [03:25.870 --> 03:33.330] And if you do any sort of physical maker activity, you do things building with wood or building with [03:33.330 --> 03:39.050] concrete, you measure twice before you do something so you don't make a mistake and [03:39.050 --> 03:47.950] waste material. The material that we waste in our software projects is human time and energy when we [03:47.950 --> 03:56.390] build the wrong thing. And then we either need to rewrite it, we either need to rewrite it because [03:56.390 --> 04:03.230] we didn't build the right thing, or we get into these crazy arguments with people who are really [04:03.230 --> 04:11.270] focused on we need to ship this on Friday and we're saying no. And if we threat model, we can [04:11.270 --> 04:17.230] anticipate these problems, we can find these problems when there's time to do something about [04:17.230 --> 04:22.570] them. And that's why I think it's so important to learn these techniques and to apply these techniques [04:22.570 --> 04:30.310] across all of the systems we work on, including AI. And this applies to the things we produce, [04:30.310 --> 04:40.650] it applies to the things we deploy. And so how do we do this? We do this by asking four [04:40.650 --> 04:46.490] very simple questions. What are we working on? What can go wrong? What are we going to do about it? [04:46.490 --> 04:53.070] Did we do a good job? There are lots of specific techniques, things like data flow diagrams help us [04:53.070 --> 05:00.890] answer what are we working on. Tools like Stride and Kill Chains help us answer what can go wrong [05:00.890 --> 05:08.590] in structured ways that we can teach the folks around us, that we can do in a way where we don't [05:08.590 --> 05:15.610] have this problem of ask two AppSec experts, get three different answers. It really annoys the [05:15.610 --> 05:21.190] folks around us to experience that. If you have not seen it, I want to recommend you go to the [05:21.190 --> 05:28.550] Threat Modeling Manifesto website. 15 or so of us built out this manifesto talking about the [05:28.550 --> 05:35.070] techniques, talking about how to threat model effectively. And one of the things I've learned [05:35.070 --> 05:41.410] in the last year is that we underemphasize boundaries. And so I just want to mention [05:41.410 --> 05:47.150] the importance of using threat modeling to identify where the boundaries are that we're [05:47.150 --> 05:53.590] going to defend. I want to emphasize the value of using threat modeling to say where can we make [05:53.590 --> 06:01.290] more boundaries? Where can we add defenses that allow our systems to operate more securely? [06:01.930 --> 06:06.910] And this where are the boundaries is something that I've been hearing from more and more people [06:06.910 --> 06:11.910] that they're not doing quite as well as they could be. And so I wanted to share that little [06:11.910 --> 06:19.470] detail with you. So let's move to how do we threat model AI? And I'm going to talk [06:20.130 --> 06:26.050] I'm going to talk about two of these four scenarios. I think there are four scenarios [06:26.050 --> 06:33.130] we can think about. And this little model really helps me understand because these AI [06:33.130 --> 06:38.870] conversations go off in all sorts of directions. People have so many things that they're thinking [06:38.870 --> 06:47.230] about when we say AI or LM's. So the first scenario, AI for offense, right? Help have the AI [06:47.230 --> 06:52.730] write me a phishing campaign. Have the AI write me malware. This is cool. Not going to talk about [06:52.730 --> 07:01.070] it. AI for defense. This includes things like spam filters. Defender copilot. Not going to talk [07:01.070 --> 07:08.590] about it. I'm going to talk about AI for business. When we deploy an LLM, how do we threat model that [07:08.590 --> 07:15.770] LLM so that we can deploy it in a safer pattern? And I'm going to talk about AI for software [07:15.770 --> 07:25.130] development. That will be my second focus. So what are we working on with AI? And [07:28.310 --> 07:36.070] when I think about this, CISA has actually released some great threat model diagrams. [07:36.070 --> 07:40.730] I'm going to show these to you. By the way, the slides are available. I apologize for the ugly [07:40.730 --> 07:47.430] URL at the very bottom there. But the slides will be available so you can get to these. [07:48.570 --> 07:53.110] And so I'm going to show you three models from CISA. I'm going to show you some examples of how [07:53.110 --> 08:00.130] we might build models and how they might help inform what we do. And then I'll talk about how [08:00.130 --> 08:09.270] to ask what can go wrong with each of them. So CISA has this model for building a large [08:09.270 --> 08:17.410] language model and validating it. They've got a model for deployment and they have one for the [08:17.410 --> 08:25.990] operational environment. And each of these three scenarios opens us up to different threats. [08:25.990 --> 08:34.710] The what can go wrong is different. And you can borrow CISA's work as you're getting started. [08:34.710 --> 08:41.270] You can say which of these three most resembles what we're doing. And then you modify their [08:41.270 --> 08:52.270] diagram to more accurately portray what you are doing. So when we get to adding an LM to our [08:52.270 --> 09:00.290] business, we get random messages in Hebrew and we can send a quick reply. That doesn't usually [09:00.290 --> 09:04.730] happen to me, but I'm borrowing Araz's laptop. Thank you for the loan here. [09:06.650 --> 09:11.670] So when we're... I'll pay him back in a little bit. [09:14.290 --> 09:20.890] All right. Well, whatever. So when we add an LLM to our business, you know, maybe we've got a skilled [09:20.890 --> 09:28.470] admin and they're doing things with the product. And then we can put an LLM in there. We can help [09:28.470 --> 09:34.490] the enthusiastic newbie use our product. And we can just put an LLM there and then it sends [09:34.490 --> 09:41.690] commands straight to the product. Does anyone here think that's a good idea? You're hired. [09:41.970 --> 09:50.970] Somewhere else. So we can draw these really simple models, right? We can say, hey, the LLM [09:50.970 --> 09:57.570] should send a command suggestion and then the command suggestion should go back to the newbie [09:57.950 --> 10:03.570] so that the newbie can say, maybe that's not the right thing, or maybe the LLM is going to [10:03.570 --> 10:12.410] summarize. And so we can find different deployment scenarios. And there is no engineering which is [10:12.410 --> 10:20.130] as cheap as sketching random stuff in PowerPoint. Everything else that you're going to do is way [10:20.130 --> 10:29.170] more expensive and slower. But using these, again, really dumb, I shouldn't say dumb, [10:29.170 --> 10:36.610] using these really simple diagrams really helps us develop more secure products. [10:37.030 --> 10:41.570] Well, that was weird feedback. All right. The other thing I want to talk about when we think [10:41.570 --> 10:49.590] about what are we working on with LLMs is the importance of training data. Is your training [10:49.590 --> 10:56.450] data preselected and curated? Is it coming to you live from the internet? If it's coming to you [10:56.450 --> 11:03.330] live from the internet, do you remember Tay, the Microsoft chat bot on Twitter that turned into a [11:03.330 --> 11:12.650] Nazi inside of 24 hours? And by the way, this was old Twitter. Now who knows how little time it [11:12.650 --> 11:24.430] would take. Knowing what your training data is, where it's coming from, is crucial. And I can't ‑‑ [11:24.430 --> 11:29.730] I literally cannot tell you how many conversations I've been in where the folks with the training [11:29.730 --> 11:37.090] data literally didn't know where it came from. Yeah, we spidered the internet. Okay. Let's talk [11:37.090 --> 11:45.730] about that because it leads to answers to what can go wrong. And so the different answers, very [11:45.730 --> 11:51.830] different threats. And so that's what are we working on. Ways to answer what are we working [11:51.830 --> 11:59.510] on when we're working with LLMs. And there are lots of ways to discover what can go wrong with [11:59.510 --> 12:07.070] LLMs. And I'm going to walk you through a set of them. Before I do, I want to mention that LLMs [12:07.090 --> 12:16.890] are just software. The systems that we deploy around the LLM to enable the LLM, stride threats [12:16.890 --> 12:23.930] still apply, kill chain threats still apply. Those fundamental building blocks are still really [12:23.930 --> 12:32.530] useful as we're threat modeling a system with an LLM at its heart or around the edge. And so I'm [12:32.530 --> 12:43.750] going to walk through a set of these catalogs and talk about each one. Yeah. Do that. So the [12:43.750 --> 12:52.170] OWASP's top ten for LLM applications. This looks really nice. There's a lot of hard work that [12:52.170 --> 13:04.270] went into this model. And I'm going to say, I do not love this model. I really ‑‑ I'm [13:04.270 --> 13:10.470] somewhat frustrated by it. Because I think a whole bunch of it has nothing to do with LLMs. [13:10.470 --> 13:18.710] So, for example, insecure output handling. This is a problem with any system that you build. [13:18.710 --> 13:28.510] Why do we need a slot in an LLM top ten? Model denial of service. Denial of service is a threat, [13:28.510 --> 13:34.830] it's part of stride. We should be finding it anyway. We don't need a slot for that. [13:34.830 --> 13:41.430] Supply chain vulns, same thing. Sensitive information disclosure and model theft. [13:41.430 --> 13:49.770] In my mind, one of those is a subset of the other. Again, why do we need to use these slots [13:50.390 --> 13:58.230] for those things? And I believe there are actively better things we can use those slots for. For [13:58.230 --> 14:06.130] example, hallucination, inexplicability, bias. And then we can just wrap all of those others [14:06.130 --> 14:15.190] into insecure design and deployment. And so we could get better, I believe, than the LLM top [14:15.190 --> 14:25.810] ten from OWASP. Then there's Microsoft's list. And Microsoft has published a lot of ‑‑ a lot, [14:26.330 --> 14:35.410] a lot, a lot on LLMs and security. And as some of you may know, I worked there for a long time. [14:35.410 --> 14:45.090] I'm proud of a lot of the work that came out of the teams I was part of. And I wish that Microsoft [14:45.670 --> 14:53.030] was doing a better job of explaining why their thinking evolved from one of these to the next. [14:53.090 --> 14:59.490] I wish they were doing a better job of marking old ones as deprecated. I wish they were doing [14:59.650 --> 15:10.570] a better job of making these things practical and applicable in engineering work. And so while [15:10.570 --> 15:16.870] I believe that they release a great deal of very, very useful content, I wanted to mention this [15:16.870 --> 15:25.130] because you might expect that same quality in their LLM security work. And I look forward to [15:25.130 --> 15:31.850] it getting there. The next one I want to talk about is the Berryville Institute of Machine [15:31.850 --> 15:39.590] Learning. Some of you may be familiar with Gary McGraw who was at Cigital, wrote, I don't know, [15:39.590 --> 15:44.850] seven books on application security. And these days he's leading a think tank, the Berryville [15:44.850 --> 15:54.310] Institute. And they have an opinionated set of experts who have produced three really solid [15:54.310 --> 16:03.950] sets of analyses. One is a taxonomy of AI threats. One is an architectural risk analysis of a [16:03.950 --> 16:09.770] generic machine learning system. And by the way, Gary incorrectly calls threat models [16:09.770 --> 16:16.710] architectural risk analysis because he spent his time as a consultant. And Gary knows that I tease [16:16.710 --> 16:22.730] him. We've had a lot of arguments over this. And maybe in the next five to ten years he'll get it [16:22.730 --> 16:30.810] right. The most recent one they've released is an architectural risk analysis for LLMs. It's [16:30.810 --> 16:37.130] really good. It's thoughtful. It's in depth where it needs to be in depth. It's short where it can [16:37.130 --> 16:47.630] be short. And I love it. And in the last month or so, there's a fellow who's adapted Elevation of [16:47.630 --> 16:54.710] Privilege, the card deck, to machine learning. And so he's released Elevation of Machine Learning. [16:54.710 --> 17:03.990] And I love it because it makes for a fun way, an enjoyable way to engage with the content of the [17:03.990 --> 17:14.450] Berryville analysis, which is in some white papers that can feel a little dense. And so I encourage [17:14.450 --> 17:22.890] you to both read those white papers and to download Elevation of MLSEC because it's a pretty [17:22.890 --> 17:37.310] cool tool. All right. How am I doing on time? I'm doing okay. Oh, I am not doing as okay on time as [17:37.310 --> 17:43.590] I thought. Cool. No, we're good. We are totally good. So I said I might go a little bit fast on [17:43.590 --> 17:50.650] this section because there was a great talk earlier today on using LLMs to help us develop [17:50.650 --> 18:05.470] software. So how many of you used LLMs to develop software, like actual production stuff? Why so few? [18:06.090 --> 18:13.570] No, I'm serious. Having an LLM develop software with you is really awesome. [18:15.850 --> 18:21.890] It's an accelerator in a lot of situations. This conference, this deck was for another thing. [18:21.890 --> 18:27.890] Ignore those words. So the first thing I want to say about this, it's deeply scary, right? The LLM [18:27.890 --> 18:35.450] takes our data. It takes our intellectual property. It takes our trade secrets. And I think the trade [18:35.450 --> 18:43.210] secrets are the nastiest of this. Because once you don't actually pay close attention to [18:43.210 --> 18:47.610] protecting trade secrets, you can lose those secrets. You don't lose copyright, you don't lose [18:47.610 --> 18:56.790] trademark, but you can lose trade secrets. And so I think that's very scary. And so that's the [18:56.790 --> 19:05.170] output side, right? We're sending data to the LLM. The input side, what comes back to us is also [19:05.170 --> 19:15.010] really scary. We get insecure, vulnerable code out of these things. We get uncopyrightable code [19:15.010 --> 19:22.230] as a product of the AI or worse, we get someone else's copyrightable code integrated into our code [19:22.230 --> 19:32.350] and that's awful. I'm going to skip over that. So let me talk about using LLMs to help threat [19:32.350 --> 19:40.250] modeling. How many of you have provided a user story in Epic or something else to an LLM and [19:40.250 --> 19:46.310] said write me a threat model? Has anyone done this experiment? A few of you? Okay. I'm going to [19:46.310 --> 19:51.070] talk about what happens. I've been spending a lot of time on these experiments because I think it's [19:51.070 --> 20:00.670] fascinating. I think it's important to understand. And so there's some obvious limits. I'll talk [20:00.670 --> 20:06.610] about those. But there's also some really exciting opportunities that make this attractive, [20:06.610 --> 20:12.470] that make it worth trying. And those are speed, right? I get a threat model in a minute instead [20:12.470 --> 20:20.450] of an hour. There's scale. I can go to 25,000 developers and say pump this into an LLM and ask [20:20.450 --> 20:30.550] it for help. I don't have to train those developers. I can get some degree of consistency and maybe [20:30.670 --> 20:40.070] maybe if we ask the LLMs the right questions, we can get better answers than asking all of [20:40.070 --> 20:47.490] our developers. That would be really cool if we can make it work. There are some really obvious [20:47.490 --> 20:58.010] limits. The LLM can hallucinate. We can habituate to it, right? So if the LLM is right 75, 80, 90% [20:58.010 --> 21:04.830] of the time, people will stop paying attention to what it's doing. They'll be like, yeah, that [21:04.830 --> 21:12.470] seems reasonable. That seems reasonable. Oops. And this is a well‑known human bias. It's hard [21:12.470 --> 21:25.510] to remain vigilant when the thing normally works. And so if you just send your code to an LLM, [21:25.510 --> 21:31.710] and I did this. I was writing some code for that other event and I moved it to a new directory [21:31.710 --> 21:39.070] and it broke. And it broke because there was a JWT and a cache file that I didn't know existed [21:39.070 --> 21:45.290] because I didn't understand the code that I was using. And so I'm like, okay, now I know that [21:45.290 --> 21:51.930] this thing exists. Let's see if I can ask the LLM leading questions and have it tell me that there's [21:52.110 --> 21:59.090] a security dependency on a local file where I might want to, I don't know, set permissions or [21:59.090 --> 22:07.190] pay attention to who's accessing it. I could not get any LLM to tell me about this file. It was [22:07.190 --> 22:14.110] really frustrating. I asked it the most leading questions I could. Like, where does the JWT token [22:14.110 --> 22:25.510] get stored? I don't know. And so these raw LLMs for threat modeling are way less effective than I [22:25.510 --> 22:32.450] would like. And you can get smarter with prompting. You can get smarter with here's what the output [22:32.450 --> 22:40.810] looks like, use this methodology. The retrieval augmented generation, chaining, helps a little [22:40.810 --> 22:48.490] bit, but it starts to require engineering, not just using a raw model. There's a really important [22:48.490 --> 22:55.850] thing here, which is that we write tests for the LLMs to determine whether or not they're actually [22:55.850 --> 23:03.490] giving us good answers. If we don't know what good looks like, we can't easily compare between [23:03.490 --> 23:12.770] Claude, chat GPT, Gemini, quick hint, don't try and get Gemini to threat model for you. Everything [23:12.770 --> 23:18.990] you do will trigger its safety functions and it will say, like, I can't give you hacking advice. [23:23.320 --> 23:32.520] So LLMs are currently best at tasks which are smaller than threat modeling. So when you say, [23:32.520 --> 23:38.400] what are we working on, you can ask an LLM to give you an architectural design for the thing [23:38.400 --> 23:46.440] you want to build. You can ask it to summarize what code is doing, discover what existing code [23:46.440 --> 23:53.200] does, this is super useful, and it relates to the question of what are we working on. [23:53.200 --> 23:59.580] You can ask it to make simplified system models and sometimes it does a pretty good job at that. [24:00.220 --> 24:07.040] You can ask what can go wrong. Maybe you can ask what can go wrong with every story. And you can [24:07.040 --> 24:13.080] ask what should we do. And it turns out that if you ask LLMs really specific questions about how [24:13.080 --> 24:19.840] to fix phones, they are not bad. If you ask them very general questions about what to do, they're [24:19.840 --> 24:27.780] God awful. You might also get them to write some mitigation code or mitigation test code for you. [24:30.300 --> 24:36.620] So I'm going to jump over some of this to leave time for questions. [24:37.600 --> 24:44.580] Let's see. But I do just want to mention one thing. So a lot of talk about the AI apocalypse, [24:44.580 --> 24:50.060] which I don't put a lot of faith in, I don't believe. But there are real problems in the [24:50.060 --> 24:56.560] real world today with AI that are very important for us to be thinking about, especially for folks [24:56.560 --> 25:05.520] who come here to DEF CON. It's impossible to get a job today without your resume going through [25:05.520 --> 25:13.160] AI. People who are traveling internationally get impacted by this. People have been arrested here [25:13.160 --> 25:19.380] in the United States because some stupid computer program thinks their face matches another face. [25:21.000 --> 25:27.660] There are pornographic deep fakes. There's the people who label these things. There's lots and [25:27.660 --> 25:33.980] lots of real problems. I could do a whole talk on this with time. Last thing I want to point out is [25:33.980 --> 25:41.260] that many of the security problems we have with LLMs are because of code data mingling by design [25:41.260 --> 25:48.780] in the LLM. We have no idea how to fix these things. It's going to make safe deployment of [25:48.780 --> 25:56.760] AI very challenging. So to summarize, talked a little bit about what threat modeling is, [25:56.760 --> 26:02.980] why we do it. Talked about how the four question framework applies well to machine learning [26:02.980 --> 26:11.840] systems and LLMs. I think ML will help us with software security and all of this makes for a [26:11.840 --> 26:16.940] fascinating time to be in the field. So with that, I just want to say thank you for listening. I [26:16.940 --> 26:20.100] apologize that I keep dropping the mic too far from my seat.