1 00:00:00,640 --> 00:00:03,120 talk two that we've got 2 00:00:03,120 --> 00:00:06,359 today we're going to start off with uh 3 00:00:06,359 --> 00:00:08,080 Nick fette he's a senior security 4 00:00:08,080 --> 00:00:10,160 researcher at data 5 00:00:10,160 --> 00:00:13,679 dog sorry where he specializes in AWS 6 00:00:13,679 --> 00:00:15,440 offensive security and today Nick's 7 00:00:15,440 --> 00:00:16,920 going to be talking about how to evade 8 00:00:16,920 --> 00:00:19,359 logging in the cloud this talks called 9 00:00:19,359 --> 00:00:21,359 evading logging in the cloud by passing 10 00:00:21,359 --> 00:00:25,439 AWS cloud trail please give a warm 11 00:00:28,679 --> 00:00:31,039 welcome hey everyone thank you so much 12 00:00:31,039 --> 00:00:32,840 for being here welcome to my talk on 13 00:00:32,840 --> 00:00:34,920 bypassing Cloud tra uh hope you're 14 00:00:34,920 --> 00:00:36,760 excited to hear about Cloud security 15 00:00:36,760 --> 00:00:38,280 vulnerabilities and vulnerabilities and 16 00:00:38,280 --> 00:00:39,719 cloud service providers it's one of my 17 00:00:39,719 --> 00:00:41,920 favorite topics uh my name is Nick 18 00:00:41,920 --> 00:00:43,800 forette I'm a security researcher over 19 00:00:43,800 --> 00:00:45,760 at data dog where I work on our Cloud 20 00:00:45,760 --> 00:00:48,160 security products I spent a lot of time 21 00:00:48,160 --> 00:00:50,239 coming up with ways that adversaries can 22 00:00:50,239 --> 00:00:53,320 more effectively compromise and exploit 23 00:00:53,320 --> 00:00:55,719 uh Cloud resources and from that how do 24 00:00:55,719 --> 00:00:57,680 we detect that behavior or hopefully 25 00:00:57,680 --> 00:01:00,519 prevent it entirely um I'm also so the 26 00:01:00,519 --> 00:01:02,000 creator of hacking the cloud which you 27 00:01:02,000 --> 00:01:03,359 may have seen it's an open source 28 00:01:03,359 --> 00:01:05,159 Encyclopedia of offensive security 29 00:01:05,159 --> 00:01:07,960 techniques that you can use in Cloud 30 00:01:07,960 --> 00:01:10,040 environment uh for this talk we have 31 00:01:10,040 --> 00:01:11,960 quite a lot to get through we'll start 32 00:01:11,960 --> 00:01:14,159 with a quick introduction to what cloud 33 00:01:14,159 --> 00:01:16,720 trail is and why we care about it then 34 00:01:16,720 --> 00:01:18,320 we'll take a look at the internals of 35 00:01:18,320 --> 00:01:20,320 the ads API getting a little bit of 36 00:01:20,320 --> 00:01:22,159 familiarity with how it works so that we 37 00:01:22,159 --> 00:01:24,119 can start applying that knowledge to 38 00:01:24,119 --> 00:01:27,439 bypassing cloud trail over time I found 39 00:01:27,439 --> 00:01:28,880 a number of vulnerabilities that have 40 00:01:28,880 --> 00:01:31,040 allowed me to bypass cloud trail in some 41 00:01:31,040 --> 00:01:33,720 way everything from simple permission 42 00:01:33,720 --> 00:01:36,240 enumeration up to and including just 43 00:01:36,240 --> 00:01:38,159 interacting with an indivual individual 44 00:01:38,159 --> 00:01:40,240 service while just completely avoiding 45 00:01:40,240 --> 00:01:43,040 logging now it's important to note that 46 00:01:43,040 --> 00:01:45,399 when we talk about a cloud trail bypass 47 00:01:45,399 --> 00:01:47,640 this is not a 48 00:01:47,640 --> 00:01:49,439 misconfiguration this is not something 49 00:01:49,439 --> 00:01:51,680 we can account for by changing our cloud 50 00:01:51,680 --> 00:01:54,399 trail setup uh it's nothing uh Galaxy 51 00:01:54,399 --> 00:01:57,119 brain like hey if I turn cloud trail off 52 00:01:57,119 --> 00:01:59,200 then I'm bypassing it or anything like 53 00:01:59,200 --> 00:02:02,280 that a clal bypass is very much so a 54 00:02:02,280 --> 00:02:04,960 flaw on the AWS side of the shared 55 00:02:04,960 --> 00:02:07,280 responsibility model and as a result 56 00:02:07,280 --> 00:02:09,598 it's ultimately up to Amazon to fix 57 00:02:09,598 --> 00:02:12,360 mitigate or otherwise remediate these 58 00:02:12,360 --> 00:02:14,720 issues now as I'm sure you can imagine 59 00:02:14,720 --> 00:02:17,640 AWS has a uh vested interest in ensuring 60 00:02:17,640 --> 00:02:19,879 the security of their platform and as a 61 00:02:19,879 --> 00:02:22,160 result almost all the specific issues 62 00:02:22,160 --> 00:02:24,319 we'll be talking about today have since 63 00:02:24,319 --> 00:02:27,360 been fixed by AWS so think of this talk 64 00:02:27,360 --> 00:02:29,400 less from the perspective of if you're a 65 00:02:29,400 --> 00:02:31,239 pentest or red teamer here are some 66 00:02:31,239 --> 00:02:33,280 specific vulnerabilities you can abuse 67 00:02:33,280 --> 00:02:35,120 and much more from the perspective of 68 00:02:35,120 --> 00:02:36,200 what can we learn from these 69 00:02:36,200 --> 00:02:37,959 vulnerabilities that we can apply to 70 00:02:37,959 --> 00:02:40,599 Future bypasses and indeed we'll show 71 00:02:40,599 --> 00:02:42,599 there's still a ton of opportunity to 72 00:02:42,599 --> 00:02:44,640 evade Cloud tril logging while these 73 00:02:44,640 --> 00:02:46,200 specific vulnerabilities will be talking 74 00:02:46,200 --> 00:02:48,400 about today have been fixed the high 75 00:02:48,400 --> 00:02:51,040 level archetypes or or categories are 76 00:02:51,040 --> 00:02:53,840 still absolutely exploitable and those 77 00:02:53,840 --> 00:02:55,360 the the ones that we'll be talking about 78 00:02:55,360 --> 00:02:58,560 are protocol mutation undocumented apis 79 00:02:58,560 --> 00:03:01,920 and abusing nonproduction end 80 00:03:01,920 --> 00:03:05,360 points now uh that all being said I 81 00:03:05,360 --> 00:03:06,560 certainly don't want to disappoint my 82 00:03:06,560 --> 00:03:08,640 pentest and Red Team friends so as a 83 00:03:08,640 --> 00:03:10,360 result a little later on in the talk I 84 00:03:10,360 --> 00:03:12,000 do have some techniques that do still 85 00:03:12,000 --> 00:03:16,280 work today and can be used uh now let's 86 00:03:16,280 --> 00:03:19,280 get started really quick what is AWS 87 00:03:19,280 --> 00:03:22,040 cloudt trail cloudt trail is a 88 00:03:22,040 --> 00:03:24,519 fundamental Security Service offered by 89 00:03:24,519 --> 00:03:27,360 AWS and it is responsible for logging 90 00:03:27,360 --> 00:03:30,680 calls to the AWS API under most 91 00:03:30,680 --> 00:03:33,040 circumstances when an identity in an ous 92 00:03:33,040 --> 00:03:35,560 environment performs in a call to the ad 93 00:03:35,560 --> 00:03:38,560 API that invocation will create a cloud 94 00:03:38,560 --> 00:03:41,280 trail event and that event will contain 95 00:03:41,280 --> 00:03:44,000 all of the relevant metadata around that 96 00:03:44,000 --> 00:03:46,120 invocation the identity that performed 97 00:03:46,120 --> 00:03:48,360 it the date and time that occurred the 98 00:03:48,360 --> 00:03:50,640 specific uh service and action that was 99 00:03:50,640 --> 00:03:53,480 invoked the IP address and user agent of 100 00:03:53,480 --> 00:03:55,840 the client as well as all of the 101 00:03:55,840 --> 00:03:59,360 parameters associated with that call and 102 00:03:59,360 --> 00:04:02,720 now this combined with a Sim or a data L 103 00:04:02,720 --> 00:04:04,599 makes it super easy for security teams 104 00:04:04,599 --> 00:04:06,760 to do automated threat detection of 105 00:04:06,760 --> 00:04:09,200 suspicious activities and alert on the 106 00:04:09,200 --> 00:04:11,280 going on in their environment cloud 107 00:04:11,280 --> 00:04:13,360 trail is fantastic for answering the 108 00:04:13,360 --> 00:04:17,358 question of who did what win in an AWS 109 00:04:17,358 --> 00:04:21,759 account now by that exact same notion uh 110 00:04:21,759 --> 00:04:24,160 what's great for security teams is a 111 00:04:24,160 --> 00:04:27,479 problem for adversaries for an attacker 112 00:04:27,479 --> 00:04:29,919 there is a significant draw to want to 113 00:04:29,919 --> 00:04:33,160 go after and use stolen imem credentials 114 00:04:33,160 --> 00:04:35,240 because with those credentials they open 115 00:04:35,240 --> 00:04:37,280 the possibility for things like privileg 116 00:04:37,280 --> 00:04:39,919 escalation lateral movement accessing 117 00:04:39,919 --> 00:04:42,720 resources maintaining persistence and so 118 00:04:42,720 --> 00:04:46,320 much more but adversaries run the risk 119 00:04:46,320 --> 00:04:47,880 that just about anything they would do 120 00:04:47,880 --> 00:04:49,720 with those credentials would ultimately 121 00:04:49,720 --> 00:04:51,720 get logged to cloud trail and later on 122 00:04:51,720 --> 00:04:54,360 analyzed by a sim a DAT leg or something 123 00:04:54,360 --> 00:04:57,639 else getting them caught and so this is 124 00:04:57,639 --> 00:04:59,680 the motivation behind the research we're 125 00:04:59,680 --> 00:05:01,320 going to be talking about today 126 00:05:01,320 --> 00:05:04,600 adversaries want to leave as as small a 127 00:05:04,600 --> 00:05:07,240 footprint as possible to try and evade 128 00:05:07,240 --> 00:05:10,039 detection and you can't really get much 129 00:05:10,039 --> 00:05:12,160 better than leaving no Trace at 130 00:05:12,160 --> 00:05:14,360 all uh and it's important to note that 131 00:05:14,360 --> 00:05:16,240 from the victim's perspective if an 132 00:05:16,240 --> 00:05:18,400 adversary can invoke actions against the 133 00:05:18,400 --> 00:05:21,000 ad of API without leaving any Trace in 134 00:05:21,000 --> 00:05:24,080 cloud trail that attacker is invisible 135 00:05:24,080 --> 00:05:25,840 Defenders have no way of knowing that 136 00:05:25,840 --> 00:05:27,680 this activity has 137 00:05:27,680 --> 00:05:29,800 occurred so let's talk a little bit 138 00:05:29,800 --> 00:05:32,880 about how the ews Epi Works um one of 139 00:05:32,880 --> 00:05:35,080 the major talking points or one of the 140 00:05:35,080 --> 00:05:37,280 major design focuses at AWS is something 141 00:05:37,280 --> 00:05:40,160 they referred to as model first design 142 00:05:40,160 --> 00:05:41,840 and what they mean by this is when they 143 00:05:41,840 --> 00:05:44,319 create a new service before they write a 144 00:05:44,319 --> 00:05:46,720 single line of code they first create a 145 00:05:46,720 --> 00:05:48,919 model that describes everything about 146 00:05:48,919 --> 00:05:51,759 that service what its operations will be 147 00:05:51,759 --> 00:05:54,919 what parameters they'll need and so on 148 00:05:54,919 --> 00:05:58,039 now uh as a result this model first 149 00:05:58,039 --> 00:06:00,120 designed carries over well into 150 00:06:00,120 --> 00:06:01,680 production and as a result we can 151 00:06:01,680 --> 00:06:04,759 actually extract out those models from 152 00:06:04,759 --> 00:06:07,440 the SDK uh what you see on the slide 153 00:06:07,440 --> 00:06:10,039 here is a sample the the top portion of 154 00:06:10,039 --> 00:06:11,800 the model for the secrets manager 155 00:06:11,800 --> 00:06:14,400 Service uh that I pulled from the bodor 156 00:06:14,400 --> 00:06:15,680 python 157 00:06:15,680 --> 00:06:18,319 library now these models are incredibly 158 00:06:18,319 --> 00:06:20,039 important because if you want to 159 00:06:20,039 --> 00:06:22,599 interact with the adus API you need 160 00:06:22,599 --> 00:06:24,800 basically all the information contained 161 00:06:24,800 --> 00:06:27,199 within this model uh when it comes to 162 00:06:27,199 --> 00:06:30,120 things like undocumented apis finding 163 00:06:30,120 --> 00:06:32,919 these is basically half the 164 00:06:32,919 --> 00:06:35,560 battle so there's a lot of important 165 00:06:35,560 --> 00:06:37,440 parts in the model for our purposes 166 00:06:37,440 --> 00:06:39,800 today by far the most important part is 167 00:06:39,800 --> 00:06:42,400 something called the protocol the 168 00:06:42,400 --> 00:06:45,000 protocol of an ads API is essentially 169 00:06:45,000 --> 00:06:47,160 the format by which the client will 170 00:06:47,160 --> 00:06:49,120 serialize requests so they can be 171 00:06:49,120 --> 00:06:51,960 properly deserialized on the server and 172 00:06:51,960 --> 00:06:54,120 as we can see here uh Secrets manager 173 00:06:54,120 --> 00:06:57,360 uses the Json protocol specifically Json 174 00:06:57,360 --> 00:06:58,400 version 175 00:06:58,400 --> 00:07:01,720 1.1 there are six possible protocols 176 00:07:01,720 --> 00:07:04,440 currently in use by the ads API and 177 00:07:04,440 --> 00:07:06,879 again this is simply the format of the 178 00:07:06,879 --> 00:07:09,400 request so to continue our secrets 179 00:07:09,400 --> 00:07:11,479 manager example because we know that 180 00:07:11,479 --> 00:07:14,960 Secrets manager uses Json version 1.1 181 00:07:14,960 --> 00:07:16,840 that tells us it'll always be a post 182 00:07:16,840 --> 00:07:19,599 request it'll always go to the base path 183 00:07:19,599 --> 00:07:22,199 not/ API or anything like that we know 184 00:07:22,199 --> 00:07:25,080 it'll send content as Json we know there 185 00:07:25,080 --> 00:07:27,319 will be an X Amazon Target header which 186 00:07:27,319 --> 00:07:29,400 is comprised of some terms from the 187 00:07:29,400 --> 00:07:33,080 model as well as the content type header 188 00:07:33,080 --> 00:07:34,840 and for our purposes this is the most 189 00:07:34,840 --> 00:07:38,000 important part as for the Json family of 190 00:07:38,000 --> 00:07:41,120 services the content type header is the 191 00:07:41,120 --> 00:07:44,280 version of Json that gets sent along and 192 00:07:44,280 --> 00:07:46,159 so this introduces the first potential 193 00:07:46,159 --> 00:07:49,960 for cloudro bypass if the adus API uses 194 00:07:49,960 --> 00:07:53,479 this very rigid well formatted structure 195 00:07:53,479 --> 00:07:55,680 what happens if we were to mutate our 196 00:07:55,680 --> 00:07:59,039 requests or malform our inputs could we 197 00:07:59,039 --> 00:08:01,319 call the Ed API to behave in a way that 198 00:08:01,319 --> 00:08:03,720 is advantageous to an 199 00:08:03,720 --> 00:08:06,000 attacker an interesting place to get 200 00:08:06,000 --> 00:08:08,039 started with this is simply well hey if 201 00:08:08,039 --> 00:08:09,759 there's two versions of Json what 202 00:08:09,759 --> 00:08:11,639 happens if I send the wrong version to a 203 00:08:11,639 --> 00:08:13,520 particular endpoint so for instance 204 00:08:13,520 --> 00:08:17,919 sending a 1.0 header to a 1.1 205 00:08:17,919 --> 00:08:20,360 API as it turns out we got some 206 00:08:20,360 --> 00:08:23,159 interesting results depending on if an 207 00:08:23,159 --> 00:08:26,240 identity did or did not have permission 208 00:08:26,240 --> 00:08:28,720 to perform an API action you would get 209 00:08:28,720 --> 00:08:31,840 back a different HTTP Response Code if 210 00:08:31,840 --> 00:08:33,719 you did have permission you get back a 211 00:08:33,719 --> 00:08:36,159 404 and if you did not you would get 212 00:08:36,159 --> 00:08:39,599 back a 403 and critical to all of this 213 00:08:39,599 --> 00:08:41,839 regardless of the level of permission 214 00:08:41,839 --> 00:08:45,120 none of it got logged to cloud trail and 215 00:08:45,120 --> 00:08:47,320 so what this meant was for an adversary 216 00:08:47,320 --> 00:08:49,480 who has stolen IM IM credentials they 217 00:08:49,480 --> 00:08:51,560 could use this technique of changing a 218 00:08:51,560 --> 00:08:54,000 single character in a header to silently 219 00:08:54,000 --> 00:08:56,040 enumerate what permissions they had 220 00:08:56,040 --> 00:08:59,240 access to all while avoiding detection 221 00:08:59,240 --> 00:09:02,320 and at the time this applied to over 645 222 00:09:02,320 --> 00:09:05,160 actions across over 40 223 00:09:05,160 --> 00:09:07,480 Services now for a little bit of 224 00:09:07,480 --> 00:09:09,440 background on why this matters or how we 225 00:09:09,440 --> 00:09:11,440 would use this it's important to note 226 00:09:11,440 --> 00:09:13,720 that for adversaries who have stolen IM 227 00:09:13,720 --> 00:09:15,600 IM credentials they don't have a very 228 00:09:15,600 --> 00:09:17,279 good way of knowing what level of 229 00:09:17,279 --> 00:09:19,920 privilege they've just compromised the 230 00:09:19,920 --> 00:09:21,519 the keys that they found might belong to 231 00:09:21,519 --> 00:09:23,640 the root user and have full access to 232 00:09:23,640 --> 00:09:26,120 that AWS account or they might have 233 00:09:26,120 --> 00:09:29,279 literally no permissions at all and so a 234 00:09:29,279 --> 00:09:31,760 common technique or method that 235 00:09:31,760 --> 00:09:33,800 adversaries use to deal with this is 236 00:09:33,800 --> 00:09:36,000 root Force they try and see what works 237 00:09:36,000 --> 00:09:37,920 if it succeeds they know they have that 238 00:09:37,920 --> 00:09:40,200 permission if it fails well they know 239 00:09:40,200 --> 00:09:42,920 that they don't now the good news for 240 00:09:42,920 --> 00:09:44,600 Defenders oh and one thing I should 241 00:09:44,600 --> 00:09:46,240 mention other's even a handy tool to 242 00:09:46,240 --> 00:09:47,680 Brute Force this for you called 243 00:09:47,680 --> 00:09:50,079 enumerate imem simply run this tool and 244 00:09:50,079 --> 00:09:52,320 you will very quickly find out what uh 245 00:09:52,320 --> 00:09:55,160 API calls you can make with a pair of uh 246 00:09:55,160 --> 00:09:56,959 stolen IM IM 247 00:09:56,959 --> 00:09:59,839 credentials now the good good news for 248 00:09:59,839 --> 00:10:01,880 defenders in this case is that this 249 00:10:01,880 --> 00:10:04,200 behavior is incredibly noisy and 250 00:10:04,200 --> 00:10:06,399 definitely easy to spot it presents 251 00:10:06,399 --> 00:10:08,920 itself as a sudden increase in access 252 00:10:08,920 --> 00:10:11,279 denied errors in cloud trail or you can 253 00:10:11,279 --> 00:10:13,640 also pick up on it by a identity 254 00:10:13,640 --> 00:10:15,800 performing API actions that has no 255 00:10:15,800 --> 00:10:18,560 history of ever doing so before and as a 256 00:10:18,560 --> 00:10:20,320 result this serves as a golden 257 00:10:20,320 --> 00:10:22,120 opportunity to detect suspicious 258 00:10:22,120 --> 00:10:24,120 attacker Behavior going on in your 259 00:10:24,120 --> 00:10:26,760 environment and kicking them out of 260 00:10:26,760 --> 00:10:30,399 it but if we use the method I described 261 00:10:30,399 --> 00:10:32,440 previously of changing a single 262 00:10:32,440 --> 00:10:34,920 character in a header none of it would 263 00:10:34,920 --> 00:10:37,079 appear in cloud trail and adversaries 264 00:10:37,079 --> 00:10:39,320 would have a free pass to enumerate 265 00:10:39,320 --> 00:10:41,320 hundreds of permissions for tens of 266 00:10:41,320 --> 00:10:44,200 services completely silently all while 267 00:10:44,200 --> 00:10:46,800 avoiding cloud trail Defenders would 268 00:10:46,800 --> 00:10:49,279 lose out on a golden opportunity to 269 00:10:49,279 --> 00:10:51,240 detect suspicious behavior and 270 00:10:51,240 --> 00:10:53,079 adversaries get a free pass to move on 271 00:10:53,079 --> 00:10:55,519 to their next objective uh if you're 272 00:10:55,519 --> 00:10:57,240 interested in this topic I have a ton of 273 00:10:57,240 --> 00:10:59,800 additional resources links proof of 274 00:10:59,800 --> 00:11:01,839 concept scripts at that uh URL down 275 00:11:01,839 --> 00:11:04,320 below um for its time this was an 276 00:11:04,320 --> 00:11:06,240 amazing technique for pentesters and red 277 00:11:06,240 --> 00:11:07,920 teamers to silently enumerate 278 00:11:07,920 --> 00:11:11,000 permissions and avoid the 279 00:11:11,000 --> 00:11:13,440 sock uh next I'd like to talk a little 280 00:11:13,440 --> 00:11:16,320 bit about undocumented apis um these 281 00:11:16,320 --> 00:11:18,399 have been a very Hot Topic in the aw 282 00:11:18,399 --> 00:11:20,240 security research Community lately as 283 00:11:20,240 --> 00:11:22,079 they have led to some fairly significant 284 00:11:22,079 --> 00:11:23,760 vulnerabilities including cross tenant 285 00:11:23,760 --> 00:11:26,040 ones and they've been shown to have the 286 00:11:26,040 --> 00:11:29,600 potential for cloud trail bypass now 287 00:11:29,600 --> 00:11:33,560 the problem with an undocumented API is 288 00:11:33,560 --> 00:11:37,279 how do you find it because it is 289 00:11:37,279 --> 00:11:39,560 undocumented we can't exactly just roll 290 00:11:39,560 --> 00:11:42,959 up to the uh wikis or anything else to 291 00:11:42,959 --> 00:11:45,360 figure out what apis are 292 00:11:45,360 --> 00:11:47,639 available by far the best way that I've 293 00:11:47,639 --> 00:11:49,399 personally found to do this has been to 294 00:11:49,399 --> 00:11:52,000 abuse the AWS 295 00:11:52,000 --> 00:11:54,200 console in order for your browser to 296 00:11:54,200 --> 00:11:57,040 know how to properly format sign and 297 00:11:57,040 --> 00:11:58,800 configure those requests it needs to 298 00:11:58,800 --> 00:12:00,880 have have those very same models that I 299 00:12:00,880 --> 00:12:03,279 showed previously and as a result what 300 00:12:03,279 --> 00:12:06,160 you can do is crawl the Edis console and 301 00:12:06,160 --> 00:12:08,399 extract out those models from the 302 00:12:08,399 --> 00:12:10,760 JavaScript that gets sent to the client 303 00:12:10,760 --> 00:12:13,160 and interestingly enough the models that 304 00:12:13,160 --> 00:12:15,639 are in the console are not the same ones 305 00:12:15,639 --> 00:12:18,160 that appear in the sdks and often 306 00:12:18,160 --> 00:12:21,440 include internal only and undocumented 307 00:12:21,440 --> 00:12:24,120 apis now as an example of this if you 308 00:12:24,120 --> 00:12:26,000 were to crawl the console and start 309 00:12:26,000 --> 00:12:27,639 extracting these you would eventually 310 00:12:27,639 --> 00:12:30,720 find a service called IEM 311 00:12:30,720 --> 00:12:33,399 admin now I am admin is super 312 00:12:33,399 --> 00:12:35,040 interesting aside from the fact that its 313 00:12:35,040 --> 00:12:37,160 name is I 314 00:12:37,160 --> 00:12:40,000 admin uh it's actually likely a service 315 00:12:40,000 --> 00:12:41,720 you may have interacted with before you 316 00:12:41,720 --> 00:12:43,480 just didn't know it uh if you were to 317 00:12:43,480 --> 00:12:45,880 open up your browser navigate to the IEM 318 00:12:45,880 --> 00:12:48,440 page in the console uh hit F12 to open 319 00:12:48,440 --> 00:12:50,240 the the network Tab and refresh you'd 320 00:12:50,240 --> 00:12:52,639 start seeing calls to the imem admin 321 00:12:52,639 --> 00:12:54,920 service now another interesting thing 322 00:12:54,920 --> 00:12:57,160 about it is that the names of its 323 00:12:57,160 --> 00:13:00,360 operations sound Vaguely Familiar to IM 324 00:13:00,360 --> 00:13:03,320 ones but not quite so for instance IM IM 325 00:13:03,320 --> 00:13:05,279 admin has an operation titled list 326 00:13:05,279 --> 00:13:07,399 access keys for multiple users which 327 00:13:07,399 --> 00:13:10,320 sounds sort of similar to I IM list 328 00:13:10,320 --> 00:13:11,519 access 329 00:13:11,519 --> 00:13:13,920 Keys uh now again we can crawl the 330 00:13:13,920 --> 00:13:15,959 console extract out uh all the 331 00:13:15,959 --> 00:13:18,000 information we need and this gives us a 332 00:13:18,000 --> 00:13:20,320 nice list of operations that we can 333 00:13:20,320 --> 00:13:23,800 invoke against theem admin 334 00:13:23,800 --> 00:13:26,800 Service uh now from here a common trick 335 00:13:26,800 --> 00:13:29,800 used by ad security researchers is if 336 00:13:29,800 --> 00:13:33,399 you find a sketchy API try and invoke it 337 00:13:33,399 --> 00:13:35,959 with a user or role who has no 338 00:13:35,959 --> 00:13:38,519 permissions at all and the reason you do 339 00:13:38,519 --> 00:13:40,959 that is because the API that you are 340 00:13:40,959 --> 00:13:43,279 calling does not always have a on toone 341 00:13:43,279 --> 00:13:45,240 relationship to what actually gets 342 00:13:45,240 --> 00:13:47,639 invoked on the back end so to 343 00:13:47,639 --> 00:13:50,639 demonstrate this if you were to call IEM 344 00:13:50,639 --> 00:13:52,399 admin list access keys for multiple 345 00:13:52,399 --> 00:13:55,279 users in the resulting error message you 346 00:13:55,279 --> 00:13:58,160 get back you'll see user is not 347 00:13:58,160 --> 00:14:01,320 authorized to to perform IM list access 348 00:14:01,320 --> 00:14:06,920 keys and that is a normal documented API 349 00:14:06,920 --> 00:14:08,920 and so it's through this method of using 350 00:14:08,920 --> 00:14:12,279 an undocumented API sort of as a proxy 351 00:14:12,279 --> 00:14:14,360 that we can invoke normal 352 00:14:14,360 --> 00:14:16,720 apis and of course if we repeat this 353 00:14:16,720 --> 00:14:18,880 process for all the operations we found 354 00:14:18,880 --> 00:14:20,560 in the previous step we're able to 355 00:14:20,560 --> 00:14:23,959 create a map between the undocumented 356 00:14:23,959 --> 00:14:27,120 imem admin operations and the documented 357 00:14:27,120 --> 00:14:29,839 imem ones 358 00:14:29,839 --> 00:14:32,320 now the question here is when we invoke 359 00:14:32,320 --> 00:14:34,639 these apis what does this look like in 360 00:14:34,639 --> 00:14:37,800 cloudrail does it show up as I Imon does 361 00:14:37,800 --> 00:14:40,800 it show up as IM IM does it show up as 362 00:14:40,800 --> 00:14:44,240 both Well turns out showed up as neither 363 00:14:44,240 --> 00:14:46,440 because it didn't show up at 364 00:14:46,440 --> 00:14:49,279 all none of the invocations against the 365 00:14:49,279 --> 00:14:51,920 IMM and service would appear in cloud 366 00:14:51,920 --> 00:14:54,639 trail and so it's through this method of 367 00:14:54,639 --> 00:14:57,120 using an undocumented API that an 368 00:14:57,120 --> 00:14:58,680 attacker would be able to make 369 00:14:58,680 --> 00:15:00,800 invitations to the imem service 370 00:15:00,800 --> 00:15:03,519 completely silently all while avoiding 371 00:15:03,519 --> 00:15:06,240 cloud trail now the reason this matters 372 00:15:06,240 --> 00:15:07,920 is again this is another golden 373 00:15:07,920 --> 00:15:09,480 opportunity to detect suspicious 374 00:15:09,480 --> 00:15:11,880 Behavior Uh a ton of commercial Sims 375 00:15:11,880 --> 00:15:14,360 have default out ofthe boox rules for 376 00:15:14,360 --> 00:15:16,519 things like suspicious calls to list 377 00:15:16,519 --> 00:15:18,680 access Keys list groups things like that 378 00:15:18,680 --> 00:15:21,120 and even aws's own guard Duty has a 379 00:15:21,120 --> 00:15:23,480 detection for anomalous Behavior that's 380 00:15:23,480 --> 00:15:27,560 designed to catch literally this um but 381 00:15:27,560 --> 00:15:29,680 because we're bypassing cloud trail none 382 00:15:29,680 --> 00:15:31,600 of those tools have the opportunity to 383 00:15:31,600 --> 00:15:34,480 see this activity at all and adversaries 384 00:15:34,480 --> 00:15:36,480 get a free pass to do do what they want 385 00:15:36,480 --> 00:15:39,680 completely silently now this specific 386 00:15:39,680 --> 00:15:42,639 example has since been fixed by NWS any 387 00:15:42,639 --> 00:15:45,600 calls to imem admin will show up as the 388 00:15:45,600 --> 00:15:48,880 equivalent imem operation in cloud trail 389 00:15:48,880 --> 00:15:51,480 but due to the sheer number of thousands 390 00:15:51,480 --> 00:15:54,199 of undocumented apis it makes you wonder 391 00:15:54,199 --> 00:15:57,600 what other apis behave in a similar 392 00:15:57,600 --> 00:16:00,519 manner and that takes us to uh a pretty 393 00:16:00,519 --> 00:16:02,600 exciting topic uh nonproduction 394 00:16:02,600 --> 00:16:04,920 endpoints um personally I think this is 395 00:16:04,920 --> 00:16:06,880 the most likely to return future cloud 396 00:16:06,880 --> 00:16:09,199 trail bypasses with relatively little 397 00:16:09,199 --> 00:16:11,040 effort and we'll talk a little bit about 398 00:16:11,040 --> 00:16:14,040 why that is but first um a little bit of 399 00:16:14,040 --> 00:16:17,639 background with the ads API the endpoint 400 00:16:17,639 --> 00:16:19,920 that you're interacting with Will differ 401 00:16:19,920 --> 00:16:22,560 on a service by service basis and a 402 00:16:22,560 --> 00:16:25,800 region by region basis and the format 403 00:16:25,800 --> 00:16:28,600 for that endpoint is typically all 404 00:16:28,600 --> 00:16:33,079 though not always servic name. region. 405 00:16:33,079 --> 00:16:36,560 amazon.com so to continue our uh Secrets 406 00:16:36,560 --> 00:16:38,440 manager example if you want to talk to 407 00:16:38,440 --> 00:16:40,839 Secrets manager in the usd1 region 408 00:16:40,839 --> 00:16:43,440 that's the endpoint you would use now 409 00:16:43,440 --> 00:16:45,000 it's important to note that that is an 410 00:16:45,000 --> 00:16:47,800 example of a production endpoint that's 411 00:16:47,800 --> 00:16:51,240 what the CLI SDK console all use it's 412 00:16:51,240 --> 00:16:53,720 what you're expected to use it may 413 00:16:53,720 --> 00:16:55,959 surprise you to know that there are 414 00:16:55,959 --> 00:16:59,240 thousands of non production points that 415 00:16:59,240 --> 00:17:01,279 we may be able to interact with over the 416 00:17:01,279 --> 00:17:03,399 internet and we may be able to 417 00:17:03,399 --> 00:17:05,720 authenticate against using our normal 418 00:17:05,720 --> 00:17:09,280 AWS accounts now these non-production 419 00:17:09,280 --> 00:17:12,160 endpoints exist for a variety of reasons 420 00:17:12,160 --> 00:17:14,599 there are pre-production environments uh 421 00:17:14,599 --> 00:17:17,280 Alpha Beta gamma which is part of aws's 422 00:17:17,280 --> 00:17:19,959 deployment pipeline uh there's staging 423 00:17:19,959 --> 00:17:23,359 preview builds uh uh Legacy alphabetical 424 00:17:23,359 --> 00:17:26,000 ones and so on and again this is just a 425 00:17:26,000 --> 00:17:28,760 small uh subset there are thousands and 426 00:17:28,760 --> 00:17:31,720 thousands of these out there now you 427 00:17:31,720 --> 00:17:34,480 might be thinking okay cool but how do I 428 00:17:34,480 --> 00:17:37,039 interact with that endpoint do I have to 429 00:17:37,039 --> 00:17:39,600 manually sign it using sigv4 the good 430 00:17:39,600 --> 00:17:42,559 news is no you don't uh at least for 431 00:17:42,559 --> 00:17:45,039 apis that exist within the CLI you can 432 00:17:45,039 --> 00:17:47,320 actually use the CLI for this there is a 433 00:17:47,320 --> 00:17:50,280 handy uh argument for endpoint URL 434 00:17:50,280 --> 00:17:52,080 simply pass in the endpoint you want to 435 00:17:52,080 --> 00:17:54,120 use and everything works about as well 436 00:17:54,120 --> 00:17:56,840 as you'd expect now nonproduction 437 00:17:56,840 --> 00:17:58,799 endpoints are particular particularly 438 00:17:58,799 --> 00:18:01,440 exciting for a wide variety of use cases 439 00:18:01,440 --> 00:18:03,840 related to defense evasion including 440 00:18:03,840 --> 00:18:07,120 outside of cloud trail bypass to sort of 441 00:18:07,120 --> 00:18:09,320 get us started to sort of set a base 442 00:18:09,320 --> 00:18:11,600 case situation I'd like to introduce you 443 00:18:11,600 --> 00:18:16,120 to ks- a now this is a nonproduction 444 00:18:16,120 --> 00:18:19,240 endpoint that has access to production 445 00:18:19,240 --> 00:18:21,799 resources and does log to cloud trail 446 00:18:21,799 --> 00:18:23,799 and what I mean by that is if you were 447 00:18:23,799 --> 00:18:25,880 to use that endpoint uh if you were to 448 00:18:25,880 --> 00:18:27,640 list Keys you would see all the keys you 449 00:18:27,640 --> 00:18:30,360 would expect uh if you were to modify 450 00:18:30,360 --> 00:18:32,280 delete or create something via that 451 00:18:32,280 --> 00:18:34,919 endpoint all of the those changes or 452 00:18:34,919 --> 00:18:37,159 what you created would also show up in 453 00:18:37,159 --> 00:18:39,400 the normal production uh endpoint it 454 00:18:39,400 --> 00:18:41,240 show up in the console and everything 455 00:18:41,240 --> 00:18:43,559 would work fairly normally additionally 456 00:18:43,559 --> 00:18:46,960 all of it gets logged to cloud trail now 457 00:18:46,960 --> 00:18:48,919 the reason I'm being so specific that 458 00:18:48,919 --> 00:18:51,360 this endpoint exhibits the behavior of 459 00:18:51,360 --> 00:18:53,280 having access to production resources 460 00:18:53,280 --> 00:18:55,159 and logging to clown Trail is because 461 00:18:55,159 --> 00:18:58,520 it's possible for the inverse to be true 462 00:18:58,520 --> 00:19:01,080 there are nonproduction endpoints that 463 00:19:01,080 --> 00:19:03,039 do not have access to production 464 00:19:03,039 --> 00:19:05,919 resources and do not log to cloud trail 465 00:19:05,919 --> 00:19:07,320 now to demonstrate this we have a little 466 00:19:07,320 --> 00:19:09,000 bit of a test setup and I apologize I 467 00:19:09,000 --> 00:19:10,840 recognize uh the fonts are probably 468 00:19:10,840 --> 00:19:13,520 super tiny so I'll narrate um here we're 469 00:19:13,520 --> 00:19:16,840 performing two API calls the first is 470 00:19:16,840 --> 00:19:21,120 SNS list topics in the US East 2 region 471 00:19:21,120 --> 00:19:23,880 and you see that we get back on topic 472 00:19:23,880 --> 00:19:26,240 because there is one in that in that 473 00:19:26,240 --> 00:19:30,200 region uh we then perform the same API 474 00:19:30,200 --> 00:19:33,159 operation a second time but this time 475 00:19:33,159 --> 00:19:36,440 against the nonproduction endpoint 476 00:19:36,440 --> 00:19:39,760 sn- gamma and you see that we get back 477 00:19:39,760 --> 00:19:40,919 an empty 478 00:19:40,919 --> 00:19:43,880 response now presumably this is because 479 00:19:43,880 --> 00:19:46,240 ss- gamma doesn't have access to 480 00:19:46,240 --> 00:19:48,280 production resources hopefully in the 481 00:19:48,280 --> 00:19:49,919 same way that your pre-production 482 00:19:49,919 --> 00:19:51,919 environment doesn't have access to your 483 00:19:51,919 --> 00:19:53,600 production database or anything like 484 00:19:53,600 --> 00:19:56,280 that now this is all a bit of a bummer 485 00:19:56,280 --> 00:19:58,240 because that nonproduction endpoint 486 00:19:58,240 --> 00:20:00,360 doesn't log to cloud trail and so if it 487 00:20:00,360 --> 00:20:02,360 did have access to production resources 488 00:20:02,360 --> 00:20:04,159 that'd be great we could interact with 489 00:20:04,159 --> 00:20:06,039 this service completely silently create 490 00:20:06,039 --> 00:20:09,039 modifi delete all while avoiding cloud 491 00:20:09,039 --> 00:20:12,240 trail but just because it doesn't have 492 00:20:12,240 --> 00:20:14,480 access to production resources doesn't 493 00:20:14,480 --> 00:20:17,320 mean it's entirely worthless to us if 494 00:20:17,320 --> 00:20:19,799 you'll notice we still got a successful 495 00:20:19,799 --> 00:20:22,200 response it came back empty so we can't 496 00:20:22,200 --> 00:20:25,120 see the the resources but somewhere 497 00:20:25,120 --> 00:20:27,400 along the line IM took a look at the 498 00:20:27,400 --> 00:20:28,960 permissions of the identity performing 499 00:20:28,960 --> 00:20:30,840 this API call and said yeah you're 500 00:20:30,840 --> 00:20:32,760 authorized to do that and let it go 501 00:20:32,760 --> 00:20:35,799 through and critically it didn't get 502 00:20:35,799 --> 00:20:38,640 logged to cloud trail we see only one 503 00:20:38,640 --> 00:20:40,799 event because we performed that top one 504 00:20:40,799 --> 00:20:43,039 completely normally it didn't see the 505 00:20:43,039 --> 00:20:45,120 second one and so it's through this 506 00:20:45,120 --> 00:20:47,280 method of using a non-production 507 00:20:47,280 --> 00:20:49,120 endpoint very similar to what I 508 00:20:49,120 --> 00:20:51,080 described with the protocol mutation 509 00:20:51,080 --> 00:20:52,919 that we can enumerate permissions 510 00:20:52,919 --> 00:20:54,960 completely 511 00:20:54,960 --> 00:20:58,400 silently uh and for my uh this this 512 00:20:58,400 --> 00:21:00,400 raises the questions uh if you're an 513 00:21:00,400 --> 00:21:01,799 adversary who has stolen I IM 514 00:21:01,799 --> 00:21:03,760 credentials why would you ever use a 515 00:21:03,760 --> 00:21:05,679 normal production endpoint that'll log 516 00:21:05,679 --> 00:21:07,440 to cloud trail and probably get you 517 00:21:07,440 --> 00:21:09,159 caught when you might be able to take 518 00:21:09,159 --> 00:21:11,480 advantage of a non-production point get 519 00:21:11,480 --> 00:21:13,679 the exact same information and 520 00:21:13,679 --> 00:21:16,960 completely avoid cloud trail uh and as 521 00:21:16,960 --> 00:21:18,200 you mentioned for my pentest and Red 522 00:21:18,200 --> 00:21:20,159 Team friends this technique still works 523 00:21:20,159 --> 00:21:22,480 today uh including outside of that 524 00:21:22,480 --> 00:21:24,320 endpoint it works for a variety of 525 00:21:24,320 --> 00:21:28,240 endpoints across a variety of services 526 00:21:28,240 --> 00:21:29,919 uh I did disclose this to ews who 527 00:21:29,919 --> 00:21:31,480 responded that they're not interested in 528 00:21:31,480 --> 00:21:33,440 changing this Behavior at this time 529 00:21:33,440 --> 00:21:35,320 which as a result makes it fair game to 530 00:21:35,320 --> 00:21:38,000 abuse uh and in a few weeks I I intend 531 00:21:38,000 --> 00:21:40,559 to release a blog post with uh the full 532 00:21:40,559 --> 00:21:42,360 data set of nonproduction endpoints that 533 00:21:42,360 --> 00:21:44,520 behave this way along with their 534 00:21:44,520 --> 00:21:47,400 Associated uh 535 00:21:47,400 --> 00:21:50,679 Service uh next the next potential use 536 00:21:50,679 --> 00:21:52,520 case for uh nonproduction end points 537 00:21:52,520 --> 00:21:54,520 that we'll talk about here is something 538 00:21:54,520 --> 00:21:57,120 called Event Source obfuscation and to 539 00:21:57,120 --> 00:21:59,960 be clear this is super rare this is 540 00:21:59,960 --> 00:22:02,080 probably the rarest combination of 541 00:22:02,080 --> 00:22:03,960 attributes I've seen on a non-production 542 00:22:03,960 --> 00:22:06,799 endpoint um but here's an example of it 543 00:22:06,799 --> 00:22:09,400 working uh again tiny font so I'll I'll 544 00:22:09,400 --> 00:22:12,080 narrate uh we're performing uh two API 545 00:22:12,080 --> 00:22:13,679 calls very similar set up to what we did 546 00:22:13,679 --> 00:22:16,679 before uh we're doing IVs list channels 547 00:22:16,679 --> 00:22:19,320 in the AP Northeast one region and you 548 00:22:19,320 --> 00:22:21,559 see we get back a result because there 549 00:22:21,559 --> 00:22:24,000 is one there is a channel in that region 550 00:22:24,000 --> 00:22:27,520 we then do the exact same operation but 551 00:22:27,520 --> 00:22:29,360 this time using the non-production 552 00:22:29,360 --> 00:22:33,679 endpoint iv- gamma and this time we do 553 00:22:33,679 --> 00:22:36,039 get back a result presumably this 554 00:22:36,039 --> 00:22:37,960 non-production res or non-production 555 00:22:37,960 --> 00:22:39,840 endpoint has access to production 556 00:22:39,840 --> 00:22:42,520 resources great does it log to cloud 557 00:22:42,520 --> 00:22:45,960 trail well bad news there's two events 558 00:22:45,960 --> 00:22:48,960 so yes it does log to cloud trail but it 559 00:22:48,960 --> 00:22:53,080 does it wrong um if you'll notice the uh 560 00:22:53,080 --> 00:22:54,559 the first invocation the one that 561 00:22:54,559 --> 00:22:56,480 occurred at the 19th second the one on 562 00:22:56,480 --> 00:22:57,960 the bottom that we did totally normal 563 00:22:57,960 --> 00:23:01,640 normally has an event source of iv. 564 00:23:01,640 --> 00:23:03,880 amazon.com now that's what we would 565 00:23:03,880 --> 00:23:06,600 expect that's totally normal the second 566 00:23:06,600 --> 00:23:08,640 invocation the one we used with the 567 00:23:08,640 --> 00:23:10,720 non-production endpoint that occurred at 568 00:23:10,720 --> 00:23:14,039 the 25th second has an event source of 569 00:23:14,039 --> 00:23:15,559 gamma- 570 00:23:15,559 --> 00:23:17,799 starfruit now I don't know what 571 00:23:17,799 --> 00:23:20,400 starfruit is or gamma- starfruit is I 572 00:23:20,400 --> 00:23:23,159 presume it's an internal a code name or 573 00:23:23,159 --> 00:23:25,200 service name or something like that and 574 00:23:25,200 --> 00:23:27,200 worth knowing not all nonproduction 575 00:23:27,200 --> 00:23:29,279 endpoints that exhibit this event Source 576 00:23:29,279 --> 00:23:31,919 ausc Behavior have an event source of 577 00:23:31,919 --> 00:23:34,400 gamma- starfruit instead by far the much 578 00:23:34,400 --> 00:23:36,520 more common format that I've seen is 579 00:23:36,520 --> 00:23:39,919 gamma- service name but um starfruit is 580 00:23:39,919 --> 00:23:42,640 certainly the most interesting now this 581 00:23:42,640 --> 00:23:45,480 matters for two key reasons the first is 582 00:23:45,480 --> 00:23:47,240 it's worth knowing that there are a ton 583 00:23:47,240 --> 00:23:49,799 of commercial Sims that use the Event 584 00:23:49,799 --> 00:23:53,120 Source as a part of their detection Rule 585 00:23:53,120 --> 00:23:56,200 and if you were to uh have a rule for as 586 00:23:56,200 --> 00:23:58,480 an example this IVs service 587 00:23:58,480 --> 00:24:00,880 when that Sim goes to evaluate that rule 588 00:24:00,880 --> 00:24:02,760 against this event it's going to compare 589 00:24:02,760 --> 00:24:04,360 two strings and they're not going to 590 00:24:04,360 --> 00:24:07,200 match and so this can be a way to evade 591 00:24:07,200 --> 00:24:09,960 detection from some Sim detection 592 00:24:09,960 --> 00:24:12,320 rules the second reason this matters is 593 00:24:12,320 --> 00:24:14,559 for forensic scenarios uh post 594 00:24:14,559 --> 00:24:16,400 compromise post breach it's totally 595 00:24:16,400 --> 00:24:18,799 reasonable to want to pull all the uh 596 00:24:18,799 --> 00:24:20,600 logs for an affected service during a 597 00:24:20,600 --> 00:24:22,720 given time frame and typically when you 598 00:24:22,720 --> 00:24:24,600 pull logs on a service by service basis 599 00:24:24,600 --> 00:24:26,679 you do it by the Event Source if you try 600 00:24:26,679 --> 00:24:28,279 to pull all the logs for IBS you're 601 00:24:28,279 --> 00:24:30,720 going to miss out on that event that 602 00:24:30,720 --> 00:24:32,919 used Event Source acusation so something 603 00:24:32,919 --> 00:24:34,559 to keep in mind if you're involved in 604 00:24:34,559 --> 00:24:39,080 inser response or uh uh forensic 605 00:24:39,080 --> 00:24:42,000 scenarios does it show up on the 606 00:24:42,000 --> 00:24:46,919 bill uh great question um I don't know 607 00:24:46,919 --> 00:24:50,360 if I can answer that actually uh let's 608 00:24:50,360 --> 00:24:51,960 talk after we'll 609 00:24:51,960 --> 00:24:54,480 see um and and finally the last 610 00:24:54,480 --> 00:24:55,840 potential use case for nonproduction 611 00:24:55,840 --> 00:24:57,440 endpoints that's public and we'll talk 612 00:24:57,440 --> 00:25:00,039 about today is I'm as I'm sure you 613 00:25:00,039 --> 00:25:01,880 assumed uh there's a combination of 614 00:25:01,880 --> 00:25:03,880 attributes for uh has access to 615 00:25:03,880 --> 00:25:07,000 production resources and doesn't log to 616 00:25:07,000 --> 00:25:08,600 cloud trail and that's exactly what we 617 00:25:08,600 --> 00:25:11,120 saw in service catalog uh by simply 618 00:25:11,120 --> 00:25:13,360 changing the endpoint we're interacting 619 00:25:13,360 --> 00:25:16,440 with nothing would appear in cloud trail 620 00:25:16,440 --> 00:25:18,760 both read and write operations we can 621 00:25:18,760 --> 00:25:21,840 modify things completely silently and 622 00:25:21,840 --> 00:25:23,679 this is particularly concerning for a 623 00:25:23,679 --> 00:25:25,640 service like service catalog whose 624 00:25:25,640 --> 00:25:27,840 entire purpose is to be a centralized 625 00:25:27,840 --> 00:25:29,760 location to store infrastructures code 626 00:25:29,760 --> 00:25:31,520 templates that you would then deploy out 627 00:25:31,520 --> 00:25:33,399 across your Enterprise imagine a 628 00:25:33,399 --> 00:25:35,039 scenario in which an adversary gains a 629 00:25:35,039 --> 00:25:37,039 foothold in that account with privilege 630 00:25:37,039 --> 00:25:38,919 by literally changing the endpoint that 631 00:25:38,919 --> 00:25:41,159 they're talking to they could backo or 632 00:25:41,159 --> 00:25:43,520 modify those portfolios and applications 633 00:25:43,520 --> 00:25:45,919 completely silently as they get forced 634 00:25:45,919 --> 00:25:48,159 out across the Enterprise um if you're 635 00:25:48,159 --> 00:25:49,720 interested in service catalog there is 636 00:25:49,720 --> 00:25:51,399 actually a talk on this two sessions 637 00:25:51,399 --> 00:25:53,480 from now for using it for privilege 638 00:25:53,480 --> 00:25:55,480 escalation scenarios imagine how scary 639 00:25:55,480 --> 00:25:57,120 that would be if you could also evade 640 00:25:57,120 --> 00:25:58,559 all dete 641 00:25:58,559 --> 00:26:01,039 ction uh another example of this this 642 00:26:01,039 --> 00:26:03,320 time with the event Bridge service again 643 00:26:03,320 --> 00:26:05,520 very similar setup for whatever reason 644 00:26:05,520 --> 00:26:07,480 that particular endpoint when interacted 645 00:26:07,480 --> 00:26:09,200 with has access to production resources 646 00:26:09,200 --> 00:26:10,880 so you can see everything that exists 647 00:26:10,880 --> 00:26:14,000 there but you simply avoid all cloud 648 00:26:14,000 --> 00:26:16,440 trail now I'm sure you're wondering how 649 00:26:16,440 --> 00:26:18,520 do you find non-production endpoints 650 00:26:18,520 --> 00:26:20,720 it's a really good question uh I've 651 00:26:20,720 --> 00:26:22,640 tried a number of things I've tried root 652 00:26:22,640 --> 00:26:24,520 Force I've tried looking at subject 653 00:26:24,520 --> 00:26:27,279 alternative names in TLS shts uh looking 654 00:26:27,279 --> 00:26:31,760 at passive DNS uh asking AWS very nicely 655 00:26:31,760 --> 00:26:34,559 uh before eventually uh landing on what 656 00:26:34,559 --> 00:26:36,840 I think is probably the best uh at least 657 00:26:36,840 --> 00:26:38,679 the the fastest way to go about it is to 658 00:26:38,679 --> 00:26:41,440 use certificate transparency logs um 659 00:26:41,440 --> 00:26:44,159 there is a fantastic op Source tool 660 00:26:44,159 --> 00:26:46,039 called search spotter that allows you to 661 00:26:46,039 --> 00:26:49,360 monitor uh domains and subdomains uh for 662 00:26:49,360 --> 00:26:51,320 certificate transparency lcks and so I 663 00:26:51,320 --> 00:26:53,440 built some automation around that that 664 00:26:53,440 --> 00:26:55,480 every time a new log is published for a 665 00:26:55,480 --> 00:26:57,679 domain or subdomain associated with the 666 00:26:57,679 --> 00:27:00,640 ads API uh the automation goes in tries 667 00:27:00,640 --> 00:27:02,520 to validate that it is actually the ads 668 00:27:02,520 --> 00:27:04,720 API uh and then after try and 669 00:27:04,720 --> 00:27:07,120 fingerprint what service It's associated 670 00:27:07,120 --> 00:27:09,080 with uh and I have this automation 671 00:27:09,080 --> 00:27:11,200 running regularly as it finds new things 672 00:27:11,200 --> 00:27:13,440 I hand it off to AWS to be fixed uh as 673 00:27:13,440 --> 00:27:15,320 it finds more uh endpoints that could be 674 00:27:15,320 --> 00:27:17,080 used for permission enumeration I add it 675 00:27:17,080 --> 00:27:18,240 to a nice little 676 00:27:18,240 --> 00:27:21,240 database and that has been a look at all 677 00:27:21,240 --> 00:27:23,480 the ways that are publicly known to 678 00:27:23,480 --> 00:27:26,360 bypass cloud trail um there is still a 679 00:27:26,360 --> 00:27:28,039 ton of opportunity out out there to 680 00:27:28,039 --> 00:27:30,080 continue to evade cloud trail logging 681 00:27:30,080 --> 00:27:31,640 and there will be more research coming 682 00:27:31,640 --> 00:27:33,440 out soon showing other ways to get 683 00:27:33,440 --> 00:27:36,200 around it uh for our purposes today we 684 00:27:36,200 --> 00:27:38,919 took a look at protocol mutation abusing 685 00:27:38,919 --> 00:27:41,279 the format and rigid structure of the 686 00:27:41,279 --> 00:27:43,320 edus API so that we could silently 687 00:27:43,320 --> 00:27:45,200 enumerate permissions while avoiding 688 00:27:45,200 --> 00:27:47,159 detection then we took a look at 689 00:27:47,159 --> 00:27:49,880 undocumented apis using them essentially 690 00:27:49,880 --> 00:27:52,840 as a proxy to allow us to invoke normal 691 00:27:52,840 --> 00:27:55,519 apis completely silently and then we 692 00:27:55,519 --> 00:27:57,519 took a look at non-production endpoints 693 00:27:57,519 --> 00:27:59,440 points and the world of opportunity they 694 00:27:59,440 --> 00:28:02,120 provide um for defense EV asion but 695 00:28:02,120 --> 00:28:04,480 especially by changing the literal URL 696 00:28:04,480 --> 00:28:06,200 we're talking to we can avoid cloud 697 00:28:06,200 --> 00:28:08,919 trail if you're a security researcher I 698 00:28:08,919 --> 00:28:10,200 strongly encourage you to take a look at 699 00:28:10,200 --> 00:28:11,399 some of these techniques that you can 700 00:28:11,399 --> 00:28:13,320 apply them to your own bypasses or 701 00:28:13,320 --> 00:28:15,519 perhaps you'll find an entirely new way 702 00:28:15,519 --> 00:28:17,799 to evade cloud trail and with that thank 703 00:28:17,799 --> 00:28:21,200 you so much I'd be happy to answer any 704 00:28:26,440 --> 00:28:29,000 questions 705 00:28:29,000 --> 00:28:30,600 um what happens if you try to create 706 00:28:30,600 --> 00:28:32,240 resources in the non- production end 707 00:28:32,240 --> 00:28:34,720 coins so uh the question was what 708 00:28:34,720 --> 00:28:36,679 happens if you try to create resources 709 00:28:36,679 --> 00:28:39,200 in nonproduction points uh it's a good 710 00:28:39,200 --> 00:28:41,519 question and uh one that I struggle with 711 00:28:41,519 --> 00:28:44,039 for for a while because it is kind of uh 712 00:28:44,039 --> 00:28:45,440 it's kind of challenging so for 713 00:28:45,440 --> 00:28:47,120 endpoints that do have access to 714 00:28:47,120 --> 00:28:49,159 production resources they show up in the 715 00:28:49,159 --> 00:28:50,880 console they show up when you query them 716 00:28:50,880 --> 00:28:53,440 normally if it doesn't it's almost like 717 00:28:53,440 --> 00:28:54,799 it exists in like an alternative 718 00:28:54,799 --> 00:28:56,720 Dimension where like you can create 719 00:28:56,720 --> 00:28:58,320 stuff and you can talk to it as long as 720 00:28:58,320 --> 00:28:59,960 you use the right endpoint but you're 721 00:28:59,960 --> 00:29:01,159 not going to see it in the console 722 00:29:01,159 --> 00:29:02,840 you're not going to see it uh with the 723 00:29:02,840 --> 00:29:05,679 CLI or anything additionally if you try 724 00:29:05,679 --> 00:29:08,279 and reference it so like say for 725 00:29:08,279 --> 00:29:11,480 example uh you did this with an S3 726 00:29:11,480 --> 00:29:12,960 bucket and you're trying to have another 727 00:29:12,960 --> 00:29:15,279 service try and talk to it to store logs 728 00:29:15,279 --> 00:29:17,279 it like it acts like it doesn't exist so 729 00:29:17,279 --> 00:29:19,240 it's like a an isolated environment 730 00:29:19,240 --> 00:29:20,679 almost and that's why finding the ones 731 00:29:20,679 --> 00:29:22,159 that have access production resources 732 00:29:22,159 --> 00:29:23,760 are great because then you can interact 733 00:29:23,760 --> 00:29:25,559 with the real stuff not like you know 734 00:29:25,559 --> 00:29:28,399 the other other world face I'm thinking 735 00:29:28,399 --> 00:29:31,440 M what's your cat's name uh that is 736 00:29:31,440 --> 00:29:34,440 beira uh she is uh one of one of her 737 00:29:34,440 --> 00:29:36,240 babies uh we also have a second cat 738 00:29:36,240 --> 00:29:38,240 named cow which I think is my current 739 00:29:38,240 --> 00:29:39,720 Twitter profile picture but I might be 740 00:29:39,720 --> 00:29:42,159 mistaken on 741 00:29:42,159 --> 00:29:47,120 that yes um excuse me if I missed us at 742 00:29:47,120 --> 00:29:49,919 the beginning of your talk um I believe 743 00:29:49,919 --> 00:29:52,000 you said something about one of the 744 00:29:52,000 --> 00:29:53,720 things you found was something about 745 00:29:53,720 --> 00:29:56,840 multi-tenant uh crossover um I was 746 00:29:56,840 --> 00:29:59,679 curious did you Happ to go over 747 00:29:59,679 --> 00:30:03,159 that yeah no worries about what you 748 00:30:03,159 --> 00:30:05,919 discover that was cross yeah uh so the 749 00:30:05,919 --> 00:30:07,799 question was I teased a bit about some 750 00:30:07,799 --> 00:30:09,760 cross tenant research I did previously 751 00:30:09,760 --> 00:30:11,799 um I found a couple cross tenant bugs um 752 00:30:11,799 --> 00:30:14,760 the most interesting one was for appsync 753 00:30:14,760 --> 00:30:17,039 uh if you search security Labs appsync 754 00:30:17,039 --> 00:30:20,799 it'll probably come up um uh for uh uh 755 00:30:20,799 --> 00:30:22,720 invoking there's confused Deputy attack 756 00:30:22,720 --> 00:30:24,720 in Apps sync service and then in 757 00:30:24,720 --> 00:30:27,519 addition for app Runner uh there was is 758 00:30:27,519 --> 00:30:30,039 also and undocumented API uh that you 759 00:30:30,039 --> 00:30:31,559 could use cross tenant uh there are two 760 00:30:31,559 --> 00:30:33,399 of those uh that should also pop up if 761 00:30:33,399 --> 00:30:35,840 you Google 762 00:30:36,039 --> 00:30:39,440 it yes I you found you can set like scps 763 00:30:39,440 --> 00:30:42,880 to block the undocumented apis from 764 00:30:42,880 --> 00:30:45,440 running 765 00:30:50,440 --> 00:30:53,039 environment block them or is that going 766 00:30:53,039 --> 00:30:56,000 to break yeah so so the question was can 767 00:30:56,000 --> 00:30:58,600 we use scps to if I if I get this right 768 00:30:58,600 --> 00:31:01,159 uh to prevent undocumented apis or to 769 00:31:01,159 --> 00:31:02,760 prevent the use honestly I haven't 770 00:31:02,760 --> 00:31:04,519 actually looked at using scps that's a 771 00:31:04,519 --> 00:31:06,880 really good idea um I'll definitely look 772 00:31:06,880 --> 00:31:10,360 into that yes how does it behave against 773 00:31:10,360 --> 00:31:12,960 let's say you have a a interface any 774 00:31:12,960 --> 00:31:15,600 point or Gateway endpoint that's uh that 775 00:31:15,600 --> 00:31:17,360 that you set up to let's say if you talk 776 00:31:17,360 --> 00:31:18,760 a secret manager you have to go through 777 00:31:18,760 --> 00:31:21,320 this endpoint how does it react when it 778 00:31:21,320 --> 00:31:23,880 talks to the non production does it go 779 00:31:23,880 --> 00:31:25,840 through does it Force the traffic 780 00:31:25,840 --> 00:31:28,159 through the interface point or it just 781 00:31:28,159 --> 00:31:31,039 ignore that completely good question if 782 00:31:31,039 --> 00:31:32,840 if I got this right the question is if 783 00:31:32,840 --> 00:31:35,320 you've set up like a VPC endpoint or or 784 00:31:35,320 --> 00:31:37,039 requirement to to interact with a 785 00:31:37,039 --> 00:31:40,320 particular resource right yeah um good 786 00:31:40,320 --> 00:31:42,320 question as far as I'm aware it will 787 00:31:42,320 --> 00:31:45,320 still require that you use that uh that 788 00:31:45,320 --> 00:31:47,639 endpoint but for things like for as an 789 00:31:47,639 --> 00:31:49,320 example for Secrets manager like list 790 00:31:49,320 --> 00:31:51,200 Secrets as far as I'm whereare you can't 791 00:31:51,200 --> 00:31:52,799 force because it's not on the it's not a 792 00:31:52,799 --> 00:31:54,720 resource based po it's policy it's an 793 00:31:54,720 --> 00:31:57,039 identity policy um as far as I'm we 794 00:31:57,039 --> 00:31:58,320 those those would still go through just 795 00:31:58,320 --> 00:32:01,399 fine um if it's on the resource itself 796 00:32:01,399 --> 00:32:03,440 it probably would uh require you to go 797 00:32:03,440 --> 00:32:05,840 through that vbcm point or that Gateway 798 00:32:05,840 --> 00:32:07,480 yeah for example like S3 Gateway 799 00:32:07,480 --> 00:32:10,000 endpoint right anything that call AWS I 800 00:32:10,000 --> 00:32:13,480 mean S3 Amazon aws.com has to go through 801 00:32:13,480 --> 00:32:16,159 the the channel if this didn't walk 802 00:32:16,159 --> 00:32:18,639 inside the VPC has to go through the VPC 803 00:32:18,639 --> 00:32:21,000 endpoint just wondering if what happened 804 00:32:21,000 --> 00:32:23,960 if we calling non production we also 805 00:32:23,960 --> 00:32:26,240 have the the same oh and and force it 806 00:32:26,240 --> 00:32:28,360 through um honestly I haven't tried 807 00:32:28,360 --> 00:32:30,960 that's a really good idea um there 808 00:32:30,960 --> 00:32:32,240 there's so many different opportunities 809 00:32:32,240 --> 00:32:33,639 for for messing with this that's it's a 810 00:32:33,639 --> 00:32:35,840 great 811 00:32:36,200 --> 00:32:39,240 idea anybody one in the back yeah I 812 00:32:39,240 --> 00:32:40,919 think one similar to his is yeah you're 813 00:32:40,919 --> 00:32:43,000 using private end points as well as I 814 00:32:43,000 --> 00:32:45,559 think there's also a way now to prevent 815 00:32:45,559 --> 00:32:46,600 use 816 00:32:46,600 --> 00:32:49,720 of credentials without being internal to 817 00:32:49,720 --> 00:32:52,720 the environment there a way to do that 818 00:32:52,720 --> 00:32:54,919 that might 819 00:32:54,919 --> 00:32:57,760 ability potentially yeah 820 00:32:57,760 --> 00:32:59,720 I I thought I saw one more hand yes have 821 00:32:59,720 --> 00:33:01,600 you done a similar assessment against 822 00:33:01,600 --> 00:33:04,679 Azure management apis and if so you have 823 00:33:04,679 --> 00:33:07,159 that publ yeah so the question was have 824 00:33:07,159 --> 00:33:09,519 I done any of this for Azure uh 825 00:33:09,519 --> 00:33:12,480 unfortunately I'm only an AWS guy uh but 826 00:33:12,480 --> 00:33:14,840 if anybody's into Azure even hey gcp 827 00:33:14,840 --> 00:33:17,200 feel free to try this uh I've talked to 828 00:33:17,200 --> 00:33:19,200 some folks who've uh sort of carried 829 00:33:19,200 --> 00:33:21,360 over research I've done in AWS to other 830 00:33:21,360 --> 00:33:23,559 clouds and they've had a lot of success 831 00:33:23,559 --> 00:33:24,840 so if you're looking for finding some 832 00:33:24,840 --> 00:33:28,959 Cloud VES you probably have a good shot 833 00:33:30,480 --> 00:33:32,000 I don't see any other hands thank you so 834 00:33:32,000 --> 00:33:33,050 much 835 00:33:33,050 --> 00:33:35,120 [Music] 836 00:33:35,120 --> 00:33:38,120 everybody