1 00:00:00,240 --> 00:00:03,719 so we have our first Speaker of the day 2 00:00:03,719 --> 00:00:06,680 our first speaker is toar brown toar is 3 00:00:06,680 --> 00:00:09,639 a a research Tech lead at Orca security 4 00:00:09,639 --> 00:00:11,519 uh where he helps bring cyber criminals 5 00:00:11,519 --> 00:00:14,120 to Justice where he stops ransomware 6 00:00:14,120 --> 00:00:16,119 from extorting innocence and unveiling 7 00:00:16,119 --> 00:00:17,680 numerous security issues for 8 00:00:17,680 --> 00:00:20,600 high-profile companies in this talk toar 9 00:00:20,600 --> 00:00:23,400 is going to introduce I amape which is 10 00:00:23,400 --> 00:00:26,720 uh an I am AWS policy evaluator open- 11 00:00:26,720 --> 00:00:28,439 Source tool and it was designed to 12 00:00:28,439 --> 00:00:30,039 simplify the process of calculating 13 00:00:30,039 --> 00:00:32,840 effective permissions for AWS entities 14 00:00:32,840 --> 00:00:37,280 so please give us a warm welcome for 15 00:00:41,719 --> 00:00:44,640 toar all right thank you good morning 16 00:00:44,640 --> 00:00:47,520 everyone uh it's an honor to be here 17 00:00:47,520 --> 00:00:49,600 thank you Mike for the introduction my 18 00:00:49,600 --> 00:00:52,520 name is toar uh I'm from Orca security 19 00:00:52,520 --> 00:00:55,039 I'm the research Tech lead over there uh 20 00:00:55,039 --> 00:00:57,840 and just a quick note before we start 21 00:00:57,840 --> 00:01:00,440 something I want to get off my chest 22 00:01:00,440 --> 00:01:03,760 I am am in AWS is a 23 00:01:03,760 --> 00:01:05,680 mess thank 24 00:01:05,680 --> 00:01:10,520 you thank you amen all right I was going 25 00:01:10,520 --> 00:01:12,200 to go with like raise your hand if you 26 00:01:12,200 --> 00:01:14,080 disagree but we don't need 27 00:01:14,080 --> 00:01:16,640 that all right a little bit about myself 28 00:01:16,640 --> 00:01:18,840 the gratuitous uh who am I my name is 29 00:01:18,840 --> 00:01:20,960 toar I've been doing cyber security for 30 00:01:20,960 --> 00:01:25,759 the past eight or so years my uh formal 31 00:01:25,759 --> 00:01:27,520 education is completely irrelevant if 32 00:01:27,520 --> 00:01:28,920 you want to ask me about that I'll talk 33 00:01:28,920 --> 00:01:31,439 about it to no end and uh because you 34 00:01:31,439 --> 00:01:33,119 need to put your credentials on your who 35 00:01:33,119 --> 00:01:35,200 am I these are my AWS credentials if you 36 00:01:35,200 --> 00:01:37,759 want to grab 37 00:01:38,159 --> 00:01:41,680 those all right so quickly what is ape 38 00:01:41,680 --> 00:01:45,000 uh ape is the AWS policy evaluator its 39 00:01:45,000 --> 00:01:48,759 whole purpose is to show you this little 40 00:01:48,759 --> 00:01:51,200 thing the effective permissions the sum 41 00:01:51,200 --> 00:01:53,159 of all the permissions you have in your 42 00:01:53,159 --> 00:01:57,600 on your user group uh or role uh I do 43 00:01:57,600 --> 00:02:00,920 that by basically evaluating all the 44 00:02:00,920 --> 00:02:02,520 policies we'll talk about that in a 45 00:02:02,520 --> 00:02:04,680 minute why is why it's such a problem 46 00:02:04,680 --> 00:02:06,840 why it's such such a hassle and why I 47 00:02:06,840 --> 00:02:10,520 had to uh come up with this Nifty little 48 00:02:10,520 --> 00:02:12,959 Tool uh but first let's do a little 49 00:02:12,959 --> 00:02:15,480 crash course in I IM for those of you 50 00:02:15,480 --> 00:02:16,519 who aren't 51 00:02:16,519 --> 00:02:20,040 initiated uh just a couple basic things 52 00:02:20,040 --> 00:02:23,640 it's not going to be super comprehensive 53 00:02:23,640 --> 00:02:25,319 I'm going to be missing a lot of little 54 00:02:25,319 --> 00:02:28,319 points I'm going to be oversimplifying a 55 00:02:28,319 --> 00:02:30,080 few things don't worry about it if you 56 00:02:30,080 --> 00:02:33,680 want to jump uh deeper into I am that's 57 00:02:33,680 --> 00:02:37,160 a whole like 2hour talk at 58 00:02:37,160 --> 00:02:40,640 least uh so you have your users which 59 00:02:40,640 --> 00:02:43,440 are the human interactors with your 60 00:02:43,440 --> 00:02:46,200 platform you have groups which are a 61 00:02:46,200 --> 00:02:50,000 collection of users uh groups are just 62 00:02:50,000 --> 00:02:53,319 uh a simplified way of managing all your 63 00:02:53,319 --> 00:02:56,760 VI of your all of your users uh so you 64 00:02:56,760 --> 00:02:58,319 don't have to attach policies 65 00:02:58,319 --> 00:03:01,400 individually to each to each user uh you 66 00:03:01,400 --> 00:03:04,319 have your roles which are your nonhuman 67 00:03:04,319 --> 00:03:07,480 users uh basically all your applications 68 00:03:07,480 --> 00:03:10,120 all of your Federated entities they can 69 00:03:10,120 --> 00:03:12,480 be users if they use SS so I told you I 70 00:03:12,480 --> 00:03:15,799 was going to oversimplify things um and 71 00:03:15,799 --> 00:03:17,879 you have your policies you have managed 72 00:03:17,879 --> 00:03:20,120 policies which are essentially resources 73 00:03:20,120 --> 00:03:22,760 which you can then uh attach to either 74 00:03:22,760 --> 00:03:25,720 users roles groups instance profiles Etc 75 00:03:25,720 --> 00:03:27,599 over simplification 76 00:03:27,599 --> 00:03:31,159 again um and those policies are made up 77 00:03:31,159 --> 00:03:34,760 of statements each statement is made up 78 00:03:34,760 --> 00:03:35,480 of 79 00:03:35,480 --> 00:03:39,120 [Laughter] 80 00:03:39,120 --> 00:03:42,840 crap um sorry wait I I I mean I meant 81 00:03:42,840 --> 00:03:45,040 Park I meant Park yeah it's made out of 82 00:03:45,040 --> 00:03:50,080 park uh a principle a principle is uh 83 00:03:50,080 --> 00:03:52,319 essential the principal action resource 84 00:03:52,319 --> 00:03:55,720 and condition is basically the who what 85 00:03:55,720 --> 00:03:58,879 where and when can perform any action on 86 00:03:58,879 --> 00:04:02,239 AWS the prin principle is the user role 87 00:04:02,239 --> 00:04:05,959 group Etc the action is the specific API 88 00:04:05,959 --> 00:04:07,640 action that they can perform and 89 00:04:07,640 --> 00:04:10,000 resource specifies which resource they 90 00:04:10,000 --> 00:04:12,439 can perform that API call on and the 91 00:04:12,439 --> 00:04:14,959 condition is a set of condition anything 92 00:04:14,959 --> 00:04:18,160 from uh when during the day a user can 93 00:04:18,160 --> 00:04:20,358 perform those actions all the way to who 94 00:04:20,358 --> 00:04:22,600 exactly can perform those actions from 95 00:04:22,600 --> 00:04:24,880 which IP addresses whether they have MFA 96 00:04:24,880 --> 00:04:27,400 enabled etc etc there are hundreds and 97 00:04:27,400 --> 00:04:30,120 hundreds of conditions uh not going to 98 00:04:30,120 --> 00:04:34,759 get into that uh just again as an as an 99 00:04:34,759 --> 00:04:39,080 overview of what is I am uh there's also 100 00:04:39,080 --> 00:04:43,000 uh ni or nen or n which however you 101 00:04:43,000 --> 00:04:45,320 would it's not part of the park so I I 102 00:04:45,320 --> 00:04:47,960 had to put another slide for it it's 103 00:04:47,960 --> 00:04:50,560 essentially the effect so a statement 104 00:04:50,560 --> 00:04:53,720 can uh be either allow or deny so you 105 00:04:53,720 --> 00:04:56,840 can both deny actions and uh allow 106 00:04:56,840 --> 00:04:59,960 actions you have your not action so so 107 00:04:59,960 --> 00:05:03,240 if you uh specify a not action then 108 00:05:03,240 --> 00:05:06,199 you're essentially including all other 109 00:05:06,199 --> 00:05:08,320 actions in that statement for example if 110 00:05:08,320 --> 00:05:12,039 you have an allow and a not action of IM 111 00:05:12,039 --> 00:05:16,000 am asterisk then every other single 112 00:05:16,000 --> 00:05:18,400 action across AWS is permitted except I 113 00:05:18,400 --> 00:05:20,919 am am asterisk uh you also have not 114 00:05:20,919 --> 00:05:23,160 resource which is the same principle 115 00:05:23,160 --> 00:05:25,520 only in 116 00:05:25,520 --> 00:05:28,479 resources so now that we've gone over 117 00:05:28,479 --> 00:05:30,400 that 118 00:05:30,400 --> 00:05:32,680 uh what's the problem with all that 119 00:05:32,680 --> 00:05:35,880 sounds simple enough right um the 120 00:05:35,880 --> 00:05:40,000 problem is there are policies everywhere 121 00:05:40,000 --> 00:05:41,800 take for example this user we'll call 122 00:05:41,800 --> 00:05:44,400 him Jim Jim is a concept he does not 123 00:05:44,400 --> 00:05:48,080 exist do not get attached we'll kill him 124 00:05:48,080 --> 00:05:52,160 later so Jim can have an inline policy 125 00:05:52,160 --> 00:05:53,919 an inline policy is an integral part of 126 00:05:53,919 --> 00:05:57,199 the user you uh set it up the same way 127 00:05:57,199 --> 00:05:59,000 that you would set up the user's email 128 00:05:59,000 --> 00:06:01,720 the user name name user password Etc 129 00:06:01,720 --> 00:06:03,880 it's an integral part of the user you 130 00:06:03,880 --> 00:06:06,680 can also attach a managed policy the one 131 00:06:06,680 --> 00:06:09,000 that we mentioned earlier you can also 132 00:06:09,000 --> 00:06:13,199 attach a group that group can have an 133 00:06:13,199 --> 00:06:14,280 inline 134 00:06:14,280 --> 00:06:17,680 policy that group can also have an 135 00:06:17,680 --> 00:06:20,520 attached managed policy and another 136 00:06:20,520 --> 00:06:22,759 attached managed policy and all those 137 00:06:22,759 --> 00:06:25,400 policies apply to Jim who is part of 138 00:06:25,400 --> 00:06:27,639 that group oh and did I mention he's 139 00:06:27,639 --> 00:06:30,440 also a member of another group 140 00:06:30,440 --> 00:06:33,360 who also has three 141 00:06:33,360 --> 00:06:35,720 policies I forgot to also mention a 142 00:06:35,720 --> 00:06:37,919 little thing called permissions 143 00:06:37,919 --> 00:06:42,479 boundary which is a policy which um 144 00:06:42,479 --> 00:06:44,440 defines the maximum amount of 145 00:06:44,440 --> 00:06:46,759 permissions that a user or an entity in 146 00:06:46,759 --> 00:06:52,599 AWS can have um essentially if if a an 147 00:06:52,599 --> 00:06:55,400 action or an API call is not defined in 148 00:06:55,400 --> 00:06:57,960 the permission boundary then it is not 149 00:06:57,960 --> 00:07:01,639 allowed by any other uh policy if you 150 00:07:01,639 --> 00:07:04,680 define a permission boundary with only a 151 00:07:04,680 --> 00:07:06,919 set of those permissions you cannot 152 00:07:06,919 --> 00:07:09,360 Grant other permissions to the users it 153 00:07:09,360 --> 00:07:13,199 does not in itself Grant uh permissions 154 00:07:13,199 --> 00:07:15,000 to a user or to an entity it only 155 00:07:15,000 --> 00:07:17,240 defines the maximum amount of 156 00:07:17,240 --> 00:07:19,560 permissions same concept applies to a 157 00:07:19,560 --> 00:07:21,879 thing called SCP which is a service 158 00:07:21,879 --> 00:07:24,319 control policy it is the same concept 159 00:07:24,319 --> 00:07:26,800 only applies to an entire Cloud account 160 00:07:26,800 --> 00:07:27,639 in 161 00:07:27,639 --> 00:07:33,840 AWS so given that we now have uh eight 162 00:07:33,840 --> 00:07:36,960 policies a permission boundary and an 163 00:07:36,960 --> 00:07:39,440 SCP policy what the heck are my 164 00:07:39,440 --> 00:07:40,879 effective 165 00:07:40,879 --> 00:07:43,240 permissions this is the question that we 166 00:07:43,240 --> 00:07:45,479 come here came here to 167 00:07:45,479 --> 00:07:49,039 answer so the solution is IM am ape 168 00:07:49,039 --> 00:07:51,479 identity and access management AWS 169 00:07:51,479 --> 00:07:54,479 policy evaluator and if you think that I 170 00:07:54,479 --> 00:07:56,039 came up with the acronym first and what 171 00:07:56,039 --> 00:07:58,319 it meant later then you're probably 172 00:07:58,319 --> 00:08:01,159 right 173 00:08:01,159 --> 00:08:03,479 how does it work all right so we have 174 00:08:03,479 --> 00:08:06,080 four phases how the tool works the first 175 00:08:06,080 --> 00:08:08,240 phase is we have to collect all the 176 00:08:08,240 --> 00:08:10,440 information all the relevant policies 177 00:08:10,440 --> 00:08:14,199 are gathered through the AWS uh API 178 00:08:14,199 --> 00:08:16,960 called get account authorization details 179 00:08:16,960 --> 00:08:19,080 which gives you a very long very 180 00:08:19,080 --> 00:08:22,080 comprehensive Json report of all of your 181 00:08:22,080 --> 00:08:23,520 policies all of your roles all of your 182 00:08:23,520 --> 00:08:25,599 users all of your groups all of your all 183 00:08:25,599 --> 00:08:28,919 of your uh permission boundaries but not 184 00:08:28,919 --> 00:08:30,879 your SCP policies we'll talk about that 185 00:08:30,879 --> 00:08:34,080 later uh they are optional and you can 186 00:08:34,080 --> 00:08:37,559 either use uh your regular credentials 187 00:08:37,559 --> 00:08:39,080 as long as you have permissions or you 188 00:08:39,080 --> 00:08:43,039 can provide that uh to ape as a as as an 189 00:08:43,039 --> 00:08:45,399 input after we've gathered all that 190 00:08:45,399 --> 00:08:46,440 information we've made all the 191 00:08:46,440 --> 00:08:49,120 connections of all the uh users that we 192 00:08:49,120 --> 00:08:51,640 want to uh uh get the effective 193 00:08:51,640 --> 00:08:53,720 permissions for we've connected all the 194 00:08:53,720 --> 00:08:56,240 relevant policies we then need to expand 195 00:08:56,240 --> 00:08:58,720 those policies essentially we Tech we 196 00:08:58,720 --> 00:09:01,640 take the uh policy statement on the left 197 00:09:01,640 --> 00:09:04,320 in this case I've gone with allow S3 get 198 00:09:04,320 --> 00:09:07,240 wild card on the Wild Card resource we 199 00:09:07,240 --> 00:09:11,440 expand that into a a set of uh action 200 00:09:11,440 --> 00:09:15,320 resource condition topples uh basically 201 00:09:15,320 --> 00:09:18,120 we have an allow list we have a deny 202 00:09:18,120 --> 00:09:20,839 list and you have a permission boundary 203 00:09:20,839 --> 00:09:25,000 list uh as you can see each topple is 204 00:09:25,000 --> 00:09:29,200 just the specific API action uh with no 205 00:09:29,200 --> 00:09:31,560 wild cards the resource to which they 206 00:09:31,560 --> 00:09:34,760 apply and whether or not they it has a 207 00:09:34,760 --> 00:09:38,279 condition now we come to the Crocs of 208 00:09:38,279 --> 00:09:41,040 the matter the 209 00:09:41,040 --> 00:09:44,320 evaluation each allow statement has to 210 00:09:44,320 --> 00:09:47,760 be evaluated against any deny statements 211 00:09:47,760 --> 00:09:50,320 or boundary statements that are relevant 212 00:09:50,320 --> 00:09:53,760 to that action how do we do 213 00:09:53,760 --> 00:09:56,320 that essentially we have this decision 214 00:09:56,320 --> 00:09:58,600 Tree in which we check whether the 215 00:09:58,600 --> 00:10:02,160 allowed resource is uh equivalent to the 216 00:10:02,160 --> 00:10:05,079 denied resource again we have the uh 217 00:10:05,079 --> 00:10:08,880 specific API for uh the allowed action 218 00:10:08,880 --> 00:10:11,640 and with the same API call for as a 219 00:10:11,640 --> 00:10:14,200 denied action if those resources match 220 00:10:14,200 --> 00:10:16,720 we deny the action if the denied 221 00:10:16,720 --> 00:10:19,600 resource is a wild card that includes 222 00:10:19,600 --> 00:10:22,440 the allowed resource we deny it if the 223 00:10:22,440 --> 00:10:26,200 allowed resource is in a greater scope 224 00:10:26,200 --> 00:10:28,320 than the denied resource then we 225 00:10:28,320 --> 00:10:31,839 ultimately partially allow the action so 226 00:10:31,839 --> 00:10:34,640 in this case you can see uh we have this 227 00:10:34,640 --> 00:10:37,480 example in which we had an allow 228 00:10:37,480 --> 00:10:41,120 statement which allowed uh S3 wild card 229 00:10:41,120 --> 00:10:45,160 on the resource uh basically on all S3 230 00:10:45,160 --> 00:10:47,959 buckets in uh AWS but we also had a deny 231 00:10:47,959 --> 00:10:51,720 action for this specific bucket not this 232 00:10:51,720 --> 00:10:54,639 and not these on all those resources so 233 00:10:54,639 --> 00:10:57,200 we've added the uh not 234 00:10:57,200 --> 00:11:00,639 resource uh part of the statement in 235 00:11:00,639 --> 00:11:03,680 order to show that uh if you are 236 00:11:03,680 --> 00:11:05,320 familiar with 237 00:11:05,320 --> 00:11:08,519 awsam then you know that this is 238 00:11:08,519 --> 00:11:12,200 actually not an acceptable Syntax for uh 239 00:11:12,200 --> 00:11:15,480 an AWS statement AWS does not support 240 00:11:15,480 --> 00:11:18,399 this type of uh syntax of having both 241 00:11:18,399 --> 00:11:20,360 the resource field and the not resource 242 00:11:20,360 --> 00:11:24,760 field but I felt that it is a simpler 243 00:11:24,760 --> 00:11:26,320 more 244 00:11:26,320 --> 00:11:29,800 uh explainable way of showing you guys 245 00:11:29,800 --> 00:11:32,320 that you have uh permissions for those 246 00:11:32,320 --> 00:11:34,320 resources but not those resources 247 00:11:34,320 --> 00:11:36,920 instead of having two statements one of 248 00:11:36,920 --> 00:11:39,639 allow one deny I felt it was more 249 00:11:39,639 --> 00:11:44,240 appropriate more uh nice if we zoom in 250 00:11:44,240 --> 00:11:48,320 for a second uh we can see that we also 251 00:11:48,320 --> 00:11:49,360 have 252 00:11:49,360 --> 00:11:52,120 conditions which we mentioned briefly 253 00:11:52,120 --> 00:11:54,760 but in this case if we have the allowed 254 00:11:54,760 --> 00:11:56,519 action resource and the denied action 255 00:11:56,519 --> 00:11:59,480 resource that are equal but then the 256 00:11:59,480 --> 00:12:02,240 deny statement also has a condition then 257 00:12:02,240 --> 00:12:05,040 we have to add that condition into the 258 00:12:05,040 --> 00:12:06,519 allow 259 00:12:06,519 --> 00:12:09,519 statement for example uh if we had a 260 00:12:09,519 --> 00:12:12,560 deny action which had the condition of 261 00:12:12,560 --> 00:12:15,560 string equals S3 prefix project doesn't 262 00:12:15,560 --> 00:12:18,040 matter the specifics but essentially we 263 00:12:18,040 --> 00:12:21,880 have to flip that condition from being a 264 00:12:21,880 --> 00:12:25,279 positive or negative back to negative or 265 00:12:25,279 --> 00:12:28,519 positive so if the uh if the deny 266 00:12:28,519 --> 00:12:31,320 statement used to be string equals as 267 00:12:31,320 --> 00:12:33,160 three perix in the deny statement then 268 00:12:33,160 --> 00:12:35,440 the allow statement has to say string 269 00:12:35,440 --> 00:12:40,800 not equals all right follow me so far 270 00:12:40,800 --> 00:12:43,440 good all right 271 00:12:43,440 --> 00:12:46,320 so yeah I I said it was a decision tree 272 00:12:46,320 --> 00:12:48,959 more it's more of a decision Forest 273 00:12:48,959 --> 00:12:52,680 because there's not only allow resource 274 00:12:52,680 --> 00:12:54,920 and deny resource there's also not 275 00:12:54,920 --> 00:12:57,639 resource so we also have to check those 276 00:12:57,639 --> 00:13:00,760 conditions uh where the allow there's an 277 00:13:00,760 --> 00:13:02,760 allow resource and a deny resource allow 278 00:13:02,760 --> 00:13:05,720 not resource in the deny resource so it 279 00:13:05,720 --> 00:13:08,320 becomes this whole Maze of decision 280 00:13:08,320 --> 00:13:10,600 forests and we also have to account for 281 00:13:10,600 --> 00:13:13,600 conditions as I said if you want to div 282 00:13:13,600 --> 00:13:17,199 dive deeper into the into the code I 283 00:13:17,199 --> 00:13:19,240 more than welcome you to do that uh we 284 00:13:19,240 --> 00:13:21,320 just don't have the time to go over over 285 00:13:21,320 --> 00:13:25,360 over all of it right here uh oh and then 286 00:13:25,360 --> 00:13:28,959 we come to boundaries so boundaries can 287 00:13:28,959 --> 00:13:31,000 also of course have deny statements and 288 00:13:31,000 --> 00:13:33,800 those deny statements act just like any 289 00:13:33,800 --> 00:13:36,040 other deny statements because in AWS am 290 00:13:36,040 --> 00:13:38,279 deny trumps everything if you have a 291 00:13:38,279 --> 00:13:40,360 deny statement anywhere that deny 292 00:13:40,360 --> 00:13:42,720 statement wins 293 00:13:42,720 --> 00:13:45,880 so if there is no allow statement within 294 00:13:45,880 --> 00:13:49,040 the permission boundary then we do not 295 00:13:49,040 --> 00:13:52,120 allow that action if the allowed 296 00:13:52,120 --> 00:13:55,360 resource is again same as the deny 297 00:13:55,360 --> 00:13:58,560 resource uh sorry that must be a typo 298 00:13:58,560 --> 00:14:00,759 any anyway if the allowed resource uh 299 00:14:00,759 --> 00:14:03,600 equals to the allow the boundary 300 00:14:03,600 --> 00:14:06,560 resource then uh we allow the action if 301 00:14:06,560 --> 00:14:09,399 the allowed resource in the in the 302 00:14:09,399 --> 00:14:12,040 policy uh is within the scope of the 303 00:14:12,040 --> 00:14:14,440 boundary resource again we allow if the 304 00:14:14,440 --> 00:14:18,959 allowed resource is uh a larger scope 305 00:14:18,959 --> 00:14:20,600 than the scope that the permission 306 00:14:20,600 --> 00:14:22,440 boundary allows we only do the partial 307 00:14:22,440 --> 00:14:24,399 allow and we add that not not resource 308 00:14:24,399 --> 00:14:27,279 again and the allowed res if the allowed 309 00:14:27,279 --> 00:14:31,360 resource is uh not the same as the uh 310 00:14:31,360 --> 00:14:33,920 boundary resource 311 00:14:33,920 --> 00:14:37,440 we um it should say deny I'm not sure 312 00:14:37,440 --> 00:14:40,160 why it says that L I'm 313 00:14:40,160 --> 00:14:45,480 sorry and again it's the same same 314 00:14:45,480 --> 00:14:48,399 situation with uh boundary resources and 315 00:14:48,399 --> 00:14:51,040 not resources and allow resources and 316 00:14:51,040 --> 00:14:54,440 Boundary resources it's very tedious it 317 00:14:54,440 --> 00:14:56,320 took me a while to write this thank you 318 00:14:56,320 --> 00:14:57,680 for 319 00:14:57,680 --> 00:14:59,880 coming 320 00:14:59,880 --> 00:15:02,560 uh okay and now the Final Phase we take 321 00:15:02,560 --> 00:15:04,199 all of that information all of that 322 00:15:04,199 --> 00:15:06,360 giant list of tles and we have to 323 00:15:06,360 --> 00:15:08,800 minimize it so you guys can read it and 324 00:15:08,800 --> 00:15:11,279 it looks nice uh so basically we take 325 00:15:11,279 --> 00:15:12,800 all the actions and the resources we 326 00:15:12,800 --> 00:15:15,600 group them together any uh similar 327 00:15:15,600 --> 00:15:17,519 actions and resources we group all the 328 00:15:17,519 --> 00:15:19,399 all of the uh actions and conditions 329 00:15:19,399 --> 00:15:21,680 sorry we group all the resources to 330 00:15:21,680 --> 00:15:24,560 which they apply together and then we go 331 00:15:24,560 --> 00:15:28,040 okay those resources have a set uh um 332 00:15:28,040 --> 00:15:30,600 list of actions so we group those 333 00:15:30,600 --> 00:15:33,560 together so it looks nice 334 00:15:33,560 --> 00:15:36,319 um like I said the generated policy 335 00:15:36,319 --> 00:15:38,759 might not always be compliant with aws's 336 00:15:38,759 --> 00:15:41,079 uh constraints alternatively if you 337 00:15:41,079 --> 00:15:43,839 don't want to minimize you can use the 338 00:15:43,839 --> 00:15:47,160 Json report and the Json report in my 339 00:15:47,160 --> 00:15:50,600 opinion is really where uh AWS a im am 340 00:15:50,600 --> 00:15:54,720 ape shines because not only it shows you 341 00:15:54,720 --> 00:15:57,079 a detail report of all of your allowed 342 00:15:57,079 --> 00:15:59,759 actions it also shows you a detailed 343 00:15:59,759 --> 00:16:03,680 report of all your denied actions and in 344 00:16:03,680 --> 00:16:06,000 addition to that it also show you 345 00:16:06,000 --> 00:16:08,680 ineffective permissions so ineffective 346 00:16:08,680 --> 00:16:11,240 permissions are permissions which are 347 00:16:11,240 --> 00:16:14,160 allowed in one place but were denied 348 00:16:14,160 --> 00:16:16,480 either by a permission boundary or a 349 00:16:16,480 --> 00:16:18,560 deny statement 350 00:16:18,560 --> 00:16:21,519 somewhere so let's go quickly over the 351 00:16:21,519 --> 00:16:25,319 Json report you can see uh it is divided 352 00:16:25,319 --> 00:16:28,680 by Services resources and access level 353 00:16:28,680 --> 00:16:31,680 read write Etc and all of the actions 354 00:16:31,680 --> 00:16:33,399 and it shows you the ineffective 355 00:16:33,399 --> 00:16:34,920 permissions again with Services 356 00:16:34,920 --> 00:16:38,240 resources access level and what those 357 00:16:38,240 --> 00:16:41,240 those uh permissions were denied by so 358 00:16:41,240 --> 00:16:42,680 if you're trying to Grant yourself 359 00:16:42,680 --> 00:16:45,319 access to uh an S3 bucket but you're 360 00:16:45,319 --> 00:16:48,279 just not darn able to uh this can show 361 00:16:48,279 --> 00:16:50,279 you 362 00:16:50,279 --> 00:16:53,319 why all right so uh everyone praise the 363 00:16:53,319 --> 00:16:55,639 demo 364 00:16:57,480 --> 00:17:00,480 gods 365 00:17:01,839 --> 00:17:06,439 all right so let's go with a quick 366 00:17:06,439 --> 00:17:08,679 demonstration you'll have to like uh 367 00:17:08,679 --> 00:17:12,119 trust me bro on this because as you can 368 00:17:12,119 --> 00:17:14,880 see this is the I IM get account 369 00:17:14,880 --> 00:17:17,599 authorization details report it's very 370 00:17:17,599 --> 00:17:22,720 long and comprehensive I had just um 371 00:17:22,720 --> 00:17:25,199 generated this from my demo account you 372 00:17:25,199 --> 00:17:27,919 can see it's very very very very very 373 00:17:27,919 --> 00:17:29,240 long 374 00:17:29,240 --> 00:17:33,280 but we'll uh just focus on on these two 375 00:17:33,280 --> 00:17:37,320 users we have an admin with MFA so this 376 00:17:37,320 --> 00:17:40,880 user has an inline policy which grants 377 00:17:40,880 --> 00:17:44,520 him these actions I IM Wild Card 378 00:17:44,520 --> 00:17:47,799 organizations Wild Card Route 53 S3 and 379 00:17:47,799 --> 00:17:52,039 STS it it is an allow statement on all 380 00:17:52,039 --> 00:17:54,919 resources he is also a member of the 381 00:17:54,919 --> 00:17:59,600 enforce MFA group and he has an attached 382 00:17:59,600 --> 00:18:03,039 managed policy let's take a look at the 383 00:18:03,039 --> 00:18:07,240 group and the group is uh a simple 384 00:18:07,240 --> 00:18:11,799 deny everything on everything 385 00:18:11,799 --> 00:18:15,600 unless that user has AWS uh multiactor 386 00:18:15,600 --> 00:18:18,679 multiactor authentic authorization 387 00:18:18,679 --> 00:18:21,720 authentication uh 388 00:18:21,720 --> 00:18:25,880 present the attached manag policy is 389 00:18:25,880 --> 00:18:26,799 this 390 00:18:26,799 --> 00:18:28,960 statement which 391 00:18:28,960 --> 00:18:32,960 allows all the not actions that we've 392 00:18:32,960 --> 00:18:35,799 shown here so these are actions these 393 00:18:35,799 --> 00:18:38,600 are not actions like we said that means 394 00:18:38,600 --> 00:18:43,000 every other um action is allowed and 395 00:18:43,000 --> 00:18:47,159 again resource wad card so 396 00:18:47,159 --> 00:18:48,880 let's 397 00:18:48,880 --> 00:18:53,080 just do this we run IM ape we give it 398 00:18:53,080 --> 00:18:56,400 the profile on which we want to uh query 399 00:18:56,400 --> 00:18:59,080 the AWS cloud and we give it the the Arn 400 00:18:59,080 --> 00:19:02,320 of the user that we want to uh get the 401 00:19:02,320 --> 00:19:05,240 effective permissions for hit enter and 402 00:19:05,240 --> 00:19:08,960 then IMAP automatically queries your AWS 403 00:19:08,960 --> 00:19:11,400 account like I said you can also just 404 00:19:11,400 --> 00:19:13,799 provide the uh output for the get 405 00:19:13,799 --> 00:19:16,320 account authorization details uh as an 406 00:19:16,320 --> 00:19:20,679 input as a Json file and if the Wi-Fi 407 00:19:20,679 --> 00:19:23,120 here 408 00:19:23,320 --> 00:19:26,639 will just 409 00:19:27,240 --> 00:19:31,039 cooperate let's give it a second I do 410 00:19:31,039 --> 00:19:33,320 have a 411 00:19:37,240 --> 00:19:39,480 backup 412 00:19:39,480 --> 00:19:42,840 um that does not look 413 00:19:42,840 --> 00:19:45,400 right did you guys pray to the demo God 414 00:19:45,400 --> 00:19:47,640 enough come on I asked you nicely all 415 00:19:47,640 --> 00:19:50,159 right let's go with the backup uh let's 416 00:19:50,159 --> 00:19:52,640 go with 417 00:19:52,640 --> 00:19:55,400 the 418 00:19:55,400 --> 00:19:57,960 input all right no authentication there 419 00:19:57,960 --> 00:19:58,840 we go 420 00:19:58,840 --> 00:20:04,520 go so this is the output that you should 421 00:20:04,520 --> 00:20:08,600 get as you can see we have an a single 422 00:20:08,600 --> 00:20:11,280 statement which shows you that the 423 00:20:11,280 --> 00:20:13,360 effect is allow the action is wild card 424 00:20:13,360 --> 00:20:15,480 resource is wild card and it has the 425 00:20:15,480 --> 00:20:18,080 condition of multiactor authentication 426 00:20:18,080 --> 00:20:20,120 present 427 00:20:20,120 --> 00:20:23,479 true you can 428 00:20:25,440 --> 00:20:28,720 clap thank you thank you 429 00:20:28,720 --> 00:20:31,000 all right and now let's move to the 430 00:20:31,000 --> 00:20:32,559 bucket user which is a little more 431 00:20:32,559 --> 00:20:34,120 complicated we have this bucket user 432 00:20:34,120 --> 00:20:36,400 I'll go over it quickly because I see we 433 00:20:36,400 --> 00:20:40,360 are oh we're actually okay on time so um 434 00:20:40,360 --> 00:20:43,120 this guy has a couple of groups he has I 435 00:20:43,120 --> 00:20:46,360 am admins he has bucket admins and he 436 00:20:46,360 --> 00:20:49,880 also has this permissions boundary um 437 00:20:49,880 --> 00:20:51,760 this permissions boundary this is its 438 00:20:51,760 --> 00:20:55,000 Arn we'll go over it in a second uh we 439 00:20:55,000 --> 00:20:57,360 also so let's take a look at uh the 440 00:20:57,360 --> 00:20:58,840 groups he has no no attached manage 441 00:20:58,840 --> 00:21:00,679 policies he has no inline policies only 442 00:21:00,679 --> 00:21:02,440 these groups and this uh permission 443 00:21:02,440 --> 00:21:06,000 battery so this uh group bucket admins 444 00:21:06,000 --> 00:21:10,039 grants him um basically all of the S3 445 00:21:10,039 --> 00:21:13,279 actions on all of the S3 buckets and an 446 00:21:13,279 --> 00:21:15,919 allow he is a bucket admin bucket or a 447 00:21:15,919 --> 00:21:18,720 bucket user after all the second group 448 00:21:18,720 --> 00:21:22,760 he has is I IM admins which is a has an 449 00:21:22,760 --> 00:21:25,880 attached manage policy called awm Full 450 00:21:25,880 --> 00:21:29,400 Access that policy let's take a look at 451 00:21:29,400 --> 00:21:32,480 that uh the I am full access grants him 452 00:21:32,480 --> 00:21:35,320 these permissions I am wild card and 453 00:21:35,320 --> 00:21:36,640 some 454 00:21:36,640 --> 00:21:41,000 organizations um other API calls which I 455 00:21:41,000 --> 00:21:43,720 don't understand why it needs them but 456 00:21:43,720 --> 00:21:46,919 uh there you go thanks 457 00:21:46,919 --> 00:21:50,720 AWS and the uh permission boundary let's 458 00:21:50,720 --> 00:21:52,080 see let's uh take a look at the 459 00:21:52,080 --> 00:21:55,559 permissions boundy we here we have uh an 460 00:21:55,559 --> 00:21:59,120 a deny statement which deny him access 461 00:21:59,120 --> 00:22:03,159 to my bucket and any resources within my 462 00:22:03,159 --> 00:22:06,960 bucket it has an allow 463 00:22:06,960 --> 00:22:09,120 of 464 00:22:09,120 --> 00:22:11,320 um 465 00:22:11,320 --> 00:22:15,600 sorry and allow not action for I am and 466 00:22:15,600 --> 00:22:18,120 organization so the permission boundary 467 00:22:18,120 --> 00:22:22,120 includes all actions except I am and 468 00:22:22,120 --> 00:22:26,440 organizations and the uh as risk 469 00:22:26,440 --> 00:22:28,760 resource so 470 00:22:28,760 --> 00:22:31,600 essentially if we go through it through 471 00:22:31,600 --> 00:22:35,120 it in our mind we can see that he should 472 00:22:35,120 --> 00:22:40,399 have access to most buckets 473 00:22:41,559 --> 00:22:44,880 except these two the this bucket and uh 474 00:22:44,880 --> 00:22:48,919 objects within it and we can say that 475 00:22:48,919 --> 00:22:50,600 someone has 476 00:22:50,600 --> 00:22:54,200 erroneously uh added this user to the IM 477 00:22:54,200 --> 00:22:57,159 am admins group because as we can see in 478 00:22:57,159 --> 00:22:59,200 the uh permission per battery as we saw 479 00:22:59,200 --> 00:23:01,400 in the permissions battery uh he's 480 00:23:01,400 --> 00:23:03,799 actually not allowed to access any I IM 481 00:23:03,799 --> 00:23:06,640 actions or organization uh 482 00:23:06,640 --> 00:23:09,360 actions so now let's 483 00:23:09,360 --> 00:23:11,520 run 484 00:23:11,520 --> 00:23:13,830 the command for 485 00:23:13,830 --> 00:23:16,679 [Music] 486 00:23:16,679 --> 00:23:20,360 that and here we are wait that's not the 487 00:23:20,360 --> 00:23:22,678 the right 488 00:23:23,360 --> 00:23:26,880 one I swear I can copy and 489 00:23:26,880 --> 00:23:32,200 paste there we go so he has the uh S3 490 00:23:32,200 --> 00:23:35,840 actions and the S3 resource except that 491 00:23:35,840 --> 00:23:37,440 bucket in those object and as you can 492 00:23:37,440 --> 00:23:40,880 see the I IM actions and organization 493 00:23:40,880 --> 00:23:44,080 actions are not 494 00:23:44,080 --> 00:23:47,520 present but this is the simple version 495 00:23:47,520 --> 00:23:51,840 let's go and look over the report a 496 00:23:51,840 --> 00:23:56,120 little so if we go to the more verbose 497 00:23:56,120 --> 00:23:59,320 report we can see 498 00:23:59,320 --> 00:24:01,559 that he had an 499 00:24:01,559 --> 00:24:03,919 organizations permission organization 500 00:24:03,919 --> 00:24:07,559 service permission on the Wild Card 501 00:24:07,559 --> 00:24:10,760 resource he had read permissions to 502 00:24:10,760 --> 00:24:13,960 describe account but it was denied by 503 00:24:13,960 --> 00:24:15,320 the permission 504 00:24:15,320 --> 00:24:18,320 boundary so that in my opinion is a 505 00:24:18,320 --> 00:24:22,120 really powerful and useful uh feature 506 00:24:22,120 --> 00:24:26,799 not if you agree yes thank 507 00:24:26,799 --> 00:24:29,799 you 508 00:24:30,640 --> 00:24:32,880 all 509 00:24:32,880 --> 00:24:35,799 right thank you demo gods for giving me 510 00:24:35,799 --> 00:24:37,640 my back my 511 00:24:37,640 --> 00:24:41,120 backup all right uh so what is next 512 00:24:41,120 --> 00:24:43,440 basically it's up to you I amap is an 513 00:24:43,440 --> 00:24:46,799 open resource uh open source uh program 514 00:24:46,799 --> 00:24:50,440 you can go to the GitHub and uh open 515 00:24:50,440 --> 00:24:54,159 issues open pull requests dive into the 516 00:24:54,159 --> 00:24:56,760 code and please do because I need 517 00:24:56,760 --> 00:24:58,520 help 518 00:24:58,520 --> 00:25:00,880 uh some use cases for you guys uh you 519 00:25:00,880 --> 00:25:03,520 can discover overprivileged users so if 520 00:25:03,520 --> 00:25:05,720 you have a user you look into it's 521 00:25:05,720 --> 00:25:08,080 inline policy it should not have uh 522 00:25:08,080 --> 00:25:10,480 admin privileges but suddenly it has 523 00:25:10,480 --> 00:25:12,799 that's a great way to discover that uh 524 00:25:12,799 --> 00:25:14,840 you can find privileg escalation attacks 525 00:25:14,840 --> 00:25:16,960 so if you are more of a red teamer you 526 00:25:16,960 --> 00:25:18,840 want to find the effective permissions 527 00:25:18,840 --> 00:25:22,159 for a user that maybe you've uh manage 528 00:25:22,159 --> 00:25:26,559 to compromise the credentials for am my 529 00:25:26,559 --> 00:25:28,360 slide uh 530 00:25:28,360 --> 00:25:32,080 you can uh analyze more effectively for 531 00:25:32,080 --> 00:25:34,760 for uh privilege escalation attacks you 532 00:25:34,760 --> 00:25:36,799 can uh minimize the amount of false 533 00:25:36,799 --> 00:25:39,360 positives you get uh you can find out 534 00:25:39,360 --> 00:25:42,480 why the heck you can't get yourself uh 535 00:25:42,480 --> 00:25:44,600 permissions to access that specific 536 00:25:44,600 --> 00:25:46,279 bucket and you can create a more 537 00:25:46,279 --> 00:25:48,480 comprehensive more easy to read map of 538 00:25:48,480 --> 00:25:50,840 any users you have in your 539 00:25:50,840 --> 00:25:52,480 organizations 540 00:25:52,480 --> 00:25:55,720 um some future plans for the Tool uh I 541 00:25:55,720 --> 00:25:57,480 do plan to add support for resource 542 00:25:57,480 --> 00:25:58,640 polic policies this is something we 543 00:25:58,640 --> 00:26:00,360 haven't really touched about but in NWS 544 00:26:00,360 --> 00:26:03,600 you can also uh give Pol give policies 545 00:26:03,600 --> 00:26:04,799 to 546 00:26:04,799 --> 00:26:07,159 resources uh it is not something that is 547 00:26:07,159 --> 00:26:08,600 currently supported because there are 548 00:26:08,600 --> 00:26:11,240 just too many darn resources in your AWS 549 00:26:11,240 --> 00:26:13,039 account and I am not going to crawl that 550 00:26:13,039 --> 00:26:13,919 entire 551 00:26:13,919 --> 00:26:17,520 thing um but what you will be able to do 552 00:26:17,520 --> 00:26:21,240 is just uh provide a resource uh policy 553 00:26:21,240 --> 00:26:23,320 or several resource policies in as an 554 00:26:23,320 --> 00:26:26,360 input and have it uh evaluated as part 555 00:26:26,360 --> 00:26:28,360 of the entire chain 556 00:26:28,360 --> 00:26:33,320 uh we I also plan to uh integrate 557 00:26:33,320 --> 00:26:35,200 additional permissions gained by role 558 00:26:35,200 --> 00:26:37,880 assumption roles are resources which can 559 00:26:37,880 --> 00:26:43,880 be uh assumed by entities and if a user 560 00:26:43,880 --> 00:26:47,960 has a permission to assume a role he not 561 00:26:47,960 --> 00:26:50,360 exactly automatically but there's some 562 00:26:50,360 --> 00:26:52,399 conditions he also uh gains those 563 00:26:52,399 --> 00:26:55,159 permissions I do plan on adding this 564 00:26:55,159 --> 00:26:58,880 kind of uh s sort of lateral movement 565 00:26:58,880 --> 00:27:00,600 let's call it like that uh some 566 00:27:00,600 --> 00:27:02,080 integration with privilege escalation 567 00:27:02,080 --> 00:27:03,880 analysis to there are plenty of those 568 00:27:03,880 --> 00:27:06,600 out there that are great uh and more as 569 00:27:06,600 --> 00:27:08,880 I said it's a it's an open source tool I 570 00:27:08,880 --> 00:27:11,360 am very much open to suggestions and 571 00:27:11,360 --> 00:27:14,919 collaborations and more and more and 572 00:27:14,919 --> 00:27:17,919 more and that is my time so thank you 573 00:27:17,919 --> 00:27:20,520 very very 574 00:27:25,000 --> 00:27:29,480 much yeah I help one be a suggestion uh 575 00:27:29,480 --> 00:27:31,399 do you plan to do the other way around 576 00:27:31,399 --> 00:27:33,200 meaning like I want to locate someone 577 00:27:33,200 --> 00:27:35,559 who can actually do this specific API 578 00:27:35,559 --> 00:27:38,399 call against my entire environment 579 00:27:38,399 --> 00:27:40,360 meaning like I want to know if anyone 580 00:27:40,360 --> 00:27:44,200 can do KS import key materials Pro the 581 00:27:44,200 --> 00:27:45,880 whole thing and see which one happen 582 00:27:45,880 --> 00:27:47,559 Okay so so the question was just to 583 00:27:47,559 --> 00:27:49,600 repeat it for those who didn't didn't 584 00:27:49,600 --> 00:27:52,640 hear uh the question was whether I plan 585 00:27:52,640 --> 00:27:55,559 on doing like a reverse lookup if some 586 00:27:55,559 --> 00:27:58,960 to see if someone can uh uh access a 587 00:27:58,960 --> 00:28:01,600 specific API that's I I mean like uh if 588 00:28:01,600 --> 00:28:04,240 you know from specific some specific API 589 00:28:04,240 --> 00:28:06,760 that can be used maliciously I want to 590 00:28:06,760 --> 00:28:07,880 be able to 591 00:28:07,880 --> 00:28:10,840 track with all the resource in in all 592 00:28:10,840 --> 00:28:13,519 the roles used group you my in my 593 00:28:13,519 --> 00:28:16,159 environment right which user can do this 594 00:28:16,159 --> 00:28:19,240 specific API call B on the permission uh 595 00:28:19,240 --> 00:28:21,919 so that is not something that I'm 596 00:28:21,919 --> 00:28:24,960 planning on doing but there are uh tools 597 00:28:24,960 --> 00:28:28,519 such as I Amic uh which is a great tool 598 00:28:28,519 --> 00:28:31,919 by the way it's IM am button code which 599 00:28:31,919 --> 00:28:35,279 uh you you can just dump the uh policies 600 00:28:35,279 --> 00:28:38,720 generated by uh IMAP into those tools 601 00:28:38,720 --> 00:28:41,440 and they run a a a great search within 602 00:28:41,440 --> 00:28:44,960 uh permissions for that 603 00:28:47,760 --> 00:28:49,919 okay any more 604 00:28:49,919 --> 00:28:52,720 questions yeah please do you have any 605 00:28:52,720 --> 00:28:55,080 plans to integr with the sorry I can't 606 00:28:55,080 --> 00:28:56,840 hear you do you have any plans to 607 00:28:56,840 --> 00:28:58,519 integrate with the source code to see 608 00:28:58,519 --> 00:29:02,120 which calls uh the code is making the aw 609 00:29:02,120 --> 00:29:07,519 services and compare the sorry again so 610 00:29:07,519 --> 00:29:09,720 okay do you have any plans to integrate 611 00:29:09,720 --> 00:29:11,399 into the source code to see like which 612 00:29:11,399 --> 00:29:14,600 cost AWS cost have been uh the source 613 00:29:14,600 --> 00:29:17,440 Cod is trying to make versus like what 614 00:29:17,440 --> 00:29:20,080 policies that the 615 00:29:20,080 --> 00:29:23,919 user uh so like what 616 00:29:23,919 --> 00:29:26,799 uh what your um what actually the 617 00:29:26,799 --> 00:29:29,320 service me what the user actually needs 618 00:29:29,320 --> 00:29:32,159 versus what he actually has uh so that 619 00:29:32,159 --> 00:29:37,919 is a a bit of a more complex problem um 620 00:29:37,919 --> 00:29:40,120 AWS gives you this information only 621 00:29:40,120 --> 00:29:43,279 based on Services rather than specific 622 00:29:43,279 --> 00:29:46,240 uh calls you know if you want to uh find 623 00:29:46,240 --> 00:29:49,360 out exactly which calls a user uh wants 624 00:29:49,360 --> 00:29:52,519 to make or does make uh then you have to 625 00:29:52,519 --> 00:29:55,000 basically monitor the cloud trail and 626 00:29:55,000 --> 00:29:59,760 see what API quality makes um but yeah 627 00:29:59,760 --> 00:30:03,039 integrating the the what services uh he 628 00:30:03,039 --> 00:30:06,679 has then yeah that's uh that's a a great 629 00:30:06,679 --> 00:30:09,840 idea yeah thank 630 00:30:10,360 --> 00:30:12,880 you thank you very 631 00:30:12,880 --> 00:30:15,880 much