1 00:00:05,060 --> 00:00:06,200 Hi everyone. 2 00:00:06,200 --> 00:00:10,060 Well, let's start my talk. 3 00:00:10,140 --> 00:00:11,440 The title is U.S. 4 00:00:11,440 --> 00:00:20,080 C1 Shuffle, Lateral Movements and Other Creative Steps that Attackers Take in AWS Cloud Environments and How to Detect Them. 5 00:00:20,460 --> 00:00:22,500 So, who am I? 6 00:00:22,500 --> 00:00:24,880 Well, my name is Felipe Esposito. 7 00:00:24,880 --> 00:00:26,760 I'm also known as Proteus. 8 00:00:26,920 --> 00:00:37,580 And a little bit more than 10 years of experience in IT security, mostly on researching and sysadmin stuff. 9 00:00:37,580 --> 00:00:40,980 I'm also a proud father of a girl. 10 00:00:41,140 --> 00:00:43,420 I'm also a booting instructor. 11 00:00:43,420 --> 00:00:47,620 And my main job right now, I'm a security researcher at AT&T Security. 12 00:00:47,800 --> 00:00:56,980 And as a researcher, most of my job is Googling around, reading documentations and creating bugs and testing security stuff. 13 00:00:56,980 --> 00:01:03,640 But sometimes, we are asked to help our clients with some questions they have. 14 00:01:03,640 --> 00:01:16,580 And I remember that day when I was reading docs, Googling around, and one of our clients asked us, hey, can you take a look on these network diagrams and his IAM profiles? 15 00:01:16,580 --> 00:01:17,960 And we said yes. 16 00:01:18,000 --> 00:01:20,880 And he was doing all kinds of nasty stuff. 17 00:01:20,880 --> 00:01:25,980 He was doing stuff like VPC peering between projects in the environment. 18 00:01:26,300 --> 00:01:31,540 He has cross accounts roles between almost all their accounts. 19 00:01:31,640 --> 00:01:33,060 And I said, well, no. 20 00:01:33,400 --> 00:01:37,360 You can't do like this because there's a thing called lateral movements. 21 00:01:37,560 --> 00:01:40,000 And an attacker can take advantage of it. 22 00:01:40,140 --> 00:01:42,200 And he was like, what? 23 00:01:42,200 --> 00:01:42,860 Yeah. 24 00:01:42,860 --> 00:01:46,700 So I made this statement. 25 00:01:46,700 --> 00:01:48,660 I know it's a bold statement. 26 00:01:48,980 --> 00:01:52,220 But I have support. 27 00:01:52,220 --> 00:01:53,920 I have arguments to support this. 28 00:01:53,920 --> 00:01:57,660 So cloud security is more complex than on-premise security. 29 00:02:00,020 --> 00:02:09,820 So by the title of this talk, I was looking for titles who might be lateral movements. 30 00:02:09,820 --> 00:02:17,500 And the only thing that I could remember that moves laterally is Caranguejo or CREBs in English. 31 00:02:17,500 --> 00:02:20,540 And I was like, not a good title for this talk. 32 00:02:20,540 --> 00:02:26,140 But my boss, Ciera, he remembered this kind of dance he's calling Texas Shuffle. 33 00:02:26,200 --> 00:02:29,740 And it looks a little bit more like this. 34 00:03:00,000 --> 00:03:01,320 Seems fun, right? 35 00:03:01,320 --> 00:03:14,200 So as I'm a Brazilian, and I'm also from Rio de Janeiro, I had to bring up something different just to make a contrast between the Texas Shuffle and any other kind of dancing style. 36 00:03:14,200 --> 00:03:20,120 So I brought you what we call Brazilian funky. 37 00:03:20,120 --> 00:03:22,960 And it's something like this. 38 00:03:44,550 --> 00:03:45,130 Yeah. 39 00:03:45,130 --> 00:03:46,590 Seems hard, huh? 40 00:03:46,590 --> 00:03:51,850 So well, let's jump to cloud. 41 00:03:51,850 --> 00:03:55,570 But take those two dances in perspective. 42 00:03:55,570 --> 00:04:11,810 So when we talk about lateral movements on AWS, we can say things about like an attacker can move laterally between an instance on a VPC on account A and a VPC in account B. 43 00:04:11,830 --> 00:04:17,050 If they have a VPC peer established between each other, you know, routes and everything. 44 00:04:18,590 --> 00:04:21,150 And this is what we call the data plane. 45 00:04:21,150 --> 00:04:30,810 And if you take this into consideration, the data plane seems like on-premises network, because we have networks, some networks, house between those networks. 46 00:04:31,030 --> 00:04:39,670 And the attacker can also move laterally between those networks on the data plane and also on-premises networks. 47 00:04:39,730 --> 00:04:43,690 But in cloud, we do have one thing that we call the control plane. 48 00:04:43,690 --> 00:04:51,050 And the control plane is basically how the AWS or other cloud providers control the data plane. 49 00:04:51,050 --> 00:05:02,710 So the control plane basically is all the APIs that we call for creating resources, deleting resources, changing properties on those resources, and things like that. 50 00:05:02,850 --> 00:05:08,730 So in also the control plane, that's where we have the IAM. 51 00:05:08,730 --> 00:05:12,870 And that's the thing that controls permissions on AWS. 52 00:05:13,150 --> 00:05:24,750 So what happens is you can have a role on the control plane, and you can assume another role on the same account. 53 00:05:24,750 --> 00:05:29,970 So if you have an account moderator, you can assume a role administrator on this account. 54 00:05:29,970 --> 00:05:31,890 And this is kind of a lateral movement. 55 00:05:31,990 --> 00:05:40,970 But we can also assume, we can also exact something on the EC2 instance that is on the same account. 56 00:05:41,310 --> 00:05:50,630 So you are in the control plane, and then you can jump to the data plane by executing a command on an EC2 instance in this VPC. 57 00:05:51,190 --> 00:06:00,390 But if that EC2 instance also has a role, you can also jump from between the data plane to the control plane by assuming this role. 58 00:06:01,330 --> 00:06:04,490 So things get a bit more complex, right? 59 00:06:04,490 --> 00:06:11,270 And you can also assume a role from the account A to account B. 60 00:06:11,270 --> 00:06:14,410 So you can assume another role in another account. 61 00:06:14,710 --> 00:06:27,390 And you can also assume a role from the EC2 instance on the VPC A on another account, on account B, for example. 62 00:06:27,390 --> 00:06:39,550 And you can also execute any command from this role here on the account B to any instance on account on the VPC B. 63 00:06:39,550 --> 00:06:50,990 So this makes it much more complex to understand lateral movement possibilities, and much more complex to track this kind of lateral movement possibilities. 64 00:06:50,990 --> 00:07:01,770 So I promised my sister-in-law, she's a dancing teacher, that we can't compare dancing styles, but we can compare aspects. 65 00:07:01,830 --> 00:07:07,950 So if you guys remember those two dances, which one of you seems more difficult to learn? 66 00:07:07,970 --> 00:07:15,630 The Brazilian funk is faster for sure, has a lot of fast movements, but he's dancing alone. 67 00:07:15,730 --> 00:07:22,970 And when you get Texas Shuffle, for instance, you have the interaction between the partners. 68 00:07:23,470 --> 00:07:29,630 They have to balance each other to understand where they are in the space. 69 00:07:29,630 --> 00:07:32,070 They have to coordinate this with the rhythm. 70 00:07:32,070 --> 00:07:38,270 And they can also dance alone by themselves, also always looking for the other partner. 71 00:07:38,270 --> 00:07:46,790 So Texas Shuffle has some aspects that are more complex than Brazilian funk. 72 00:07:47,970 --> 00:08:03,510 So in order to illustrate how the attackers can take creative steps, I was wondering what can I bring to you guys, would you remember this? 73 00:08:03,510 --> 00:08:07,070 And then I remember a music, it's called Cupid Shuffle. 74 00:08:07,070 --> 00:08:14,630 It's like to the left, to the left, to the right, to the right, now kick, now kick, now walk it by yourself, walk it by yourself. 75 00:08:14,630 --> 00:08:17,230 Most of you guys might remember this. 76 00:08:17,270 --> 00:08:20,030 So it's like Macarena for Brazilians. 77 00:08:20,750 --> 00:08:25,570 Yeah, so we have some steps that are called to the left, to the left. 78 00:08:25,570 --> 00:08:34,330 And this happens between EC2 instance to EC2 instance in different accounts, for example, if they have VPC peering. 79 00:08:34,330 --> 00:08:40,690 So what happens is that ARP protocol doesn't work as expected on AWS. 80 00:08:40,690 --> 00:08:46,350 So in AWS, the ARP protocol doesn't have the broadcast. 81 00:08:46,350 --> 00:08:52,870 So there's no easy way to find what are the other networks that you have on the data plane. 82 00:08:53,190 --> 00:08:58,650 So you have to go to the default mode that's scanning. 83 00:08:58,870 --> 00:09:02,210 So yeah, you can use an Nmap for scanning this. 84 00:09:02,210 --> 00:09:04,750 So you can scan a range slash eight. 85 00:09:04,750 --> 00:09:06,870 It's nice, but it's effective. 86 00:09:07,130 --> 00:09:11,030 And you can use this comment right here to do it. 87 00:09:11,830 --> 00:09:23,750 And once you find another machine, after that, you can hack your way into this new instance and then jump in between EC2 instance, also between accounts. 88 00:09:26,420 --> 00:09:30,400 There's another movement that are called step up and diagonal. 89 00:09:30,880 --> 00:09:41,130 That happens when you have an EC2 instance or a Lambda or ECS or a batch job, et cetera, anything that can run any kind of 90 00:09:44,580 --> 00:09:45,780 a program . 91 00:09:46,040 --> 00:09:49,340 And that it has a role to assume. 92 00:09:49,340 --> 00:09:55,560 So there's also a Maitreya tactics for this. 93 00:09:55,560 --> 00:10:00,080 The technique is called 1550.001. 94 00:10:00,080 --> 00:10:14,100 And if the attacker lands for somehow an exploit or any vulnerability on an EC2 instance that has a role to it, he can assume a role and jump from the data plane to the control plane. 95 00:10:14,240 --> 00:10:22,100 So for this, so the attacker lands here, he can get a STS get caller identity to find out each role he has. 96 00:10:22,120 --> 00:10:27,940 And then he can just use the service that's called instance metadata. 97 00:10:28,240 --> 00:10:43,100 He's a service in AWS who allows him to get credentials, find out each IP address he has and do a lot of stuff, finding the host name and things like that. 98 00:10:43,980 --> 00:10:51,920 So with the service, he would be able to get the credentials as we saw right here. 99 00:10:51,920 --> 00:10:55,960 And with those credentials, he can jump to the data to the control plane. 100 00:10:56,180 --> 00:11:01,600 And by jumping to the control plane, he would be able to use tools like Paku. 101 00:11:01,600 --> 00:11:06,700 If you guys don't know Paku, it's like the meta exploit for AWS. 102 00:11:06,780 --> 00:11:09,560 So it's open source AWS exploitation framework. 103 00:11:09,560 --> 00:11:10,740 Pretty good. 104 00:11:11,580 --> 00:11:19,480 And it was developed by the guys of Rhino Security, especially by the late Spencer Gittin. 105 00:11:19,840 --> 00:11:28,980 So it's a great tool if you have AWS credentials to explore and to get doing more nasty stuff on the AWS. 106 00:11:29,420 --> 00:11:35,480 So another letter of movement, I call it step down. 107 00:11:35,760 --> 00:11:52,540 And that happens if any user with any user or role with SSCM or instance, creating instance actions and actions are kind of permissions on AWS, they can execute code and jump to the data plane. 108 00:11:52,540 --> 00:12:13,240 So if you have a user, A, who wants to jump to a specific VPC or a specific subnetwork, and this user has the ability to execute anything, like create, execute an instance that already exists on this VPC. 109 00:12:13,240 --> 00:12:23,730 Or if he can also, if he can create an instance, he could create an instance on this VPC, execute code, and then jump from the control plane to the data plane. 110 00:12:24,360 --> 00:12:35,660 So this is a comment that an attacker would do to make an EC2 instance create a reverse shell for his IP address. 111 00:12:35,660 --> 00:12:42,240 So he's doing an AWS run shell script with these parameters. 112 00:12:42,240 --> 00:12:46,420 And this is what the EC2 instance will exec. 113 00:12:48,840 --> 00:12:55,180 So another movement that I call here, called to the right, to the right. 114 00:12:55,180 --> 00:13:02,140 And that is when you can assume a role between accounts and cross accounts between AWS. 115 00:13:02,200 --> 00:13:18,740 So if you have an account A, you can do an account B has this policy, that means that any principal on account A can assume a role in account B. 116 00:13:19,220 --> 00:13:25,540 So if you have, you can assume a role from account A to account B, right? 117 00:13:25,720 --> 00:13:48,420 But if you are in account B, after assumed a role in it from account A, and you want to assume a role in account C, just jumping between accounts, you might think that's the necessary thing to do is, it's have this policy in account C, like any entity from account B can assume a role in account C. 118 00:13:48,420 --> 00:13:50,520 But the thing is, that's not true. 119 00:13:50,520 --> 00:14:03,400 Because when it comes from account A, an attacker can assume the role in account B, he's not an instance of account B, he's an instance of account A. 120 00:14:03,400 --> 00:14:06,700 So this is not possible. 121 00:14:06,700 --> 00:14:13,260 The only thing that would be possible from assuming a role from B to C, would be a policy like this. 122 00:14:13,300 --> 00:14:18,480 So anything on B, we've assumed the role, and the name of the role, and the value. 123 00:14:18,480 --> 00:14:26,720 Because when you assume a role, you do a temporary value for this, like a comment for this assumed role. 124 00:14:27,000 --> 00:14:29,300 And this might also be true. 125 00:14:29,300 --> 00:14:36,500 But these kind of things, just to be honest with you guys, I never saw in production in any of our clients. 126 00:14:36,500 --> 00:14:44,920 So I don't believe it's feasible to find any other environment with this kind of assumed role, right? 127 00:14:44,920 --> 00:14:48,800 So this won't work for most of the things. 128 00:14:48,800 --> 00:14:59,980 But one thing that one attacker can do is jumping from the account B to a data plane, and then assuming a role in account C. 129 00:15:00,000 --> 00:15:08,120 But this thing here, what we call assume a role for account A, and assume a role for account C, it's called role chaining for AWS. 130 00:15:08,120 --> 00:15:10,700 And it also has a hard limit of one hour. 131 00:15:10,860 --> 00:15:30,420 So one hour might not seem a lot, but when we're talking about control plane, the things that has a lot of APIs, really well documented from AWS, you can just script your attack, and one hour is enough time to run any kind of scripts. 132 00:15:30,500 --> 00:15:34,900 But yeah, this thing has a hard limit to one hour. 133 00:15:34,900 --> 00:15:39,340 But there is a bypass for that, that I call now kick and now kick. 134 00:15:40,100 --> 00:15:45,800 And that's an error when you have account A with assumed role in account B. 135 00:15:46,280 --> 00:15:50,580 And the account B, account C, has assumed role from account B. 136 00:15:50,580 --> 00:16:08,540 What an attacker can do is jump from the control plane to the data plane, gives the EC2 instance the privilege to assume role, and as this EC2 instance is an entity from account B, this policy in account C will work. 137 00:16:08,780 --> 00:16:32,360 And by doing this kind of movement, simplified here, the attacker can bypass this hard limit of one hour, because EC2 instances, are not treated as the same way the other instances are treated for assumed role operations. 138 00:16:33,080 --> 00:16:36,280 So this is well documented here. 139 00:16:37,060 --> 00:16:40,680 And this bypass can work up to 12 hours. 140 00:16:43,860 --> 00:16:48,280 So what are the attacker requirements to do things like this? 141 00:16:48,280 --> 00:16:50,300 It has to have enough privileges. 142 00:16:50,400 --> 00:16:53,960 For example, it has to assume role in resource star. 143 00:16:54,420 --> 00:16:57,560 He also must know a related account ID. 144 00:16:58,180 --> 00:17:04,520 And for finding this related account ID, he can find this in CloudTrail, IAM policies, and also through OSINT. 145 00:17:05,280 --> 00:17:09,940 And they also need to know the origin of a role to assume the new account. 146 00:17:09,940 --> 00:17:26,940 So it can be brute force, or if he came from the master account, if the account has a SSO single-site organizations, and if he came from the master, he'd be able to find another account pretty easily. 147 00:17:27,360 --> 00:17:34,520 So to have enough permissions, there's also a thing that we call AWS privilege escalations. 148 00:17:34,600 --> 00:17:41,280 And privilege escalations are basically a set of actions that allows you as a principal to increase their privileges. 149 00:17:41,280 --> 00:17:47,000 So there was a great research by the late Spencer Gittin, also from the Greenhouse Security Labs. 150 00:17:47,000 --> 00:17:52,580 He found out around 28 no-privilege escalation techniques. 151 00:17:52,720 --> 00:17:58,980 And there will be a new one just released by Spooker Labs in his talk called Village. 152 00:17:58,980 --> 00:18:00,920 Watch it, don't miss it. 153 00:18:00,920 --> 00:18:04,760 And even more possibilities with the IAM pass role. 154 00:18:04,840 --> 00:18:14,720 And there is a research by Nolan Daham, where he's looking for IAM pass role possibilities and how to privilege escalation with that. 155 00:18:14,740 --> 00:18:24,180 But the thing is, privilege escalation is a thing in AWS, and that's not pretty easy to find out and understand those things. 156 00:18:24,180 --> 00:18:32,040 But not all privilege escalations are created equal, because not all techniques have the same effectiveness. 157 00:18:32,220 --> 00:18:33,120 And how so? 158 00:18:33,120 --> 00:18:35,520 So we have here two techniques. 159 00:18:35,520 --> 00:18:37,960 One is called create policy version. 160 00:18:38,240 --> 00:18:54,660 And if an attacker got credentials, and he has not all actions on AWS, but he has a great policy version, he can create a new policy version for him with the system administrator permissions. 161 00:18:54,660 --> 00:18:59,120 And then he becomes a system administration on that AWS account. 162 00:19:00,060 --> 00:19:06,780 But there's another technique that's called IAM set default policy version. 163 00:19:06,920 --> 00:19:17,760 That means that the attacker has the version v1 right now on his, and he has this privilege set default policy version. 164 00:19:17,760 --> 00:19:26,900 But to become a system administrator, he needs that the previous version, or any of the previously versions, has the system administrator possibility. 165 00:19:27,280 --> 00:19:33,350 So he has a precondition to privilege escalate in this technique. 166 00:19:40,400 --> 00:19:45,960 So how do we find out possibilities of privilege escalation? 167 00:19:45,960 --> 00:19:54,310 There is a tool, there is called CloudExplaining, and was created by Ken McQuaid, was first released on 30 April of 2020. 168 00:19:55,830 --> 00:19:59,310 And this is a IAM security assessment tool. 169 00:19:59,310 --> 00:20:17,430 This tool is able to create, to find out privilege escalation possibilities in customer policies, inline policies on AWS, and also find out about data filtration possibilities, resource exposure, credential exposure, and infrastructure modification. 170 00:20:17,490 --> 00:20:19,790 So this tool is really great. 171 00:20:20,720 --> 00:20:31,110 And if you didn't know, you can use it to find out possibilities of privilege escalations in your environment, right? 172 00:20:32,770 --> 00:20:45,250 So any other, what are the requirements that an attacker would need to move laterally between AWS accounts, would be an ID of the related account. 173 00:20:45,250 --> 00:20:49,470 So it can be found in CloudTrail, IAM policies, and also SYNT. 174 00:20:49,530 --> 00:21:00,250 And you can also, for example, you know, SYNT stuff, you can find out the company GitHub, find Terraform scripts, and other kind of things. 175 00:21:00,250 --> 00:21:08,750 And those numbers might be, or might not be, but they are probably hard-coded on those files, right? 176 00:21:09,110 --> 00:21:27,050 So in this, we have an example of CloudTrail, and we can find out there's account ID doing anything here with the account ID, and you can find out the account IDs also from the CloudTrail. 177 00:21:29,710 --> 00:21:42,250 So if the attackers also use AWS organizations or Control Tower, the attacker also, he needs to know a role to assume on these accounts. 178 00:21:42,250 --> 00:21:54,810 So he's in account A, he wants to assume a role in account B, but he also knows a role, he has to know a name, the ID of the account, and he has to know the name of the role to assume. 179 00:21:55,550 --> 00:22:06,890 But if the organizations use AWS, if the AWS accounts use organizations or Control Tower, the attacker knows the name of those roles because they are hard-coded. 180 00:22:07,050 --> 00:22:25,930 So if the attacker gets access to the master account, it's game over, it's final dance, because from the master, the attacker with the assumed role condition can assume any role, can assume a role called organizational account access role, or he can also assume a role called AWS Control Tower execution. 181 00:22:25,930 --> 00:22:31,530 And those roles, by default, they have admin privileges in all the accounts with the same organizations. 182 00:22:31,830 --> 00:22:35,950 So protect your master account as much as possible. 183 00:22:35,950 --> 00:22:44,030 If useful, if it's used, well, do not use any kind of workload on the master accounts. 184 00:22:44,630 --> 00:22:54,850 So there are some scenarios, our best practice from AWS that we can explore to understand ladder movements possibilities. 185 00:22:54,990 --> 00:23:00,250 So the first scenario is called Rub and Spoke. 186 00:23:00,250 --> 00:23:06,090 This is a really well understood network design from AWS. 187 00:23:06,090 --> 00:23:11,890 So we have several accounts, accounts A, accounts B, accounts C, a shared services account. 188 00:23:12,350 --> 00:23:23,510 And what you can do, the wrong things that you can do is create an EC2 instance with two network interfaces on the shared services. 189 00:23:23,510 --> 00:23:28,030 And those interfaces connect to the account A to the account C. 190 00:23:28,030 --> 00:23:31,430 So it might be a route point. 191 00:23:31,430 --> 00:23:37,810 So an attacker who got an account A, he can hack this instance, and then jump to account C. 192 00:23:38,290 --> 00:23:44,810 But you can also do you can also do a VPC peering between account A, account B and account C. 193 00:23:44,950 --> 00:23:54,870 This also might break the network interface that want to work on this network. 194 00:23:54,870 --> 00:23:57,230 So don't do it. 195 00:23:57,230 --> 00:23:58,750 Please don't do it. 196 00:23:58,750 --> 00:23:59,870 Right. 197 00:23:59,870 --> 00:24:12,030 And another AWS pattern and possible thing that you can do is to cross back, cross account back to master all CICD accounts. 198 00:24:12,030 --> 00:24:19,770 So this we have a partner, a pattern that we call, and the user logins to the master account. 199 00:24:19,770 --> 00:24:23,210 And this user, he has access to CICD. 200 00:24:23,770 --> 00:24:29,950 And he has access also to dev and to staging, but he doesn't have access to prod. 201 00:24:30,330 --> 00:24:31,170 Right. 202 00:24:31,170 --> 00:24:39,090 But what happens if the administrator of this account do a cross account between the dev and CICD? 203 00:24:39,810 --> 00:24:47,650 This user, as an attacker, he can just do a cross account to the master and just jump to the dev. 204 00:24:47,650 --> 00:24:49,030 He can also jump to the dev. 205 00:24:49,030 --> 00:24:56,790 But the CICD account, as he has permissions to deploy in prod, he can also make a jump to prod. 206 00:24:56,830 --> 00:25:08,870 So also do not never cross accounts between your dev environments and staging environments back to a master or CICD account. 207 00:25:09,670 --> 00:25:18,690 So in order to find out in our clients, we tested a lot of tools, but none of did what we wanted to do. 208 00:25:18,690 --> 00:25:21,490 We test AWS PX. 209 00:25:21,490 --> 00:25:24,330 We tested CloudMapper from dual labs. 210 00:25:24,330 --> 00:25:34,670 We tested several tools, but none of them was able to deliver what we were thinking about. 211 00:25:35,310 --> 00:25:39,930 What we thought that would be a good delivery to find out a lot of movements. 212 00:25:40,010 --> 00:25:42,330 So we have to create your own. 213 00:25:42,330 --> 00:25:45,130 So we had some requirements for that. 214 00:25:45,130 --> 00:26:08,670 One of our requirements is to use open source and free tools, automatically download the necessary information from the AWS APIs, plot an easy to understand graph with graphs, what an attacker could do at a control plane data plane as well, and has a carry language to allow alerts to be raised automatically. 215 00:26:08,850 --> 00:26:15,810 So as a backend, use Gremlin as a carry language. 216 00:26:15,810 --> 00:26:27,150 We also use Cloud Splane to download all the information, not all the information, but some information automatically, and also understand what previous collision techniques would be useful. 217 00:26:27,150 --> 00:26:31,110 And we also use D3.js for visualization. 218 00:26:31,850 --> 00:26:42,630 So what we model, we model things like if anything is to instance or a lambda, anything from data plane is a square. 219 00:26:43,270 --> 00:26:46,350 Anything from the control plane is a circle. 220 00:26:47,070 --> 00:26:54,930 Anything that has, if it has the same account, AWS account, it has the same color, different colors, different accounts. 221 00:26:54,930 --> 00:27:04,230 And we also model a row and arrow, and that's a directional relationship between any of those instances, right? 222 00:27:05,470 --> 00:27:07,790 So kind of demo time. 223 00:27:08,090 --> 00:27:10,070 Well, the name has no name. 224 00:27:10,070 --> 00:27:11,390 The tool has no name yet. 225 00:27:11,390 --> 00:27:23,090 So there was, back on the Cloud Village, there was a pool on Twitter to find out the name of this tool. 226 00:27:24,630 --> 00:27:36,070 We are in some days to release this tool, so keep up, keep looking for our Twitter accounts, and we'll be released soon, right? 227 00:27:36,070 --> 00:27:39,810 So for the demo time, 228 00:27:44,920 --> 00:27:49,500 as I said, the tool has no name yet. 229 00:27:51,240 --> 00:28:04,340 And by clicking search, it downloads all the information and plot the graphs, and you can also zoom, you can pan in, pan out, move laterally things. 230 00:28:13,110 --> 00:28:16,470 As you can see, there are several colors here. 231 00:28:16,470 --> 00:28:23,670 And this data, it came from a simulation that one of our clients who has hacked it. 232 00:28:23,670 --> 00:28:28,030 So one of our clients lost his credentials for one of his accounts. 233 00:28:29,390 --> 00:28:39,010 And by the end of the time, the end of the day, the attacker just created an EC2 instance and running some crypto miners on that. 234 00:28:39,010 --> 00:28:45,110 So we were able to catch it pretty quickly and clean up the account. 235 00:28:45,290 --> 00:28:57,490 But what the attacker could do, if he has the visibility of the possibilities that he could do, it's much more scary than just crypto mining. 236 00:29:00,990 --> 00:29:08,930 So just organize, you can move things, you can just organize things here. 237 00:29:09,030 --> 00:29:11,550 The thing is, the attacker lost control of this 238 00:29:14,910 --> 00:29:18,570 account , and he would be able to create an EC2 instance. 239 00:29:18,730 --> 00:29:22,050 This EC2 instance has an assumed role. 240 00:29:24,510 --> 00:29:31,170 He would be able to jump to all other accounts, because this EC2 instance was in a master account. 241 00:29:31,170 --> 00:29:33,370 And he also has a VPC peering. 242 00:29:33,450 --> 00:29:39,670 And if you see, if you watch closely, all the connections between VPCs are two-way connections. 243 00:29:39,670 --> 00:29:41,150 So you have EC2 instance. 244 00:29:41,150 --> 00:29:46,670 We have a connection from this EC2 instance to this EC2 instance, and back and forth. 245 00:29:46,810 --> 00:29:56,530 And he could also jump from this to this EC2 instance, and then also assume a role in this account here. 246 00:30:05,080 --> 00:30:09,360 As you can see, he could assume a role in another account. 247 00:30:27,520 --> 00:30:36,400 He could also jump to this EC2 instance right here, and then become an administrator on this orange account. 248 00:30:43,570 --> 00:30:54,850 One thing that we find out, the easiest way to analyze these things is to look for big clusters like this, because they have the most interactions, like this. 249 00:30:54,850 --> 00:31:01,610 And things like this are just lambdas with assumed roles, and they're not really well connected to the graph. 250 00:31:01,610 --> 00:31:07,610 So by analyzing, the easiest way is to be looking for large clusters. 251 00:31:07,610 --> 00:31:25,450 And you can also have a filter here for privileged escalations, that you could find out that this role here has a privileged escalation possibility to this role, that's the administrator role, by creating a new policy version, as you can see here. 252 00:31:25,950 --> 00:31:29,890 So you can also find out privileged escalation possibilities. 253 00:31:33,610 --> 00:31:37,630 So what's the future or our to-do list for EC2? 254 00:31:37,630 --> 00:31:43,710 We want to evaluate all the restrictions of all privileged escalation techniques, so it just takes a little bit more time. 255 00:31:43,710 --> 00:31:53,650 We also want to support, to add support for other resources like S3 and RDS, and also support for resource-based policies. 256 00:31:53,990 --> 00:32:07,610 And a little bit better visualization and filtering, because there's what this visualization thing was just a POC, a POC, and was using another open source tool, it's called GraphXL, something like this. 257 00:32:09,090 --> 00:32:12,190 But we want to do better with this. 258 00:32:12,790 --> 00:32:26,390 So in order to conclude, what you have to have in mind, so also try to apply the least privilege to IAM role permissions, and this is said and done, we know that. 259 00:32:26,450 --> 00:32:37,530 But you can use SCPs and IAM boundaries, and please, please try to never use a resource star, that brings a lot of possibilities to attackers. 260 00:32:37,870 --> 00:32:41,450 And don't run any workloads in your master account. 261 00:32:41,450 --> 00:32:56,850 So if you run any workloads in a master account, and if you by accident give this workload, EC2 instance, assume role, you can recruit a jump between all those accounts in your environment. 262 00:32:56,850 --> 00:33:03,530 And also don't cross-account any accounts to master, or any accounts to CICD accounts, and things like that. 263 00:33:03,530 --> 00:33:10,710 So always review all your trusted cross-account policies, and segment your network and accounts as much as possible. 264 00:33:13,050 --> 00:33:17,790 So thank you guys, thank you for coming, watching my talk. 265 00:33:17,830 --> 00:33:22,890 Hope to see you guys next year on CloudVillage and DEF CON 31. 266 00:33:23,390 --> 00:33:29,870 So these are my contacts, Twitter, the TTC security Twitter, and my LinkedIn. 267 00:33:30,230 --> 00:33:33,690 So if you have any questions, just keep in touch. 268 00:33:33,750 --> 00:33:34,290 See you!