1 00:00:00,000 --> 00:00:02,660 If you were here yesterday, then you might already know me. 2 00:00:02,660 --> 00:00:11,140 I do application security at Sage, and in my spare time, which is a lot of it, no, I'm one of the three leaders for the London OS chapter. 3 00:00:11,600 --> 00:00:21,180 Spiros is a security engineer and architect, and he is actually the nerd that coined the name of this game in the presentation, and then didn't bother to show up and show off. 4 00:00:22,420 --> 00:00:26,280 Right, so let's start with some threat modeling basics. 5 00:00:26,820 --> 00:00:31,000 Just a quick show of hands, how many people know what threat modeling is? 6 00:00:31,300 --> 00:00:34,140 Perfect, yeah, real AppSec village, nice. 7 00:00:35,320 --> 00:00:43,920 All right, 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. 8 00:00:43,960 --> 00:00:58,240 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. 9 00:00:58,580 --> 00:01:02,820 So it's also the answer to something called security by design. 10 00:01:02,820 --> 00:01:12,220 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. 11 00:01:13,080 --> 00:01:14,760 And we can do that. 12 00:01:14,760 --> 00:01:33,660 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. 13 00:01:33,660 --> 00:01:35,520 And that's the definition of a threat model. 14 00:01:36,120 --> 00:01:37,640 There are lots of definitions. 15 00:01:37,640 --> 00:01:38,940 This is the one I picked. 16 00:01:40,140 --> 00:01:47,940 Right, so threat modeling in an ideal situation is done in that part of the SDLC, so in the planning phase. 17 00:01:47,940 --> 00:01:50,220 In real life, it's not always like that. 18 00:01:50,220 --> 00:01:54,220 You can do threat modeling at any point of the SDLC and hope for the best. 19 00:01:54,740 --> 00:02:01,860 It examines the design of system operations and how the data flows across system boundaries. 20 00:02:01,860 --> 00:02:09,580 And it identifies all the points where the attackers, hackers could exploit and how they could do so. 21 00:02:09,900 --> 00:02:13,500 And lastly, it designs solutions to keep our data and applications safe. 22 00:02:15,060 --> 00:02:19,120 So you've probably seen this in countless other security talks. 23 00:02:19,120 --> 00:02:24,520 There's a difference between finding issues in the beginning of the flow versus at the end. 24 00:02:24,740 --> 00:02:33,840 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. 25 00:02:34,200 --> 00:02:37,340 So when we do threat modeling, we try to get the full picture of a system. 26 00:02:37,340 --> 00:02:42,760 This is a slightly weird picture, but I found it in a 2019 training and I really liked it. 27 00:02:42,940 --> 00:02:48,100 It always helps if we have different perspectives and experiences around the table. 28 00:02:48,360 --> 00:02:59,820 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. 29 00:02:59,820 --> 00:03:09,520 And security is usually there to facilitate the whole exercise, learn, so that we can then support development efforts afterwards. 30 00:03:11,780 --> 00:03:20,100 OK, 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. 31 00:03:20,100 --> 00:03:22,140 Attack, vulnerability and risk. 32 00:03:22,140 --> 00:03:24,900 The attack is what we're trying to protect against. 33 00:03:25,160 --> 00:03:28,580 The vulnerability is a weakness in our protection defenses. 34 00:03:29,300 --> 00:03:36,020 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. 35 00:03:38,420 --> 00:03:47,180 Now, moving on to how exactly we do threat modeling, we can use one way is to use these four questions as a framework. 36 00:03:47,180 --> 00:03:48,700 What are we working on? 37 00:03:48,700 --> 00:03:50,120 What could go wrong? 38 00:03:50,120 --> 00:03:52,320 What are we hoping to do about it? 39 00:03:53,000 --> 00:03:55,140 And did we do a good enough job? 40 00:03:56,000 --> 00:04:04,880 And then we combine those questions with some quite simplistic components in the data flow diagram. 41 00:04:04,880 --> 00:04:07,060 So you probably already know what DFDs are. 42 00:04:07,180 --> 00:04:12,080 They are simplistic, but they do cover most of the concepts in a system. 43 00:04:12,700 --> 00:04:17,440 So entities, processes, data stores and data flows, and most importantly, trust boundaries. 44 00:04:19,020 --> 00:04:21,240 We can come up with something that looks like this. 45 00:04:21,240 --> 00:04:22,020 Don't get scared. 46 00:04:22,020 --> 00:04:24,740 That's a real life corporate threat model. 47 00:04:24,740 --> 00:04:30,760 It's quite ugly, but it does include everything that you need in a threat model. 48 00:04:30,760 --> 00:04:32,460 You have your assets clearly identified. 49 00:04:32,460 --> 00:04:34,580 So the what are we working on? 50 00:04:35,020 --> 00:04:40,880 You have your use cases, the user workflows and what people need to achieve if they use your system or your app. 51 00:04:40,880 --> 00:04:42,200 You have data flows. 52 00:04:42,200 --> 00:04:46,580 So how exactly is data going through past trust boundaries? 53 00:04:47,040 --> 00:04:49,680 And then on top of all of these, you can come up with threats. 54 00:04:49,680 --> 00:04:50,720 So what could go wrong? 55 00:04:51,740 --> 00:04:55,340 There are also various ways and approaches of doing threat modeling. 56 00:04:55,340 --> 00:05:01,300 And I'm saying that because in our team, for example, there's 20 of us, 20 AppSec engineers. 57 00:05:01,300 --> 00:05:03,880 We each have a different way of doing threat modeling. 58 00:05:03,880 --> 00:05:06,740 Sometimes quite annoying, but it works. 59 00:05:07,080 --> 00:05:10,900 So we have lots of acronyms in this space. 60 00:05:10,900 --> 00:05:19,780 STRIDES, which stands for spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege. 61 00:05:19,800 --> 00:05:25,200 You have PASTA, not food, but the process for attack simulation and threat analysis. 62 00:05:25,680 --> 00:05:31,260 Linden, which is for identifying and mitigating privacy threats. 63 00:05:31,800 --> 00:05:34,680 And then when it comes to tools, you have games. 64 00:05:35,160 --> 00:05:41,160 Threat modeling is code, which looks at Terraform and Threat Dragon, which is another OS project. 65 00:05:42,960 --> 00:05:44,340 Something interesting here. 66 00:05:44,340 --> 00:05:50,560 Yeah, the two games out now, maybe you guys know of more, are Elevation of Privilege and Cornucopia. 67 00:05:50,560 --> 00:05:54,080 And later we're going to talk about Cornucopia a little bit more. 68 00:05:55,480 --> 00:05:56,180 Right. 69 00:05:56,180 --> 00:05:57,580 So insights. 70 00:05:57,740 --> 00:06:04,440 By the way, this is generated by GPT, obviously, because, yeah, lots of generated images. 71 00:06:05,660 --> 00:06:09,040 Hence, it doesn't want to spell exploits for some reason. 72 00:06:09,040 --> 00:06:10,460 I tried. 73 00:06:10,820 --> 00:06:11,420 Right. 74 00:06:11,420 --> 00:06:13,220 So some of the lessons learned. 75 00:06:13,220 --> 00:06:15,360 People have very little time. 76 00:06:15,360 --> 00:06:20,960 It's usually quite difficult to convince teams to allow you to do threat modeling. 77 00:06:21,520 --> 00:06:24,920 So you have to be efficient with the little time you're given. 78 00:06:24,920 --> 00:06:32,920 Stick to the points and enable teams to do threat modeling without you there so that you're not a bottleneck. 79 00:06:32,960 --> 00:06:36,040 And have the confidence that they've done it properly. 80 00:06:36,740 --> 00:06:39,280 Don't assume familiarity with terms. 81 00:06:39,280 --> 00:06:45,620 As we all know, different acronyms mean different things to development versus security. 82 00:06:46,600 --> 00:06:51,140 Don't point and ask where vulnerabilities are on a data flow. 83 00:06:51,140 --> 00:06:55,300 I did that and the results was crickets and confused faces. 84 00:06:55,920 --> 00:07:05,840 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. 85 00:07:05,840 --> 00:07:15,500 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. 86 00:07:17,280 --> 00:07:20,140 Don't assume everything needs to be mitigated. 87 00:07:20,180 --> 00:07:28,000 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. 88 00:07:28,000 --> 00:07:29,500 Context is very important. 89 00:07:30,320 --> 00:07:33,900 And lastly, threat modeling is a time-consuming process, as we said. 90 00:07:33,900 --> 00:07:36,960 There are literally too many ways to do it. 91 00:07:36,960 --> 00:07:38,900 It can easily get out of hand. 92 00:07:38,900 --> 00:07:43,240 And if you try to look at a big diagram in one go, you'll get lost. 93 00:07:43,240 --> 00:07:48,280 So start small and keep in mind that a threat model is a living document. 94 00:07:48,280 --> 00:07:53,920 It should be updated the same rate as you update your application with major changes. 95 00:07:55,440 --> 00:07:58,020 Now, a little bit about Cornucopia. 96 00:07:59,200 --> 00:08:02,200 It is an OS project, yet another one. 97 00:08:02,200 --> 00:08:04,520 Those are the leaders and the team. 98 00:08:04,520 --> 00:08:14,700 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. 99 00:08:14,700 --> 00:08:25,480 It helps because it's language and platform agnostic and it kind of gets developers to think of identifying and developing security user stories. 100 00:08:27,540 --> 00:08:31,060 So these are the suits of the web application version. 101 00:08:32,200 --> 00:08:42,760 They're focused around normal stuff like authentication, authorization, data security and cryptography, session management and an overall threat category called Cornucopia. 102 00:08:43,840 --> 00:08:47,840 And then the game itself has a couple of pros and cons. 103 00:08:47,900 --> 00:08:52,600 Pros, you are allowing developers to play a card game on work hours. 104 00:08:52,600 --> 00:08:53,420 So that's cool. 105 00:08:53,420 --> 00:08:54,460 They will like it. 106 00:08:54,460 --> 00:08:56,740 And it's very easy to pick up for them. 107 00:08:58,120 --> 00:09:10,280 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. 108 00:09:10,280 --> 00:09:13,520 So we could overlook important exploits. 109 00:09:14,320 --> 00:09:24,780 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. 110 00:09:26,500 --> 00:09:29,360 That's where engineers and exploits comes in. 111 00:09:29,880 --> 00:09:32,580 Spiros really likes Dungeons and Dragons. 112 00:09:32,580 --> 00:09:34,220 He really wanted to call it this. 113 00:09:34,900 --> 00:09:41,900 The idea behind this game is to make it like a mini game based on Cornucopia to train the trainers. 114 00:09:41,900 --> 00:09:43,460 Trainers can be whoever. 115 00:09:43,460 --> 00:09:52,080 Other security people, developers, architects, anyone that wants to go back to their teams and introduce the mindset of threat modeling. 116 00:09:52,440 --> 00:09:59,340 To make sure the engineering teams are self-sufficient and they don't just depend on security being there. 117 00:10:01,680 --> 00:10:04,420 Please admire some more AI generated art. 118 00:10:04,540 --> 00:10:09,380 Do not count swords, teeth or anything like that or letters. 119 00:10:11,200 --> 00:10:14,620 Right, so what is engineers and exploits? 120 00:10:14,620 --> 00:10:18,580 It's the mini game can help because it's giving you some sample diagrams. 121 00:10:18,580 --> 00:10:22,420 It can be as complex or as simplistic as the game master wants it to be. 122 00:10:22,720 --> 00:10:28,820 And it helps because you're not jumping straight into a threat modeling exercise for your actual production app. 123 00:10:29,360 --> 00:10:32,200 You're doing something as a game to understand the concept. 124 00:10:33,040 --> 00:10:34,680 And it has a few rules. 125 00:10:34,680 --> 00:10:35,980 There's a game master. 126 00:10:36,460 --> 00:10:43,140 Preferably, this is the more experienced threat modeler to take on the role of a very annoying, very confident dev. 127 00:10:43,900 --> 00:10:48,880 There are four to seven players around the table, each with around seven cards. 128 00:10:48,880 --> 00:11:01,260 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. 129 00:11:02,820 --> 00:11:04,740 Yeah, good luck with that. 130 00:11:04,740 --> 00:11:07,360 Each round is roughly 20 minutes. 131 00:11:07,780 --> 00:11:11,700 The person with most threats wins and you can steal points. 132 00:11:11,700 --> 00:11:13,040 This is very fair. 133 00:11:14,000 --> 00:11:24,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. 134 00:11:24,620 --> 00:11:27,940 You are, as I said, the role of a very confident dev. 135 00:11:27,940 --> 00:11:28,700 You're not thick. 136 00:11:28,700 --> 00:11:30,300 You just don't really know security. 137 00:11:31,460 --> 00:11:34,200 When you give points, you have to be very precious with your points. 138 00:11:34,200 --> 00:11:40,020 If a player points at a web server and says, oh, cross-site scripting, that's not a threat. 139 00:11:40,280 --> 00:11:44,940 If a player just reads the card or asks a question, that's not a point. 140 00:11:46,440 --> 00:11:48,860 And then these are the players. 141 00:11:49,020 --> 00:11:57,140 I don't know if you guys noticed your AppSec organizers, AppSec village organizers today, but one of them is in this image. 142 00:11:59,020 --> 00:12:02,220 I just asked the AI to generate this and it came up with errors. 143 00:12:02,220 --> 00:12:03,060 So I don't know. 144 00:12:03,060 --> 00:12:04,480 It must have known. 145 00:12:04,620 --> 00:12:10,960 So as a player, you're there to learn and have fun, but get competitive and play your cards smartly. 146 00:12:11,380 --> 00:12:13,700 And that brings me to tomorrow's session. 147 00:12:13,700 --> 00:12:20,980 So if you do want to come back, play the game and win the cornucopia card decks, be here between those times. 148 00:12:20,980 --> 00:12:23,700 And yeah, enjoy it. 149 00:12:23,700 --> 00:12:24,600 Questions? 150 00:12:34,790 --> 00:12:35,970 No questions. 151 00:12:36,530 --> 00:12:37,270 Yes. 152 00:12:52,910 --> 00:12:57,670 Is it necessary to add a story to the game or is it just like an exercise? 153 00:13:03,220 --> 00:13:04,780 Yes, yes, exactly. 154 00:13:04,780 --> 00:13:05,040 Yeah. 155 00:13:05,040 --> 00:13:06,380 So story points. 156 00:13:09,470 --> 00:13:13,110 Yeah, that's that's an even better that's like an expansion of the game for that. 157 00:13:13,110 --> 00:13:16,750 That's even better to get people to be even more competitive. 158 00:13:18,070 --> 00:13:18,870 Thanks. 159 00:13:19,070 --> 00:13:19,870 All right. 160 00:13:19,870 --> 00:13:21,270 Thank you very much.