1 00:00:08,380 --> 00:00:10,760 Let's start with some Threat Modeling basics. 2 00:00:11,300 --> 00:00:15,400 Just a quick show of hands, how many people know what Threat Modeling is? 3 00:00:15,880 --> 00:00:16,680 Perfect! 4 00:00:16,760 --> 00:00:18,640 Yeah, real AppSec village, nice. 5 00:00:19,980 --> 00: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. 6 00:00:28,460 --> 00: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. 7 00:00:43,280 --> 00: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. 8 00:00:57,800 --> 00: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, 9 00:01:18,160 --> 00:01:20,160 and that's the definition of a Threat Model. 10 00:01:20,740 --> 00:01:23,600 There are lots of definitions, this is the one I picked. 11 00:01:24,700 --> 00:01:32,520 Right, so, Threat Modeling in an ideal situation is done in that part of the SDLC, so in the planning phase. 12 00:01:32,520 --> 00:01:34,860 In real life, it's not always like that. 13 00:01:34,860 --> 00:01:38,820 You can do Threat Modeling at any point of the SDLC and hope for the best. 14 00:01:39,140 --> 00: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. 15 00:01:54,360 --> 00:01:58,240 And lastly, it designs solutions to keep our data and applications safe. 16 00:01:59,520 --> 00:02:03,640 So, you've probably seen this in countless other security talks. 17 00:02:03,800 --> 00: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. 18 00:02:18,800 --> 00:02:21,960 So, when we do Threat Modeling, we try to get the full picture of a system. 19 00:02:21,960 --> 00:02:27,420 This is a slightly weird picture, but I found it in a 2019 training, and I really liked it. 20 00:02:27,600 --> 00:02:32,780 It always helps if we have different perspectives and experiences around the table. 21 00:02:33,040 --> 00: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. 22 00:02:44,440 --> 00:02:54,200 And security is usually there to facilitate the whole exercise, learn, so that we can then support development efforts afterwards. 23 00:02:56,520 --> 00:02:57,300 Okay. 24 00:02:57,300 --> 00: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. 25 00:03:04,900 --> 00:03:06,780 Attack, vulnerability, and risk. 26 00:03:06,780 --> 00:03:09,500 The attack is what we're trying to protect against. 27 00:03:09,840 --> 00:03:13,160 The vulnerability is a weakness in our protection defenses. 28 00:03:14,060 --> 00: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. 29 00:03:23,100 --> 00:03:27,200 Now, moving on to how exactly we do threat modeling. 30 00:03:27,860 --> 00:03:31,860 One way is to use these four questions as a framework. 31 00:03:31,860 --> 00:03:33,580 What are we working on? 32 00:03:33,580 --> 00:03:34,860 What could go wrong? 33 00:03:34,860 --> 00:03:37,120 What are we hoping to do about it? 34 00:03:37,580 --> 00:03:39,960 And did we do a good enough job? 35 00:03:40,640 --> 00:03:45,120 And then we combine those questions with some quite simplistic components. 36 00:03:47,820 --> 00:03:51,780 In the data flow diagram, so you probably already know what DFDs are. 37 00:03:52,040 --> 00:03:56,780 They are simplistic, but they do cover most of the concepts in a system. 38 00:03:57,560 --> 00:04:02,240 So, entities, processes, data stores, and data flows, and most importantly, trust boundaries. 39 00:04:03,760 --> 00:04:05,940 We can come up with something that looks like this. 40 00:04:05,940 --> 00:04:06,700 Don't get scared. 41 00:04:06,700 --> 00:04:09,440 That's a real-life corporate threat model. 42 00:04:09,440 --> 00:04:10,440 It's quite ugly. 43 00:04:12,460 --> 00:04:15,100 But it does include everything that you need in a threat model. 44 00:04:15,100 --> 00:04:17,320 You have your assets clearly identified. 45 00:04:17,320 --> 00:04:19,200 So, what are we working on? 46 00:04:19,780 --> 00: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. 47 00:04:25,700 --> 00:04:27,160 You have data flows. 48 00:04:27,260 --> 00:04:31,440 So, how exactly is data going through past trust boundaries? 49 00:04:31,780 --> 00:04:34,240 And then on top of all of these, you can come up with threats. 50 00:04:34,240 --> 00:04:35,380 So, what could go wrong? 51 00:04:36,580 --> 00:04:40,080 There are also various ways and approaches of doing threat modeling. 52 00:04:40,080 --> 00:04:45,860 And I'm saying that because in our team, for example, there's 20 of us, 20 AppSec engineers. 53 00:04:45,860 --> 00:04:48,700 We each have a different way of doing threat modeling. 54 00:04:48,700 --> 00:04:51,640 Sometimes quite annoying, but it works. 55 00:04:51,820 --> 00:04:55,700 So, we have lots of acronyms in this space. 56 00:04:55,700 --> 00:05:04,580 STRIVE, which stands for Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege. 57 00:05:04,620 --> 00:05:09,820 You have PASTA, not food, but the process for Attack Simulation and Threat Analysis. 58 00:05:10,580 --> 00:05:16,360 Linden, which is for Identifying and Mitigating Privacy Threats. 59 00:05:16,360 --> 00: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. 60 00:05:27,680 --> 00:05:29,500 Something interesting here, yeah. 61 00:05:29,500 --> 00:05:35,300 The two games out now, maybe you guys know of more, are Elevation of Privilege and Cornucopia. 62 00:05:35,300 --> 00:05:38,560 And later we're going to talk about Cornucopia a little bit more. 63 00:05:39,740 --> 00:05:40,940 Right. 64 00:05:41,000 --> 00:05:42,420 So, insights. 65 00:05:42,640 --> 00:05:47,180 By the way, this is generated by GPT, obviously. 66 00:05:47,180 --> 00:05:49,360 Because, yeah, lots of generated images. 67 00:05:50,380 --> 00:05:53,960 Hence, it doesn't want to spell exploits for some reason. 68 00:05:53,980 --> 00:05:55,220 I tried. 69 00:05:55,840 --> 00:05:56,200 Right. 70 00:05:56,200 --> 00:05:58,080 So, some of the lessons learned. 71 00:05:58,080 --> 00:06:00,180 People have very little time. 72 00:06:00,180 --> 00:06:05,860 It's usually quite difficult to convince teams to allow you to do Threat Modeling. 73 00:06:05,860 --> 00:06:09,780 So, you have to be efficient with the little time you're given. 74 00:06:09,780 --> 00:06:17,800 Stick to the points and enable teams to do Threat Modeling without you there, so that you're not a bottleneck. 75 00:06:17,800 --> 00:06:20,920 And have the confidence that they've done it properly. 76 00:06:21,640 --> 00:06:25,240 Don't assume familiarity with terms, as we all know. 77 00:06:25,240 --> 00:06:30,740 Different acronyms mean different things to development versus security. 78 00:06:31,460 --> 00:06:36,000 Don't point and ask where vulnerabilities are on a data flow. 79 00:06:36,060 --> 00:06:40,380 I did that, and the result was crickets and confused faces. 80 00:06:40,940 --> 00: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. 81 00:06:50,880 --> 00: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. 82 00:07:02,160 --> 00:07:05,000 Don't assume everything needs to be mitigated. 83 00:07:05,140 --> 00: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. 84 00:07:12,900 --> 00:07:14,360 Context is very important. 85 00:07:15,440 --> 00:07:18,940 And lastly, Threat Modeling is a time-consuming process, as we said. 86 00:07:18,940 --> 00:07:21,820 There are literally too many ways to do it. 87 00:07:21,840 --> 00: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. 88 00:07:28,120 --> 00:07:33,160 So, start small, and keep in mind that a threat model is a living document. 89 00:07:33,160 --> 00:07:38,920 It should be updated the same rate as you update your application with major changes. 90 00:07:40,300 --> 00:07:43,000 Now, a little bit about Cornucopia. 91 00:07:44,120 --> 00:07:47,240 It is an OS project, yet another one. 92 00:07:47,360 --> 00:07:49,740 Those are the leaders and the team. 93 00:07:49,820 --> 00: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. 94 00:07:59,600 --> 00: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. 95 00:08:12,000 --> 00:08:16,680 So, these are the suits of the web application version. 96 00:08:16,840 --> 00: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. 97 00:08:28,540 --> 00:08:32,840 And then, the game itself has a couple of pros and cons. 98 00:08:32,920 --> 00:08:38,400 Pros, you are allowing developers to play a card game on work hours, so that's cool. 99 00:08:38,400 --> 00:08:39,460 They will like it. 100 00:08:39,460 --> 00:08:41,660 And it's very easy to pick up for them. 101 00:08:43,100 --> 00: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. 102 00:08:55,260 --> 00:08:58,780 So, we could overlook important exploits. 103 00:08:59,360 --> 00: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. 104 00:09:11,660 --> 00:09:14,220 That's where Engineers and Exploits comes in. 105 00:09:14,220 --> 00:09:17,560 So, Spiros really likes Dungeons and Dragons. 106 00:09:17,560 --> 00:09:19,500 He really wanted to call it this. 107 00:09:19,980 --> 00:09:26,900 The idea behind this game is to make it like a mini-game based on Cornucopia, to train the trainers. 108 00:09:26,900 --> 00:09:28,480 Trainers can be whoever. 109 00:09:28,480 --> 00:09:37,100 Other security people, developers, architects, anyone that wants to go back to their teams and introduce the mindset of threat modeling. 110 00:09:37,520 --> 00:09:44,840 To make sure that engineering teams are self-sufficient and they don't just depend on security being there. 111 00:09:46,700 --> 00:09:49,540 Please admire some more AI-generated art. 112 00:09:49,580 --> 00:09:54,440 Do not count swords, teeth, or anything like that, or letters. 113 00:09:56,300 --> 00:09:59,660 Right, so, what is Engineers and Exploits? 114 00:09:59,660 --> 00:10:00,720 It's the mini-game. 115 00:10:00,720 --> 00:10:03,680 It can help because it's giving you some sample diagrams. 116 00:10:03,680 --> 00:10:07,620 It can be as complex or as simplistic as the game master wants it to be. 117 00:10:07,820 --> 00:10:14,300 And it helps because you're not jumping straight into a threat modeling exercise for your actual production app. 118 00:10:14,640 --> 00:10:17,240 You're doing something as a game to understand the concept. 119 00:10:18,240 --> 00:10:19,740 And it has a few rules. 120 00:10:19,740 --> 00:10:21,120 There's a game master. 121 00:10:21,500 --> 00:10:28,000 Preferably this is the more experienced threat modeler to take on the role of a very annoying, very confident dev. 122 00:10:28,960 --> 00:10:31,960 There are four to seven players around the table. 123 00:10:31,960 --> 00:10:34,100 Each with around seven cards. 124 00:10:34,100 --> 00: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. 125 00:10:48,000 --> 00:10:49,820 Yeah, good luck with that. 126 00:10:49,860 --> 00:10:52,460 Each round is roughly 20 minutes. 127 00:10:52,740 --> 00:10:56,820 The person with most threats wins and you can steal points. 128 00:10:56,840 --> 00:10:58,040 This is very fair. 129 00:10:59,520 --> 00: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. 130 00:11:09,860 --> 00:11:13,080 You are, as I said, the role of a very confident dev. 131 00:11:13,080 --> 00:11:13,820 You're not thick. 132 00:11:13,820 --> 00:11:15,460 You just don't really know security. 133 00:11:16,580 --> 00:11:19,280 When you give points, you have to be very precious with your points. 134 00:11:19,280 --> 00:11:25,200 If a player points at a web server and says, oh, cross-site scripting, that's not a threat. 135 00:11:25,400 --> 00:11:30,140 If a player just reads the card or asks a question, that's not a point. 136 00:11:31,560 --> 00:11:34,060 And then, these are the players. 137 00:11:34,200 --> 00:11:42,080 I don't know if you guys noticed your AppSec village organizers today, but one of them is in this image. 138 00:11:43,980 --> 00:11:48,220 I just asked the AI to generate this and it came up with errors, so I don't know. 139 00:11:48,220 --> 00:11:49,680 It must have known. 140 00:11:49,820 --> 00:11:56,140 So, as a player, you're there to learn and have fun, but get competitive and play your cards smartly. 141 00:11:56,680 --> 00:11:58,900 And that brings me to tomorrow's session. 142 00:11:58,900 --> 00: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.