[00:00.000 --> 00:02.660] If you were here yesterday, then you might already know me. [00:02.660 --> 00:04.440] I do application security at Sage, [00:04.440 --> 00:07.480] and in my spare time, which is a lot of it, [00:07.480 --> 00:11.140] no, I'm one of the three leaders for the London OS chapter. [00:11.600 --> 00:13.720] Spiros is a security engineer and architect, [00:13.720 --> 00:16.920] and he is actually the nerd that coined the name of this game [00:16.920 --> 00:18.220] in the presentation, [00:18.220 --> 00:21.180] and then didn't bother to show up and show off. [00:22.420 --> 00:26.280] Right, so let's start with some threat modeling basics. [00:26.820 --> 00:28.580] Just a quick show of hands, [00:28.580 --> 00:31.000] how many people know what threat modeling is? [00:31.300 --> 00:34.140] Perfect, yeah, real AppSec village, nice. [00:35.320 --> 00:39.500] All right, so this might be something that you already know, [00:39.500 --> 00:42.440] but I'll still go through a bit of an introduction [00:42.440 --> 00:43.920] for those who don't know. [00:43.960 --> 00:46.360] It's sometimes called diagram hacking, [00:46.360 --> 00:49.320] and it's like blue sky thinking of what could go wrong [00:49.320 --> 00:52.400] in an application, but you actually have to try [00:52.400 --> 00:54.180] to have your feet firmly on the ground [00:54.180 --> 00:58.240] and think of the context of your application as well. [00:58.580 --> 01:00.760] So it's also the answer to something [01:00.760 --> 01:02.820] called security by design. [01:02.820 --> 01:05.180] So that's like the fancy, boring way of saying [01:05.180 --> 01:08.860] that security should be embedded in a product from its inception [01:08.860 --> 01:12.220] rather than an add-on at the end of the development. [01:13.080 --> 01:14.760] And we can do that. [01:14.760 --> 01:17.960] We can achieve this by understanding user culture, [01:17.960 --> 01:20.300] goals, and workflows, [01:20.980 --> 01:24.360] by understanding organizational and technical capabilities [01:24.360 --> 01:26.140] of a product and a team, [01:26.140 --> 01:29.280] as well as adversary capabilities and dispositions, [01:29.780 --> 01:31.440] and then putting all of this together [01:31.440 --> 01:33.660] in a solution called a threat model. [01:33.660 --> 01:35.520] And that's the definition of a threat model. [01:36.120 --> 01:38.940] There are lots of definitions. This is the one I picked. [01:40.140 --> 01:43.260] Right, so threat modeling in an ideal situation [01:43.260 --> 01:47.940] is done in that part of the SDLC, so in the planning phase. [01:47.940 --> 01:50.220] In real life, it's not always like that. [01:50.220 --> 01:52.760] You can do threat modeling at any point of the SDLC [01:52.760 --> 01:54.220] and hope for the best. [01:54.740 --> 01:58.360] It examines the design of system operations [01:58.840 --> 02:01.860] and how the data flows across system boundaries. [02:01.860 --> 02:06.120] And it identifies all the points where the attackers, [02:06.940 --> 02:09.580] hackers could exploit and how they could do so. [02:09.900 --> 02:13.500] And lastly, it designs solutions to keep our data and applications safe. [02:15.060 --> 02:19.120] So you've probably seen this in countless other security talks. [02:19.120 --> 02:21.960] There's a difference between finding issues [02:21.960 --> 02:24.520] in the beginning of the flow versus at the end. [02:24.740 --> 02:28.280] So we don't end up in production with something looking like this, [02:28.280 --> 02:30.300] where you either don't have any security controls [02:30.300 --> 02:33.840] or controls that aren't applicable to your context. [02:34.200 --> 02:35.300] So when we do threat modeling, [02:35.300 --> 02:37.340] we try to get the full picture of a system. [02:37.340 --> 02:38.700] This is a slightly weird picture, [02:38.700 --> 02:42.760] but I found it in a 2019 training and I really liked it. [02:42.940 --> 02:45.200] It always helps if we have different perspectives [02:45.720 --> 02:48.100] and experiences around the table. [02:48.360 --> 02:51.480] So keep in mind, this is an exercise for developers, [02:51.480 --> 02:54.240] architects, QA, business leads, [02:54.240 --> 02:56.620] anyone that can bring a different perspective, [02:57.080 --> 02:59.820] as much as it is for security people. [02:59.820 --> 03:03.380] And security is usually there to facilitate the whole exercise, [03:03.380 --> 03:09.520] learn, so that we can then support development efforts afterwards. [03:11.780 --> 03:15.420] OK, I'd like to take a couple of seconds to go through some terms [03:15.420 --> 03:18.100] that are usually used interchangeably, [03:18.100 --> 03:20.100] but they do not mean the same thing. [03:20.100 --> 03:22.140] Attack, vulnerability and risk. [03:22.140 --> 03:24.900] The attack is what we're trying to protect against. [03:25.160 --> 03:28.580] The vulnerability is a weakness in our protection defenses. [03:29.300 --> 03:32.420] And then when we put these two together with our assets [03:32.420 --> 03:33.900] or the things we're trying to protect, [03:33.900 --> 03:36.020] then we get the exposure or the risk. [03:38.420 --> 03:42.520] Now, moving on to how exactly we do threat modeling, [03:42.520 --> 03:47.180] we can use one way is to use these four questions as a framework. [03:47.180 --> 03:48.700] What are we working on? [03:48.700 --> 03:50.120] What could go wrong? [03:50.120 --> 03:52.320] What are we hoping to do about it? [03:53.000 --> 03:55.140] And did we do a good enough job? [03:56.000 --> 03:57.480] And then we combine those questions [03:57.980 --> 04:04.880] with some quite simplistic components in the data flow diagram. [04:04.880 --> 04:07.060] So you probably already know what DFDs are. [04:07.180 --> 04:12.080] They are simplistic, but they do cover most of the concepts in a system. [04:12.700 --> 04:15.520] So entities, processes, data stores and data flows, [04:15.520 --> 04:17.440] and most importantly, trust boundaries. [04:19.020 --> 04:21.240] We can come up with something that looks like this. [04:21.240 --> 04:24.740] Don't get scared. That's a real life corporate threat model. [04:24.740 --> 04:30.760] It's quite ugly, but it does include everything that you need in a threat model. [04:30.760 --> 04:32.460] You have your assets clearly identified. [04:32.460 --> 04:34.580] So the what are we working on? [04:35.020 --> 04:37.200] You have your use cases, the user workflows [04:37.200 --> 04:40.880] and what people need to achieve if they use your system or your app. [04:40.880 --> 04:42.200] You have data flows. [04:42.200 --> 04:46.580] So how exactly is data going through past trust boundaries? [04:47.040 --> 04:49.680] And then on top of all of these, you can come up with threats. [04:49.680 --> 04:50.720] So what could go wrong? [04:51.740 --> 04:55.340] There are also various ways and approaches of doing threat modeling. [04:55.340 --> 04:58.720] And I'm saying that because in our team, for example, [04:58.720 --> 05:01.300] there's 20 of us, 20 AppSec engineers. [05:01.300 --> 05:03.880] We each have a different way of doing threat modeling. [05:03.880 --> 05:06.740] Sometimes quite annoying, but it works. [05:07.080 --> 05:10.900] So we have lots of acronyms in this space. [05:10.900 --> 05:14.960] STRIDES, which stands for spoofing, tampering, repudiation, [05:14.960 --> 05:19.780] information disclosure, denial of service, elevation of privilege. [05:19.800 --> 05:21.740] You have PASTA, not food, [05:21.740 --> 05:25.200] but the process for attack simulation and threat analysis. [05:25.680 --> 05:31.260] Linden, which is for identifying and mitigating privacy threats. [05:31.800 --> 05:34.680] And then when it comes to tools, you have games. [05:35.160 --> 05:37.740] Threat modeling is code, which looks at Terraform [05:37.740 --> 05:41.160] and Threat Dragon, which is another OS project. [05:42.960 --> 05:44.340] Something interesting here. [05:44.340 --> 05:48.460] Yeah, the two games out now, maybe you guys know of more, [05:48.460 --> 05:50.560] are Elevation of Privilege and Cornucopia. [05:50.560 --> 05:54.080] And later we're going to talk about Cornucopia a little bit more. [05:55.480 --> 05:57.580] Right. So insights. [05:57.740 --> 06:02.220] By the way, this is generated by GPT, obviously, [06:02.220 --> 06:04.440] because, yeah, lots of generated images. [06:05.660 --> 06:09.040] Hence, it doesn't want to spell exploits for some reason. [06:09.040 --> 06:11.420] I tried. Right. [06:11.420 --> 06:13.220] So some of the lessons learned. [06:13.220 --> 06:15.360] People have very little time. [06:15.360 --> 06:18.360] It's usually quite difficult to convince teams [06:18.360 --> 06:20.960] to allow you to do threat modeling. [06:21.520 --> 06:24.920] So you have to be efficient with the little time you're given. [06:24.920 --> 06:29.660] Stick to the points and enable teams to do threat modeling without you there [06:29.660 --> 06:32.920] so that you're not a bottleneck. [06:32.960 --> 06:36.040] And have the confidence that they've done it properly. [06:36.740 --> 06:39.280] Don't assume familiarity with terms. [06:39.280 --> 06:45.620] As we all know, different acronyms mean different things to development versus security. [06:46.600 --> 06:51.140] Don't point and ask where vulnerabilities are on a data flow. [06:51.140 --> 06:55.300] I did that and the results was crickets and confused faces. [06:55.920 --> 07:01.000] Try to get the conversation flowing between the same people in the same team, [07:01.000 --> 07:05.840] because you'll see that they are not all on the same page with what's being built. [07:05.840 --> 07:08.400] So usually architects have a picture in their minds [07:08.400 --> 07:12.260] and then the developers who write the code know what they're building [07:12.260 --> 07:15.500] and it's not exactly what architects envisioned. [07:17.280 --> 07:20.140] Don't assume everything needs to be mitigated. [07:20.180 --> 07:24.300] So make it clear to the team that you're not there to quadruple their workload [07:24.300 --> 07:28.000] because they will get scared and they will stop listening to you. [07:28.000 --> 07:29.500] Context is very important. [07:30.320 --> 07:33.900] And lastly, threat modeling is a time-consuming process, as we said. [07:33.900 --> 07:36.960] There are literally too many ways to do it. [07:36.960 --> 07:38.900] It can easily get out of hand. [07:38.900 --> 07:43.240] And if you try to look at a big diagram in one go, you'll get lost. [07:43.240 --> 07:48.280] So start small and keep in mind that a threat model is a living document. [07:48.280 --> 07:53.920] It should be updated the same rate as you update your application with major changes. [07:55.440 --> 07:58.020] Now, a little bit about Cornucopia. [07:59.200 --> 08:02.200] It is an OS project, yet another one. [08:02.200 --> 08:04.520] Those are the leaders and the team. [08:04.520 --> 08:08.880] It was built in 2012 and it currently has two decks, [08:08.880 --> 08:12.740] but a lot of expansions are planned for different industries, [08:12.740 --> 08:14.700] for AI security, for example. [08:14.700 --> 08:18.220] It helps because it's language and platform agnostic [08:18.220 --> 08:23.180] and it kind of gets developers to think of identifying [08:23.180 --> 08:25.480] and developing security user stories. [08:27.540 --> 08:31.060] So these are the suits of the web application version. [08:32.200 --> 08:36.760] They're focused around normal stuff like authentication, authorization, [08:36.760 --> 08:39.140] data security and cryptography, session management [08:39.140 --> 08:42.760] and an overall threat category called Cornucopia. [08:43.840 --> 08:47.840] And then the game itself has a couple of pros and cons. [08:47.900 --> 08:52.600] Pros, you are allowing developers to play a card game on work hours. [08:52.600 --> 08:54.460] So that's cool. They will like it. [08:54.460 --> 08:56.740] And it's very easy to pick up for them. [08:58.120 --> 09:01.540] Cons, oddly enough, security people struggle to pick it up [09:01.540 --> 09:04.320] because we sometimes go into a threat modeling session [09:05.100 --> 09:10.280] having already thought of some threats for an application. [09:10.280 --> 09:13.520] So we could overlook important exploits. [09:14.320 --> 09:17.200] And then some people struggle trying to explain [09:17.200 --> 09:18.940] what the difference is between cards [09:19.560 --> 09:21.800] or give an example for their own application [09:21.800 --> 09:24.780] and come up with the actual risk for a card. [09:26.500 --> 09:29.360] That's where engineers and exploits comes in. [09:29.880 --> 09:32.580] Spiros really likes Dungeons and Dragons. [09:32.580 --> 09:34.220] He really wanted to call it this. [09:34.900 --> 09:39.100] The idea behind this game is to make it like a mini game [09:39.100 --> 09:41.900] based on Cornucopia to train the trainers. [09:41.900 --> 09:43.460] Trainers can be whoever. [09:43.460 --> 09:46.860] Other security people, developers, architects, [09:46.860 --> 09:49.120] anyone that wants to go back to their teams [09:49.120 --> 09:52.080] and introduce the mindset of threat modeling. [09:52.440 --> 09:56.820] To make sure the engineering teams are self-sufficient [09:56.820 --> 09:59.340] and they don't just depend on security being there. [10:01.680 --> 10:04.420] Please admire some more AI generated art. [10:04.540 --> 10:09.380] Do not count swords, teeth or anything like that or letters. [10:11.200 --> 10:14.620] Right, so what is engineers and exploits? [10:14.620 --> 10:16.060] It's the mini game can help [10:16.060 --> 10:18.580] because it's giving you some sample diagrams. [10:18.580 --> 10:20.380] It can be as complex or as simplistic [10:20.380 --> 10:22.420] as the game master wants it to be. [10:22.720 --> 10:25.160] And it helps because you're not jumping straight [10:25.160 --> 10:28.820] into a threat modeling exercise for your actual production app. [10:29.360 --> 10:32.200] You're doing something as a game to understand the concept. [10:33.040 --> 10:35.980] And it has a few rules. There's a game master. [10:36.460 --> 10:38.960] Preferably, this is the more experienced threat modeler [10:38.960 --> 10:43.140] to take on the role of a very annoying, very confident dev. [10:43.900 --> 10:46.900] There are four to seven players around the table, [10:46.900 --> 10:48.880] each with around seven cards. [10:48.880 --> 10:50.940] They all impersonate security consultants [10:50.940 --> 10:54.460] and they are there on a mission to find what could go wrong [10:54.460 --> 10:57.520] and convince the game master to open Jira tickets [10:57.840 --> 11:01.260] and fix those issues before the app goes into production. [11:02.820 --> 11:07.360] Yeah, good luck with that. Each round is roughly 20 minutes. [11:07.780 --> 11:11.700] The person with most threats wins and you can steal points. [11:11.700 --> 11:15.980] This is very fair. Right, so as a game master, [11:15.980 --> 11:18.880] you want to keep a positive attitude and atmosphere [11:18.880 --> 11:23.200] and get people to actually think about what could go wrong [11:23.200 --> 11:24.620] and give examples. [11:24.620 --> 11:27.940] You are, as I said, the role of a very confident dev. [11:27.940 --> 11:30.300] You're not thick. You just don't really know security. [11:31.460 --> 11:34.200] When you give points, you have to be very precious with your points. [11:34.200 --> 11:37.620] If a player points at a web server and says, [11:37.620 --> 11:40.020] oh, cross-site scripting, that's not a threat. [11:40.280 --> 11:43.900] If a player just reads the card or asks a question, [11:43.900 --> 11:44.940] that's not a point. [11:46.440 --> 11:48.860] And then these are the players. [11:49.020 --> 11:54.000] I don't know if you guys noticed your AppSec organizers, [11:54.000 --> 11:57.140] AppSec village organizers today, but one of them is in this image. [11:59.020 --> 12:02.220] I just asked the AI to generate this and it came up with errors. [12:02.220 --> 12:04.480] So I don't know. It must have known. [12:04.620 --> 12:07.420] So as a player, you're there to learn and have fun, [12:07.420 --> 12:10.960] but get competitive and play your cards smartly. [12:11.380 --> 12:13.700] And that brings me to tomorrow's session. [12:13.700 --> 12:16.280] So if you do want to come back, play the game [12:16.700 --> 12:20.980] and win the cornucopia card decks, be here between those times. [12:20.980 --> 12:23.700] And yeah, enjoy it. [12:23.700 --> 12:24.600] Questions? [12:34.790 --> 12:35.970] No questions. [12:36.530 --> 12:37.270] Yes. [12:52.910 --> 12:57.670] Is it necessary to add a story to the game or is it just like an exercise? [13:03.220 --> 13:04.780] Yes, yes, exactly. [13:04.780 --> 13:06.380] Yeah. So story points. [13:09.470 --> 13:13.110] Yeah, that's that's an even better that's like an expansion of the game for that. [13:13.110 --> 13:16.750] That's even better to get people to be even more competitive. [13:18.070 --> 13:18.870] Thanks. [13:19.070 --> 13:21.270] All right. Thank you very much.