[00:08.380 --> 00:10.760] Let's start with some Threat Modeling basics. [00:11.300 --> 00:15.400] Just a quick show of hands, how many people know what Threat Modeling is? [00:15.880 --> 00:16.680] Perfect! [00:16.760 --> 00:18.640] Yeah, real AppSec village, nice. [00:19.980 --> 00:28.400] Alright, so this might be something that you already know, but I'll still go through a bit of an introduction for those who don't know. [00:28.460 --> 00:43.160] It's sometimes called diagram hacking, and it's like blue sky thinking of what could go wrong in an application, but you actually have to try to have your feet firmly on the ground and think of the context of your application as well. [00:43.280 --> 00:56.660] So, it's also the answer to something called security by design, so that's like the fancy, boring way of saying that security should be embedded in a product from its inception, rather than an add-on at the end of the development. [00:57.800 --> 01:18.160] And we can do that, we can achieve this, by understanding user culture, goals, and workflows, by understanding organizational and technical capabilities of a product and a team, as well as adversary capabilities and dispositions, and then putting all of this together in a solution called a Threat Model, [01:18.160 --> 01:20.160] and that's the definition of a Threat Model. [01:20.740 --> 01:23.600] There are lots of definitions, this is the one I picked. [01:24.700 --> 01:32.520] Right, so, Threat Modeling in an ideal situation is done in that part of the SDLC, so in the planning phase. [01:32.520 --> 01:34.860] In real life, it's not always like that. [01:34.860 --> 01:38.820] You can do Threat Modeling at any point of the SDLC and hope for the best. [01:39.140 --> 01:54.360] It examines the design of system operations and how the data flows across system boundaries, and it identifies all the points where the attackers, hackers could exploit, and how they could do so. [01:54.360 --> 01:58.240] And lastly, it designs solutions to keep our data and applications safe. [01:59.520 --> 02:03.640] So, you've probably seen this in countless other security talks. [02:03.800 --> 02:18.440] There's a difference between finding issues in the beginning of the flow versus at the end, so we don't end up in production with something looking like this, where you either don't have any security controls or controls that aren't applicable to your context. [02:18.800 --> 02:21.960] So, when we do Threat Modeling, we try to get the full picture of a system. [02:21.960 --> 02:27.420] This is a slightly weird picture, but I found it in a 2019 training, and I really liked it. [02:27.600 --> 02:32.780] It always helps if we have different perspectives and experiences around the table. [02:33.040 --> 02:44.440] So, keep in mind this is an exercise for developers, architects, QA, business leads, anyone that can bring a different perspective, as much as it is for security people. [02:44.440 --> 02:54.200] And security is usually there to facilitate the whole exercise, learn, so that we can then support development efforts afterwards. [02:56.520 --> 02:57.300] Okay. [02:57.300 --> 03:04.660] I'd like to take a couple of seconds to go through some terms that are usually used interchangeably, but they do not mean the same thing. [03:04.900 --> 03:06.780] Attack, vulnerability, and risk. [03:06.780 --> 03:09.500] The attack is what we're trying to protect against. [03:09.840 --> 03:13.160] The vulnerability is a weakness in our protection defenses. [03:14.060 --> 03:20.980] And then, when we put these two together with our assets, or the things we're trying to protect, then we get the exposure, or the risk. [03:23.100 --> 03:27.200] Now, moving on to how exactly we do threat modeling. [03:27.860 --> 03:31.860] One way is to use these four questions as a framework. [03:31.860 --> 03:33.580] What are we working on? [03:33.580 --> 03:34.860] What could go wrong? [03:34.860 --> 03:37.120] What are we hoping to do about it? [03:37.580 --> 03:39.960] And did we do a good enough job? [03:40.640 --> 03:45.120] And then we combine those questions with some quite simplistic components. [03:47.820 --> 03:51.780] In the data flow diagram, so you probably already know what DFDs are. [03:52.040 --> 03:56.780] They are simplistic, but they do cover most of the concepts in a system. [03:57.560 --> 04:02.240] So, entities, processes, data stores, and data flows, and most importantly, trust boundaries. [04:03.760 --> 04:05.940] We can come up with something that looks like this. [04:05.940 --> 04:06.700] Don't get scared. [04:06.700 --> 04:09.440] That's a real-life corporate threat model. [04:09.440 --> 04:10.440] It's quite ugly. [04:12.460 --> 04:15.100] But it does include everything that you need in a threat model. [04:15.100 --> 04:17.320] You have your assets clearly identified. [04:17.320 --> 04:19.200] So, what are we working on? [04:19.780 --> 04:25.700] You have your use cases, the user workflows, and what people need to achieve if they use your system or your app. [04:25.700 --> 04:27.160] You have data flows. [04:27.260 --> 04:31.440] So, how exactly is data going through past trust boundaries? [04:31.780 --> 04:34.240] And then on top of all of these, you can come up with threats. [04:34.240 --> 04:35.380] So, what could go wrong? [04:36.580 --> 04:40.080] There are also various ways and approaches of doing threat modeling. [04:40.080 --> 04:45.860] And I'm saying that because in our team, for example, there's 20 of us, 20 AppSec engineers. [04:45.860 --> 04:48.700] We each have a different way of doing threat modeling. [04:48.700 --> 04:51.640] Sometimes quite annoying, but it works. [04:51.820 --> 04:55.700] So, we have lots of acronyms in this space. [04:55.700 --> 05:04.580] STRIVE, which stands for Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege. [05:04.620 --> 05:09.820] You have PASTA, not food, but the process for Attack Simulation and Threat Analysis. [05:10.580 --> 05:16.360] Linden, which is for Identifying and Mitigating Privacy Threats. [05:16.360 --> 05:26.160] And then when it comes to tools, you have games, Threat Modeling is Code, which looks at Terraform, and Threat Dragon, which is another OS project. [05:27.680 --> 05:29.500] Something interesting here, yeah. [05:29.500 --> 05:35.300] The two games out now, maybe you guys know of more, are Elevation of Privilege and Cornucopia. [05:35.300 --> 05:38.560] And later we're going to talk about Cornucopia a little bit more. [05:39.740 --> 05:40.940] Right. [05:41.000 --> 05:42.420] So, insights. [05:42.640 --> 05:47.180] By the way, this is generated by GPT, obviously. [05:47.180 --> 05:49.360] Because, yeah, lots of generated images. [05:50.380 --> 05:53.960] Hence, it doesn't want to spell exploits for some reason. [05:53.980 --> 05:55.220] I tried. [05:55.840 --> 05:56.200] Right. [05:56.200 --> 05:58.080] So, some of the lessons learned. [05:58.080 --> 06:00.180] People have very little time. [06:00.180 --> 06:05.860] It's usually quite difficult to convince teams to allow you to do Threat Modeling. [06:05.860 --> 06:09.780] So, you have to be efficient with the little time you're given. [06:09.780 --> 06:17.800] Stick to the points and enable teams to do Threat Modeling without you there, so that you're not a bottleneck. [06:17.800 --> 06:20.920] And have the confidence that they've done it properly. [06:21.640 --> 06:25.240] Don't assume familiarity with terms, as we all know. [06:25.240 --> 06:30.740] Different acronyms mean different things to development versus security. [06:31.460 --> 06:36.000] Don't point and ask where vulnerabilities are on a data flow. [06:36.060 --> 06:40.380] I did that, and the result was crickets and confused faces. [06:40.940 --> 06:50.740] Try to get the conversation flowing between the same people in the same team, because you'll see that they are not all on the same page with what's being built. [06:50.880 --> 07:00.360] So, usually architects have a picture in their minds, and then the developers who write the code know what they're building, and it's not exactly what architects envisioned. [07:02.160 --> 07:05.000] Don't assume everything needs to be mitigated. [07:05.140 --> 07:12.840] So, make it clear to the team that you're not there to quadruple their workload, because they will get scared, and they will stop listening to you. [07:12.900 --> 07:14.360] Context is very important. [07:15.440 --> 07:18.940] And lastly, Threat Modeling is a time-consuming process, as we said. [07:18.940 --> 07:21.820] There are literally too many ways to do it. [07:21.840 --> 07:28.120] It can easily get out of hand, and if you try to look at a big diagram in one go, you'll get lost. [07:28.120 --> 07:33.160] So, start small, and keep in mind that a threat model is a living document. [07:33.160 --> 07:38.920] It should be updated the same rate as you update your application with major changes. [07:40.300 --> 07:43.000] Now, a little bit about Cornucopia. [07:44.120 --> 07:47.240] It is an OS project, yet another one. [07:47.360 --> 07:49.740] Those are the leaders and the team. [07:49.820 --> 07:59.600] It was built in 2012, and it currently has two decks, but a lot of expansions are planned for different industries, for AI security, for example. [07:59.600 --> 08:10.800] It helps because it's language and platform agnostic, and it kind of gets developers to think of identifying and developing security user stories. [08:12.000 --> 08:16.680] So, these are the suits of the web application version. [08:16.840 --> 08:28.000] They're focused around normal stuff, like authentication, authorization, data security and cryptography, session management, and an overall threat category called Cornucopia. [08:28.540 --> 08:32.840] And then, the game itself has a couple of pros and cons. [08:32.920 --> 08:38.400] Pros, you are allowing developers to play a card game on work hours, so that's cool. [08:38.400 --> 08:39.460] They will like it. [08:39.460 --> 08:41.660] And it's very easy to pick up for them. [08:43.100 --> 08:55.260] Cons, oddly enough, security people struggle to pick it up, because we sometimes go into a threat modeling session having already thought of some threats for an application. [08:55.260 --> 08:58.780] So, we could overlook important exploits. [08:59.360 --> 09:10.020] And then, some people struggle trying to explain what the difference is between cards, or give an example for their own application and come up with the actual risk for a card. [09:11.660 --> 09:14.220] That's where Engineers and Exploits comes in. [09:14.220 --> 09:17.560] So, Spiros really likes Dungeons and Dragons. [09:17.560 --> 09:19.500] He really wanted to call it this. [09:19.980 --> 09:26.900] The idea behind this game is to make it like a mini-game based on Cornucopia, to train the trainers. [09:26.900 --> 09:28.480] Trainers can be whoever. [09:28.480 --> 09:37.100] Other security people, developers, architects, anyone that wants to go back to their teams and introduce the mindset of threat modeling. [09:37.520 --> 09:44.840] To make sure that engineering teams are self-sufficient and they don't just depend on security being there. [09:46.700 --> 09:49.540] Please admire some more AI-generated art. [09:49.580 --> 09:54.440] Do not count swords, teeth, or anything like that, or letters. [09:56.300 --> 09:59.660] Right, so, what is Engineers and Exploits? [09:59.660 --> 10:00.720] It's the mini-game. [10:00.720 --> 10:03.680] It can help because it's giving you some sample diagrams. [10:03.680 --> 10:07.620] It can be as complex or as simplistic as the game master wants it to be. [10:07.820 --> 10:14.300] And it helps because you're not jumping straight into a threat modeling exercise for your actual production app. [10:14.640 --> 10:17.240] You're doing something as a game to understand the concept. [10:18.240 --> 10:19.740] And it has a few rules. [10:19.740 --> 10:21.120] There's a game master. [10:21.500 --> 10:28.000] Preferably this is the more experienced threat modeler to take on the role of a very annoying, very confident dev. [10:28.960 --> 10:31.960] There are four to seven players around the table. [10:31.960 --> 10:34.100] Each with around seven cards. [10:34.100 --> 10:46.320] They all impersonate security consultants and they are there on a mission to find what could go wrong and convince the game master to open Jira tickets and fix those issues before the app goes into production. [10:48.000 --> 10:49.820] Yeah, good luck with that. [10:49.860 --> 10:52.460] Each round is roughly 20 minutes. [10:52.740 --> 10:56.820] The person with most threats wins and you can steal points. [10:56.840 --> 10:58.040] This is very fair. [10:59.520 --> 11:09.620] Right, so as a game master, you want to keep a positive attitude and atmosphere and get people to actually think about what could go wrong and give examples. [11:09.860 --> 11:13.080] You are, as I said, the role of a very confident dev. [11:13.080 --> 11:13.820] You're not thick. [11:13.820 --> 11:15.460] You just don't really know security. [11:16.580 --> 11:19.280] When you give points, you have to be very precious with your points. [11:19.280 --> 11:25.200] If a player points at a web server and says, oh, cross-site scripting, that's not a threat. [11:25.400 --> 11:30.140] If a player just reads the card or asks a question, that's not a point. [11:31.560 --> 11:34.060] And then, these are the players. [11:34.200 --> 11:42.080] I don't know if you guys noticed your AppSec village organizers today, but one of them is in this image. [11:43.980 --> 11:48.220] I just asked the AI to generate this and it came up with errors, so I don't know. [11:48.220 --> 11:49.680] It must have known. [11:49.820 --> 11:56.140] So, as a player, you're there to learn and have fun, but get competitive and play your cards smartly. [11:56.680 --> 11:58.900] And that brings me to tomorrow's session. [11:58.900 --> 12:08.300] So, if you do want to come back, play the game and win the cornucopia card decks, be here between those times and, yeah, enjoy it.