1 00:00:00,680 --> 00:00:02,120 researcher at tenable uh where he 2 00:00:02,120 --> 00:00:03,840 specializes an application in web 3 00:00:03,840 --> 00:00:06,440 security uh his talk today will showcase 4 00:00:06,440 --> 00:00:09,160 a key concept so uh sometimes not 5 00:00:09,160 --> 00:00:11,400 discussed enough uh cloud services are 6 00:00:11,400 --> 00:00:13,200 built on top of each other and one click 7 00:00:13,200 --> 00:00:16,000 in the console can cause many things to 8 00:00:16,000 --> 00:00:17,560 happen behind the scenes which increases 9 00:00:17,560 --> 00:00:19,840 risks and attack surface the title of 10 00:00:19,840 --> 00:00:22,560 Liv's talk is one click six Services 11 00:00:22,560 --> 00:00:24,160 abusing the dangerous multi-service 12 00:00:24,160 --> 00:00:28,670 orchestration pattern please welcome Liv 13 00:00:28,670 --> 00:00:31,080 [Applause] 14 00:00:31,080 --> 00:00:32,200 thank you 15 00:00:32,200 --> 00:00:34,600 Mike hello everyone and welcome to my 16 00:00:34,600 --> 00:00:37,480 talk one click six Services abusing the 17 00:00:37,480 --> 00:00:41,239 dangerous multi-service orchestration 18 00:00:41,239 --> 00:00:44,079 pattern Cloud providers often build 19 00:00:44,079 --> 00:00:46,600 their services on top of each other it 20 00:00:46,600 --> 00:00:49,680 creates risks for Defenders and also 21 00:00:49,680 --> 00:00:52,000 opens the door for attackers if one 22 00:00:52,000 --> 00:00:54,719 service gets attacked or is vulnerable 23 00:00:54,719 --> 00:00:56,879 the other services are prone to be 24 00:00:56,879 --> 00:01:00,000 impacted as well as a result of this 25 00:01:00,000 --> 00:01:02,840 Jenga concept that I realized that is 26 00:01:02,840 --> 00:01:04,839 actually present in the major Cloud 27 00:01:04,839 --> 00:01:09,479 providers and not only in gcp but in gcp 28 00:01:09,479 --> 00:01:11,880 I have a case study for you for today to 29 00:01:11,880 --> 00:01:15,240 prove the Jenga concept so let's get it 30 00:01:15,240 --> 00:01:17,920 started have you ever pondered with the 31 00:01:17,920 --> 00:01:20,360 question of what is going on when you 32 00:01:20,360 --> 00:01:24,759 create a cloud function in gcp so I had 33 00:01:24,759 --> 00:01:27,840 and as an ordinary user or or as a 34 00:01:27,840 --> 00:01:29,920 researcher I just created a cloud 35 00:01:29,920 --> 00:01:31,479 function in my 36 00:01:31,479 --> 00:01:33,840 account then I looked at the logs and I 37 00:01:33,840 --> 00:01:36,399 saw this odd Cloud build trigger that 38 00:01:36,399 --> 00:01:39,560 was initiated in my account turns out 39 00:01:39,560 --> 00:01:42,200 that this Cloud Bri trigger was created 40 00:01:42,200 --> 00:01:44,520 by the cloud function I just 41 00:01:44,520 --> 00:01:47,240 created and not only that cloud will 42 00:01:47,240 --> 00:01:50,719 trigger also a storage bucket an 43 00:01:50,719 --> 00:01:53,680 artifact registry or a container 44 00:01:53,680 --> 00:01:57,439 registry and possibly event triggers and 45 00:01:57,439 --> 00:01:59,880 Cloud one service all of these Serv 46 00:01:59,880 --> 00:02:02,560 Services were created for the functions 47 00:02:02,560 --> 00:02:04,399 deployment process in order to even 48 00:02:04,399 --> 00:02:07,280 create a function I just created in my 49 00:02:07,280 --> 00:02:09,399 account and that that is absolutely 50 00:02:09,399 --> 00:02:12,920 crazy in terms of attacking privilege 51 00:02:12,920 --> 00:02:15,440 escalations vulnerabilities and even 52 00:02:15,440 --> 00:02:17,800 Eden services that the cloud provider 53 00:02:17,800 --> 00:02:20,560 itself in that case gcp creates behind 54 00:02:20,560 --> 00:02:22,959 the scenes for the user kind of without 55 00:02:22,959 --> 00:02:24,560 the user's 56 00:02:24,560 --> 00:02:27,120 knowledge I am Le Matan a senior 57 00:02:27,120 --> 00:02:29,519 security researcher at Tenille I'm 58 00:02:29,519 --> 00:02:31,800 Michael of's most valuable researcher 59 00:02:31,800 --> 00:02:34,319 and as you can see or might assume I 60 00:02:34,319 --> 00:02:36,760 hunt across the major Cloud providers 61 00:02:36,760 --> 00:02:40,400 and this is the case study of 62 00:02:40,400 --> 00:02:42,720 gcp so we've talked about the Jenga 63 00:02:42,720 --> 00:02:44,400 concept and we've talked about a little 64 00:02:44,400 --> 00:02:47,120 bit Cloud function and how does it work 65 00:02:47,120 --> 00:02:49,319 behind the scenes but there are some 66 00:02:49,319 --> 00:02:52,200 risks correlated for example if you 67 00:02:52,200 --> 00:02:54,480 think about it behind every service that 68 00:02:54,480 --> 00:02:57,000 you see on the screen there is more I am 69 00:02:57,000 --> 00:02:58,879 correlated so these Services need to 70 00:02:58,879 --> 00:03:00,400 communicate with each other 71 00:03:00,400 --> 00:03:03,360 and sometimes they are attached with 72 00:03:03,360 --> 00:03:05,959 permissions so for example an attacker 73 00:03:05,959 --> 00:03:08,480 with an access to a cloud one service 74 00:03:08,480 --> 00:03:10,319 and that cloud cloud on service by 75 00:03:10,319 --> 00:03:12,319 default have access to the artifact 76 00:03:12,319 --> 00:03:15,360 registry or a container registry service 77 00:03:15,360 --> 00:03:18,000 and this Services Services by default 78 00:03:18,000 --> 00:03:21,080 also holds the images of the functions 79 00:03:21,080 --> 00:03:23,720 in the same account so this is just one 80 00:03:23,720 --> 00:03:25,879 example of a privilege escalation path 81 00:03:25,879 --> 00:03:28,000 that an attacker can abuse as a result 82 00:03:28,000 --> 00:03:31,040 of the realization of the Gen 83 00:03:31,040 --> 00:03:33,840 concept but how does this magic even 84 00:03:33,840 --> 00:03:36,040 happen like how does how do these 85 00:03:36,040 --> 00:03:37,640 Services even communicate with each 86 00:03:37,640 --> 00:03:40,239 other so please welcome Service agents 87 00:03:40,239 --> 00:03:43,519 Service agents are service accounts but 88 00:03:43,519 --> 00:03:46,200 they sit in a Google manage service in a 89 00:03:46,200 --> 00:03:50,159 Google manage uh project so they're kind 90 00:03:50,159 --> 00:03:51,760 of hidden like you don't really see them 91 00:03:51,760 --> 00:03:54,159 because they are in a Google manage 92 00:03:54,159 --> 00:03:58,159 project and this is the cloud the Google 93 00:03:58,159 --> 00:04:00,680 Cloud function service agent so now you 94 00:04:00,680 --> 00:04:05,040 can guess that this exact service agent 95 00:04:05,040 --> 00:04:08,200 might be responsible for creating all of 96 00:04:08,200 --> 00:04:10,000 the resources that you saw that are 97 00:04:10,000 --> 00:04:12,920 created when you create a cloud function 98 00:04:12,920 --> 00:04:18,040 this is internal in the Google managed 99 00:04:18,040 --> 00:04:20,759 project it also leads me to another 100 00:04:20,759 --> 00:04:23,800 concept that cloud providers often try 101 00:04:23,800 --> 00:04:26,120 to empower their capabilities their 102 00:04:26,120 --> 00:04:28,960 usability and as a result it leads to 103 00:04:28,960 --> 00:04:30,639 more complexity 104 00:04:30,639 --> 00:04:32,000 that better performance leads to 105 00:04:32,000 --> 00:04:34,800 complexity and complexity as we all know 106 00:04:34,800 --> 00:04:38,120 leads to more risks for example second 107 00:04:38,120 --> 00:04:40,039 gen Cloud functions so we have the first 108 00:04:40,039 --> 00:04:42,280 gen and then Google introduced second 109 00:04:42,280 --> 00:04:45,759 gen Cloud functions that includes into 110 00:04:45,759 --> 00:04:48,520 the mix these two beautiful Services 111 00:04:48,520 --> 00:04:51,720 named Cloud run and event Arc so these 112 00:04:51,720 --> 00:04:54,400 services are also combined into the mix 113 00:04:54,400 --> 00:04:56,280 when you deploy a cloud function and 114 00:04:56,280 --> 00:04:57,280 just 115 00:04:57,280 --> 00:05:00,240 imagine what attackers can do 116 00:05:00,240 --> 00:05:02,880 when all of these services are included 117 00:05:02,880 --> 00:05:06,280 into the mix that is absolutely crazy so 118 00:05:06,280 --> 00:05:08,560 just so we'll be on the same page first 119 00:05:08,560 --> 00:05:10,360 gen Cloud functions deploy these four 120 00:05:10,360 --> 00:05:13,039 Services bucket cloud cloud build and 121 00:05:13,039 --> 00:05:15,479 then an artifact registry or a container 122 00:05:15,479 --> 00:05:18,039 registry and obviously a cloud function 123 00:05:18,039 --> 00:05:19,960 and when you deploy a second gen Cloud 124 00:05:19,960 --> 00:05:22,479 functions also evental triggers and 125 00:05:22,479 --> 00:05:25,440 Cloud run are included into the mix so 126 00:05:25,440 --> 00:05:26,919 at the end of the day when you create 127 00:05:26,919 --> 00:05:29,400 just one Cloud function in your account 128 00:05:29,400 --> 00:05:31,880 Maybe maybe you will have six services 129 00:05:31,880 --> 00:05:35,680 in your account so let's dive into the 130 00:05:35,680 --> 00:05:37,560 function deployment flow so you know 131 00:05:37,560 --> 00:05:39,240 this services are created behind the 132 00:05:39,240 --> 00:05:42,280 scenes why they're even created why are 133 00:05:42,280 --> 00:05:45,440 they there right well the bucket as you 134 00:05:45,440 --> 00:05:47,600 might assume is there to hold the 135 00:05:47,600 --> 00:05:50,600 functions code the artifact registry is 136 00:05:50,600 --> 00:05:54,080 there to hold the functions image and 137 00:05:54,080 --> 00:05:57,240 the cloud build is there to build the 138 00:05:57,240 --> 00:05:59,800 function the cloud run is there to run 139 00:05:59,800 --> 00:06:02,120 the function well it's all it all makes 140 00:06:02,120 --> 00:06:05,400 sense this is rather simple right well 141 00:06:05,400 --> 00:06:07,440 it gets complicated because as we said 142 00:06:07,440 --> 00:06:09,479 before every service and each service 143 00:06:09,479 --> 00:06:11,280 needs I am to communicate and now these 144 00:06:11,280 --> 00:06:12,800 Services need to communicate with each 145 00:06:12,800 --> 00:06:15,240 other in order to deploy the function so 146 00:06:15,240 --> 00:06:17,639 Google has decided to attach this 147 00:06:17,639 --> 00:06:20,039 default Cloud build service account to 148 00:06:20,039 --> 00:06:22,960 the cloud build service when a user 149 00:06:22,960 --> 00:06:24,800 creates a cloud function so when a user 150 00:06:24,800 --> 00:06:26,759 creates a cloud function by default 151 00:06:26,759 --> 00:06:28,720 Google behind the scenes also attaches 152 00:06:28,720 --> 00:06:31,039 this default cloud service account and 153 00:06:31,039 --> 00:06:33,400 as we all know defaults are 154 00:06:33,400 --> 00:06:36,599 dangerous you ask yourselves why they 155 00:06:36,599 --> 00:06:38,680 why they attach the service account well 156 00:06:38,680 --> 00:06:40,880 in order to allow the cloud Bill to push 157 00:06:40,880 --> 00:06:42,160 the image of the function to the 158 00:06:42,160 --> 00:06:44,000 artifact registry again this is all 159 00:06:44,000 --> 00:06:46,000 makes sense this is how the function 160 00:06:46,000 --> 00:06:49,039 deployment works but how can we even 161 00:06:49,039 --> 00:06:50,680 abuse 162 00:06:50,680 --> 00:06:53,240 it allow me to introduce you to a new 163 00:06:53,240 --> 00:06:55,240 privilege escalation vulnerability I 164 00:06:55,240 --> 00:06:58,000 dubbed confused function confused 165 00:06:58,000 --> 00:06:59,599 function vulnerability allows anide 166 00:06:59,599 --> 00:07:01,560 identity with a permission to update or 167 00:07:01,560 --> 00:07:03,599 create a cloud function to escalate 168 00:07:03,599 --> 00:07:05,680 privileges to this default Cloud bu 169 00:07:05,680 --> 00:07:07,199 service account that Google attaches 170 00:07:07,199 --> 00:07:10,639 behind the scenes I just presented to 171 00:07:10,639 --> 00:07:13,479 you I'm sure you cannot see it from far 172 00:07:13,479 --> 00:07:15,120 away all the permissions of the default 173 00:07:15,120 --> 00:07:17,160 cloud service account but trust me 174 00:07:17,160 --> 00:07:20,759 between me and you it includes a lot of 175 00:07:20,759 --> 00:07:22,360 uh permissions some of them includes 176 00:07:22,360 --> 00:07:25,039 permissions to storage artifact registry 177 00:07:25,039 --> 00:07:30,120 bucket logs Etc absolutely crazy 178 00:07:30,120 --> 00:07:32,280 so let's dive in into the vulnerability 179 00:07:32,280 --> 00:07:35,280 let's do the fun stuff first this is an 180 00:07:35,280 --> 00:07:37,919 example of an ogs Cloud function just 181 00:07:37,919 --> 00:07:39,319 keep in mind that the vulnerability 182 00:07:39,319 --> 00:07:41,360 affects all of the program programming 183 00:07:41,360 --> 00:07:43,840 languages um if you follow the following 184 00:07:43,840 --> 00:07:46,520 concept so an attacker specifies a 185 00:07:46,520 --> 00:07:48,280 malicious dependency into the 186 00:07:48,280 --> 00:07:51,199 package.json file of an OJs Cloud 187 00:07:51,199 --> 00:07:55,199 function and then the package.json file 188 00:07:55,199 --> 00:07:56,919 with the other files of the functions 189 00:07:56,919 --> 00:07:59,800 will be stored in a bucket this bucket 190 00:07:59,800 --> 00:08:02,840 was created by Google I remind you then 191 00:08:02,840 --> 00:08:04,840 the cloud bid instance that were was 192 00:08:04,840 --> 00:08:07,319 also created by by Google will install 193 00:08:07,319 --> 00:08:09,800 these packages some of them is the 194 00:08:09,800 --> 00:08:11,680 package the malicious package of the 195 00:08:11,680 --> 00:08:14,560 attacker that was just inserted by the 196 00:08:14,560 --> 00:08:16,800 attacker's ability to edit the 197 00:08:16,800 --> 00:08:20,639 package.json file so just with an update 198 00:08:20,639 --> 00:08:22,680 permission on the files of the functions 199 00:08:22,680 --> 00:08:24,800 the attacker can insert a malicious 200 00:08:24,800 --> 00:08:26,759 dependency then at the end of the day 201 00:08:26,759 --> 00:08:28,520 when the functions is deployed and 202 00:08:28,520 --> 00:08:31,240 created the Cloud build will install the 203 00:08:31,240 --> 00:08:32,958 dependencies of the functions and some 204 00:08:32,958 --> 00:08:36,120 of them will be malicious by the 205 00:08:36,120 --> 00:08:38,599 attacker then this beautiful Cloud build 206 00:08:38,599 --> 00:08:40,919 default service account will get into 207 00:08:40,919 --> 00:08:42,839 the picture 208 00:08:42,839 --> 00:08:45,600 and yeah the code will run and the 209 00:08:45,600 --> 00:08:48,920 attacker can exfiltrate the token of 210 00:08:48,920 --> 00:08:50,600 this default cloudbed service account 211 00:08:50,600 --> 00:08:52,839 that I remind you Google has attached 212 00:08:52,839 --> 00:08:55,519 behind the scenes so this is the 213 00:08:55,519 --> 00:08:57,519 vulnerability and it gets even more 214 00:08:57,519 --> 00:09:00,519 interesting 215 00:09:01,320 --> 00:09:03,360 gcp dangerous 216 00:09:03,360 --> 00:09:06,680 defaults gcp and in that case used 217 00:09:06,680 --> 00:09:09,240 defaults they use the defaults for the 218 00:09:09,240 --> 00:09:11,079 user configuration of the functions 219 00:09:11,079 --> 00:09:13,040 deployment they use the default cloudbit 220 00:09:13,040 --> 00:09:14,959 service account and we all know that 221 00:09:14,959 --> 00:09:17,040 defaults are dangerous so this is one 222 00:09:17,040 --> 00:09:19,880 takeaway for this presentation and 223 00:09:19,880 --> 00:09:22,480 another takeaway is that this is an hard 224 00:09:22,480 --> 00:09:25,440 to fix vulnerability this architecture 225 00:09:25,440 --> 00:09:27,920 as we just as I just showed you needs 226 00:09:27,920 --> 00:09:30,800 all these permissions for for example 227 00:09:30,800 --> 00:09:32,720 the cloud build is there to push the 228 00:09:32,720 --> 00:09:34,959 image so it has to have the permission 229 00:09:34,959 --> 00:09:36,240 the service account has to have the 230 00:09:36,240 --> 00:09:39,760 permission to push the image to the uh 231 00:09:39,760 --> 00:09:41,480 artifact registry 232 00:09:41,480 --> 00:09:44,800 service the fix that Google proposed is 233 00:09:44,800 --> 00:09:48,240 to now allow user to choose the custom 234 00:09:48,240 --> 00:09:50,360 Cloud build service account so before 235 00:09:50,360 --> 00:09:53,160 the fix the user didn't have any 236 00:09:53,160 --> 00:09:55,600 visibility to that cloud build service 237 00:09:55,600 --> 00:09:57,480 account that is a part of the functions 238 00:09:57,480 --> 00:09:59,640 deployment process but now when user 239 00:09:59,640 --> 00:10:01,720 creates a cloud function it can it can 240 00:10:01,720 --> 00:10:04,040 choose two service accounts one is the 241 00:10:04,040 --> 00:10:06,000 service account of the cloud functions 242 00:10:06,000 --> 00:10:08,120 runtime environment and the second one 243 00:10:08,120 --> 00:10:09,959 is the service account of the cloud with 244 00:10:09,959 --> 00:10:13,240 instance that is created with the cloud 245 00:10:13,240 --> 00:10:16,279 function and Google also decide decided 246 00:10:16,279 --> 00:10:17,680 to use the compute engine service 247 00:10:17,680 --> 00:10:19,320 account as a new default for new Cloud 248 00:10:19,320 --> 00:10:22,240 builds we can uh infer that as a result 249 00:10:22,240 --> 00:10:25,040 of the fixer not as a result but uh 250 00:10:25,040 --> 00:10:28,120 after this fix still old Cloud builds 251 00:10:28,120 --> 00:10:29,680 are vulnerable because the the fix 252 00:10:29,680 --> 00:10:31,920 applies to new Cloud 253 00:10:31,920 --> 00:10:34,920 builds Google decided to employ deploy 254 00:10:34,920 --> 00:10:37,440 the fix by using an a new organization 255 00:10:37,440 --> 00:10:40,000 policy that you can utilize uh after 256 00:10:40,000 --> 00:10:43,000 Google has deployed the fix and this is 257 00:10:43,000 --> 00:10:44,920 this allows to disable the creation of 258 00:10:44,920 --> 00:10:46,880 the default cloudbit service account we 259 00:10:46,880 --> 00:10:49,320 have talked about some thoughts on the 260 00:10:49,320 --> 00:10:52,440 fix is that there are still minimum 261 00:10:52,440 --> 00:10:54,000 permissions for that custom cloud 262 00:10:54,000 --> 00:10:55,600 service account to work these are the 263 00:10:55,600 --> 00:10:57,120 minimum permissions that you see on the 264 00:10:57,120 --> 00:10:59,680 screen and there are there are also 265 00:10:59,680 --> 00:11:01,760 documented in Google's documentation 266 00:11:01,760 --> 00:11:03,480 some of them as said are artifact 267 00:11:03,480 --> 00:11:05,399 register writer and also storage object 268 00:11:05,399 --> 00:11:08,800 admin which are relatively uh relatively 269 00:11:08,800 --> 00:11:11,320 very high permissions so still the 270 00:11:11,320 --> 00:11:13,120 vulnerability Lees to some extent 271 00:11:13,120 --> 00:11:16,079 because the user has to deploy these 272 00:11:16,079 --> 00:11:17,639 permissions to the custom Cloud build 273 00:11:17,639 --> 00:11:20,000 service account also we all know that 274 00:11:20,000 --> 00:11:21,440 the computer engine default service 275 00:11:21,440 --> 00:11:23,519 account is notorious for being over 276 00:11:23,519 --> 00:11:25,000 privilege 277 00:11:25,000 --> 00:11:29,399 so this is still kind of risky 278 00:11:29,399 --> 00:11:30,720 a little bit about the security 279 00:11:30,720 --> 00:11:33,480 architecture of AWS Lambda with buckets 280 00:11:33,480 --> 00:11:36,560 the equivalent of cloud function in gcp 281 00:11:36,560 --> 00:11:39,120 is that in AWS we see an interesting 282 00:11:39,120 --> 00:11:41,480 thing as opposed to gcp Cloud function 283 00:11:41,480 --> 00:11:44,480 the functions code in AWS is stored in 284 00:11:44,480 --> 00:11:48,040 an AWS managed account as opposed to gcp 285 00:11:48,040 --> 00:11:50,760 that the code is stored in the users's 286 00:11:50,760 --> 00:11:53,680 bucket and if we talk about a share 287 00:11:53,680 --> 00:11:56,320 responsibility model this is kind of 288 00:11:56,320 --> 00:11:59,240 interesting because in AWS case the 289 00:11:59,240 --> 00:12:00,959 responsibility is on the cloud provider 290 00:12:00,959 --> 00:12:04,000 side because it's an AWS managed account 291 00:12:04,000 --> 00:12:07,200 and in gcp the bucket is stored in the 292 00:12:07,200 --> 00:12:09,240 user's account so the responsibility is 293 00:12:09,240 --> 00:12:12,440 on the user side so just so you can 294 00:12:12,440 --> 00:12:14,600 think about it more deeply and decide 295 00:12:14,600 --> 00:12:15,800 what you want to 296 00:12:15,800 --> 00:12:18,680 use if you dive deep into the bigger 297 00:12:18,680 --> 00:12:21,279 picture of privilege escalations we can 298 00:12:21,279 --> 00:12:23,399 see some interesting stuff is that an 299 00:12:23,399 --> 00:12:25,600 attacker with a permission to Cloud one 300 00:12:25,600 --> 00:12:28,240 service can do that interesting 301 00:12:28,240 --> 00:12:32,160 following scenario so Cloud 302 00:12:32,160 --> 00:12:34,839 function then an attacker we access to a 303 00:12:34,839 --> 00:12:36,680 cloud run the scenario we have talked 304 00:12:36,680 --> 00:12:38,720 about Cloud run I remind you is a 305 00:12:38,720 --> 00:12:40,279 service that is created when you create 306 00:12:40,279 --> 00:12:42,560 a second gen Cloud function so an 307 00:12:42,560 --> 00:12:44,399 attacker has only access to Cloud run it 308 00:12:44,399 --> 00:12:45,839 doesn't have any access to a cloud 309 00:12:45,839 --> 00:12:48,480 function and that cloud run by default 310 00:12:48,480 --> 00:12:50,639 pulls the functions image from an 311 00:12:50,639 --> 00:12:53,040 artifact or a container 312 00:12:53,040 --> 00:12:56,120 registry now when you think about it we 313 00:12:56,120 --> 00:12:58,440 said that Services need identities to 314 00:12:58,440 --> 00:13:00,519 communicate with each other so in that 315 00:13:00,519 --> 00:13:04,320 case Google has decided to use the cloud 316 00:13:04,320 --> 00:13:06,639 function service agent in order to allow 317 00:13:06,639 --> 00:13:09,120 the cloud run to pull the 318 00:13:09,120 --> 00:13:11,720 images so as an 319 00:13:11,720 --> 00:13:14,160 attacker I observed the request and I 320 00:13:14,160 --> 00:13:15,680 saw that the cloud run service is 321 00:13:15,680 --> 00:13:18,240 deployed as follows by the GCF admin 322 00:13:18,240 --> 00:13:19,760 robot which stands for the cloud 323 00:13:19,760 --> 00:13:21,639 function service agent so the next step 324 00:13:21,639 --> 00:13:25,040 for me is to actually abuse it how will 325 00:13:25,040 --> 00:13:27,480 I abuse it the cloud function service 326 00:13:27,480 --> 00:13:29,360 agent is the one that is responsible for 327 00:13:29,360 --> 00:13:32,360 pulling so I can just specify the image 328 00:13:32,360 --> 00:13:35,079 that I want to pull for example an image 329 00:13:35,079 --> 00:13:37,079 of another functions in the same account 330 00:13:37,079 --> 00:13:40,120 another function and I don't need to 331 00:13:40,120 --> 00:13:42,560 have any permission to the function I 332 00:13:42,560 --> 00:13:43,920 need to only have a permission to the 333 00:13:43,920 --> 00:13:46,199 cloud run and the cloud one will do the 334 00:13:46,199 --> 00:13:47,839 job for me with the cloud function 335 00:13:47,839 --> 00:13:50,160 service agent this is how it looks like 336 00:13:50,160 --> 00:13:53,199 in the gcp console so you can see you 337 00:13:53,199 --> 00:13:55,160 select a container image obviously in 338 00:13:55,160 --> 00:13:57,240 that case I had a read permission to the 339 00:13:57,240 --> 00:13:59,600 names of the container images but you 340 00:13:59,600 --> 00:14:01,759 can also guess the container image name 341 00:14:01,759 --> 00:14:03,839 and you can simply abuse the cloud 342 00:14:03,839 --> 00:14:05,920 function service agent in order to pull 343 00:14:05,920 --> 00:14:10,759 any functions image that is absolutely 344 00:14:11,160 --> 00:14:13,639 interesting about storage 345 00:14:13,639 --> 00:14:17,320 access there is a bucket and that bucket 346 00:14:17,320 --> 00:14:18,639 is created when you create a cloud 347 00:14:18,639 --> 00:14:20,560 function and in the bucket you can see 348 00:14:20,560 --> 00:14:22,639 Cloud function code so another privilege 349 00:14:22,639 --> 00:14:25,079 escalation path you can utilize and in 350 00:14:25,079 --> 00:14:27,240 the cloud functions code you can often 351 00:14:27,240 --> 00:14:29,600 see Secrets or vulnerable code so this 352 00:14:29,600 --> 00:14:31,759 is another privilege escalation path 353 00:14:31,759 --> 00:14:34,160 that you can utilize as a result of the 354 00:14:34,160 --> 00:14:36,360 junga concept that a bucket is created 355 00:14:36,360 --> 00:14:38,560 when you just create a cloud 356 00:14:38,560 --> 00:14:40,920 function I'm going to reveal to you a 357 00:14:40,920 --> 00:14:43,959 new tool and as researchers you can use 358 00:14:43,959 --> 00:14:46,800 this tool to map the hidden services 359 00:14:46,800 --> 00:14:48,560 that are created by the cloud provider 360 00:14:48,560 --> 00:14:51,120 behind the scenes this is a specific 361 00:14:51,120 --> 00:14:53,639 example of AWS but keeping mind we're 362 00:14:53,639 --> 00:14:55,800 going to expand the tool to also be 363 00:14:55,800 --> 00:14:58,519 applicable to gcp and Azure and this 364 00:14:58,519 --> 00:15:01,839 tool helps to combat the Jenga concept 365 00:15:01,839 --> 00:15:04,120 the Jenga concept that hidden services 366 00:15:04,120 --> 00:15:05,880 are created behind the scenes you can 367 00:15:05,880 --> 00:15:09,079 combat it with the jizer so what it does 368 00:15:09,079 --> 00:15:11,720 is basically maps The Hidden services 369 00:15:11,720 --> 00:15:13,360 that are created behind the scenes by 370 00:15:13,360 --> 00:15:15,240 searching the logs by inspecting the 371 00:15:15,240 --> 00:15:17,880 locks and I'm going to give you uh a 372 00:15:17,880 --> 00:15:20,160 live demo of this tool hopefully my 373 00:15:20,160 --> 00:15:21,759 Hotspot will not break the demo but 374 00:15:21,759 --> 00:15:23,350 let's pray 375 00:15:23,350 --> 00:15:25,800 [Music] 376 00:15:25,800 --> 00:15:29,000 together so I'm connected to the output 377 00:15:29,000 --> 00:15:30,130 and as you can 378 00:15:30,130 --> 00:15:32,120 [Music] 379 00:15:32,120 --> 00:15:35,120 see this is the tool uh I specify my 380 00:15:35,120 --> 00:15:37,000 username the profile name the region 381 00:15:37,000 --> 00:15:39,360 name and also a specify a Time start and 382 00:15:39,360 --> 00:15:43,040 time start and time end to specify the 383 00:15:43,040 --> 00:15:45,959 specific oh you can't see it 384 00:15:45,959 --> 00:15:49,279 sorry let's 385 00:15:53,759 --> 00:15:59,279 see yeah there we go woohoo so I specifi 386 00:15:59,279 --> 00:16:00,770 these 387 00:16:00,770 --> 00:16:03,990 [Music] 388 00:16:04,560 --> 00:16:07,360 parameters and I also specify time start 389 00:16:07,360 --> 00:16:10,440 time start and time end so I can um 390 00:16:10,440 --> 00:16:12,720 inspect the specific action I just made 391 00:16:12,720 --> 00:16:16,360 so I run the tool and as you can see it 392 00:16:16,360 --> 00:16:20,079 runs and this is a an example of a cloud 393 00:16:20,079 --> 00:16:21,680 formation create stock and as you can 394 00:16:21,680 --> 00:16:24,040 see this is just an example obviously I 395 00:16:24,040 --> 00:16:26,360 wouldn't use it as a great example if I 396 00:16:26,360 --> 00:16:28,240 was an attacker but you can use it and 397 00:16:28,240 --> 00:16:30,279 you can see it creat created the easy2 398 00:16:30,279 --> 00:16:32,199 uh run instances create tags all of 399 00:16:32,199 --> 00:16:34,199 these actions that were created that 400 00:16:34,199 --> 00:16:37,519 were um that were created as a result of 401 00:16:37,519 --> 00:16:40,800 the cloud formation creation uh stack uh 402 00:16:40,800 --> 00:16:43,199 this is depth level one depth level two 403 00:16:43,199 --> 00:16:45,600 we'll also look for the actions that 404 00:16:45,600 --> 00:16:48,040 this E2 that was created did and also 405 00:16:48,040 --> 00:16:49,639 you have depth level three that will 406 00:16:49,639 --> 00:16:51,680 also recursively check uh the next 407 00:16:51,680 --> 00:16:54,480 service so a great tool you can use to 408 00:16:54,480 --> 00:16:56,839 utilize and map the hidden services that 409 00:16:56,839 --> 00:16:59,120 AWS creates behind the scenes as a 410 00:16:59,120 --> 00:17:01,279 result of a creation of a 411 00:17:01,279 --> 00:17:04,160 service in gcp you can use this 412 00:17:04,160 --> 00:17:06,959 following um 413 00:17:06,959 --> 00:17:09,640 query uh the following query searches 414 00:17:09,640 --> 00:17:12,720 for creation of services uh this is 415 00:17:12,720 --> 00:17:15,720 search parenthesis uh created or 416 00:17:15,720 --> 00:17:18,160 creation and after you search with this 417 00:17:18,160 --> 00:17:20,280 following query you can see this is an 418 00:17:20,280 --> 00:17:21,799 example of a cloud function and I can 419 00:17:21,799 --> 00:17:23,480 see that the cloud build and the GCS 420 00:17:23,480 --> 00:17:26,319 bucket were created as a 421 00:17:26,319 --> 00:17:28,640 result so vulnerability patterns in a 422 00:17:28,640 --> 00:17:31,799 cloud we're going to wrap up we can uh 423 00:17:31,799 --> 00:17:33,760 say that one click in the console makes 424 00:17:33,760 --> 00:17:35,280 the cloud provider configure a 425 00:17:35,280 --> 00:17:37,240 vulnerable deployment to the user it 426 00:17:37,240 --> 00:17:39,000 happened in gcp but this is just one 427 00:17:39,000 --> 00:17:41,480 example of a cloud provider we also have 428 00:17:41,480 --> 00:17:43,760 research on AWS in Azure and Azure that 429 00:17:43,760 --> 00:17:46,320 we can't reveal today uh that also the 430 00:17:46,320 --> 00:17:49,480 same scenario happened so keep in mind 431 00:17:49,480 --> 00:17:51,200 what do you do when you create a service 432 00:17:51,200 --> 00:17:53,000 in the cloud provider and also you can 433 00:17:53,000 --> 00:17:55,799 use the jizer tool to help you map these 434 00:17:55,799 --> 00:17:57,440 hidden services that are created and the 435 00:17:57,440 --> 00:17:58,919 vulnerable configurations that are 436 00:17:58,919 --> 00:18:01,159 created when you create just one service 437 00:18:01,159 --> 00:18:03,280 in the cloud provider even the cloud 438 00:18:03,280 --> 00:18:05,159 providers themselves get it wrong 439 00:18:05,159 --> 00:18:07,799 sometimes for example in that case gcp U 440 00:18:07,799 --> 00:18:11,120 defaults and that's okay they all get it 441 00:18:11,120 --> 00:18:12,840 wrong sometimes Cloud providers are are 442 00:18:12,840 --> 00:18:14,799 not bulletproof this is another takeaway 443 00:18:14,799 --> 00:18:16,559 for the talk uh we reported the 444 00:18:16,559 --> 00:18:19,480 vulnerability to Google which remediated 445 00:18:19,480 --> 00:18:21,520 which remediated the vulnerability uh 446 00:18:21,520 --> 00:18:23,799 what are the Bounty for it and please 447 00:18:23,799 --> 00:18:25,760 comply with the bu Bounty rules because 448 00:18:25,760 --> 00:18:27,360 the research and collaborative and the 449 00:18:27,360 --> 00:18:30,640 community is very helpful and we need it 450 00:18:30,640 --> 00:18:32,600 as for the shared responsibility model 451 00:18:32,600 --> 00:18:34,440 keep in mind these Services the hidden 452 00:18:34,440 --> 00:18:36,360 services that we have talked about are 453 00:18:36,360 --> 00:18:38,520 services that are in your account so 454 00:18:38,520 --> 00:18:40,400 you're responsible for them you can edit 455 00:18:40,400 --> 00:18:42,039 them you can see them and you can delete 456 00:18:42,039 --> 00:18:44,039 them so keep in mind to map the hidden 457 00:18:44,039 --> 00:18:46,600 Services because Cloud providers 458 00:18:46,600 --> 00:18:49,840 sometimes can be a black black box thank 459 00:18:49,840 --> 00:18:52,310 you 460 00:18:52,310 --> 00:18:57,540 [Applause]