1 00:00:00,160 --> 00:00:02,560 last Talk of the day but certainly not 2 00:00:02,560 --> 00:00:05,520 least we've got Seth art uh he's a 3 00:00:05,520 --> 00:00:07,439 senior security Advocate at Daya dog 4 00:00:07,439 --> 00:00:09,120 previously created and leaded the cloud 5 00:00:09,120 --> 00:00:11,360 pen testing practice at Bishop Fox the 6 00:00:11,360 --> 00:00:13,080 title of the workshop is exploiting 7 00:00:13,080 --> 00:00:14,599 common vulnerabilities in AWS 8 00:00:14,599 --> 00:00:18,560 environments please give up set a warm 9 00:00:20,400 --> 00:00:23,519 welcome thank you can everybody hear me 10 00:00:23,519 --> 00:00:26,160 in the back raise your hand if you can 11 00:00:26,160 --> 00:00:27,560 hear me in the 12 00:00:27,560 --> 00:00:30,400 back all right 13 00:00:30,400 --> 00:00:33,600 thank you for attending the workshop so 14 00:00:33,600 --> 00:00:34,960 a lot of the workshops have been having 15 00:00:34,960 --> 00:00:36,600 trouble because the Wi-Fi has been a 16 00:00:36,600 --> 00:00:39,000 little questionable so hopefully you can 17 00:00:39,000 --> 00:00:41,640 either use your own personal hotspot or 18 00:00:41,640 --> 00:00:43,640 Join one of the Defcon the open or the 19 00:00:43,640 --> 00:00:46,239 secure Defcon Wi-Fi uh you will need 20 00:00:46,239 --> 00:00:47,680 that if you want to participate in the 21 00:00:47,680 --> 00:00:50,480 workshop so in this workshop at least an 22 00:00:50,480 --> 00:00:54,000 hour and a half will be you hacking and 23 00:00:54,000 --> 00:00:55,879 Amber and Julian and I can walk around 24 00:00:55,879 --> 00:00:58,120 and help you as needed so there's a very 25 00:00:58,120 --> 00:01:00,000 Hands-On Workshop although you can just 26 00:01:00,000 --> 00:01:01,300 you know listen if you'd 27 00:01:01,300 --> 00:01:05,519 [Music] 28 00:01:05,519 --> 00:01:08,320 like so welcome to the workshop 29 00:01:08,320 --> 00:01:11,360 exploiting common vulnerabilities in AWS 30 00:01:11,360 --> 00:01:14,040 environments my name is Seth art I a 31 00:01:14,040 --> 00:01:16,640 senior security Advocate at datadog I 32 00:01:16,640 --> 00:01:18,640 joined data dog about 3 months ago and 33 00:01:18,640 --> 00:01:20,640 in this new role I get to work on open 34 00:01:20,640 --> 00:01:23,439 source projects and security research 35 00:01:23,439 --> 00:01:24,920 and Conference presentations and 36 00:01:24,920 --> 00:01:26,720 workshops like this uh I'm really 37 00:01:26,720 --> 00:01:28,240 excited to be in this new role but 38 00:01:28,240 --> 00:01:30,159 before this new role I had had been a 39 00:01:30,159 --> 00:01:32,560 penetration tester for 14 years so I 40 00:01:32,560 --> 00:01:35,040 started on the application security side 41 00:01:35,040 --> 00:01:36,920 I then got the itch to do Network pen 42 00:01:36,920 --> 00:01:39,600 testing uh internal pen testing external 43 00:01:39,600 --> 00:01:42,159 pen testing Wireless which was really 44 00:01:42,159 --> 00:01:44,200 fun physical which is terrifying but 45 00:01:44,200 --> 00:01:46,320 really fun uh physical security pen 46 00:01:46,320 --> 00:01:49,799 tests uh so but what I really found that 47 00:01:49,799 --> 00:01:51,759 I like the most was internal penetration 48 00:01:51,759 --> 00:01:54,520 tests objective based assume breach 49 00:01:54,520 --> 00:01:57,840 style testing where you a company might 50 00:01:57,840 --> 00:02:00,680 ask you to come in plug into the Network 51 00:02:00,680 --> 00:02:02,960 and then see if you can go from that no 52 00:02:02,960 --> 00:02:04,640 credential point just plugging into the 53 00:02:04,640 --> 00:02:06,719 network what's the worst that can happen 54 00:02:06,719 --> 00:02:08,598 can you get access to the most sensitive 55 00:02:08,598 --> 00:02:11,480 data in the organization in a time box 56 00:02:11,480 --> 00:02:12,840 uh sometimes it's not plugging in from 57 00:02:12,840 --> 00:02:14,280 the network sometimes you're starting 58 00:02:14,280 --> 00:02:16,000 from the perspective of a compromised 59 00:02:16,000 --> 00:02:18,080 user so let's assume that somebody has 60 00:02:18,080 --> 00:02:20,959 been fished they their laptop has been 61 00:02:20,959 --> 00:02:23,160 compromised you know should every domain 62 00:02:23,160 --> 00:02:24,680 user be able to get to the most 63 00:02:24,680 --> 00:02:26,480 sensitive information in the network 64 00:02:26,480 --> 00:02:27,959 probably not right and so that's the 65 00:02:27,959 --> 00:02:30,879 style of testing that I really enjoyed 66 00:02:30,879 --> 00:02:32,800 so about 5 years ago when I came over to 67 00:02:32,800 --> 00:02:34,400 Bishop Fox I tried to get as many 68 00:02:34,400 --> 00:02:37,000 internal penetration tests as I could 69 00:02:37,000 --> 00:02:39,000 and I started to notice a pattern more 70 00:02:39,000 --> 00:02:40,720 and more about 3 or four years ago more 71 00:02:40,720 --> 00:02:42,080 and more of the penetration tests that 72 00:02:42,080 --> 00:02:44,319 we were being asked to do didn't have 73 00:02:44,319 --> 00:02:47,120 any active directory at all it was 74 00:02:47,120 --> 00:02:48,760 organizations that either had everybody 75 00:02:48,760 --> 00:02:50,480 had a Macbook they were using something 76 00:02:50,480 --> 00:02:53,360 like OCTA or Google workspace for their 77 00:02:53,360 --> 00:02:56,720 identities and so that whole internal 78 00:02:56,720 --> 00:02:58,480 methodology Playbook that I had starting 79 00:02:58,480 --> 00:02:59,840 from a domain user was out the way 80 00:02:59,840 --> 00:03:01,920 window right some of the highlevel 81 00:03:01,920 --> 00:03:04,599 concepts still apply but we had to think 82 00:03:04,599 --> 00:03:07,360 of a new methodology to cover this Cloud 83 00:03:07,360 --> 00:03:10,040 native type organization uh another type 84 00:03:10,040 --> 00:03:11,680 of thing we're asked to do is okay let's 85 00:03:11,680 --> 00:03:14,120 say a kubernetes pod gets compromised we 86 00:03:14,120 --> 00:03:16,080 have an application running or service 87 00:03:16,080 --> 00:03:18,440 running at our kubernetes cluster I want 88 00:03:18,440 --> 00:03:20,280 you to start from that perspective and 89 00:03:20,280 --> 00:03:21,720 let us know can you break out of the 90 00:03:21,720 --> 00:03:23,560 cluster can you get administrative 91 00:03:23,560 --> 00:03:25,120 access to the cloud environment that the 92 00:03:25,120 --> 00:03:28,159 cluster is lives in things like that so 93 00:03:28,159 --> 00:03:30,400 we ended up creating the penetration 94 00:03:30,400 --> 00:03:33,040 testing practice at Bishop Fox with four 95 00:03:33,040 --> 00:03:35,799 separate methodologies one for AWS one 96 00:03:35,799 --> 00:03:40,319 for gcp one for Azure and then one for 97 00:03:40,319 --> 00:03:42,400 kubernetes and so that's what I want to 98 00:03:42,400 --> 00:03:44,360 talk about today I want to share some of 99 00:03:44,360 --> 00:03:47,120 that methodology with you all and uh 100 00:03:47,120 --> 00:03:48,720 you're going to get some Hands-On 101 00:03:48,720 --> 00:03:51,680 hacking trying trying to exploit the 102 00:03:51,680 --> 00:03:53,159 type of things that either get you into 103 00:03:53,159 --> 00:03:55,439 a cloud environment or to see what post 104 00:03:55,439 --> 00:03:58,400 exploitation looks like in the 105 00:03:58,400 --> 00:04:01,400 cloud so uh I'd like Julian and Amber to 106 00:04:01,400 --> 00:04:02,480 raise your 107 00:04:02,480 --> 00:04:04,920 hands so that's Amber right there this 108 00:04:04,920 --> 00:04:07,439 is Julian right here if you have any 109 00:04:07,439 --> 00:04:09,120 issues with connectivity or any 110 00:04:09,120 --> 00:04:11,480 questions about the labs raise your hand 111 00:04:11,480 --> 00:04:13,319 and Amber and Julian will head uh over 112 00:04:13,319 --> 00:04:15,518 to 113 00:04:16,680 --> 00:04:19,459 you how's the volume everything 114 00:04:19,459 --> 00:04:22,120 [Music] 115 00:04:22,120 --> 00:04:24,520 good little little more all right is 116 00:04:24,520 --> 00:04:26,400 this uh I think if I hold it closer it's 117 00:04:26,400 --> 00:04:29,400 louder all right so first I'm going to 118 00:04:29,400 --> 00:04:32,400 introduce the lab 119 00:04:32,400 --> 00:04:34,520 environment then I'm going to talk about 120 00:04:34,520 --> 00:04:36,960 in my opinion where penetration testing 121 00:04:36,960 --> 00:04:39,000 fits in the overall like bigger picture 122 00:04:39,000 --> 00:04:42,280 of offensive Security in the 123 00:04:42,280 --> 00:04:45,160 cloud then we're going to do three Labs 124 00:04:45,160 --> 00:04:47,240 together the first lab is going to be 125 00:04:47,240 --> 00:04:49,199 from the perspective of a compromised 126 00:04:49,199 --> 00:04:52,320 employee so an employee has lost their 127 00:04:52,320 --> 00:04:53,759 credentials you know they checked in 128 00:04:53,759 --> 00:04:55,360 their credentials to GitHub or put them 129 00:04:55,360 --> 00:04:57,919 on past bin or stored them in a Docker 130 00:04:57,919 --> 00:04:59,759 container somewhere what wouldn't 131 00:04:59,759 --> 00:05:01,360 attacker do with those type of 132 00:05:01,360 --> 00:05:03,639 credentials or this also includes what 133 00:05:03,639 --> 00:05:05,360 would an attacker do if they fished an 134 00:05:05,360 --> 00:05:07,000 employee and gained access to their 135 00:05:07,000 --> 00:05:09,320 laptop gained access to their identity 136 00:05:09,320 --> 00:05:11,400 provider right if you have access to 137 00:05:11,400 --> 00:05:13,400 somebody's Google workspace then you can 138 00:05:13,400 --> 00:05:15,400 just log into AWS if they can log into 139 00:05:15,400 --> 00:05:17,360 AWS things like 140 00:05:17,360 --> 00:05:20,000 that the next set of scenarios is going 141 00:05:20,000 --> 00:05:22,680 to be compromise workload scenarios so 142 00:05:22,680 --> 00:05:24,840 these are cases when I say workload what 143 00:05:24,840 --> 00:05:26,680 I mean is something with compute in the 144 00:05:26,680 --> 00:05:28,520 cloud so something that you can get code 145 00:05:28,520 --> 00:05:30,000 execution on is a good way to think 146 00:05:30,000 --> 00:05:31,960 about it so the most obvious would be an 147 00:05:31,960 --> 00:05:34,199 ec2 instance but you could also have a 148 00:05:34,199 --> 00:05:37,479 kubernetes pod a compromise uh Tas in an 149 00:05:37,479 --> 00:05:39,720 ECS cluster it could even be a Lambda 150 00:05:39,720 --> 00:05:41,479 function over the years many people have 151 00:05:41,479 --> 00:05:43,960 come up to me and said I just got code 152 00:05:43,960 --> 00:05:45,840 execution and it turns out I'm in a 153 00:05:45,840 --> 00:05:47,840 Lambda function what do I do from that 154 00:05:47,840 --> 00:05:50,520 perspective 155 00:05:50,520 --> 00:05:52,960 right and then the last set of of 156 00:05:52,960 --> 00:05:55,199 scenarios will be focus on exploiting 157 00:05:55,199 --> 00:05:57,199 the type of cloud resources that are not 158 00:05:57,199 --> 00:05:59,520 compute so you can think of something 159 00:05:59,520 --> 00:06:01,720 like like an S3 bucket was misconfigured 160 00:06:01,720 --> 00:06:03,639 or an SNS topic or an 161 00:06:03,639 --> 00:06:06,759 sqsq uh you this misconfigured and a lot 162 00:06:06,759 --> 00:06:08,919 of people have this question what do I 163 00:06:08,919 --> 00:06:12,199 do right another one would be uh an ECR 164 00:06:12,199 --> 00:06:14,919 a container repository is misconfigured 165 00:06:14,919 --> 00:06:16,720 what does post exploitation look like in 166 00:06:16,720 --> 00:06:18,440 that scenario so that's kind of the 167 00:06:18,440 --> 00:06:21,560 stuff we'll talk about in Lab 168 00:06:22,599 --> 00:06:25,360 3 So today we're going to be using if 169 00:06:25,360 --> 00:06:27,039 you've all created your account in the 170 00:06:27,039 --> 00:06:29,280 data dog Learning Center so this was 171 00:06:29,280 --> 00:06:31,319 created ated and used by data dog to 172 00:06:31,319 --> 00:06:33,440 teach people about data dog products but 173 00:06:33,440 --> 00:06:35,000 we're not going to be using any data dog 174 00:06:35,000 --> 00:06:36,759 products in the workshop today all of 175 00:06:36,759 --> 00:06:38,440 that stuff's been stripped out but 176 00:06:38,440 --> 00:06:40,160 what's amazing about this platform is 177 00:06:40,160 --> 00:06:41,599 it's going to give each and every one of 178 00:06:41,599 --> 00:06:43,759 you who created an account access to 179 00:06:43,759 --> 00:06:47,400 your own ephemeral AWS account that's 180 00:06:47,400 --> 00:06:49,000 going to be nuked at the end of the 181 00:06:49,000 --> 00:06:51,520 workshop so don't worry about anything 182 00:06:51,520 --> 00:06:52,840 you do in there it's just going to be 183 00:06:52,840 --> 00:06:55,680 recycled uh at the end of the workshop 184 00:06:55,680 --> 00:06:57,919 and this AWS account has pre become 185 00:06:57,919 --> 00:07:01,120 preconfigured with cloud foxable in it 186 00:07:01,120 --> 00:07:03,120 so cloud foxable is an open source tool 187 00:07:03,120 --> 00:07:05,120 that I wrote while at Bishop Fox that 188 00:07:05,120 --> 00:07:08,599 you can in normal situation deploy into 189 00:07:08,599 --> 00:07:11,720 your own playground or sandbox AWS 190 00:07:11,720 --> 00:07:13,879 account but today you don't have to do 191 00:07:13,879 --> 00:07:15,840 that because we have created an AWS 192 00:07:15,840 --> 00:07:16,919 account for each and every one of you 193 00:07:16,919 --> 00:07:17,840 who signed 194 00:07:17,840 --> 00:07:20,599 in and what cloud foxable is it's an 195 00:07:20,599 --> 00:07:24,240 intentionally vulnerable Cloud CTF so it 196 00:07:24,240 --> 00:07:27,280 it has deployed 18 challenges worth of 197 00:07:27,280 --> 00:07:31,520 vulnerable resources into the cloud 198 00:07:31,520 --> 00:07:33,440 The Learning Management Center is also 199 00:07:33,440 --> 00:07:35,360 going to give you a virtual machine that 200 00:07:35,360 --> 00:07:37,199 you can use this virtual machine has 201 00:07:37,199 --> 00:07:39,879 been preconfigured with the AWS CLI all 202 00:07:39,879 --> 00:07:41,680 the profiles that you'll need or most of 203 00:07:41,680 --> 00:07:44,199 them have been come preconfigured the 204 00:07:44,199 --> 00:07:46,479 it's has the cloud Fox binary on it it 205 00:07:46,479 --> 00:07:48,759 has P mapper so you should have a lot of 206 00:07:48,759 --> 00:07:52,039 these tools just ready for the 207 00:07:52,039 --> 00:07:53,840 workshop okay so now's a good 208 00:07:53,840 --> 00:07:55,400 opportunity we'll take just a minute or 209 00:07:55,400 --> 00:07:58,319 two if you haven't been able to uh 210 00:07:58,319 --> 00:08:00,240 enroll and create your yet now would be 211 00:08:00,240 --> 00:08:02,280 a good time and so what you want to do 212 00:08:02,280 --> 00:08:04,280 is you want to start the course and this 213 00:08:04,280 --> 00:08:06,120 is completely optional if you want to 214 00:08:06,120 --> 00:08:08,240 get track your progress and submit your 215 00:08:08,240 --> 00:08:11,199 flags to Cloud foxal Bishop fox.com you 216 00:08:11,199 --> 00:08:13,319 can that way you know if you're going to 217 00:08:13,319 --> 00:08:16,080 keep on playing uh later you can do so 218 00:08:16,080 --> 00:08:19,080 but that's just completely 219 00:08:19,720 --> 00:08:22,879 optional all right uh does anybody is 220 00:08:22,879 --> 00:08:25,080 anybody having trouble accessing the 221 00:08:25,080 --> 00:08:27,080 learning environment raise your hand and 222 00:08:27,080 --> 00:08:31,280 Amber or Julian can help 223 00:08:31,410 --> 00:08:32,839 [Music] 224 00:08:32,839 --> 00:08:35,080 keep your hand raised uh amber we have 225 00:08:35,080 --> 00:08:37,958 one here oh 226 00:08:37,958 --> 00:08:41,718 okay I'll just take 227 00:08:43,080 --> 00:08:44,880 oh all right I'm just going to take a 228 00:08:44,880 --> 00:08:46,440 minute and walk around as well hopefully 229 00:08:46,440 --> 00:08:49,160 you can uh all be successful in creating 230 00:08:49,160 --> 00:08:49,550 an 231 00:08:49,550 --> 00:08:51,760 [Music] 232 00:08:51,760 --> 00:08:54,800 account what oh yeah so this you you 233 00:08:54,800 --> 00:08:56,120 can't you aren't really going to be 234 00:08:56,120 --> 00:08:58,040 successful accessing this on your phone 235 00:08:58,040 --> 00:08:59,600 I mean it's technically possible but 236 00:08:59,600 --> 00:09:01,399 it's not going to be easy there's a lot 237 00:09:01,399 --> 00:09:02,279 of commands that you're going to be 238 00:09:02,279 --> 00:09:04,600 entering so in that case we can just 239 00:09:04,600 --> 00:09:06,360 kind of you know I'll talk about it at a 240 00:09:06,360 --> 00:09:08,600 high 241 00:09:08,850 --> 00:09:12,409 [Music] 242 00:09:19,440 --> 00:09:21,720 level so I was able to run the command 243 00:09:21,720 --> 00:09:23,680 and everything oh perfect yeah but this 244 00:09:23,680 --> 00:09:26,959 Cloud foxable um this is uh the reg it's 245 00:09:26,959 --> 00:09:28,279 all free you don't have to do that it's 246 00:09:28,279 --> 00:09:30,200 free it's free but you don't have to use 247 00:09:30,200 --> 00:09:32,000 it it was like in the challenge itself 248 00:09:32,000 --> 00:09:33,760 it had like a cost of like 10 cents per 249 00:09:33,760 --> 00:09:34,959 month it's like that's just part of the 250 00:09:34,959 --> 00:09:36,640 CTF right yeah that's going to be you 251 00:09:36,640 --> 00:09:37,800 don't have to pay any of that because 252 00:09:37,800 --> 00:09:39,440 this is like an account for you okay 253 00:09:39,440 --> 00:09:40,880 okay this want to make sure it's all 254 00:09:40,880 --> 00:09:42,760 free yeah and and you don't even have to 255 00:09:42,760 --> 00:09:44,760 register for PL Fox only if you want to 256 00:09:44,760 --> 00:09:46,079 that's just for submitting the flags do 257 00:09:46,079 --> 00:09:47,440 the flags here or I can do the flags 258 00:09:47,440 --> 00:09:49,040 through there do them all through 259 00:09:49,040 --> 00:09:53,439 through there yeah yeah thank you 260 00:09:56,959 --> 00:09:59,680 yeah yeah so one one quick note while 261 00:09:59,680 --> 00:10:01,880 you can submit your flags to Cloud fox. 262 00:10:01,880 --> 00:10:04,680 Bishop fox.com we won't be using that 263 00:10:04,680 --> 00:10:06,279 for the instructions you know I've kind 264 00:10:06,279 --> 00:10:08,519 of modified the cloud foxal challenges 265 00:10:08,519 --> 00:10:10,240 to work in this learning environment for 266 00:10:10,240 --> 00:10:13,200 all of you so I would say uh use the 267 00:10:13,200 --> 00:10:16,160 learning environment 268 00:10:20,040 --> 00:10:21,920 instructions all right so you're going 269 00:10:21,920 --> 00:10:23,680 to have another 10 minutes of me talking 270 00:10:23,680 --> 00:10:25,360 and if you want to troubleshoot you know 271 00:10:25,360 --> 00:10:27,000 just raise your hand if you need Julian 272 00:10:27,000 --> 00:10:29,040 or Amber to come over to you and I'm 273 00:10:29,040 --> 00:10:30,399 going to just talk a little bit about 274 00:10:30,399 --> 00:10:31,600 offensive Security in the cloud and 275 00:10:31,600 --> 00:10:33,480 hopefully in 10 minutes we'll all have 276 00:10:33,480 --> 00:10:34,680 an opportunity to do some of these 277 00:10:34,680 --> 00:10:37,199 challenges 278 00:10:41,160 --> 00:10:44,160 together 279 00:10:44,630 --> 00:10:48,039 [Music] 280 00:10:50,399 --> 00:10:53,440 Julian all right so so I'd like to frame 281 00:10:53,440 --> 00:10:55,440 where I think penetration testing fits 282 00:10:55,440 --> 00:10:57,160 in the maturity model of cloud security 283 00:10:57,160 --> 00:10:59,920 or offensive Cloud security so just like 284 00:10:59,920 --> 00:11:01,560 in traditional penetration testing I 285 00:11:01,560 --> 00:11:04,519 would say Don't run too fast crawl walk 286 00:11:04,519 --> 00:11:08,240 run so in a cloud environment you still 287 00:11:08,240 --> 00:11:10,680 will have people installing software 288 00:11:10,680 --> 00:11:13,600 manually on things like ec2 instances 289 00:11:13,600 --> 00:11:15,279 and they will forget that they installed 290 00:11:15,279 --> 00:11:17,120 that thing and it will become vulnerable 291 00:11:17,120 --> 00:11:19,360 to an exploit and so that's why you 292 00:11:19,360 --> 00:11:20,440 still want to do traditional 293 00:11:20,440 --> 00:11:22,560 vulnerability scanning whenever you 294 00:11:22,560 --> 00:11:26,160 can however you also have this concept 295 00:11:26,160 --> 00:11:28,320 of cloud security posture management so 296 00:11:28,320 --> 00:11:30,240 there are a lot of open tools that do 297 00:11:30,240 --> 00:11:31,639 this there are a lot of commercial tools 298 00:11:31,639 --> 00:11:33,000 that do this what they're all 299 00:11:33,000 --> 00:11:35,040 essentially doing is measuring the way 300 00:11:35,040 --> 00:11:37,519 you've configured your account against a 301 00:11:37,519 --> 00:11:39,920 baseline a benchmark the most popular 302 00:11:39,920 --> 00:11:41,920 one is the CIS 303 00:11:41,920 --> 00:11:44,240 Benchmark and so this is really great at 304 00:11:44,240 --> 00:11:47,120 finding things that are public right you 305 00:11:47,120 --> 00:11:49,760 might have't however it doesn't tell you 306 00:11:49,760 --> 00:11:51,440 anything about context right it might 307 00:11:51,440 --> 00:11:54,120 say of the 100 S3 buckets that you have 308 00:11:54,120 --> 00:11:57,320 these 10 are public nine of them might 309 00:11:57,320 --> 00:11:58,800 be public on purpose right maybe they're 310 00:11:58,800 --> 00:12:00,959 hosting you know web content but the 311 00:12:00,959 --> 00:12:03,519 10th one might be like whoa that one 312 00:12:03,519 --> 00:12:04,920 does should definitely not be public 313 00:12:04,920 --> 00:12:06,680 right and so you still have to you know 314 00:12:06,680 --> 00:12:08,600 analyze these results but this is the 315 00:12:08,600 --> 00:12:09,839 kind of thing that's really nice to be 316 00:12:09,839 --> 00:12:12,120 running nightly basically right every 317 00:12:12,120 --> 00:12:14,160 single day continuously you want to 318 00:12:14,160 --> 00:12:15,199 check to make sure that you've 319 00:12:15,199 --> 00:12:17,079 configured everything 320 00:12:17,079 --> 00:12:19,399 properly once you've gotten all that lwh 321 00:12:19,399 --> 00:12:21,399 hanging fruit then you want to start 322 00:12:21,399 --> 00:12:23,480 thinking about this objective based 323 00:12:23,480 --> 00:12:25,800 penetration testing and so the way this 324 00:12:25,800 --> 00:12:27,440 works is that you generally have a start 325 00:12:27,440 --> 00:12:29,199 point and an end point I'm going to 326 00:12:29,199 --> 00:12:30,959 start from this perspective and I want 327 00:12:30,959 --> 00:12:34,399 to try to achieve a particular 328 00:12:34,399 --> 00:12:37,160 goal and when you're in the walk phase 329 00:12:37,160 --> 00:12:39,680 this is when I would recommend building 330 00:12:39,680 --> 00:12:42,160 detection capabilities so that usually 331 00:12:42,160 --> 00:12:45,519 involves tools right and logging and 332 00:12:45,519 --> 00:12:47,120 building your response capabilities that 333 00:12:47,120 --> 00:12:49,600 usually involves people and processes 334 00:12:49,600 --> 00:12:52,360 because in my opinion there is no red 335 00:12:52,360 --> 00:12:54,040 teaming and purple teaming unless you 336 00:12:54,040 --> 00:12:55,880 have a blue team right the purpose of 337 00:12:55,880 --> 00:12:57,480 red team and blue teaming again in my 338 00:12:57,480 --> 00:13:00,079 opinion is that it's test the efficacy 339 00:13:00,079 --> 00:13:02,000 of these tools these people these 340 00:13:02,000 --> 00:13:04,920 processes and so you need to have that 341 00:13:04,920 --> 00:13:06,480 set up and you need to make sure that 342 00:13:06,480 --> 00:13:08,199 they're working you could have all of 343 00:13:08,199 --> 00:13:10,519 the tools in the world and and they can 344 00:13:10,519 --> 00:13:13,079 alert and log everything but if somebody 345 00:13:13,079 --> 00:13:15,320 accidentally you know missed an alert 346 00:13:15,320 --> 00:13:17,440 then the process is broken and it's not 347 00:13:17,440 --> 00:13:18,519 going to work well so that's what red 348 00:13:18,519 --> 00:13:21,040 teaming purple teaming is all 349 00:13:21,040 --> 00:13:23,320 about okay hopefully you can see this 350 00:13:23,320 --> 00:13:25,680 you don't have to read everything what I 351 00:13:25,680 --> 00:13:27,560 did here is I picked a random reference 352 00:13:27,560 --> 00:13:29,839 architecture diagram off of a W's 353 00:13:29,839 --> 00:13:32,680 website this to me is what it feels like 354 00:13:32,680 --> 00:13:34,480 on day one of a penetration test 355 00:13:34,480 --> 00:13:36,399 everything is unfamiliar there might be 356 00:13:36,399 --> 00:13:38,480 AWS services that I've never heard of 357 00:13:38,480 --> 00:13:40,079 there might be Technologies in use that 358 00:13:40,079 --> 00:13:41,760 I've never heard of right and so you're 359 00:13:41,760 --> 00:13:44,120 kind of trying to grock what's going on 360 00:13:44,120 --> 00:13:46,480 in this image and you're trying to build 361 00:13:46,480 --> 00:13:49,360 with your your partner either you're an 362 00:13:49,360 --> 00:13:51,519 internal team or your your client if 363 00:13:51,519 --> 00:13:53,399 you're a consultant you're trying to say 364 00:13:53,399 --> 00:13:54,680 what are the starting points and what 365 00:13:54,680 --> 00:13:57,040 are the trophy targets so in this 366 00:13:57,040 --> 00:14:00,160 hypothetical example we're oh sorry so 367 00:14:00,160 --> 00:14:02,240 before we get to penetration testing 368 00:14:02,240 --> 00:14:05,720 where can csbm type stuff help us maybe 369 00:14:05,720 --> 00:14:07,079 the first thing I see here is there's an 370 00:14:07,079 --> 00:14:10,320 Ami that's a custom Ami and we want to 371 00:14:10,320 --> 00:14:12,079 make sure that your custom Amis are not 372 00:14:12,079 --> 00:14:14,279 public there's actually a talk tomorrow 373 00:14:14,279 --> 00:14:16,279 at afan talking about all the secrets 374 00:14:16,279 --> 00:14:19,199 and things people put inside their 375 00:14:19,199 --> 00:14:22,360 Amis CPN might also really help you find 376 00:14:22,360 --> 00:14:23,920 oh hey this elastic load balancer over 377 00:14:23,920 --> 00:14:26,040 here isn't logging right that you want 378 00:14:26,040 --> 00:14:27,600 an automated tool to be able to look at 379 00:14:27,600 --> 00:14:29,600 all of that 380 00:14:29,600 --> 00:14:31,680 okay so now that we have the cspm side 381 00:14:31,680 --> 00:14:33,680 under our belt let's talk about a 382 00:14:33,680 --> 00:14:36,839 hypothetical start point and end point 383 00:14:36,839 --> 00:14:38,839 so we're going to say that this browser 384 00:14:38,839 --> 00:14:41,240 that provides access to Virtual desktops 385 00:14:41,240 --> 00:14:43,399 is compromised that's the start point 386 00:14:43,399 --> 00:14:45,120 and we're going to say that the we have 387 00:14:45,120 --> 00:14:47,120 an S3 bucket with our AI models that's 388 00:14:47,120 --> 00:14:48,880 super sensitive and we have an RDS 389 00:14:48,880 --> 00:14:50,560 database with client data that's super 390 00:14:50,560 --> 00:14:52,800 sensitive okay so now we've defined our 391 00:14:52,800 --> 00:14:54,839 start point and our Ed Point what's 392 00:14:54,839 --> 00:14:57,800 interesting here is that if you notice 393 00:14:57,800 --> 00:14:59,399 none of the arrows in the reference 394 00:14:59,399 --> 00:15:01,920 architecture diagram point to the AI 395 00:15:01,920 --> 00:15:04,279 models or the client database right the 396 00:15:04,279 --> 00:15:06,600 normal flow works all around it but we 397 00:15:06,600 --> 00:15:07,959 have the sensitive stuff and we want to 398 00:15:07,959 --> 00:15:10,120 make sure that people somebody who 399 00:15:10,120 --> 00:15:12,320 compromises this browser can't 400 00:15:12,320 --> 00:15:15,240 inadvertently or unintendedly get into 401 00:15:15,240 --> 00:15:17,560 uh the sensitive stuff so we're going to 402 00:15:17,560 --> 00:15:19,279 pretend that this gentleman is our 403 00:15:19,279 --> 00:15:21,639 attacker who's compromised this 404 00:15:21,639 --> 00:15:24,759 browser we are going to then assume that 405 00:15:24,759 --> 00:15:26,839 that person has access to the virtual 406 00:15:26,839 --> 00:15:29,120 desktops so we have a Linux one up top 407 00:15:29,120 --> 00:15:31,600 we have uh or sorry in the bottom a a 408 00:15:31,600 --> 00:15:32,959 Windows one up 409 00:15:32,959 --> 00:15:35,000 top and so now we're going to put on our 410 00:15:35,000 --> 00:15:37,480 penetration tester hat on our hats on 411 00:15:37,480 --> 00:15:39,199 for the first time and we're going to 412 00:15:39,199 --> 00:15:40,800 think okay what does it look like in the 413 00:15:40,800 --> 00:15:43,680 cloud the first big difference is that 414 00:15:43,680 --> 00:15:46,079 we have to think about does this ec2 415 00:15:46,079 --> 00:15:49,399 instance have an IM Ro attached to it if 416 00:15:49,399 --> 00:15:52,079 it does then that means that we have the 417 00:15:52,079 --> 00:15:53,839 permissions that that are assigned to 418 00:15:53,839 --> 00:15:55,920 that I role and there's something like 419 00:15:55,920 --> 00:15:59,079 177,000 permission I am permissions so 420 00:15:59,079 --> 00:16:00,399 what does that mean as a penetration 421 00:16:00,399 --> 00:16:02,360 tester or as an attacker it means that 422 00:16:02,360 --> 00:16:05,600 post exploitation could be so different 423 00:16:05,600 --> 00:16:08,040 depending on what permissions you 424 00:16:08,040 --> 00:16:10,639 have so what I'm going to be thinking is 425 00:16:10,639 --> 00:16:13,000 okay maybe I noticed that I have 426 00:16:13,000 --> 00:16:15,319 permissions to access a bunch of EFS 427 00:16:15,319 --> 00:16:17,639 file shares so I put my pen tester hat 428 00:16:17,639 --> 00:16:19,120 on if I have access to look at those 429 00:16:19,120 --> 00:16:20,639 file shares I'm going to Rifle through 430 00:16:20,639 --> 00:16:22,120 those look to see if I can find any 431 00:16:22,120 --> 00:16:24,959 secrets sensitive information maybe I 432 00:16:24,959 --> 00:16:26,199 get lucky and this is not too 433 00:16:26,199 --> 00:16:28,199 hypothetical this happens all the time 434 00:16:28,199 --> 00:16:31,360 I'll find a a file with credentials just 435 00:16:31,360 --> 00:16:33,240 sitting there in plain text right now 436 00:16:33,240 --> 00:16:34,880 I've gotten access to the RDS database 437 00:16:34,880 --> 00:16:37,000 and accomplish one of the 438 00:16:37,000 --> 00:16:39,440 objectives okay so let's redo the 439 00:16:39,440 --> 00:16:41,360 scenario let's say we still have an IM 440 00:16:41,360 --> 00:16:43,639 rooll but this time the IM Ro only gives 441 00:16:43,639 --> 00:16:46,720 us the ability to describe ec2 442 00:16:46,720 --> 00:16:48,839 instances well that's still helpful 443 00:16:48,839 --> 00:16:50,959 right without that we'd have to do blind 444 00:16:50,959 --> 00:16:53,800 Port scanning and a a default VPC is a 445 00:16:53,800 --> 00:16:55,920 sl16 that would take a very long time 446 00:16:55,920 --> 00:16:58,000 it' be a very bad day but if we have the 447 00:16:58,000 --> 00:16:59,759 ability to describe other ec2 instances 448 00:16:59,759 --> 00:17:01,639 on the environment then we could scan 449 00:17:01,639 --> 00:17:05,520 the 10 20 200 500 ec2 instance that are 450 00:17:05,520 --> 00:17:08,839 actually live and maybe we find another 451 00:17:08,839 --> 00:17:11,280 app that's vulnerable to something like 452 00:17:11,280 --> 00:17:13,720 ssrf that means we've gone from this 453 00:17:13,720 --> 00:17:15,520 first E2 instance with maybe one 454 00:17:15,520 --> 00:17:17,520 permission now we have access to a 455 00:17:17,520 --> 00:17:19,959 second role and now this second role 456 00:17:19,959 --> 00:17:22,439 might have access to S3 star so we can 457 00:17:22,439 --> 00:17:24,240 download all the objects from all the S3 458 00:17:24,240 --> 00:17:26,679 buckets and that's another example that 459 00:17:26,679 --> 00:17:28,439 we would exploit commonly on a cloud 460 00:17:28,439 --> 00:17:29,300 pentest 461 00:17:29,300 --> 00:17:30,880 [Music] 462 00:17:30,880 --> 00:17:32,280 so hopefully that's helped you set the 463 00:17:32,280 --> 00:17:33,960 stage helps you start thinking like we 464 00:17:33,960 --> 00:17:36,280 do on a cloud penetration test and now 465 00:17:36,280 --> 00:17:37,679 we're going to start the the first 466 00:17:37,679 --> 00:17:39,840 Hands-On 467 00:17:39,840 --> 00:17:42,200 lab so for the first lab you are 468 00:17:42,200 --> 00:17:45,320 performing a white box cloud penetration 469 00:17:45,320 --> 00:17:47,320 test you're all going to be starting 470 00:17:47,320 --> 00:17:50,000 from the CTF starting user and that is 471 00:17:50,000 --> 00:17:53,080 attached to the cloud foxel 472 00:17:53,080 --> 00:17:55,720 profile this user has security audit 473 00:17:55,720 --> 00:17:58,520 policy for white box analysis meaning 474 00:17:58,520 --> 00:18:01,039 I'm giving you white box access you can 475 00:18:01,039 --> 00:18:02,679 describe and list all the things in the 476 00:18:02,679 --> 00:18:05,480 account in my opinion this is the only 477 00:18:05,480 --> 00:18:07,200 way the only effective way to do Cloud 478 00:18:07,200 --> 00:18:09,240 penetration testing otherwise you're 479 00:18:09,240 --> 00:18:11,080 just wasting time enumerating things 480 00:18:11,080 --> 00:18:13,320 right if you're an internal team time is 481 00:18:13,320 --> 00:18:14,799 money right if you're an external if 482 00:18:14,799 --> 00:18:16,960 you're a consultancy time is money why 483 00:18:16,960 --> 00:18:19,000 blackbox enumerate things if you're a 484 00:18:19,000 --> 00:18:21,280 trusted party when you don't have 485 00:18:21,280 --> 00:18:23,760 to now if you're a red teaming and 486 00:18:23,760 --> 00:18:25,159 you're trying to test the detection 487 00:18:25,159 --> 00:18:26,960 controls then that's when you might want 488 00:18:26,960 --> 00:18:29,400 to give them blackbox scenarios in my my 489 00:18:29,400 --> 00:18:32,360 opinion okay so uh you also have a few 490 00:18:32,360 --> 00:18:33,840 extra permissions and these are 491 00:18:33,840 --> 00:18:35,120 specifically designed to help you 492 00:18:35,120 --> 00:18:36,919 capture the first couple of 493 00:18:36,919 --> 00:18:39,120 flags so let's find these first three 494 00:18:39,120 --> 00:18:41,159 flags so the first one I'm going to do 495 00:18:41,159 --> 00:18:44,080 with you So for anybody who has access 496 00:18:44,080 --> 00:18:45,440 uh we're going to do it's a secret 497 00:18:45,440 --> 00:18:47,000 together and then after that I'm going 498 00:18:47,000 --> 00:18:48,880 to let you all do uh it's another secret 499 00:18:48,880 --> 00:18:51,039 and rout uh on your own and we're going 500 00:18:51,039 --> 00:18:52,880 to do 10 minutes together and have 15 501 00:18:52,880 --> 00:18:54,720 minutes for you to just hack on your own 502 00:18:54,720 --> 00:18:56,480 so again raise your hand if you have any 503 00:18:56,480 --> 00:19:00,720 questions uh about access 504 00:19:01,090 --> 00:19:04,189 [Music] 505 00:19:14,039 --> 00:19:16,919 raise your hands 506 00:19:17,760 --> 00:19:20,159 higher how long are the labs going to be 507 00:19:20,159 --> 00:19:23,520 available after this St uh the the labs 508 00:19:23,520 --> 00:19:25,440 are going to go away after the workshop 509 00:19:25,440 --> 00:19:32,120 so right after yeah sorry I hours 510 00:19:32,880 --> 00:19:35,880 sry 511 00:19:44,320 --> 00:19:46,480 NOP all right so I'm going to walk you 512 00:19:46,480 --> 00:19:47,799 through the first one just to help you 513 00:19:47,799 --> 00:19:50,919 get familiar with what cloud Fox is what 514 00:19:50,919 --> 00:19:55,000 uh the environment looks like 515 00:19:55,970 --> 00:19:59,079 [Music] 516 00:19:59,679 --> 00:20:01,039 so the first thing we're going to do you 517 00:20:01,039 --> 00:20:02,679 can either copy or you can click this 518 00:20:02,679 --> 00:20:04,559 and it'll run so we're going to test to 519 00:20:04,559 --> 00:20:06,360 make sure that our profile is working 520 00:20:06,360 --> 00:20:08,270 and in this case it 521 00:20:08,270 --> 00:20:11,470 [Music] 522 00:20:13,840 --> 00:20:16,200 is and I encourage you even if you're 523 00:20:16,200 --> 00:20:17,799 doing these on your own to use the 524 00:20:17,799 --> 00:20:19,600 solution right we only have a certain 525 00:20:19,600 --> 00:20:21,720 amount of time so feel free to go 526 00:20:21,720 --> 00:20:24,320 through and read I put a lot of uh 527 00:20:24,320 --> 00:20:26,520 methodology our own you know methodology 528 00:20:26,520 --> 00:20:29,360 into the solutions cu there's obviously 529 00:20:29,360 --> 00:20:31,280 many ways to you know get to the same 530 00:20:31,280 --> 00:20:34,360 goal uh 531 00:20:34,360 --> 00:20:36,280 [Music] 532 00:20:36,280 --> 00:20:38,159 so all right so the first thing we're 533 00:20:38,159 --> 00:20:40,080 going to do is just a quick hack to make 534 00:20:40,080 --> 00:20:43,400 sure that the IDE side of things is 535 00:20:43,400 --> 00:20:44,880 pointing to the right direction so that 536 00:20:44,880 --> 00:20:47,400 we can see our Cloud Fox output and now 537 00:20:47,400 --> 00:20:50,520 we're going to run 538 00:20:50,520 --> 00:20:53,240 uh we're going to run Cloud foxes all 539 00:20:53,240 --> 00:20:55,880 checks command so Cloud Fox AWS the 540 00:20:55,880 --> 00:20:58,760 profile name all checks 541 00:20:58,760 --> 00:21:00,280 and so with this this isn't really all 542 00:21:00,280 --> 00:21:01,360 the checks there are a few checks that 543 00:21:01,360 --> 00:21:02,960 just take way too much time to include 544 00:21:02,960 --> 00:21:05,200 in all checks but this is helping you 545 00:21:05,200 --> 00:21:07,720 get a lay of the land we cre I cre we 546 00:21:07,720 --> 00:21:10,320 created Cloud Fox to help you gain 547 00:21:10,320 --> 00:21:11,919 situational awareness and unfamiliar 548 00:21:11,919 --> 00:21:13,880 Cloud environments so the one of the 549 00:21:13,880 --> 00:21:15,840 most complicating things about AWS is 550 00:21:15,840 --> 00:21:17,320 that the resources are in different 551 00:21:17,320 --> 00:21:20,039 regions for example right so you might 552 00:21:20,039 --> 00:21:21,799 look and see what are all the Lambda 553 00:21:21,799 --> 00:21:23,240 functions in this account but you're 554 00:21:23,240 --> 00:21:25,120 only looking at one region at a time in 555 00:21:25,120 --> 00:21:27,520 the console as a penetration tester we 556 00:21:27,520 --> 00:21:29,080 want to be able to kind of quickly see 557 00:21:29,080 --> 00:21:30,360 where are all the Lambda functions 558 00:21:30,360 --> 00:21:32,200 across all regions where are all the 559 00:21:32,200 --> 00:21:33,960 file systems where are all the API 560 00:21:33,960 --> 00:21:36,320 gateways where are all the 561 00:21:36,320 --> 00:21:38,780 databases one 562 00:21:38,780 --> 00:21:42,010 [Music] 563 00:21:43,880 --> 00:21:48,919 of how how often do we get caught yeah 564 00:21:48,919 --> 00:21:50,620 RBA what's an 565 00:21:50,620 --> 00:21:53,840 [Music] 566 00:21:54,799 --> 00:21:57,120 RBA okay yeah the question is how often 567 00:21:57,120 --> 00:21:59,039 do we get caught when we use a tool like 568 00:21:59,039 --> 00:22:01,080 this on a cloud penetration test and to 569 00:22:01,080 --> 00:22:02,120 me this is one of the big 570 00:22:02,120 --> 00:22:03,799 differentiators between that penetration 571 00:22:03,799 --> 00:22:06,279 testing and red teaming so we work with 572 00:22:06,279 --> 00:22:07,799 our clients and say we're going to be 573 00:22:07,799 --> 00:22:10,400 noisy it is actually a great opportunity 574 00:22:10,400 --> 00:22:12,400 to measure your tools to like alert your 575 00:22:12,400 --> 00:22:14,400 blue team and say hey these guys are not 576 00:22:14,400 --> 00:22:16,919 going to be stealthy but you still want 577 00:22:16,919 --> 00:22:18,000 to make sure that you see what they're 578 00:22:18,000 --> 00:22:20,120 doing and and absolutely uh these are 579 00:22:20,120 --> 00:22:22,000 noisy tools so these will get caught or 580 00:22:22,000 --> 00:22:23,360 should get caught uh it's a great 581 00:22:23,360 --> 00:22:26,799 opportunity for that great 582 00:22:26,919 --> 00:22:29,559 question all right so if you are the 583 00:22:29,559 --> 00:22:31,840 reason I set this up is because what you 584 00:22:31,840 --> 00:22:34,080 can do is head over to the IDE and look 585 00:22:34,080 --> 00:22:37,559 at all the output files um through the 586 00:22:37,559 --> 00:22:40,320 browser Cloud Fox creates three types of 587 00:22:40,320 --> 00:22:43,360 output for you by default table Json and 588 00:22:43,360 --> 00:22:46,480 CSV um I generally use the table files 589 00:22:46,480 --> 00:22:48,240 and what it's doing is it's showing us 590 00:22:48,240 --> 00:22:50,559 things like uh here let me make it a 591 00:22:50,559 --> 00:22:52,760 little 592 00:22:52,760 --> 00:22:55,960 smaller okay so for instance right the 593 00:22:55,960 --> 00:22:58,520 access Keys commands I want to enumerate 594 00:22:58,520 --> 00:23:00,520 all of the access key IDs that I can 595 00:23:00,520 --> 00:23:02,240 this is not sensitive but what am I 596 00:23:02,240 --> 00:23:03,520 going to do with this as a penetration 597 00:23:03,520 --> 00:23:05,400 tester I'm going to look I'm going to 598 00:23:05,400 --> 00:23:07,240 search for each one of these in GitHub 599 00:23:07,240 --> 00:23:08,520 each one of these in Confluence and 600 00:23:08,520 --> 00:23:11,000 SharePoint because I might find the 601 00:23:11,000 --> 00:23:12,919 secret part that corresponds with this 602 00:23:12,919 --> 00:23:14,799 key and now I have access to another 603 00:23:14,799 --> 00:23:17,039 identity so that's kind of like you know 604 00:23:17,039 --> 00:23:18,600 to help you here here's another thing 605 00:23:18,600 --> 00:23:21,159 that cob Fox does is it'll alert it'll 606 00:23:21,159 --> 00:23:22,840 tell you the buckets right it'll it'll 607 00:23:22,840 --> 00:23:24,880 list enumerate all the buckets but check 608 00:23:24,880 --> 00:23:27,919 out this loot directory there's also it 609 00:23:27,919 --> 00:23:30,320 gives you the commands to download all 610 00:23:30,320 --> 00:23:33,039 of the data in any of the buckets but 611 00:23:33,039 --> 00:23:34,640 very intentionally it does not do this 612 00:23:34,640 --> 00:23:36,919 on purpose some buckets have millions 613 00:23:36,919 --> 00:23:39,000 billions of files in them and you do not 614 00:23:39,000 --> 00:23:41,039 want to download all of that data right 615 00:23:41,039 --> 00:23:42,559 so as a penetration tester you want to 616 00:23:42,559 --> 00:23:44,880 be judicious so what the design 617 00:23:44,880 --> 00:23:47,039 principle for cloud Fox is to give you 618 00:23:47,039 --> 00:23:49,400 the commands but you have to use your 619 00:23:49,400 --> 00:23:51,840 you know uh experience to determine when 620 00:23:51,840 --> 00:23:53,480 it's the right bucket so the first 621 00:23:53,480 --> 00:23:55,520 command in this gives you the ability to 622 00:23:55,520 --> 00:23:58,200 just list the files in the bucket and 623 00:23:58,200 --> 00:24:00,120 then if the files look interesting you 624 00:24:00,120 --> 00:24:01,679 could start downloading individual files 625 00:24:01,679 --> 00:24:03,240 that look interesting you could download 626 00:24:03,240 --> 00:24:04,559 a whole bucket if it looks like it's 627 00:24:04,559 --> 00:24:07,279 appropriate things like that okay so now 628 00:24:07,279 --> 00:24:12,679 let's get back to uh the 629 00:24:13,159 --> 00:24:15,080 challenge okay so the next thing we're 630 00:24:15,080 --> 00:24:18,120 going to do uh when this finishes or 631 00:24:18,120 --> 00:24:21,399 actually I'm just going to kill this 632 00:24:21,720 --> 00:24:24,440 here is in your lab you have this thing 633 00:24:24,440 --> 00:24:27,480 called a script called AWS console login 634 00:24:27,480 --> 00:24:29,039 and so this is really cool I'm going to 635 00:24:29,039 --> 00:24:31,360 run this and it's going to create a 636 00:24:31,360 --> 00:24:34,919 signning URL and 637 00:24:34,919 --> 00:24:38,919 so we can just log in the console as the 638 00:24:38,919 --> 00:24:41,240 lab 639 00:24:41,920 --> 00:24:43,080 [Music] 640 00:24:43,080 --> 00:24:45,960 user and so you see here where the uh 641 00:24:45,960 --> 00:24:47,159 AWS 642 00:24:47,159 --> 00:24:49,440 account and so let's start to do this 643 00:24:49,440 --> 00:24:50,660 first challenge in the 644 00:24:50,660 --> 00:24:51,799 [Music] 645 00:24:51,799 --> 00:24:54,000 console so we are starting from the 646 00:24:54,000 --> 00:24:55,919 perspective of the CTF starting user so 647 00:24:55,919 --> 00:24:57,480 let's see what permissions that user has 648 00:24:57,480 --> 00:24:59,710 access to 649 00:24:59,710 --> 00:25:02,880 [Music] 650 00:25:02,880 --> 00:25:06,080 so this CTF starting 651 00:25:06,440 --> 00:25:09,840 user has permissions in the form of 652 00:25:09,840 --> 00:25:11,840 permissions policies each policy has a 653 00:25:11,840 --> 00:25:14,080 set of 654 00:25:14,380 --> 00:25:16,520 [Music] 655 00:25:16,520 --> 00:25:18,240 permissions and I think we're getting 656 00:25:18,240 --> 00:25:22,679 hit by Defcon Wi-Fi there we go okay and 657 00:25:22,679 --> 00:25:25,799 we have a policy called it's a secret 658 00:25:25,799 --> 00:25:28,360 policy and if you if any of you have not 659 00:25:28,360 --> 00:25:30,480 seing what this policy looks like you 660 00:25:30,480 --> 00:25:32,159 have an action that tells you kind of 661 00:25:32,159 --> 00:25:35,360 the verbs that you have access to the 662 00:25:35,360 --> 00:25:38,440 effect is either allow or deny and the 663 00:25:38,440 --> 00:25:40,120 resource so this could be star which 664 00:25:40,120 --> 00:25:42,559 means you could get all SSM parameters 665 00:25:42,559 --> 00:25:44,039 but in this case the resource is saying 666 00:25:44,039 --> 00:25:45,919 no we only have this permission this 667 00:25:45,919 --> 00:25:49,000 action on this resource so we only the 668 00:25:49,000 --> 00:25:51,520 CTF user has the ability to download 669 00:25:51,520 --> 00:25:56,279 just this uh secret so if we had access 670 00:25:56,279 --> 00:25:58,360 to do that in the console we could do 671 00:25:58,360 --> 00:25:59,559 something like this we're going to go to 672 00:25:59,559 --> 00:26:01,720 the systems 673 00:26:01,720 --> 00:26:03,360 manager we're going to go to the 674 00:26:03,360 --> 00:26:04,060 parameter 675 00:26:04,060 --> 00:26:06,960 [Music] 676 00:26:06,960 --> 00:26:09,810 store we're going to go to it's a 677 00:26:09,810 --> 00:26:11,679 [Music] 678 00:26:11,679 --> 00:26:14,760 secret and we're going to click this but 679 00:26:14,760 --> 00:26:16,600 as you notice we're not logged in as CTF 680 00:26:16,600 --> 00:26:18,520 starting user we're logged into the lab 681 00:26:18,520 --> 00:26:20,440 AWS account role it's a different role 682 00:26:20,440 --> 00:26:22,440 this role doesn't have permissions so 683 00:26:22,440 --> 00:26:24,520 now we're ready to go back into our 684 00:26:24,520 --> 00:26:26,919 workshop and access the secret through 685 00:26:26,919 --> 00:26:30,240 the CTF starting user 686 00:26:35,399 --> 00:26:36,919 so Cloud fox has a command that will 687 00:26:36,919 --> 00:26:40,279 first enumerate the secrets for 688 00:26:41,840 --> 00:26:44,399 you we see here's the secret that we're 689 00:26:44,399 --> 00:26:47,120 talking about it's in US West 2 by the 690 00:26:47,120 --> 00:26:48,880 way all of the resources are in US West 691 00:26:48,880 --> 00:26:51,399 2 for this 692 00:26:51,919 --> 00:26:55,679 lab and as I mentioned Cloud Fox writes 693 00:26:55,679 --> 00:26:57,720 loot files so we're going to cat the 694 00:26:57,720 --> 00:26:59,480 loot file 695 00:26:59,480 --> 00:27:02,159 and this again Cloud Fox is teaching us 696 00:27:02,159 --> 00:27:03,840 the commands that we need to do the next 697 00:27:03,840 --> 00:27:05,559 thing it doesn't automatically do it for 698 00:27:05,559 --> 00:27:08,360 you and what we see here is there is 699 00:27:08,360 --> 00:27:10,279 this whole command that is the command 700 00:27:10,279 --> 00:27:12,600 needed to get that secret so this isn't 701 00:27:12,600 --> 00:27:14,320 much hacking this is just using the 702 00:27:14,320 --> 00:27:15,880 permissions that we have to get the 703 00:27:15,880 --> 00:27:19,640 secret the secret flag um because as a 704 00:27:19,640 --> 00:27:21,640 penetration tester you're often jumping 705 00:27:21,640 --> 00:27:23,360 between different identities that you 706 00:27:23,360 --> 00:27:24,919 have access to right you start as one 707 00:27:24,919 --> 00:27:26,679 identity then maybe eventually you 708 00:27:26,679 --> 00:27:28,640 compromise another you compromise other 709 00:27:28,640 --> 00:27:30,640 each one of those are often in profiles 710 00:27:30,640 --> 00:27:32,720 so the way this works is here actually 711 00:27:32,720 --> 00:27:34,840 let 712 00:27:35,000 --> 00:27:38,919 me we're going to export Pro profile 713 00:27:38,919 --> 00:27:41,000 equals cloud 714 00:27:41,000 --> 00:27:42,960 foxable and then now this command is 715 00:27:42,960 --> 00:27:45,480 going to work and we have together 716 00:27:45,480 --> 00:27:46,890 captured the first 717 00:27:46,890 --> 00:27:49,720 [Music] 718 00:27:49,720 --> 00:27:51,840 flag all right so with that I'm going to 719 00:27:51,840 --> 00:27:54,519 give you all uh 15 more minutes to try 720 00:27:54,519 --> 00:27:56,760 to capture the next flag it's similar 721 00:27:56,760 --> 00:27:58,440 except there's one more hop that you 722 00:27:58,440 --> 00:27:59,799 need to do you need to go from one 723 00:27:59,799 --> 00:28:02,240 identity to another identity and then 724 00:28:02,240 --> 00:28:04,440 you'll be able to capture the flag right 725 00:28:04,440 --> 00:28:06,559 in on a penetration test that's often 726 00:28:06,559 --> 00:28:08,320 the name of the game as soon as you get 727 00:28:08,320 --> 00:28:09,440 access to new credentials and new 728 00:28:09,440 --> 00:28:10,919 identity that's a new set of permissions 729 00:28:10,919 --> 00:28:12,640 that you have access to it might be 730 00:28:12,640 --> 00:28:14,440 fewer permissions that you previous had 731 00:28:14,440 --> 00:28:16,279 access to it might be more and it's kind 732 00:28:16,279 --> 00:28:17,840 of just following that path until you 733 00:28:17,840 --> 00:28:18,840 get to the 734 00:28:18,840 --> 00:28:21,320 objective so please uh raise your hand 735 00:28:21,320 --> 00:28:23,360 if you have questions if you need help 736 00:28:23,360 --> 00:28:25,120 uh on any of the access or have 737 00:28:25,120 --> 00:28:27,160 questions about the challenges 738 00:28:27,160 --> 00:28:30,339 [Music] 739 00:28:31,279 --> 00:28:34,600 I CES oh is nothing happening there yeah 740 00:28:34,600 --> 00:28:37,840 I can use a uh maybe try just refreshing 741 00:28:37,840 --> 00:28:40,799 and please keep your hand raised huh I 742 00:28:40,799 --> 00:28:43,840 TR many times 743 00:28:45,440 --> 00:28:48,760 yeah let's 744 00:28:50,080 --> 00:28:52,799 see okay 745 00:28:52,799 --> 00:28:56,480 yeah let's see if it LO this time okay 746 00:28:56,480 --> 00:28:59,080 oh you're in La um yeah go back to that 747 00:28:59,080 --> 00:29:00,840 one 748 00:29:00,840 --> 00:29:03,320 yep Oh weird maybe try making it bigger 749 00:29:03,320 --> 00:29:05,000 and 750 00:29:05,000 --> 00:29:08,000 smaller 751 00:29:09,039 --> 00:29:11,159 uh you know what you can I mean you can 752 00:29:11,159 --> 00:29:13,120 go to go to the 753 00:29:13,120 --> 00:29:16,840 IDE and oh that doesn't work either yeah 754 00:29:16,840 --> 00:29:18,320 um do you want to try in another browser 755 00:29:18,320 --> 00:29:20,799 or incognito mode 756 00:29:20,799 --> 00:29:23,120 maybe try that and I'll come back you 757 00:29:23,120 --> 00:29:26,320 can loog log in again and then uh 758 00:29:26,320 --> 00:29:28,600 yeah yeah 759 00:29:28,600 --> 00:29:31,279 hi so two questions uh 760 00:29:31,279 --> 00:29:34,159 first uh I don't see the output in there 761 00:29:34,159 --> 00:29:36,240 oh did you do that command go up to the 762 00:29:36,240 --> 00:29:39,799 top uh this this one do run click the 763 00:29:39,799 --> 00:29:42,480 terminal ah okay and then this will 764 00:29:42,480 --> 00:29:45,960 reset okay now open the 765 00:29:47,760 --> 00:29:50,720 ID uh okay okay so now it's way better 766 00:29:50,720 --> 00:29:53,600 yeah awesome thank you yeah so yeah yeah 767 00:29:53,600 --> 00:29:57,720 we supposed to be uh like working uh 768 00:29:57,720 --> 00:29:58,840 basically we supposed to be 769 00:29:58,840 --> 00:30:01,240 impersonating 770 00:30:01,240 --> 00:30:04,880 the the staging user not right not that 771 00:30:04,880 --> 00:30:06,399 yeah you can use this one for read only 772 00:30:06,399 --> 00:30:08,360 access but this is the one you want to 773 00:30:08,360 --> 00:30:10,039 start from so it's the profile Cloud 774 00:30:10,039 --> 00:30:13,279 foxable gotcha and so L into the ID 775 00:30:13,279 --> 00:30:17,159 there this one yes um oh you can't log 776 00:30:17,159 --> 00:30:19,519 in as Cloud foxable to the console so 777 00:30:19,519 --> 00:30:21,600 you'll just use the CTF starting user on 778 00:30:21,600 --> 00:30:22,679 the 779 00:30:22,679 --> 00:30:26,760 CI ah okay okay so you wanted to browse 780 00:30:26,760 --> 00:30:28,720 the f d on the 781 00:30:28,720 --> 00:30:30,760 but I don't think that's possible oh no 782 00:30:30,760 --> 00:30:33,240 no you can yeah there's um here can you 783 00:30:33,240 --> 00:30:36,039 it yeah if anybody else has that uh this 784 00:30:36,039 --> 00:30:38,679 one it's at the top of challenge one so 785 00:30:38,679 --> 00:30:40,760 yeah you have to move the f one yeah 786 00:30:40,760 --> 00:30:42,159 that will restart the browser and point 787 00:30:42,159 --> 00:30:43,880 the default location 788 00:30:43,880 --> 00:30:46,519 to so what 789 00:30:46,519 --> 00:30:49,960 this so uh that yeah that just allows 790 00:30:49,960 --> 00:30:53,080 you to log in as this role um so you can 791 00:30:53,080 --> 00:30:54,799 use that to hunt around but what I want 792 00:30:54,799 --> 00:30:58,120 you to do is use the AWS CLI and Cloud 793 00:30:58,120 --> 00:30:59,559 to get the actual 794 00:30:59,559 --> 00:31:02,918 commands or get the 795 00:31:03,159 --> 00:31:06,399 flags any 796 00:31:09,320 --> 00:31:12,200 questions huh how good so far good yeah 797 00:31:12,200 --> 00:31:14,200 and they have internet yeah I think cuz 798 00:31:14,200 --> 00:31:15,279 everybody's leaving at the end of the 799 00:31:15,279 --> 00:31:19,960 day maybe yeah 800 00:31:21,600 --> 00:31:26,559 than yeah uh any any better luck oh 801 00:31:26,559 --> 00:31:29,918 okay cross 802 00:31:33,600 --> 00:31:38,158 fingers that's so weird oh 803 00:31:40,720 --> 00:31:44,080 no nothing 804 00:31:45,720 --> 00:31:47,840 works I don't know the only other thing 805 00:31:47,840 --> 00:31:52,639 maybe try uh to create a new account and 806 00:31:52,639 --> 00:31:54,519 I've never seen that what is it just 807 00:31:54,519 --> 00:31:56,519 nothing's loading what browser are you 808 00:31:56,519 --> 00:32:00,240 using he was using Chrome the Chrome are 809 00:32:00,240 --> 00:32:03,600 you logged into VPN VPN is going to I'll 810 00:32:03,600 --> 00:32:05,279 be right back did you have any questions 811 00:32:05,279 --> 00:32:07,559 for me 812 00:32:07,559 --> 00:32:11,200 no couple questions so a p typically 813 00:32:11,200 --> 00:32:13,960 whats apart from security audit policy 814 00:32:13,960 --> 00:32:16,880 you would ask for your client or your 815 00:32:16,880 --> 00:32:19,639 team to gr great great question okay 816 00:32:19,639 --> 00:32:21,519 actually I should talk that to everybody 817 00:32:21,519 --> 00:32:24,480 basically what we ask is for two uh sets 818 00:32:24,480 --> 00:32:26,639 of permissions give us one user or role 819 00:32:26,639 --> 00:32:28,600 that has the security audit it but then 820 00:32:28,600 --> 00:32:30,159 also give us another one that has the 821 00:32:30,159 --> 00:32:32,080 objective based permissions so if you're 822 00:32:32,080 --> 00:32:34,519 going to simulate a developer right give 823 00:32:34,519 --> 00:32:36,279 us the role or just let us assume like 824 00:32:36,279 --> 00:32:38,519 the developer role and start from that 825 00:32:38,519 --> 00:32:41,360 um okay yeah so it depends it depends 826 00:32:41,360 --> 00:32:42,760 based on the scenario who you're trying 827 00:32:42,760 --> 00:32:44,360 to simulate okay you know if you want to 828 00:32:44,360 --> 00:32:45,480 make sure that your developers can't 829 00:32:45,480 --> 00:32:46,840 write to prod that's a good place to 830 00:32:46,840 --> 00:32:49,000 start maybe you have like an Ops Team or 831 00:32:49,000 --> 00:32:51,440 maybe you know um or maybe you're 832 00:32:51,440 --> 00:32:54,279 starting from a workload so in that case 833 00:32:54,279 --> 00:32:56,000 you can just give us access to the 834 00:32:56,000 --> 00:32:59,159 workload and then whatever IM policy 835 00:32:59,159 --> 00:33:00,760 would normally go on a workload like 836 00:33:00,760 --> 00:33:02,399 that you'd add 837 00:33:02,399 --> 00:33:05,639 that second 838 00:33:05,639 --> 00:33:10,120 question is it so you know Scout right 839 00:33:10,120 --> 00:33:13,559 it does the unra and stuff so is it like 840 00:33:13,559 --> 00:33:16,360 noisy like Scout or this 841 00:33:16,360 --> 00:33:20,760 is yeah so it's noisy um but it purpose 842 00:33:20,760 --> 00:33:22,639 is different Scout Suite is kind of it's 843 00:33:22,639 --> 00:33:24,080 it's one of those tools like cspm it's 844 00:33:24,080 --> 00:33:26,440 measuring against the base uh Baseline 845 00:33:26,440 --> 00:33:28,399 and it's supposed to give you findings I 846 00:33:28,399 --> 00:33:30,000 purposely made Cloud Fox it doesn't give 847 00:33:30,000 --> 00:33:32,440 you findings it just gives you threads 848 00:33:32,440 --> 00:33:35,440 that look might lead to findings things 849 00:33:35,440 --> 00:33:37,960 to search for it gives you like IP 850 00:33:37,960 --> 00:33:42,000 addresses to scan um it what happens 851 00:33:42,000 --> 00:33:44,279 it's just a quick way to like if you get 852 00:33:44,279 --> 00:33:45,559 access to a new role you can just 853 00:33:45,559 --> 00:33:46,840 quickly see what permissions that role 854 00:33:46,840 --> 00:33:48,399 has without expanding all of those 855 00:33:48,399 --> 00:33:50,840 policies so it's like a helper tool okay 856 00:33:50,840 --> 00:33:52,799 so that Ro only needs like a security 857 00:33:52,799 --> 00:33:55,360 audit policy uh the cloud Fox yeah 858 00:33:55,360 --> 00:33:56,880 exactly it it's built to work with 859 00:33:56,880 --> 00:33:59,600 mostly security audit uh permissions and 860 00:33:59,600 --> 00:34:04,199 it's open source open source yeah yeah 861 00:34:09,320 --> 00:34:11,839 yeah so one great question that I just 862 00:34:11,839 --> 00:34:14,320 had uh is when we're doing a a cloud 863 00:34:14,320 --> 00:34:16,480 penetration test what permissions do we 864 00:34:16,480 --> 00:34:19,918 ask for and so the answer is usually 865 00:34:19,918 --> 00:34:22,159 what we do is we say give us two 866 00:34:22,159 --> 00:34:24,520 principles one principle with this white 867 00:34:24,520 --> 00:34:26,879 box security audit type access and then 868 00:34:26,879 --> 00:34:28,800 the other principle to to simulate the 869 00:34:28,800 --> 00:34:31,159 starting point so if it's a user a 870 00:34:31,159 --> 00:34:33,639 developer give us you know a access to a 871 00:34:33,639 --> 00:34:34,960 role that you would normally give to 872 00:34:34,960 --> 00:34:37,159 that type of user or in the case of a 873 00:34:37,159 --> 00:34:40,159 compromised application or workload give 874 00:34:40,159 --> 00:34:42,040 us the access to the workload but then 875 00:34:42,040 --> 00:34:44,399 attach an IM policy that would 876 00:34:44,399 --> 00:34:46,760 traditionally or normally be applied to 877 00:34:46,760 --> 00:34:48,599 a workload like that and that's so the 878 00:34:48,599 --> 00:34:50,679 one is your auditing type you know role 879 00:34:50,679 --> 00:34:52,560 for white box testing and your other one 880 00:34:52,560 --> 00:34:55,440 is your objective based access and 881 00:34:55,440 --> 00:34:57,320 sometimes we start penetration tests 882 00:34:57,320 --> 00:34:59,200 with no I am permissions right kind of 883 00:34:59,200 --> 00:35:01,839 like that plugging into the network um 884 00:35:01,839 --> 00:35:04,160 and and that's the case 885 00:35:04,160 --> 00:35:07,350 [Music] 886 00:35:11,480 --> 00:35:14,119 too so I was having this issue so we 887 00:35:14,119 --> 00:35:16,520 restarted for the head and I keep 888 00:35:16,520 --> 00:35:18,359 getting as soon as I run this I keep 889 00:35:18,359 --> 00:35:20,160 getting this I have oh and then that's a 890 00:35:20,160 --> 00:35:21,680 signin link you click that and it'll 891 00:35:21,680 --> 00:35:23,839 open up a tab that is a link it it lines 892 00:35:23,839 --> 00:35:26,520 it logs you in yeah it's really cool so 893 00:35:26,520 --> 00:35:28,480 yeah just log out first and then if you 894 00:35:28,480 --> 00:35:29,839 click that link 895 00:35:29,839 --> 00:35:34,040 again okay so now click that link 896 00:35:34,160 --> 00:35:38,800 again and then it should open up yeah 897 00:35:38,800 --> 00:35:40,640 and so now you're logged in this isn't 898 00:35:40,640 --> 00:35:42,000 the cloud foxable profile it's a 899 00:35:42,000 --> 00:35:43,079 different one but it kind of has that 900 00:35:43,079 --> 00:35:44,440 security audited type position okay now 901 00:35:44,440 --> 00:35:45,960 I should be able to get the other steps 902 00:35:45,960 --> 00:35:48,480 going uh yeah this is just yeah you 903 00:35:48,480 --> 00:35:51,839 don't yeah yeah are you doing one or two 904 00:35:51,839 --> 00:35:53,560 um it's a secret it's a secret okay 905 00:35:53,560 --> 00:35:54,920 that's one we did together if you want 906 00:35:54,920 --> 00:35:56,359 you can skip that one and do the second 907 00:35:56,359 --> 00:35:58,079 one and they're similar but I'm glad I 908 00:35:58,079 --> 00:35:59,280 did cuz yeah this is where I was getting 909 00:35:59,280 --> 00:36:02,080 stuck so thank you 910 00:36:02,080 --> 00:36:05,179 [Music] 911 00:36:24,280 --> 00:36:27,280 yeah all right so what I'm going to do 912 00:36:27,280 --> 00:36:28,480 since there's a lot of people that don't 913 00:36:28,480 --> 00:36:31,119 have laptops I'm not going to talk about 914 00:36:31,119 --> 00:36:32,480 what I'm doing so if you're doing this 915 00:36:32,480 --> 00:36:34,079 on your own go for it but I'm just going 916 00:36:34,079 --> 00:36:36,079 to kind of silently work through the the 917 00:36:36,079 --> 00:36:37,960 Second Challenge just to kind of you 918 00:36:37,960 --> 00:36:39,119 know so you can have something to look 919 00:36:39,119 --> 00:36:42,119 at 920 00:37:17,319 --> 00:37:18,760 tell people that there seaks on the 921 00:37:18,760 --> 00:37:20,400 front people were saying that they were 922 00:37:20,400 --> 00:37:23,160 having a paring yeah if anybody's having 923 00:37:23,160 --> 00:37:24,599 a hard time Hearing in the back there's 924 00:37:24,599 --> 00:37:26,640 a bunch of seats in the front so I 925 00:37:26,640 --> 00:37:28,480 encourage you to kind of move on move on 926 00:37:28,480 --> 00:37:30,610 up 927 00:37:30,610 --> 00:37:35,639 [Music] 928 00:38:00,319 --> 00:38:03,319 basic 929 00:38:42,470 --> 00:38:45,580 [Music] 930 00:38:52,720 --> 00:38:55,359 it is extremely 931 00:38:55,359 --> 00:38:59,440 complicated it does seem 932 00:39:06,880 --> 00:39:11,079 way child like hey you haven't updated 933 00:39:11,079 --> 00:39:14,450 yet maybe should 934 00:39:14,450 --> 00:39:17,540 [Music] 935 00:39:27,480 --> 00:39:30,480 I 936 00:40:10,440 --> 00:40:14,520 is there any way to Super 937 00:40:50,440 --> 00:40:53,440 any 938 00:41:09,160 --> 00:41:12,160 all 939 00:41:30,760 --> 00:41:33,760 this 940 00:42:19,640 --> 00:42:22,640 mat 941 00:42:23,510 --> 00:42:26,699 [Music] 942 00:42:37,200 --> 00:42:40,200 have 943 00:42:57,280 --> 00:43:01,720 you're you're on your team 944 00:43:52,280 --> 00:43:55,280 so 945 00:44:08,890 --> 00:44:12,009 [Music] 946 00:44:16,359 --> 00:44:19,640 that's where 947 00:44:33,590 --> 00:44:35,760 [Music] 948 00:44:35,760 --> 00:44:38,760 ch 949 00:45:04,720 --> 00:45:06,640 all right so we're going to go through 950 00:45:06,640 --> 00:45:08,640 and talk about uh some of the things 951 00:45:08,640 --> 00:45:10,720 that we tried to learn during these 952 00:45:10,720 --> 00:45:13,720 challenges 953 00:45:27,559 --> 00:45:29,960 all right so let's do a quick review of 954 00:45:29,960 --> 00:45:31,400 of i 955 00:45:31,400 --> 00:45:35,359 principles so i principles consist of IM 956 00:45:35,359 --> 00:45:37,359 users and IM 957 00:45:37,359 --> 00:45:40,240 roles users can have long-term access 958 00:45:40,240 --> 00:45:42,720 cred long-term security credentials and 959 00:45:42,720 --> 00:45:44,559 roles have temporary security 960 00:45:44,559 --> 00:45:46,400 credentials so for users that's either a 961 00:45:46,400 --> 00:45:51,160 username and password or that is um API 962 00:45:51,160 --> 00:45:54,240 keys for a while it was the best 963 00:45:54,240 --> 00:45:56,040 practice was users were used for human 964 00:45:56,040 --> 00:45:59,200 users roles used for service accounts 965 00:45:59,200 --> 00:46:01,240 but over the years we've all learned 966 00:46:01,240 --> 00:46:03,880 that users will absolutely save their 967 00:46:03,880 --> 00:46:05,240 credentials in places that they're not 968 00:46:05,240 --> 00:46:07,440 supposed to save them so the general 969 00:46:07,440 --> 00:46:09,319 recommendation the general best practice 970 00:46:09,319 --> 00:46:13,040 these days is to not use IM users like 971 00:46:13,040 --> 00:46:16,520 at all like as a last resort because we 972 00:46:16,520 --> 00:46:18,720 have this concept of Federated identity 973 00:46:18,720 --> 00:46:20,720 so now you can have Federated identity 974 00:46:20,720 --> 00:46:23,079 providers like OCTA like Google 975 00:46:23,079 --> 00:46:25,920 workspace like Azure active 976 00:46:25,920 --> 00:46:28,200 directory authenticate the user and 977 00:46:28,200 --> 00:46:30,800 verify their identity and then you can 978 00:46:30,800 --> 00:46:32,839 have roles that are only allowed to be 979 00:46:32,839 --> 00:46:36,160 assumed by particular OCTA groups or a 980 00:46:36,160 --> 00:46:37,760 active directory groups and things like 981 00:46:37,760 --> 00:46:39,599 that so you can have a role called 982 00:46:39,599 --> 00:46:41,800 developer and then all of the developers 983 00:46:41,800 --> 00:46:43,760 can access that role and then you never 984 00:46:43,760 --> 00:46:45,359 have to worry about long-term access 985 00:46:45,359 --> 00:46:46,640 Keys ever 986 00:46:46,640 --> 00:46:49,079 again so what do they look like this is 987 00:46:49,079 --> 00:46:52,880 a this is a user a user has permissions 988 00:46:52,880 --> 00:46:54,920 and the permissions are one or more 989 00:46:54,920 --> 00:46:57,200 policies and then you have roles also 990 00:46:57,200 --> 00:46:59,000 have permissions one or more policies 991 00:46:59,000 --> 00:47:00,160 that make up the 992 00:47:00,160 --> 00:47:01,960 permissions but the difference is that 993 00:47:01,960 --> 00:47:04,680 rols have this trust policy this trust 994 00:47:04,680 --> 00:47:06,720 relationship and this is what that looks 995 00:47:06,720 --> 00:47:09,640 like so this 996 00:47:10,240 --> 00:47:13,680 is this is a ro trust policy saying that 997 00:47:13,680 --> 00:47:16,680 the CTF starting user can assume this 998 00:47:16,680 --> 00:47:20,000 role this like a run as uh in in Windows 999 00:47:20,000 --> 00:47:21,359 for 1000 00:47:21,359 --> 00:47:24,079 example and so what did we do in our 1001 00:47:24,079 --> 00:47:26,079 first three challenges in the first one 1002 00:47:26,079 --> 00:47:28,119 we started with CTF starting user it 1003 00:47:28,119 --> 00:47:31,920 simply had permission to get parameter 1004 00:47:31,920 --> 00:47:33,880 for the flag it's a 1005 00:47:33,880 --> 00:47:36,319 secret now the second one that some of 1006 00:47:36,319 --> 00:47:38,640 you worked on yourself this time the 1007 00:47:38,640 --> 00:47:41,720 user had to assume another role first 1008 00:47:41,720 --> 00:47:43,680 this is a path that we use a lot on 1009 00:47:43,680 --> 00:47:45,480 cloud penetration tests because it's 1010 00:47:45,480 --> 00:47:47,440 really complex people make mistakes with 1011 00:47:47,440 --> 00:47:49,800 ro trust policies all the time and so as 1012 00:47:49,800 --> 00:47:52,760 CTF starting user we assumed Z Zs had 1013 00:47:52,760 --> 00:47:57,480 the ability to get it's a secret 1014 00:47:57,680 --> 00:47:59,480 and so so here's a fun thing to think 1015 00:47:59,480 --> 00:48:01,680 about right when you say who has the 1016 00:48:01,680 --> 00:48:04,319 ability to access it's a secret if 1017 00:48:04,319 --> 00:48:06,079 you're not thinking about transitive 1018 00:48:06,079 --> 00:48:07,280 trust if you're not thinking about 1019 00:48:07,280 --> 00:48:09,640 privilege escalation you might say oh SS 1020 00:48:09,640 --> 00:48:12,520 has the ability to get this secret right 1021 00:48:12,520 --> 00:48:14,319 but if you're thinking like an attacker 1022 00:48:14,319 --> 00:48:16,160 you have to your model your threat model 1023 00:48:16,160 --> 00:48:18,599 has to include CTF starting user has the 1024 00:48:18,599 --> 00:48:20,880 ability to get to SS who can get to the 1025 00:48:20,880 --> 00:48:22,640 secret so both of them have access to 1026 00:48:22,640 --> 00:48:23,440 the 1027 00:48:23,440 --> 00:48:26,480 secret and this is a a real fun one this 1028 00:48:26,480 --> 00:48:29,200 is a Ro assumption chain so what I 1029 00:48:29,200 --> 00:48:30,720 wanted to show you in this challenge is 1030 00:48:30,720 --> 00:48:31,839 that there are a lot of different ways 1031 00:48:31,839 --> 00:48:36,240 to mess up or to give uh access from one 1032 00:48:36,240 --> 00:48:38,720 principle to a role and so in the first 1033 00:48:38,720 --> 00:48:40,880 one we have the scenario where Kent has 1034 00:48:40,880 --> 00:48:44,040 permission SDS assume roll star and 1035 00:48:44,040 --> 00:48:47,920 beard has this concept of trusting colon 1036 00:48:47,920 --> 00:48:50,880 root so what a lot of people think is 1037 00:48:50,880 --> 00:48:52,880 that when you trust colon root you're 1038 00:48:52,880 --> 00:48:55,440 trusting the root user the first user 1039 00:48:55,440 --> 00:48:57,799 you use to create the us account that is 1040 00:48:57,799 --> 00:48:59,680 not the case what this colon root 1041 00:48:59,680 --> 00:49:02,040 notation means is that this role can be 1042 00:49:02,040 --> 00:49:05,160 assumed by any principal in this account 1043 00:49:05,160 --> 00:49:07,319 provided that principal has the forward 1044 00:49:07,319 --> 00:49:11,119 SDS assume roll permission so if you 1045 00:49:11,119 --> 00:49:13,119 ever have a principal that has assume 1046 00:49:13,119 --> 00:49:15,799 roll star all you need to do is look at 1047 00:49:15,799 --> 00:49:17,480 all the roles and any of them that trust 1048 00:49:17,480 --> 00:49:20,319 colon root you have access to so the STS 1049 00:49:20,319 --> 00:49:22,000 assume roll star is a very dangerous 1050 00:49:22,000 --> 00:49:24,960 permission because of that so now we 1051 00:49:24,960 --> 00:49:27,240 know beard can access lasso 1052 00:49:27,240 --> 00:49:29,000 but this is confusing cuz beard doesn't 1053 00:49:29,000 --> 00:49:31,200 have any permissions whatsoever so how 1054 00:49:31,200 --> 00:49:33,200 is this 1055 00:49:33,200 --> 00:49:36,960 possible because if lasso explicitly 1056 00:49:36,960 --> 00:49:39,839 names the RN for 1057 00:49:39,839 --> 00:49:42,720 Beard beard doesn't need permission it's 1058 00:49:42,720 --> 00:49:45,119 explicitly granted this this one this is 1059 00:49:45,119 --> 00:49:46,720 one of the few cases where you can have 1060 00:49:46,720 --> 00:49:48,880 one-way trust the rooll trust 1061 00:49:48,880 --> 00:49:50,920 relationship allows the Assumption by 1062 00:49:50,920 --> 00:49:53,960 beard without any permissions now this 1063 00:49:53,960 --> 00:49:56,000 luckily this doesn't work cross account 1064 00:49:56,000 --> 00:49:59,520 so if beard was in another AWS account 1065 00:49:59,520 --> 00:50:01,200 it would have to have the SS assum roll 1066 00:50:01,200 --> 00:50:04,160 permission but intra account even if you 1067 00:50:04,160 --> 00:50:07,240 don't think you have access to uh assume 1068 00:50:07,240 --> 00:50:09,680 lasso it can't hurt to try to assume all 1069 00:50:09,680 --> 00:50:12,119 the roles that you can 1070 00:50:12,119 --> 00:50:14,240 enumerate all right so with lab two 1071 00:50:14,240 --> 00:50:15,240 we're going to talk about the 1072 00:50:15,240 --> 00:50:17,040 compromised workload 1073 00:50:17,040 --> 00:50:19,160 scenarios so we're going to say that a 1074 00:50:19,160 --> 00:50:21,000 workload has been compromised the 1075 00:50:21,000 --> 00:50:23,520 workload lives in a cloud environment 1076 00:50:23,520 --> 00:50:24,839 and we want to measure what is the 1077 00:50:24,839 --> 00:50:27,400 impact of a compromised workload 1078 00:50:27,400 --> 00:50:29,319 [Music] 1079 00:50:29,319 --> 00:50:32,599 so when I train uh junior penetration 1080 00:50:32,599 --> 00:50:35,040 testers I like to to talk about these 1081 00:50:35,040 --> 00:50:36,960 three pillars when you're when you have 1082 00:50:36,960 --> 00:50:40,040 access to a workload you have network 1083 00:50:40,040 --> 00:50:42,880 access to the VPC most likely sometimes 1084 00:50:42,880 --> 00:50:44,520 you have access like a to a Lambda that 1085 00:50:44,520 --> 00:50:46,280 doesn't have access to the bpc but if 1086 00:50:46,280 --> 00:50:48,440 it's a a kubernetes pod if it's an ec2 1087 00:50:48,440 --> 00:50:50,920 instance you do so can you exploit 1088 00:50:50,920 --> 00:50:52,640 anything else in the VPC traditional 1089 00:50:52,640 --> 00:50:54,880 Network scanning right can you find an 1090 00:50:54,880 --> 00:50:58,079 ssrf can you find an rce in another 1091 00:50:58,079 --> 00:51:00,040 application you might have access to an 1092 00:51:00,040 --> 00:51:01,920 IM role we covered this already right 1093 00:51:01,920 --> 00:51:03,680 any permissions that that workload has 1094 00:51:03,680 --> 00:51:05,559 access to you have access to use those 1095 00:51:05,559 --> 00:51:07,680 permissions try to enumerate them you 1096 00:51:07,680 --> 00:51:09,520 can enumerate them using blackbox 1097 00:51:09,520 --> 00:51:11,559 methods you can enumerate them using 1098 00:51:11,559 --> 00:51:14,440 white box if you have that level of 1099 00:51:14,440 --> 00:51:16,680 access and then lastly you have access 1100 00:51:16,680 --> 00:51:18,480 to that host right are there any 1101 00:51:18,480 --> 00:51:20,200 environment variables on that host that 1102 00:51:20,200 --> 00:51:22,839 have API keys or secrets are there any 1103 00:51:22,839 --> 00:51:24,880 files that have intellectual property or 1104 00:51:24,880 --> 00:51:26,839 secrets are there any running process 1105 00:51:26,839 --> 00:51:28,280 that are interesting is there any 1106 00:51:28,280 --> 00:51:29,920 service listening on local hosts that 1107 00:51:29,920 --> 00:51:31,440 maybe you can only access because you 1108 00:51:31,440 --> 00:51:33,240 compromise the host so that's kind of 1109 00:51:33,240 --> 00:51:35,359 your M your your highle playbook if 1110 00:51:35,359 --> 00:51:38,119 you've compromised a 1111 00:51:38,240 --> 00:51:40,200 workload okay so now we're going to 1112 00:51:40,200 --> 00:51:42,680 click next and get into lab two where 1113 00:51:42,680 --> 00:51:43,720 we're going to work on the Bastion 1114 00:51:43,720 --> 00:51:46,680 Challenge and the variable 1115 00:51:48,359 --> 00:51:50,720 Challenge and so since there's a lot of 1116 00:51:50,720 --> 00:51:53,280 people um here what I'm going to do is I 1117 00:51:53,280 --> 00:51:55,280 did make a video of of me exploiting 1118 00:51:55,280 --> 00:51:56,920 this challenge so I'm just going to play 1119 00:51:56,920 --> 00:51:59,160 the video and and and talk through it or 1120 00:51:59,160 --> 00:52:00,160 actually no maybe I'll just do the 1121 00:52:00,160 --> 00:52:01,839 challenge and talk through it so if you 1122 00:52:01,839 --> 00:52:04,359 have access to it feel free to do it on 1123 00:52:04,359 --> 00:52:05,920 your own but I'm going to kind of walk 1124 00:52:05,920 --> 00:52:08,599 through this one for 1125 00:52:13,520 --> 00:52:15,599 everybody and there's still R seats at 1126 00:52:15,599 --> 00:52:17,319 the front so if you have a hard time 1127 00:52:17,319 --> 00:52:19,000 hearing or you want to see the screen 1128 00:52:19,000 --> 00:52:23,970 better uh look for a seat up front 1129 00:52:23,970 --> 00:52:26,640 [Music] 1130 00:52:26,640 --> 00:52:29,640 you 1131 00:53:23,240 --> 00:53:27,240 are the same Bo as me 1132 00:53:41,640 --> 00:53:42,799 all right so first one I'm just going to 1133 00:53:42,799 --> 00:53:45,240 do is I'm going to use ec2 describe uh 1134 00:53:45,240 --> 00:53:46,920 instances and we're going to list all 1135 00:53:46,920 --> 00:53:49,440 the other instances um or all the 1136 00:53:49,440 --> 00:53:51,799 instances on the on the 1137 00:53:51,799 --> 00:53:54,400 VPC and now I'm going to show you 1138 00:53:54,400 --> 00:53:55,920 basically why we created a tool like 1139 00:53:55,920 --> 00:53:57,680 Cloud Fox to kind of just give you this 1140 00:53:57,680 --> 00:53:59,400 information in a much more digestible 1141 00:53:59,400 --> 00:54:01,319 way so here you see that there's two 1142 00:54:01,319 --> 00:54:04,280 instances one is Wyatt one is Bastion 1143 00:54:04,280 --> 00:54:06,820 and it's going to give us a loot 1144 00:54:06,820 --> 00:54:08,640 [Music] 1145 00:54:08,640 --> 00:54:11,680 file here with all of the SSM commands 1146 00:54:11,680 --> 00:54:16,598 so SSM is this really cool feature uh 1147 00:54:17,020 --> 00:54:20,380 [Music] 1148 00:54:24,079 --> 00:54:27,480 it so SSM is an IM am permission that 1149 00:54:27,480 --> 00:54:29,640 allows you to connect to an ec2 instance 1150 00:54:29,640 --> 00:54:32,480 provided it has a few prerequisites it 1151 00:54:32,480 --> 00:54:34,000 has to be a modern version of Amazon 1152 00:54:34,000 --> 00:54:36,000 linux2 or Ubuntu it has to basically 1153 00:54:36,000 --> 00:54:38,720 have the SSM client installed it also 1154 00:54:38,720 --> 00:54:40,520 has to have a specific policy installed 1155 00:54:40,520 --> 00:54:44,240 as well but so it's a really great uh 1156 00:54:44,240 --> 00:54:45,960 mechanism for connecting without having 1157 00:54:45,960 --> 00:54:47,960 to worry about giving SSH keys that can 1158 00:54:47,960 --> 00:54:50,680 be lost from a uh a Defender point of 1159 00:54:50,680 --> 00:54:53,720 view but from attacker this means now 1160 00:54:53,720 --> 00:54:55,799 you can potentially just get an I am 1161 00:54:55,799 --> 00:54:57,880 permission allows you to connect to ec2 1162 00:54:57,880 --> 00:55:00,000 instances which is in a lot of ways 1163 00:55:00,000 --> 00:55:03,360 sometimes easier than finding an SSH 1164 00:55:03,360 --> 00:55:06,519 [Music] 1165 00:55:17,960 --> 00:55:20,000 ke so we're going to use this second 1166 00:55:20,000 --> 00:55:22,599 terminal here to connect to uh the SSL 1167 00:55:22,599 --> 00:55:27,000 oh I forgot to 1168 00:55:34,290 --> 00:55:37,440 [Music] 1169 00:55:50,119 --> 00:55:52,480 all right so the first thing you want to 1170 00:55:52,480 --> 00:55:55,200 do if you have access to an instance is 1171 00:55:55,200 --> 00:55:57,280 check the instance metadata service and 1172 00:55:57,280 --> 00:55:59,319 see if you have access to the instance 1173 00:55:59,319 --> 00:56:00,440 metadata service so that's what we're 1174 00:56:00,440 --> 00:56:02,640 going to do right here and this means we 1175 00:56:02,640 --> 00:56:05,160 we do we we curl the metadata service 1176 00:56:05,160 --> 00:56:07,359 169 2554 169 1177 00:56:07,359 --> 00:56:09,319 254 and then the next thing we're going 1178 00:56:09,319 --> 00:56:11,920 to do is if it has an IM Ro attached to 1179 00:56:11,920 --> 00:56:14,580 it we will be able 1180 00:56:14,580 --> 00:56:16,799 [Music] 1181 00:56:16,799 --> 00:56:19,799 to so what we did is we modified that to 1182 00:56:19,799 --> 00:56:22,680 include metadata IM security credentials 1183 00:56:22,680 --> 00:56:25,640 and the role name is Raina so now all we 1184 00:56:25,640 --> 00:56:29,759 have to do is basically hit the up 1185 00:56:31,680 --> 00:56:34,000 Arrow add the name and now we have 1186 00:56:34,000 --> 00:56:36,839 access to the credentials but here's the 1187 00:56:36,839 --> 00:56:38,920 cool thing you can use these credentials 1188 00:56:38,920 --> 00:56:41,559 and take them off the the compromised 1189 00:56:41,559 --> 00:56:43,920 ec2 instance use them on your laptop use 1190 00:56:43,920 --> 00:56:45,760 them on your attacker box and that's 1191 00:56:45,760 --> 00:56:47,839 absolutely fine but you can also live 1192 00:56:47,839 --> 00:56:51,599 off the land right so we can do 1193 00:56:54,839 --> 00:56:57,720 which and a lot of times hey the AWS CLI 1194 00:56:57,720 --> 00:56:59,319 is already installed here so we don't 1195 00:56:59,319 --> 00:57:01,319 have to steal those credentials we can 1196 00:57:01,319 --> 00:57:02,559 just do an 1197 00:57:02,559 --> 00:57:06,599 AWS uh s TS get 1198 00:57:06,599 --> 00:57:09,599 Coler 1199 00:57:14,280 --> 00:57:16,400 identity and if we're lucky we'll get 1200 00:57:16,400 --> 00:57:18,720 the we'll we'll yeah so this is using 1201 00:57:18,720 --> 00:57:20,520 the instance metadata service under the 1202 00:57:20,520 --> 00:57:24,880 hood to to you know access the identity 1203 00:57:24,880 --> 00:57:26,559 and this is if you're talking about te 1204 00:57:26,559 --> 00:57:27,960 at this point it's a double-edged sword 1205 00:57:27,960 --> 00:57:30,440 right on one hand it's better to live 1206 00:57:30,440 --> 00:57:31,920 off the land but now you're if there's 1207 00:57:31,920 --> 00:57:33,400 agents on here they can detect what 1208 00:57:33,400 --> 00:57:35,559 you're doing right so in that way it 1209 00:57:35,559 --> 00:57:37,400 might be better to use the creds off on 1210 00:57:37,400 --> 00:57:38,799 the other hand there are ways to detect 1211 00:57:38,799 --> 00:57:41,000 if you use the creds off the box so if 1212 00:57:41,000 --> 00:57:43,680 you are a mature detection team you want 1213 00:57:43,680 --> 00:57:45,799 to be have you want to have detections 1214 00:57:45,799 --> 00:57:48,559 that'll say why is there an an IM Ro 1215 00:57:48,559 --> 00:57:50,400 assigned to an ec2 instance being used 1216 00:57:50,400 --> 00:57:55,079 completely outside of our VPC right 1217 00:58:00,000 --> 00:58:02,480 okay so now let and now here we got 1218 00:58:02,480 --> 00:58:05,200 access to an an E2 instance with an IM 1219 00:58:05,200 --> 00:58:07,720 roll what permissions does it have if we 1220 00:58:07,720 --> 00:58:09,480 have that white box access we can go to 1221 00:58:09,480 --> 00:58:11,319 our Cloud Fox account we can look for 1222 00:58:11,319 --> 00:58:14,039 permissions we already seen that pattern 1223 00:58:14,039 --> 00:58:17,640 U but we can also use a tool like Cloud 1224 00:58:17,640 --> 00:58:21,480 fox or a tool like uh enumerate I or 1225 00:58:21,480 --> 00:58:22,520 there's a bunch of different tools 1226 00:58:22,520 --> 00:58:24,799 that'll basically just throw the kitchen 1227 00:58:24,799 --> 00:58:26,880 sink right try to list all the lambdas 1228 00:58:26,880 --> 00:58:28,599 try to list all the cloud formation try 1229 00:58:28,599 --> 00:58:30,599 to list all the ec2s try to list all the 1230 00:58:30,599 --> 00:58:33,680 secrets and the way it works is if for 1231 00:58:33,680 --> 00:58:35,480 cloud Fox we didn't design it to work in 1232 00:58:35,480 --> 00:58:37,799 this way but if it's just checking 1233 00:58:37,799 --> 00:58:40,280 everything whatever you have access to 1234 00:58:40,280 --> 00:58:41,640 is what's going to show up so that's 1235 00:58:41,640 --> 00:58:43,280 what we're going to do right 1236 00:58:43,280 --> 00:58:45,760 here we're going to download cloud Fox 1237 00:58:45,760 --> 00:58:47,880 the 1238 00:58:48,000 --> 00:58:50,079 binary and then we're going to run Cloud 1239 00:58:50,079 --> 00:58:52,240 foxes inventory 1240 00:58:52,240 --> 00:58:54,440 command and this is doing exactly that 1241 00:58:54,440 --> 00:58:58,520 it's checking ECR eks elb blue grafana I 1242 00:58:58,520 --> 00:59:00,760 am Lambda and anything that comes out of 1243 00:59:00,760 --> 00:59:02,240 this means that we have permission at 1244 00:59:02,240 --> 00:59:06,119 least to list or describe right here's 1245 00:59:06,119 --> 00:59:07,960 the double-edged sword though just be 1246 00:59:07,960 --> 00:59:10,920 mindful you might have access to a role 1247 00:59:10,920 --> 00:59:13,400 in a blackbox scenario that role might 1248 00:59:13,400 --> 00:59:15,920 have access to get a particular file out 1249 00:59:15,920 --> 00:59:18,119 of an S3 bucket but if you don't have 1250 00:59:18,119 --> 00:59:20,440 the list buckets right or list all my 1251 00:59:20,440 --> 00:59:22,319 buckets permission you won't know in a 1252 00:59:22,319 --> 00:59:23,839 black Buck scenario that you have that 1253 00:59:23,839 --> 00:59:26,240 permission the way these work is first 1254 00:59:26,240 --> 00:59:28,720 they list all the buckets and then if 1255 00:59:28,720 --> 00:59:30,240 that's successful then it tries to do 1256 00:59:30,240 --> 00:59:32,599 the next step for each bucket so just be 1257 00:59:32,599 --> 00:59:35,280 mindful of that so here we do see that 1258 00:59:35,280 --> 00:59:40,119 we can list three S3 buckets so that's 1259 00:59:40,280 --> 00:59:42,559 great let's just confirm it using the 1260 00:59:42,559 --> 00:59:44,760 Straight Up AWS CLI on our compromis 1261 00:59:44,760 --> 00:59:47,760 workload 1262 00:59:57,319 --> 00:59:59,039 and here I'm just copying and pasting 1263 00:59:59,039 --> 01:00:00,400 I'm getting the name of the bucket the 1264 01:00:00,400 --> 01:00:02,839 Bastion bucket 1265 01:00:02,839 --> 01:00:04,920 here and now we're going to list all the 1266 01:00:04,920 --> 01:00:07,319 files in this bucket and look at that 1267 01:00:07,319 --> 01:00:09,319 here's the flag and so we're going to 1268 01:00:09,319 --> 01:00:13,279 use AWS S3 1269 01:00:14,119 --> 01:00:16,340 copy we just downloaded the 1270 01:00:16,340 --> 01:00:19,119 [Music] 1271 01:00:19,119 --> 01:00:21,319 flag and here's the flag for the Bastion 1272 01:00:21,319 --> 01:00:22,839 challenge so this is very 1273 01:00:22,839 --> 01:00:26,240 straightforward right uh on penetration 1274 01:00:26,240 --> 01:00:29,400 tests we often see overly permissive 1275 01:00:29,400 --> 01:00:31,640 workloads there are a lot of ec2 1276 01:00:31,640 --> 01:00:33,920 instances a lot of Lambda functions that 1277 01:00:33,920 --> 01:00:37,400 have a lot of permissions so definitely 1278 01:00:37,400 --> 01:00:38,799 this is something you want to look for 1279 01:00:38,799 --> 01:00:41,319 and as a Defender you really want to be 1280 01:00:41,319 --> 01:00:42,880 using the principle of lease privilege 1281 01:00:42,880 --> 01:00:44,799 right the best way to do that is by 1282 01:00:44,799 --> 01:00:46,920 using infrastructure as code when you 1283 01:00:46,920 --> 01:00:48,440 provision the instance when you're 1284 01:00:48,440 --> 01:00:50,799 provisioning the the bucket or the the 1285 01:00:50,799 --> 01:00:53,039 SNS topic or whatever you kind of use 1286 01:00:53,039 --> 01:00:55,000 your variable so that you're only giving 1287 01:00:55,000 --> 01:00:57,760 that resource access to that or that 1288 01:00:57,760 --> 01:00:59,520 workload access to the resources it 1289 01:00:59,520 --> 01:01:02,520 needs and that that's the way to thwart 1290 01:01:02,520 --> 01:01:03,780 uh these type of 1291 01:01:03,780 --> 01:01:06,680 [Music] 1292 01:01:06,680 --> 01:01:11,359 attacks all right so with the variable 1293 01:01:12,599 --> 01:01:14,640 challenge so this is another one this is 1294 01:01:14,640 --> 01:01:16,280 an interesting one in penetration 1295 01:01:16,280 --> 01:01:18,960 testing often you find pieces of 1296 01:01:18,960 --> 01:01:21,599 information through different ways right 1297 01:01:21,599 --> 01:01:23,240 you have access to SharePoint or you 1298 01:01:23,240 --> 01:01:25,240 have access to Confluence and you find 1299 01:01:25,240 --> 01:01:26,760 credentials 1300 01:01:26,760 --> 01:01:27,839 but maybe you can't use those 1301 01:01:27,839 --> 01:01:29,720 credentials right but then somewhere 1302 01:01:29,720 --> 01:01:31,440 later along the line you have access to 1303 01:01:31,440 --> 01:01:33,400 a new system and then that thing has 1304 01:01:33,400 --> 01:01:35,440 access to the service finally you put 1305 01:01:35,440 --> 01:01:37,319 those two pieces together you use the 1306 01:01:37,319 --> 01:01:40,079 credentials you use your new access and 1307 01:01:40,079 --> 01:01:42,599 now you can you know get to the database 1308 01:01:42,599 --> 01:01:43,720 and so that's what we're going to do 1309 01:01:43,720 --> 01:01:46,720 here so I'm going to show you um and in 1310 01:01:46,720 --> 01:01:48,240 doing this what we're going to do is 1311 01:01:48,240 --> 01:01:50,039 we're going to play with the tool pepper 1312 01:01:50,039 --> 01:01:52,000 which is by far my favorite tool at 1313 01:01:52,000 --> 01:01:54,279 mapping privilege escalation paths and 1314 01:01:54,279 --> 01:01:57,839 transitive uh Trust 1315 01:02:00,000 --> 01:02:01,380 all right so in terminal 1316 01:02:01,380 --> 01:02:06,039 [Music] 1317 01:02:06,039 --> 01:02:08,200 one so what we're going to do now is 1318 01:02:08,200 --> 01:02:10,640 we're going to do a Lambda list function 1319 01:02:10,640 --> 01:02:12,720 and what's interesting about this is 1320 01:02:12,720 --> 01:02:15,160 look at this the Lambda has environment 1321 01:02:15,160 --> 01:02:17,359 variables and if we have the permission 1322 01:02:17,359 --> 01:02:20,319 to list functions we can see all the 1323 01:02:20,319 --> 01:02:22,520 environment variables and people often 1324 01:02:22,520 --> 01:02:24,599 put all types of crazy stuff in Lambda 1325 01:02:24,599 --> 01:02:27,000 environment variables and this is wild 1326 01:02:27,000 --> 01:02:28,279 right because this is at the cloud 1327 01:02:28,279 --> 01:02:30,720 metadata service so we might not even 1328 01:02:30,720 --> 01:02:32,640 have access to run this Lambda function 1329 01:02:32,640 --> 01:02:34,880 we might not have access to upd update 1330 01:02:34,880 --> 01:02:36,680 the code for this Lambda function but 1331 01:02:36,680 --> 01:02:39,720 just by listing it we have right and and 1332 01:02:39,720 --> 01:02:41,359 we just have security audit permission 1333 01:02:41,359 --> 01:02:43,119 so you just gave all your developers 1334 01:02:43,119 --> 01:02:45,720 maybe readon or or security audit in 1335 01:02:45,720 --> 01:02:48,799 prod well if people are putting secrets 1336 01:02:48,799 --> 01:02:51,760 that are read right in the in the envir 1337 01:02:51,760 --> 01:02:53,680 environment variables then now your 1338 01:02:53,680 --> 01:02:55,440 developers with that read only access 1339 01:02:55,440 --> 01:02:59,440 have right access to some things and 1340 01:02:59,440 --> 01:03:03,319 so um one of my favorite uh Cloud Fox oh 1341 01:03:03,319 --> 01:03:04,930 actually here's 1342 01:03:04,930 --> 01:03:08,359 [Music] 1343 01:03:08,680 --> 01:03:11,039 uh 1344 01:03:11,039 --> 01:03:13,200 yeah one of my favorite Cloud Fox 1345 01:03:13,200 --> 01:03:14,839 commands is this environment variables 1346 01:03:14,839 --> 01:03:17,680 command which will enumerate I think I 1347 01:03:17,680 --> 01:03:20,880 say yeah app Runner ECS Lambda light s 1348 01:03:20,880 --> 01:03:22,880 containers and Sage maker so far the 1349 01:03:22,880 --> 01:03:24,440 ones that I have found that use this 1350 01:03:24,440 --> 01:03:26,039 pattern of environment variables at the 1351 01:03:26,039 --> 01:03:28,559 metadata layer and you could see let's 1352 01:03:28,559 --> 01:03:30,200 see I might have to make this a little 1353 01:03:30,200 --> 01:03:33,039 smaller but you could see we have uh a 1354 01:03:33,039 --> 01:03:34,440 bunch of lambdas with a bunch of 1355 01:03:34,440 --> 01:03:37,079 different credentials in them so this is 1356 01:03:37,079 --> 01:03:38,599 another challenge here's a Lambda with a 1357 01:03:38,599 --> 01:03:40,799 HTTP username and password and then this 1358 01:03:40,799 --> 01:03:43,640 is a nice representation of the RDS 1359 01:03:43,640 --> 01:03:45,880 username password the database name and 1360 01:03:45,880 --> 01:03:46,460 the 1361 01:03:46,460 --> 01:03:49,729 [Music] 1362 01:03:52,440 --> 01:03:56,440 host uh 1363 01:03:58,119 --> 01:04:01,119 but so to to save some time if I did end 1364 01:04:01,119 --> 01:04:03,799 map this RDS host name from this 1365 01:04:03,799 --> 01:04:05,599 terminal from you know the virtual 1366 01:04:05,599 --> 01:04:08,640 machine I don't have access to it right 1367 01:04:08,640 --> 01:04:10,799 but remember we have access to this 1368 01:04:10,799 --> 01:04:13,200 Bastion host over here and this Bastion 1369 01:04:13,200 --> 01:04:15,400 host does have access to it so really 1370 01:04:15,400 --> 01:04:16,559 the rest of this challenge is 1371 01:04:16,559 --> 01:04:20,720 essentially just using um that access oh 1372 01:04:20,720 --> 01:04:22,039 yeah let me show you P 1373 01:04:22,039 --> 01:04:24,480 mapper so now we know that just having 1374 01:04:24,480 --> 01:04:26,240 the fun the per the permission 1375 01:04:26,240 --> 01:04:28,400 Lambda list functions gives you access 1376 01:04:28,400 --> 01:04:30,640 to this so often times in a penetration 1377 01:04:30,640 --> 01:04:32,559 test and as a Defender you want to ask 1378 01:04:32,559 --> 01:04:34,680 the question who has access to this 1379 01:04:34,680 --> 01:04:37,400 permission right and so P mapper to the 1380 01:04:37,400 --> 01:04:40,720 rescue so P mapper uses um so this first 1381 01:04:40,720 --> 01:04:42,680 command is going to create a graph it's 1382 01:04:42,680 --> 01:04:44,720 going to look at all the IM policies 1383 01:04:44,720 --> 01:04:46,559 it's also going to look at all of the 1384 01:04:46,559 --> 01:04:48,599 resource policies right kind of like 1385 01:04:48,599 --> 01:04:50,880 that Ro trust you can have a a resource 1386 01:04:50,880 --> 01:04:52,839 policy applied to a bucket or a Lambda 1387 01:04:52,839 --> 01:04:55,400 function that says hey I'm a Lambda 1388 01:04:55,400 --> 01:04:56,920 function I'm going to say that these 1389 01:04:56,920 --> 01:04:58,680 three people these principles have 1390 01:04:58,680 --> 01:05:00,480 access to me it's kind of a different 1391 01:05:00,480 --> 01:05:02,559 model and it combines those and it 1392 01:05:02,559 --> 01:05:04,520 builds a graph and it said and allows 1393 01:05:04,520 --> 01:05:06,760 you to say okay these two roles have 1394 01:05:06,760 --> 01:05:09,559 access to this permission these uh eight 1395 01:05:09,559 --> 01:05:11,799 users have access to this permission and 1396 01:05:11,799 --> 01:05:13,520 it goes a step further and it might give 1397 01:05:13,520 --> 01:05:16,799 you a tack chain so to say this user can 1398 01:05:16,799 --> 01:05:19,720 Prest to this user who do who does have 1399 01:05:19,720 --> 01:05:21,640 access to list the functions and so 1400 01:05:21,640 --> 01:05:22,400 that's what we're going to see in a 1401 01:05:22,400 --> 01:05:25,160 minute 1402 01:05:25,160 --> 01:05:28,270 [Music] 1403 01:05:31,319 --> 01:05:33,319 and so there there's two ways to use uh 1404 01:05:33,319 --> 01:05:36,000 pepper you can look for just the Prest 1405 01:05:36,000 --> 01:05:38,359 paths but in this lab I've designed it 1406 01:05:38,359 --> 01:05:40,000 intentionally so that nobody has a 1407 01:05:40,000 --> 01:05:41,799 direct path to admin so we're going to 1408 01:05:41,799 --> 01:05:45,559 use the other uh mechanism this who can 1409 01:05:45,559 --> 01:05:47,359 I don't know if you can see this I don't 1410 01:05:47,359 --> 01:05:48,920 know if you can see this it says who can 1411 01:05:48,920 --> 01:05:51,720 do and then you put in the action with 1412 01:05:51,720 --> 01:05:53,319 and then you put in the resource and 1413 01:05:53,319 --> 01:05:57,599 then you can do conditions if you want 1414 01:05:58,720 --> 01:06:02,060 okay so now that the graph has been 1415 01:06:02,060 --> 01:06:04,680 [Music] 1416 01:06:04,680 --> 01:06:07,559 created so P mapper query who can do 1417 01:06:07,559 --> 01:06:09,400 Lambda list functions with 1418 01:06:09,400 --> 01:06:11,839 star and so this is that kind of 1419 01:06:11,839 --> 01:06:14,960 transitive trust right so we see 1420 01:06:14,960 --> 01:06:17,599 this user CTF starting user is 1421 01:06:17,599 --> 01:06:19,960 authorized to call it that's why the 1422 01:06:19,960 --> 01:06:21,920 cloud Fox command worked but check out 1423 01:06:21,920 --> 01:06:24,799 this Christian poisk over here can call 1424 01:06:24,799 --> 01:06:26,599 Lambda list function 1425 01:06:26,599 --> 01:06:29,079 because he can access Tab Ramos through 1426 01:06:29,079 --> 01:06:31,559 privileg escalation so Christian Pok can 1427 01:06:31,559 --> 01:06:34,680 create a stack in cloud formation that 1428 01:06:34,680 --> 01:06:37,960 then can and and has the permission then 1429 01:06:37,960 --> 01:06:40,839 to pass the roll Tab Ramos to that stack 1430 01:06:40,839 --> 01:06:43,400 so then in theory Christian P could 1431 01:06:43,400 --> 01:06:45,640 create a stack and the only purpose of 1432 01:06:45,640 --> 01:06:49,400 the stack is to create another role that 1433 01:06:49,400 --> 01:06:52,559 so that uh and oh no that's right the 1434 01:06:52,559 --> 01:06:55,359 stack can then list the function uh and 1435 01:06:55,359 --> 01:06:56,580 get the environment 1436 01:06:56,580 --> 01:07:00,630 [Music] 1437 01:07:22,000 --> 01:07:23,880 variables okay so now it's time to 1438 01:07:23,880 --> 01:07:26,300 finally get the flag we're going to copy 1439 01:07:26,300 --> 01:07:28,400 [Music] 1440 01:07:28,400 --> 01:07:29,720 we're going to get use cloud Fox's 1441 01:07:29,720 --> 01:07:31,119 database command to just quickly get the 1442 01:07:31,119 --> 01:07:32,510 name of that 1443 01:07:32,510 --> 01:07:36,849 [Music] 1444 01:07:38,319 --> 01:07:41,530 host and we're going to go to Terminal 2 1445 01:07:41,530 --> 01:07:45,109 [Music] 1446 01:07:48,000 --> 01:07:51,279 here and now we're going to install uh 1447 01:07:51,279 --> 01:07:54,039 nmap and confirm that we have access to 1448 01:07:54,039 --> 01:07:58,660 that host on uh 3306 which is the my SQL 1449 01:07:58,660 --> 01:08:05,899 [Music] 1450 01:08:11,480 --> 01:08:14,279 Port so on on a pent test this is a this 1451 01:08:14,279 --> 01:08:17,640 is kind of very much um created because 1452 01:08:17,640 --> 01:08:19,158 of a a cool finding I found on a 1453 01:08:19,158 --> 01:08:21,880 penetration test um this was a 1454 01:08:21,880 --> 01:08:25,158 kubernetes environment I had um access 1455 01:08:25,158 --> 01:08:27,279 to the kubernetes dashboard and I could 1456 01:08:27,279 --> 01:08:28,880 actually see all the environment 1457 01:08:28,880 --> 01:08:32,080 variables attached to uh the pods and I 1458 01:08:32,080 --> 01:08:33,920 found the credentials but I didn't have 1459 01:08:33,920 --> 01:08:36,040 network access uh from my initial 1460 01:08:36,040 --> 01:08:38,279 starting point but I did have access to 1461 01:08:38,279 --> 01:08:41,120 connect to the Pod so I then connected 1462 01:08:41,120 --> 01:08:43,640 to the Pod and then from there was able 1463 01:08:43,640 --> 01:08:47,560 to access the uh the RDS database and so 1464 01:08:47,560 --> 01:08:48,679 the next thing we're going to do is 1465 01:08:48,679 --> 01:08:51,158 we're going to install my SQL uh the 1466 01:08:51,158 --> 01:08:53,759 tool and we're going to connect to the 1467 01:08:53,759 --> 01:08:56,759 database 1468 01:08:57,750 --> 01:09:00,859 [Music] 1469 01:09:00,920 --> 01:09:05,319 oh I need to get that password now 1470 01:09:29,520 --> 01:09:31,719 all 1471 01:09:35,839 --> 01:09:38,238 right and now we're going to use this 1472 01:09:38,238 --> 01:09:40,370 Cloud Fox 1473 01:09:40,370 --> 01:09:44,318 [Music] 1474 01:09:48,560 --> 01:09:50,799 database and we've just gotten the flag 1475 01:09:50,799 --> 01:09:52,560 from the credit card 1476 01:09:52,560 --> 01:09:55,600 table so that is our two challenges for 1477 01:09:55,600 --> 01:09:57,480 compromised 1478 01:09:57,480 --> 01:09:59,640 workloads so now I'm going to switch 1479 01:09:59,640 --> 01:10:02,160 over to the slides 1480 01:10:02,160 --> 01:10:06,619 [Music] 1481 01:10:11,960 --> 01:10:14,760 again okay so let's 1482 01:10:14,760 --> 01:10:17,880 recap so in the first challenge we 1483 01:10:17,880 --> 01:10:22,360 simply use the r Rea to access uh the 1484 01:10:22,360 --> 01:10:23,960 the 1485 01:10:23,960 --> 01:10:26,719 flag and then the the second one we had 1486 01:10:26,719 --> 01:10:28,400 to first use the Lambda list functions 1487 01:10:28,400 --> 01:10:30,320 to get the credentials but we didn't 1488 01:10:30,320 --> 01:10:32,159 have access to the database there so we 1489 01:10:32,159 --> 01:10:34,400 then had to use the access the Bastion 1490 01:10:34,400 --> 01:10:36,679 host which gave us access to the VPC and 1491 01:10:36,679 --> 01:10:40,480 then we were able to access the the 1492 01:10:40,520 --> 01:10:42,920 database all right so in the last lab 1493 01:10:42,920 --> 01:10:44,520 we're going to talk about uh this is a 1494 01:10:44,520 --> 01:10:47,440 fun one a compromise Cloud 1495 01:10:47,440 --> 01:10:50,040 resource so we're going to deal with SNS 1496 01:10:50,040 --> 01:10:52,880 for these next two Labs so what you need 1497 01:10:52,880 --> 01:10:54,520 to know is that if you're not familiar 1498 01:10:54,520 --> 01:10:58,159 SNS topic and ssqs are message 1499 01:10:58,159 --> 01:11:00,679 Brokers they essentially receive 1500 01:11:00,679 --> 01:11:03,600 messages from uh a producer and then 1501 01:11:03,600 --> 01:11:06,840 they deliver messages to 1502 01:11:06,840 --> 01:11:09,760 subscribers and often on when you're 1503 01:11:09,760 --> 01:11:12,239 doing Cloud uh configuration review your 1504 01:11:12,239 --> 01:11:14,199 tool might find that hey you have a 1505 01:11:14,199 --> 01:11:16,440 bunch of SNS topics that are you know 1506 01:11:16,440 --> 01:11:17,679 anybody in the world could publish to 1507 01:11:17,679 --> 01:11:19,000 them or anybody in the world could 1508 01:11:19,000 --> 01:11:21,640 subscribe to them and as an offensive 1509 01:11:21,640 --> 01:11:23,040 security person you want to answer the 1510 01:11:23,040 --> 01:11:24,800 question like what does that mean right 1511 01:11:24,800 --> 01:11:27,239 is that bad or no I don't know and so 1512 01:11:27,239 --> 01:11:30,600 the first thing to note is it depends if 1513 01:11:30,600 --> 01:11:34,520 you have a topic that is not being used 1514 01:11:34,520 --> 01:11:36,640 right somebody created a topic anybody 1515 01:11:36,640 --> 01:11:37,960 could subscribe to it anybody could 1516 01:11:37,960 --> 01:11:40,960 publish to it but no no sensitive data 1517 01:11:40,960 --> 01:11:42,960 is being sent to it by your systems 1518 01:11:42,960 --> 01:11:46,360 nobody's consuming the data from it I 1519 01:11:46,360 --> 01:11:47,560 mean it's a it's a you know a 1520 01:11:47,560 --> 01:11:49,560 misconfiguration but there's no impact 1521 01:11:49,560 --> 01:11:52,520 right but if that topic is actually 1522 01:11:52,520 --> 01:11:54,960 being used that's information disclosure 1523 01:11:54,960 --> 01:11:56,600 it's some somebody can subscribe to it 1524 01:11:56,600 --> 01:11:58,360 and that's what we're going to see and 1525 01:11:58,360 --> 01:12:00,440 there's potential to do much worse if 1526 01:12:00,440 --> 01:12:02,600 somebody could publish messages to it so 1527 01:12:02,600 --> 01:12:04,560 the next challenge it's it's not fully 1528 01:12:04,560 --> 01:12:06,600 what I saw on a penetration test but on 1529 01:12:06,600 --> 01:12:09,760 a penetration test what I saw was the 1530 01:12:09,760 --> 01:12:11,679 the topic that I had the ability to 1531 01:12:11,679 --> 01:12:13,960 subscribe and publish to was accepting 1532 01:12:13,960 --> 01:12:17,280 python pickles and some and something 1533 01:12:17,280 --> 01:12:20,600 was consuming those pickles that compute 1534 01:12:20,600 --> 01:12:22,320 so you could just do a DC realization 1535 01:12:22,320 --> 01:12:24,199 attack that way so this challenge is a 1536 01:12:24,199 --> 01:12:25,679 little simpler than that but it's the 1537 01:12:25,679 --> 01:12:27,760 same idea right I think a lot of you 1538 01:12:27,760 --> 01:12:29,000 your eyes kind of went like this as soon 1539 01:12:29,000 --> 01:12:30,920 as I said it was consuming pickles right 1540 01:12:30,920 --> 01:12:33,159 cu cu a lot of times you can get code 1541 01:12:33,159 --> 01:12:35,040 execution through these type of 1542 01:12:35,040 --> 01:12:36,960 misconfigurations or not a lot of times 1543 01:12:36,960 --> 01:12:38,490 but 1544 01:12:38,490 --> 01:12:42,309 [Music] 1545 01:12:42,560 --> 01:12:44,760 occasionally any questions uh on 1546 01:12:44,760 --> 01:12:46,600 anything I've covered so 1547 01:12:46,600 --> 01:12:50,060 [Music] 1548 01:12:52,000 --> 01:12:54,440 far all right so now it's time to click 1549 01:12:54,440 --> 01:12:55,719 next in 1550 01:12:55,719 --> 01:12:59,450 uh to go to lab three 1551 01:12:59,450 --> 01:13:13,370 [Music] 1552 01:13:16,300 --> 01:13:25,350 [Music] 1553 01:13:30,719 --> 01:13:33,040 there we 1554 01:13:44,120 --> 01:13:46,679 go all right so there's two uh Cloud Fox 1555 01:13:46,679 --> 01:13:47,679 commands that will help you do this 1556 01:13:47,679 --> 01:13:49,239 again you could do all of this through 1557 01:13:49,239 --> 01:13:51,840 the UI um you know you can look at your 1558 01:13:51,840 --> 01:13:53,320 and you canot do all this through csbm 1559 01:13:53,320 --> 01:13:55,760 tools but we're going to run uh the the 1560 01:13:55,760 --> 01:13:58,480 cloud Fox re resource trust command so 1561 01:13:58,480 --> 01:13:59,880 this is I think one of the areas that a 1562 01:13:59,880 --> 01:14:02,040 tool like Cloud Fox excels in it's 1563 01:14:02,040 --> 01:14:03,360 allowing you to look for the same 1564 01:14:03,360 --> 01:14:05,760 pattern across multiple resource types 1565 01:14:05,760 --> 01:14:07,719 so this one's looking at S3 buckets 1566 01:14:07,719 --> 01:14:10,520 Lambda functions uh you know anything 1567 01:14:10,520 --> 01:14:13,000 that has a resource policy so I'm going 1568 01:14:13,000 --> 01:14:14,120 to make this really small just for a 1569 01:14:14,120 --> 01:14:16,520 second so I can explain 1570 01:14:16,520 --> 01:14:19,280 it so I know this is really hard to see 1571 01:14:19,280 --> 01:14:20,880 but we're saying so this is the the 1572 01:14:20,880 --> 01:14:22,920 resource and first I'm telling you if 1573 01:14:22,920 --> 01:14:24,520 it's public or not and even if it's not 1574 01:14:24,520 --> 01:14:25,679 public is it 1575 01:14:25,679 --> 01:14:27,679 interesting and the only reason that 1576 01:14:27,679 --> 01:14:29,159 these are not public is cuz I don't want 1577 01:14:29,159 --> 01:14:30,960 your own lab environments to get popped 1578 01:14:30,960 --> 01:14:33,480 so I've put an IP address restriction 1579 01:14:33,480 --> 01:14:35,080 but think about it as if the IP 1580 01:14:35,080 --> 01:14:37,159 instruction didn't exist right anybody 1581 01:14:37,159 --> 01:14:39,360 can publish or subscribe to this first 1582 01:14:39,360 --> 01:14:41,760 topic and same thing with this one 1583 01:14:41,760 --> 01:14:43,800 except here's an interesting condition 1584 01:14:43,800 --> 01:14:47,320 on the Executioner one anybody only the 1585 01:14:47,320 --> 01:14:49,800 principal account so basically any 1586 01:14:49,800 --> 01:14:51,560 principal in this account can publish 1587 01:14:51,560 --> 01:14:55,719 this topic so this is a pattern that 1588 01:14:55,719 --> 01:14:57,760 is is usually there's good intentions 1589 01:14:57,760 --> 01:14:59,800 but it's often you know opens up priv 1590 01:14:59,800 --> 01:15:01,800 escalation we've even seen things where 1591 01:15:01,800 --> 01:15:04,000 the resource policy says this action is 1592 01:15:04,000 --> 01:15:06,880 allowed by anybody in my organization 1593 01:15:06,880 --> 01:15:08,520 right so that's if you apply something 1594 01:15:08,520 --> 01:15:10,480 like that in prod then that means that 1595 01:15:10,480 --> 01:15:13,000 anybody with access to Dev can do the 1596 01:15:13,000 --> 01:15:14,440 thing that you just put the condition on 1597 01:15:14,440 --> 01:15:16,280 so be careful with those conditions that 1598 01:15:16,280 --> 01:15:18,080 are kind of at the account level or the 1599 01:15:18,080 --> 01:15:19,000 or 1600 01:15:19,000 --> 01:15:23,320 level so okay so now there's also the 1601 01:15:23,320 --> 01:15:26,960 um the SNS topic or the 1602 01:15:26,960 --> 01:15:29,320 SNS and as you can imagine the reason 1603 01:15:29,320 --> 01:15:30,600 I'm calling this one out is because this 1604 01:15:30,600 --> 01:15:33,040 one gives you the commands to subscribe 1605 01:15:33,040 --> 01:15:34,560 or publish to the topic which is just 1606 01:15:34,560 --> 01:15:36,530 like a helper 1607 01:15:36,530 --> 01:15:45,420 [Music] 1608 01:15:48,320 --> 01:15:50,199 essentially and so I'm going to show you 1609 01:15:50,199 --> 01:15:52,679 what exploitation of a topic that we can 1610 01:15:52,679 --> 01:15:56,920 subscribe to uh looks like 1611 01:15:58,440 --> 01:15:59,679 so the first thing we're going to do is 1612 01:15:59,679 --> 01:16:01,960 we're going to use the terminal 2 and 1613 01:16:01,960 --> 01:16:04,440 we're going to set up a necat listener 1614 01:16:04,440 --> 01:16:06,120 the cool thing about these in uh these 1615 01:16:06,120 --> 01:16:08,320 Labs here is that they all uh can listen 1616 01:16:08,320 --> 01:16:10,520 on public ports so that's going to be 1617 01:16:10,520 --> 01:16:12,960 helpful and now these commands that I'm 1618 01:16:12,960 --> 01:16:14,480 that I'm highlighting right here these 1619 01:16:14,480 --> 01:16:15,600 are the commands that cloud Fox 1620 01:16:15,600 --> 01:16:17,239 generated for us so we're going to 1621 01:16:17,239 --> 01:16:19,440 export the cloud Fox level 1622 01:16:19,440 --> 01:16:21,760 profile and when when you have something 1623 01:16:21,760 --> 01:16:23,960 that is accessible like an SNS topic 1624 01:16:23,960 --> 01:16:26,320 that allows anybody to subscribe to it 1625 01:16:26,320 --> 01:16:29,280 what does that mean that means any a any 1626 01:16:29,280 --> 01:16:32,719 principal from any AWS account can do 1627 01:16:32,719 --> 01:16:35,480 that so in in you know here they're all 1628 01:16:35,480 --> 01:16:37,040 on the same account but I could use my 1629 01:16:37,040 --> 01:16:38,400 personal account and subscribed to the 1630 01:16:38,400 --> 01:16:39,240 same 1631 01:16:39,240 --> 01:16:42,969 [Music] 1632 01:16:48,280 --> 01:16:50,560 topic and so here's the command that's 1633 01:16:50,560 --> 01:16:52,520 going to subscribe and what I did was I 1634 01:16:52,520 --> 01:16:54,320 basically just curled the IP address of 1635 01:16:54,320 --> 01:16:58,040 this lab VM and if we go over here this 1636 01:16:58,040 --> 01:16:59,239 is the message that we just got on 1637 01:16:59,239 --> 01:17:03,280 netcat it's a subscription um message 1638 01:17:03,280 --> 01:17:04,840 and so if we click 1639 01:17:04,840 --> 01:17:07,760 this we have now just subscribed to the 1640 01:17:07,760 --> 01:17:10,080 topic as an attacker right our our neat 1641 01:17:10,080 --> 01:17:11,460 listener has subscribed to the 1642 01:17:11,460 --> 01:17:14,520 [Music] 1643 01:17:14,520 --> 01:17:16,520 topic and what we need to do is we need 1644 01:17:16,520 --> 01:17:18,170 to restart that 1645 01:17:18,170 --> 01:17:20,239 [Music] 1646 01:17:20,239 --> 01:17:22,320 listener and to make the challenge work 1647 01:17:22,320 --> 01:17:24,199 I have a uh a process that's kind of 1648 01:17:24,199 --> 01:17:25,760 recreating the challenge every uh they 1649 01:17:25,760 --> 01:17:27,679 recreating the message every minute so 1650 01:17:27,679 --> 01:17:30,080 within a minute we should see uh a 1651 01:17:30,080 --> 01:17:32,080 message come across this 1652 01:17:32,080 --> 01:17:34,480 topic something is something outside of 1653 01:17:34,480 --> 01:17:36,800 our control is producing messages to 1654 01:17:36,800 --> 01:17:38,239 this 1655 01:17:38,239 --> 01:17:40,639 topic oh this happens occasionally let's 1656 01:17:40,639 --> 01:17:44,480 subscribe one more time 1657 01:17:47,600 --> 01:17:50,719 [Music] 1658 01:17:53,090 --> 01:17:55,040 [Music] 1659 01:17:55,040 --> 01:17:57,320 all right and here we go sensitive 1660 01:17:57,320 --> 01:17:58,880 information is being sent to this topic 1661 01:17:58,880 --> 01:18:00,920 that anybody in the world can 1662 01:18:00,920 --> 01:18:03,840 access so the way SNS works is it's a 1663 01:18:03,840 --> 01:18:05,280 you're going to have a many as many 1664 01:18:05,280 --> 01:18:07,600 subscribers as you want right so anybody 1665 01:18:07,600 --> 01:18:09,840 who subscribes to this message can just 1666 01:18:09,840 --> 01:18:11,560 get a copy of anything that's sent to it 1667 01:18:11,560 --> 01:18:13,560 or subscribes to this topic can get a 1668 01:18:13,560 --> 01:18:15,880 copy of the messages sqs is a little 1669 01:18:15,880 --> 01:18:17,400 different you're actually kind of 1670 01:18:17,400 --> 01:18:19,480 pulling messages off the queue so you 1671 01:18:19,480 --> 01:18:21,080 want to be careful in doing an attack 1672 01:18:21,080 --> 01:18:23,080 like this where you might actually pull 1673 01:18:23,080 --> 01:18:24,840 real data off of the queue that might 1674 01:18:24,840 --> 01:18:26,520 not get processed so this isn't 1675 01:18:26,520 --> 01:18:28,199 necessarily something that you want to 1676 01:18:28,199 --> 01:18:29,760 do in production it's something you 1677 01:18:29,760 --> 01:18:31,120 might want to test you know in a in a 1678 01:18:31,120 --> 01:18:33,000 lab environment but it is possible it's 1679 01:18:33,000 --> 01:18:35,120 just there's there's risks there another 1680 01:18:35,120 --> 01:18:36,520 note is what we've done is we've 1681 01:18:36,520 --> 01:18:39,520 listened a netcat clear text right you 1682 01:18:39,520 --> 01:18:40,960 know if you're doing a real penetration 1683 01:18:40,960 --> 01:18:44,080 test your listener should be TLS and you 1684 01:18:44,080 --> 01:18:45,560 also want to unsubscribe at the end 1685 01:18:45,560 --> 01:18:46,440 right you don't want to just like leave 1686 01:18:46,440 --> 01:18:47,960 your subscription as a penetration 1687 01:18:47,960 --> 01:18:49,000 tester you don't you don't want to leave 1688 01:18:49,000 --> 01:18:51,040 your stuff laying around so you know be 1689 01:18:51,040 --> 01:18:54,320 polite unsubscribe after but here we can 1690 01:18:54,320 --> 01:18:56,880 see first name John last name Smith and 1691 01:18:56,880 --> 01:18:59,320 the social security number somewhere is 1692 01:18:59,320 --> 01:19:01,760 our flag uh the reason I hid this here 1693 01:19:01,760 --> 01:19:03,440 is because you know as a penetration 1694 01:19:03,440 --> 01:19:05,639 tester sometimes you see stuff and you 1695 01:19:05,639 --> 01:19:08,199 might miss the important thing right so 1696 01:19:08,199 --> 01:19:09,800 sometimes you do have to like look a 1697 01:19:09,800 --> 01:19:12,000 little closely to see that oh wow there 1698 01:19:12,000 --> 01:19:14,040 is SSN here or 1699 01:19:14,040 --> 01:19:18,199 something okay so the last uh challenge 1700 01:19:18,199 --> 01:19:19,320 we're going to do is we're going to do 1701 01:19:19,320 --> 01:19:23,760 that code execution challenge um if you 1702 01:19:23,760 --> 01:19:24,960 think that's cool and you want want to 1703 01:19:24,960 --> 01:19:28,280 do uh there is another challenge in uh 1704 01:19:28,280 --> 01:19:29,360 so you can do this Challenge on your own 1705 01:19:29,360 --> 01:19:32,080 in Cloud foxal after um but also there's 1706 01:19:32,080 --> 01:19:34,120 there's another challenge that does take 1707 01:19:34,120 --> 01:19:37,360 in that distalization of pickles uh into 1708 01:19:37,360 --> 01:19:39,040 account in Cloud foxable but we're just 1709 01:19:39,040 --> 01:19:40,700 going to do a simpler version 1710 01:19:40,700 --> 01:19:44,540 [Music] 1711 01:19:50,800 --> 01:19:54,760 so oh 1712 01:19:54,760 --> 01:19:56,480 have a question yeah can you list 1713 01:19:56,480 --> 01:19:58,000 subscribers for 1714 01:19:58,000 --> 01:19:59,600 topic yeah we're going to actually do 1715 01:19:59,600 --> 01:20:01,199 that in the next challenge yeah you can 1716 01:20:01,199 --> 01:20:03,560 list it and it's kind of funny seeing it 1717 01:20:03,560 --> 01:20:06,320 the ne uh you know yeah 44 1718 01:20:06,320 --> 01:20:09,440 yeah uh so you can list subscribers on 1719 01:20:09,440 --> 01:20:10,880 your topics that was the question can 1720 01:20:10,880 --> 01:20:12,239 can you see who subscribed to your topic 1721 01:20:12,239 --> 01:20:14,679 and you you 1722 01:20:14,679 --> 01:20:17,679 can is that possible with fox or would 1723 01:20:17,679 --> 01:20:19,440 you have to uh not not possible with 1724 01:20:19,440 --> 01:20:21,080 Cloud Fox I just I just don't have that 1725 01:20:21,080 --> 01:20:23,639 in there but there there's an AWS uh 1726 01:20:23,639 --> 01:20:25,920 command to list we're going to actually 1727 01:20:25,920 --> 01:20:28,210 see it it's in the solution for the next 1728 01:20:28,210 --> 01:20:32,100 [Music] 1729 01:20:36,120 --> 01:20:40,239 [Music] 1730 01:20:40,239 --> 01:20:43,080 challenge all right so for this one um 1731 01:20:43,080 --> 01:20:44,520 I'm just going to you know speed along a 1732 01:20:44,520 --> 01:20:46,960 little bit right so we have another 1733 01:20:46,960 --> 01:20:49,239 topic called the Executioner and this is 1734 01:20:49,239 --> 01:20:51,000 the one that allowed anybody in this 1735 01:20:51,000 --> 01:20:53,040 account to subscribe to it or publish to 1736 01:20:53,040 --> 01:20:54,840 it 1737 01:20:54,840 --> 01:20:57,040 so even if you have like an auditor or 1738 01:20:57,040 --> 01:20:58,560 even if you have a third party that 1739 01:20:58,560 --> 01:21:00,520 you're trusting any principal in this 1740 01:21:00,520 --> 01:21:03,080 account can subscribe or publish to this 1741 01:21:03,080 --> 01:21:06,440 topic so we're going to do uh a netcat 1742 01:21:06,440 --> 01:21:08,400 listener on a different port this 1743 01:21:08,400 --> 01:21:10,760 time and we're going to use the venous 1744 01:21:10,760 --> 01:21:13,520 Junior profile 1745 01:21:13,520 --> 01:21:15,719 here and here let's do one of the these 1746 01:21:15,719 --> 01:21:20,480 one at a time uh terminal one 1747 01:21:20,700 --> 01:21:23,960 [Music] 1748 01:21:25,000 --> 01:21:26,040 so we're going to go through the same 1749 01:21:26,040 --> 01:21:28,040 process of 1750 01:21:28,040 --> 01:21:31,600 subscribing so here we got the the 1751 01:21:31,600 --> 01:21:34,239 subscriber URL hopefully we only have to 1752 01:21:34,239 --> 01:21:36,599 do this 1753 01:21:36,620 --> 01:21:38,719 [Music] 1754 01:21:38,719 --> 01:21:42,840 once start listening again 1755 01:21:42,840 --> 01:21:55,689 [Music] 1756 01:21:59,080 --> 01:22:01,440 all right here we go so now look at this 1757 01:22:01,440 --> 01:22:03,679 message here this is the the whole this 1758 01:22:03,679 --> 01:22:05,360 is the the actual message that was sent 1759 01:22:05,360 --> 01:22:08,679 to the topic Echo hello world so I see 1760 01:22:08,679 --> 01:22:11,360 that I'm like hey wait a minute that's a 1761 01:22:11,360 --> 01:22:13,440 that's an OS command is there OS code 1762 01:22:13,440 --> 01:22:15,800 inject OS command injection right what 1763 01:22:15,800 --> 01:22:18,360 is consuming this so to answer your 1764 01:22:18,360 --> 01:22:20,600 question let's first use our white box 1765 01:22:20,600 --> 01:22:23,600 access 1766 01:22:25,840 --> 01:22:28,639 and we're going to do the AWS SNS list 1767 01:22:28,639 --> 01:22:30,360 subscriptions by topic and we're going 1768 01:22:30,360 --> 01:22:33,920 to put in this topic name 1769 01:22:34,000 --> 01:22:35,719 executioner and so this is what I 1770 01:22:35,719 --> 01:22:36,760 thought it funny right it's always funny 1771 01:22:36,760 --> 01:22:39,320 to see this so we are subscribed to the 1772 01:22:39,320 --> 01:22:43,560 topic this uh our IP address on 1337 but 1773 01:22:43,560 --> 01:22:46,480 also this is the AHA or the oh crap 1774 01:22:46,480 --> 01:22:48,600 moment there's a Lambda function 1775 01:22:48,600 --> 01:22:51,760 subscribed to this topic so if we're 1776 01:22:51,760 --> 01:22:54,960 lucky that Lambda function is actually 1777 01:22:54,960 --> 01:22:57,360 executing that Echo command it's very 1778 01:22:57,360 --> 01:22:58,719 possible it's not right but if we're 1779 01:22:58,719 --> 01:23:00,330 lucky it 1780 01:23:00,330 --> 01:23:02,960 [Music] 1781 01:23:02,960 --> 01:23:06,400 is so now we're going to yeah kill that 1782 01:23:06,400 --> 01:23:11,608 [Music] 1783 01:23:21,080 --> 01:23:22,880 listener and we're going to start a new 1784 01:23:22,880 --> 01:23:24,540 listener on 8888 1785 01:23:24,540 --> 01:23:28,119 [Music] 1786 01:23:39,080 --> 01:23:40,960 and so the first thing we want to do is 1787 01:23:40,960 --> 01:23:43,320 what do we want to do what's our payload 1788 01:23:43,320 --> 01:23:47,159 reverse Shell let's try 1789 01:23:47,600 --> 01:23:51,440 it so I'm using the bash interactive 1790 01:23:51,440 --> 01:23:54,239 bash Shell through the dev TCP trick so 1791 01:23:54,239 --> 01:23:56,000 I just saved you all a lot of time and 1792 01:23:56,000 --> 01:23:58,520 and trouble because what you might want 1793 01:23:58,520 --> 01:24:00,840 to try to do is use netcat first for 1794 01:24:00,840 --> 01:24:04,000 your call back right or you know other 1795 01:24:04,000 --> 01:24:06,040 tools but these Lambda functions are 1796 01:24:06,040 --> 01:24:09,679 running very stripped down right uh 1797 01:24:09,679 --> 01:24:11,600 operating systems essentially right like 1798 01:24:11,600 --> 01:24:14,280 the it the the tools on the the Lambda 1799 01:24:14,280 --> 01:24:16,480 function the Lambda runtime are it first 1800 01:24:16,480 --> 01:24:18,000 of all it depends is it python is it 1801 01:24:18,000 --> 01:24:21,159 node is it Java right but so you can 1802 01:24:21,159 --> 01:24:23,120 always kind of rely on the old bash Dev 1803 01:24:23,120 --> 01:24:26,040 TCP trick and so we did that and let's 1804 01:24:26,040 --> 01:24:27,400 see what we get on our 1805 01:24:27,400 --> 01:24:29,360 listener wait a minute we got a 1806 01:24:29,360 --> 01:24:30,679 connection 1807 01:24:30,679 --> 01:24:33,320 received but it closed before we even 1808 01:24:33,320 --> 01:24:36,040 had access to it now there if you have 1809 01:24:36,040 --> 01:24:37,560 control of the Lambda function you can 1810 01:24:37,560 --> 01:24:39,119 create a Lambda function that has like a 1811 01:24:39,119 --> 01:24:41,159 5 minute 15minute timeout but if you 1812 01:24:41,159 --> 01:24:42,520 don't have that by default it's going to 1813 01:24:42,520 --> 01:24:44,040 time out right away right it ran the 1814 01:24:44,040 --> 01:24:46,920 command it timed out so does anybody 1815 01:24:46,920 --> 01:24:48,800 have an idea how we could exploit this 1816 01:24:48,800 --> 01:24:51,360 Lambda function add a command with a 1817 01:24:51,360 --> 01:24:53,600 delay add a command with a delay that's 1818 01:24:53,600 --> 01:24:55,719 a good one try to do like a weight right 1819 01:24:55,719 --> 01:24:58,840 after that's one not you Austin anybody 1820 01:24:58,840 --> 01:25:01,000 else how can we exploit this Lambda 1821 01:25:01,000 --> 01:25:03,280 function if we without without a a 1822 01:25:03,280 --> 01:25:04,080 reverse 1823 01:25:04,080 --> 01:25:07,070 shell without an interactive reverse 1824 01:25:07,070 --> 01:25:09,840 [Music] 1825 01:25:09,840 --> 01:25:14,480 shell what invoke it oh invoke 1826 01:25:14,960 --> 01:25:17,800 it uh we we invoke the L function so 1827 01:25:17,800 --> 01:25:19,639 that's a different type of attack if we 1828 01:25:19,639 --> 01:25:21,520 had the permission to invoke it we could 1829 01:25:21,520 --> 01:25:24,480 absolutely do that um but this one we we 1830 01:25:24,480 --> 01:25:26,880 have kind of that that we just have code 1831 01:25:26,880 --> 01:25:28,199 within the 1832 01:25:28,199 --> 01:25:30,920 runtime here's here's a here's a hint 1833 01:25:30,920 --> 01:25:33,520 Lambda functions don't use the imds how 1834 01:25:33,520 --> 01:25:36,080 do they get access to their roles does 1835 01:25:36,080 --> 01:25:36,650 anybody 1836 01:25:36,650 --> 01:25:39,000 [Music] 1837 01:25:39,000 --> 01:25:42,280 know Austin environment variables 1838 01:25:42,280 --> 01:25:43,480 environment 1839 01:25:43,480 --> 01:25:46,840 variables so what can we do forget about 1840 01:25:46,840 --> 01:25:48,840 the interactive B shell why don't we 1841 01:25:48,840 --> 01:25:52,280 just modify that payload to just pipe 1842 01:25:52,280 --> 01:25:54,960 the output of the N command across our 1843 01:25:54,960 --> 01:25:57,320 Network 1844 01:25:58,600 --> 01:26:01,340 Port so let's restart the 1845 01:26:01,340 --> 01:26:06,280 [Music] 1846 01:26:06,280 --> 01:26:08,320 listener and so what you see here is 1847 01:26:08,320 --> 01:26:11,000 instead of the bash ey right we're just 1848 01:26:11,000 --> 01:26:13,520 running n on the Lambda function and 1849 01:26:13,520 --> 01:26:17,480 then sending the output of that to our 1850 01:26:17,880 --> 01:26:20,560 listener and here we go all the Lambda 1851 01:26:20,560 --> 01:26:23,920 environment variables including the AWS 1852 01:26:23,920 --> 01:26:26,840 session token the AWS secret key and the 1853 01:26:26,840 --> 01:26:31,440 AWS uh key ID so now we can essentially 1854 01:26:31,440 --> 01:26:33,239 I mean this this it feels like magic 1855 01:26:33,239 --> 01:26:34,760 right you can configure a profile on 1856 01:26:34,760 --> 01:26:37,040 your laptop that is acting as the 1857 01:26:37,040 --> 01:26:38,400 permissions assigned to the Lambda 1858 01:26:38,400 --> 01:26:39,679 function it feels like you shouldn't be 1859 01:26:39,679 --> 01:26:43,500 able to do that but you 1860 01:26:43,500 --> 01:26:46,609 [Music] 1861 01:26:47,760 --> 01:26:50,520 can so uh this part I have to do 1862 01:26:50,520 --> 01:26:55,960 manually uh so let's go ahead and 1863 01:27:12,679 --> 01:27:14,970 all right help me find okay this is the 1864 01:27:14,970 --> 01:27:20,419 [Music] 1865 01:27:20,440 --> 01:27:25,119 ID now let's find the key 1866 01:27:35,920 --> 01:27:38,280 and the 1867 01:27:45,320 --> 01:27:49,719 token cross your fingers 1868 01:28:01,080 --> 01:28:03,960 all right so now we are acting as uh the 1869 01:28:03,960 --> 01:28:05,480 ream rooll which is the one that was 1870 01:28:05,480 --> 01:28:07,000 assigned to the Lambda 1871 01:28:07,000 --> 01:28:09,480 [Music] 1872 01:28:09,480 --> 01:28:12,520 function and so to drive home I know I 1873 01:28:12,520 --> 01:28:13,920 skipped a lot because we're doing this 1874 01:28:13,920 --> 01:28:16,280 interactively but as as a penetration 1875 01:28:16,280 --> 01:28:18,560 tester this is the process I think I 1876 01:28:18,560 --> 01:28:20,480 can't underscore this enough every time 1877 01:28:20,480 --> 01:28:22,560 you get access to a new I IM role a new 1878 01:28:22,560 --> 01:28:24,679 I am principal the first question is 1879 01:28:24,679 --> 01:28:25,960 what permissions does this one have 1880 01:28:25,960 --> 01:28:29,010 access to so let's let's for the last 1881 01:28:29,010 --> 01:28:32,159 [Music] 1882 01:28:32,159 --> 01:28:34,440 time and again you can absolutely do 1883 01:28:34,440 --> 01:28:36,280 this through the AWS CLI you can do this 1884 01:28:36,280 --> 01:28:38,000 through the UI we're just going to use 1885 01:28:38,000 --> 01:28:40,400 cloud Fox for 1886 01:28:40,400 --> 01:28:43,119 this and our white box access which is 1887 01:28:43,119 --> 01:28:46,159 right really nice and we see that it has 1888 01:28:46,159 --> 01:28:48,840 access to this final uh 1889 01:28:48,840 --> 01:28:50,920 parameter and so I'm going to skip some 1890 01:28:50,920 --> 01:28:53,639 of the I'm just we've already done this 1891 01:28:53,639 --> 01:28:56,630 before we're just going to print out the 1892 01:28:56,630 --> 01:28:58,600 [Music] 1893 01:28:58,600 --> 01:29:00,840 command oh running the secrets okay so 1894 01:29:00,840 --> 01:29:02,360 here's the 1895 01:29:02,360 --> 01:29:04,480 command so again this whole thing where 1896 01:29:04,480 --> 01:29:06,199 I'm exporting the profile this is just a 1897 01:29:06,199 --> 01:29:08,320 cloud Fox specific thing so that I can 1898 01:29:08,320 --> 01:29:11,320 constantly switch between profiles so 1899 01:29:11,320 --> 01:29:14,760 here let going to export right I created 1900 01:29:14,760 --> 01:29:16,300 the profile 1901 01:29:16,300 --> 01:29:18,199 [Music] 1902 01:29:18,199 --> 01:29:22,400 re and now let's get that last 1903 01:29:22,560 --> 01:29:27,199 flag all right so hopefully uh that was 1904 01:29:27,199 --> 01:29:31,150 enjoyable Let's uh wrap up the 1905 01:29:31,150 --> 01:29:34,700 [Music] 1906 01:29:41,770 --> 01:29:44,919 [Music] 1907 01:29:52,719 --> 01:29:56,040 presentation there we go 1908 01:30:01,760 --> 01:30:04,960 okay so what do we see in the first 1909 01:30:04,960 --> 01:30:07,360 challenge any 1910 01:30:07,360 --> 01:30:10,080 principal from any AWS account could 1911 01:30:10,080 --> 01:30:12,119 subscribe to the first topic now you 1912 01:30:12,119 --> 01:30:14,280 might be asking yourself how do how 1913 01:30:14,280 --> 01:30:15,639 would somebody from another account even 1914 01:30:15,639 --> 01:30:17,560 get find the Arn for that topic you need 1915 01:30:17,560 --> 01:30:19,480 the Arn to subscribe to it and that's a 1916 01:30:19,480 --> 01:30:21,520 really good question like it's not super 1917 01:30:21,520 --> 01:30:25,199 easy but it could be in 1918 01:30:25,199 --> 01:30:27,560 uh JavaScript it could be in source code 1919 01:30:27,560 --> 01:30:29,199 it could be in an internal knowledge 1920 01:30:29,199 --> 01:30:31,280 base right maybe you just have it it's 1921 01:30:31,280 --> 01:30:33,400 like in a knowledge Bas somewhere and so 1922 01:30:33,400 --> 01:30:35,280 somebody is like hey I found an SNS 1923 01:30:35,280 --> 01:30:36,760 topic let me see if I can subscribe to 1924 01:30:36,760 --> 01:30:39,239 it right so it's not impossible but it's 1925 01:30:39,239 --> 01:30:41,840 not easily discoverable by anybody on 1926 01:30:41,840 --> 01:30:43,440 the internet per 1927 01:30:43,440 --> 01:30:46,960 se and in the next one 1928 01:30:46,960 --> 01:30:49,880 uh we first subscribed to the topic then 1929 01:30:49,880 --> 01:30:51,760 we published something to it we learned 1930 01:30:51,760 --> 01:30:53,320 that the Lambda function was also 1931 01:30:53,320 --> 01:30:56,280 subscribed to it it access it it uh 1932 01:30:56,280 --> 01:30:58,920 executed our code we accessed re and 1933 01:30:58,920 --> 01:31:00,960 then uh accessed the flag cuz we 1934 01:31:00,960 --> 01:31:03,400 exploited re's 1935 01:31:03,400 --> 01:31:05,639 [Music] 1936 01:31:05,639 --> 01:31:08,440 permissions so a reminder for anybody 1937 01:31:08,440 --> 01:31:10,199 that use the lab environment they all 1938 01:31:10,199 --> 01:31:12,920 going to be nuked at the end of this uh 1939 01:31:12,920 --> 01:31:14,880 Workshop uh you can spin up Cloud 1940 01:31:14,880 --> 01:31:16,840 foxable on your own playground account 1941 01:31:16,840 --> 01:31:19,239 do not deploy Cloud foxable to a 1942 01:31:19,239 --> 01:31:20,880 production account it's got lots of 1943 01:31:20,880 --> 01:31:23,480 vulnerable stuff in it um but you 1944 01:31:23,480 --> 01:31:25,480 absolutely can play with P foxal after 1945 01:31:25,480 --> 01:31:28,239 this workshop and it's not a red team if 1946 01:31:28,239 --> 01:31:30,040 you have no blue team uh it's just a 1947 01:31:30,040 --> 01:31:31,679 penetration test that's just you know my 1948 01:31:31,679 --> 01:31:34,560 personal opinion on the matter um and 1949 01:31:34,560 --> 01:31:36,480 and mostly you know if you had to sell 1950 01:31:36,480 --> 01:31:38,400 out how is cloud penetration testing 1951 01:31:38,400 --> 01:31:41,760 different I am is King always be mindful 1952 01:31:41,760 --> 01:31:43,360 of what I am permissions you have access 1953 01:31:43,360 --> 01:31:46,679 to and always remember that it's not 1954 01:31:46,679 --> 01:31:48,560 just the last principle that has access 1955 01:31:48,560 --> 01:31:50,480 to the thing it's anybody who can get to 1956 01:31:50,480 --> 01:31:52,639 the last principle also has access to 1957 01:31:52,639 --> 01:31:54,880 the resource 1958 01:31:54,880 --> 01:31:56,560 so thank you all very much for sitting 1959 01:31:56,560 --> 01:31:58,400 with me for two 1960 01:31:58,400 --> 01:32:02,199 hours and feel free to uh head up hit up 1961 01:32:02,199 --> 01:32:04,760 this short URL it's a Google form uh I 1962 01:32:04,760 --> 01:32:07,800 would love feedback was it too slow too 1963 01:32:07,800 --> 01:32:10,639 fast um and also the slides are there as 1964 01:32:10,639 --> 01:32:14,719 well if you want to grab them