1 00:00:00,399 --> 00:00:02,560 his talk will explore how default 2 00:00:02,560 --> 00:00:04,960 configurations in architectures of our 3 00:00:04,960 --> 00:00:07,319 most commonly used software Supply Chain 4 00:00:07,319 --> 00:00:10,440 Services can lead to a handful of 5 00:00:10,440 --> 00:00:13,040 unsavory outcomes including Secrets 6 00:00:13,040 --> 00:00:15,799 exploitation lateral movement and 7 00:00:15,799 --> 00:00:17,800 privilege escalation within production 8 00:00:17,800 --> 00:00:21,160 cloud and SAS environments the title of 9 00:00:21,160 --> 00:00:23,800 Mike's talk is attacking and defending 10 00:00:23,800 --> 00:00:26,560 software Supply chains how we got admin 11 00:00:26,560 --> 00:00:31,160 in your clouds please welcome Mike 12 00:00:31,160 --> 00:00:31,960 thank 13 00:00:31,960 --> 00:00:34,840 you turn off how's everyone doing how's 14 00:00:34,840 --> 00:00:37,040 my uh volume in the back good here in 15 00:00:37,040 --> 00:00:38,719 the front good in the back I got thumbs 16 00:00:38,719 --> 00:00:41,640 up let's do it okay everyone my name is 17 00:00:41,640 --> 00:00:44,640 Mike um I I guess I don't need to do an 18 00:00:44,640 --> 00:00:46,360 intro we just got the intro uh so we're 19 00:00:46,360 --> 00:00:48,440 talking today at about attacking and 20 00:00:48,440 --> 00:00:50,600 defending software Supply chains and how 21 00:00:50,600 --> 00:00:52,520 we got admin in your Cloud environment 22 00:00:52,520 --> 00:00:55,719 but first a completely legitimate and 23 00:00:55,719 --> 00:00:58,680 safe QR code this is uh linked to the 24 00:00:58,680 --> 00:01:00,920 talks mostly for folks in the back uh we 25 00:01:00,920 --> 00:01:03,079 only have such a big uh screen so if you 26 00:01:03,079 --> 00:01:05,119 guys want to follow along on your phones 27 00:01:05,119 --> 00:01:06,400 uh you can scan that link and that 28 00:01:06,400 --> 00:01:08,840 should go to Google Drive um you know 29 00:01:08,840 --> 00:01:11,560 buy or beware but but it's probably 30 00:01:11,560 --> 00:01:15,119 safe okay to start I need to not get 31 00:01:15,119 --> 00:01:18,200 stuck that's the first step okay to 32 00:01:18,200 --> 00:01:20,040 start I want to talk about you know why 33 00:01:20,040 --> 00:01:21,720 we use software Supply chains in the 34 00:01:21,720 --> 00:01:24,079 first place and in particular uh why we 35 00:01:24,079 --> 00:01:26,479 use cic CD tools right most of us are 36 00:01:26,479 --> 00:01:28,640 probably familiar with this uh really 37 00:01:28,640 --> 00:01:30,560 what it comes down to is it's a forcing 38 00:01:30,560 --> 00:01:33,520 function of Company Success right um a 39 00:01:33,520 --> 00:01:37,000 company of 10 20 50 even 100 employees 40 00:01:37,000 --> 00:01:38,720 they can probably get away with having 41 00:01:38,720 --> 00:01:40,920 their entire engineering Workforce have 42 00:01:40,920 --> 00:01:42,560 production credentials on all of their 43 00:01:42,560 --> 00:01:43,960 you know end points they can probably 44 00:01:43,960 --> 00:01:47,079 get away with pushing to prod but as a 45 00:01:47,079 --> 00:01:49,320 company grows and becomes more 46 00:01:49,320 --> 00:01:52,280 successful 500 a th000 employees it kind 47 00:01:52,280 --> 00:01:53,759 of becomes impossible to do this right 48 00:01:53,759 --> 00:01:55,159 everyone's just sort of stepping over 49 00:01:55,159 --> 00:01:57,280 one another and so we need to 50 00:01:57,280 --> 00:01:59,719 productionize that process for everyone 51 00:01:59,719 --> 00:02:01,600 uh that process comes with a couple of 52 00:02:01,600 --> 00:02:03,479 Security benefits for example we can 53 00:02:03,479 --> 00:02:05,280 remove all of those credentials that 54 00:02:05,280 --> 00:02:07,000 might have originally been on all of our 55 00:02:07,000 --> 00:02:09,000 engineering endpoints and we can instead 56 00:02:09,000 --> 00:02:10,639 have these individuals working on uh 57 00:02:10,639 --> 00:02:11,720 with tools that they're kind of more 58 00:02:11,720 --> 00:02:12,920 familiar and comfortable with like 59 00:02:12,920 --> 00:02:15,879 Version Control GitHub things like this 60 00:02:15,879 --> 00:02:18,280 uh now the typically when we talk about 61 00:02:18,280 --> 00:02:19,920 software Supply chains and software 62 00:02:19,920 --> 00:02:21,519 supply chain security I think we tend to 63 00:02:21,519 --> 00:02:23,599 think more Upstream about like the open 64 00:02:23,599 --> 00:02:25,480 source providers and libraries that we 65 00:02:25,480 --> 00:02:27,680 end up pulling in uh but the scope of 66 00:02:27,680 --> 00:02:29,000 this presentation is going to take a 67 00:02:29,000 --> 00:02:30,400 slightly different approach and it's 68 00:02:30,400 --> 00:02:32,000 going to actually look at those tools 69 00:02:32,000 --> 00:02:33,200 that we use internally to our 70 00:02:33,200 --> 00:02:35,959 organizations and how we take code from 71 00:02:35,959 --> 00:02:37,820 source to production in those 72 00:02:37,820 --> 00:02:39,680 [Music] 73 00:02:39,680 --> 00:02:42,879 environments and to level set um some of 74 00:02:42,879 --> 00:02:44,080 you might already be familiar with some 75 00:02:44,080 --> 00:02:46,920 of these tools um but if you're not uh 76 00:02:46,920 --> 00:02:48,480 this might be a good refresher or you 77 00:02:48,480 --> 00:02:50,360 know a good sort of primer so we're 78 00:02:50,360 --> 00:02:52,720 going to start with uh VCS and GitHub in 79 00:02:52,720 --> 00:02:54,080 particular we won't spend too much time 80 00:02:54,080 --> 00:02:55,239 here I think most people know what this 81 00:02:55,239 --> 00:02:57,440 is all about the main thing that I want 82 00:02:57,440 --> 00:02:58,560 to talk about is really the big 83 00:02:58,560 --> 00:03:00,239 difference between uh your your sort of 84 00:03:00,239 --> 00:03:02,120 free version of GitHub you know your 85 00:03:02,120 --> 00:03:03,959 repos you can turn public have make 86 00:03:03,959 --> 00:03:06,400 private thing or yeah things like that 87 00:03:06,400 --> 00:03:08,200 um but with the Enterprise version you 88 00:03:08,200 --> 00:03:09,120 actually get something known as 89 00:03:09,120 --> 00:03:10,440 organizations right which is this 90 00:03:10,440 --> 00:03:12,799 logical boundary in the same way that a 91 00:03:12,799 --> 00:03:14,519 repository is a logical boundary around 92 00:03:14,519 --> 00:03:16,319 your source for all of your services 93 00:03:16,319 --> 00:03:18,080 organization is a logical boundary that 94 00:03:18,080 --> 00:03:20,480 exists for all of your employees and all 95 00:03:20,480 --> 00:03:21,840 of the repositories for your 96 00:03:21,840 --> 00:03:23,440 organization and that allows you to do 97 00:03:23,440 --> 00:03:24,840 that sort of scaling that we talked 98 00:03:24,840 --> 00:03:26,920 about in the last Slide by managing you 99 00:03:26,920 --> 00:03:28,720 know Access Control collaboration things 100 00:03:28,720 --> 00:03:30,959 like that across all of those 101 00:03:30,959 --> 00:03:33,000 repositories now if you're a company who 102 00:03:33,000 --> 00:03:34,720 is sort of in the beginnings of their 103 00:03:34,720 --> 00:03:37,120 engineering maturity you're probably 104 00:03:37,120 --> 00:03:39,319 managing repositories uh all by the 105 00:03:39,319 --> 00:03:40,879 console all manually you know it's good 106 00:03:40,879 --> 00:03:42,200 developer experience allows your teams 107 00:03:42,200 --> 00:03:44,400 to move quickly uh what that means right 108 00:03:44,400 --> 00:03:45,840 is that anyone's going to go and be able 109 00:03:45,840 --> 00:03:47,599 to make those repositories and they'll 110 00:03:47,599 --> 00:03:49,000 have the permissions to manage things 111 00:03:49,000 --> 00:03:51,319 like collaborators uh configure web 112 00:03:51,319 --> 00:03:53,640 hooks Branch protection and and um sorry 113 00:03:53,640 --> 00:03:55,239 branching strategy and protection rules 114 00:03:55,239 --> 00:03:57,519 things like not you know allowing um 115 00:03:57,519 --> 00:03:59,439 Force pushes to to Main and things like 116 00:03:59,439 --> 00:04:02,519 this also uh setting up the CI you know 117 00:04:02,519 --> 00:04:04,879 the configuration files for your CI 118 00:04:04,879 --> 00:04:07,599 which leads us to our next slide so 119 00:04:07,599 --> 00:04:08,920 continuous integration we're going to 120 00:04:08,920 --> 00:04:10,799 talk about a couple Tools in this space 121 00:04:10,799 --> 00:04:11,799 but in particular we're going to talk 122 00:04:11,799 --> 00:04:14,439 about GitHub actions GitHub actions the 123 00:04:14,439 --> 00:04:16,639 way they work is through workflows uh 124 00:04:16,639 --> 00:04:18,199 GitHub actions is probably the easiest 125 00:04:18,199 --> 00:04:19,798 tool to use with GitHub since it's just 126 00:04:19,798 --> 00:04:21,358 natively supported you know the second 127 00:04:21,358 --> 00:04:22,840 that you turn on a repos or create a 128 00:04:22,840 --> 00:04:25,880 repository you have gi of action support 129 00:04:25,880 --> 00:04:27,440 uh so they work through these workflows 130 00:04:27,440 --> 00:04:28,880 and the way that it works is you define 131 00:04:28,880 --> 00:04:30,880 a set of jobs in configuration files and 132 00:04:30,880 --> 00:04:32,440 those jobs then run on a dedicated 133 00:04:32,440 --> 00:04:34,759 computer get up actions worker and the 134 00:04:34,759 --> 00:04:36,400 workflows themselves those config files 135 00:04:36,400 --> 00:04:38,039 are in a reserved file path they're in 136 00:04:38,039 --> 00:04:40,720 this GitHub slork flows file path so 137 00:04:40,720 --> 00:04:42,400 anything that you create there is going 138 00:04:42,400 --> 00:04:44,919 to be a workflow that runs for GitHub 139 00:04:44,919 --> 00:04:46,880 actions now for these workflows to be 140 00:04:46,880 --> 00:04:49,080 able to interact with the outside world 141 00:04:49,080 --> 00:04:50,800 uh the way that they do that is by 142 00:04:50,800 --> 00:04:52,520 providing an identity of some kind right 143 00:04:52,520 --> 00:04:55,280 so this identity tends to be a a GitHub 144 00:04:55,280 --> 00:04:57,080 token that gets assigned to the worker 145 00:04:57,080 --> 00:04:58,759 when that job kicks off and it gives you 146 00:04:58,759 --> 00:05:00,320 access to GitHub a 147 00:05:00,320 --> 00:05:02,039 things like Secrets if the repository 148 00:05:02,039 --> 00:05:04,199 has any and or based Secrets if those 149 00:05:04,199 --> 00:05:07,199 exist um now perhaps you know in those 150 00:05:07,199 --> 00:05:08,199 Secrets you're going to have other 151 00:05:08,199 --> 00:05:10,160 identities to your SAS services to your 152 00:05:10,160 --> 00:05:11,720 Cloud environments things like this but 153 00:05:11,720 --> 00:05:13,600 perhaps a bit more elegantly is you 154 00:05:13,600 --> 00:05:16,560 might have oidc Federation so you might 155 00:05:16,560 --> 00:05:18,240 actually not need those credentials so 156 00:05:18,240 --> 00:05:19,880 that you can actually allow your actions 157 00:05:19,880 --> 00:05:21,680 workers to get direct access into your 158 00:05:21,680 --> 00:05:24,440 clouds uh through some short lived o IDC 159 00:05:24,440 --> 00:05:27,440 based operation now these workflows uh 160 00:05:27,440 --> 00:05:29,240 the way that they uh work are through 161 00:05:29,240 --> 00:05:30,759 trigger and the triggers are are the 162 00:05:30,759 --> 00:05:32,120 event triggers that you're probably most 163 00:05:32,120 --> 00:05:34,759 familiar with these are you know on push 164 00:05:34,759 --> 00:05:37,600 a PR on merge things like this and we 165 00:05:37,600 --> 00:05:39,080 can see an example of what this GitHub 166 00:05:39,080 --> 00:05:42,919 actions um config looks like here on the 167 00:05:42,919 --> 00:05:45,560 right okay next CI tool is buildkite 168 00:05:45,560 --> 00:05:47,199 very similar to GitHub actions in the 169 00:05:47,199 --> 00:05:49,520 way that it works uh so it uses 170 00:05:49,520 --> 00:05:52,280 pipelines just like workflows and the 171 00:05:52,280 --> 00:05:54,600 pipelines are configured uh with this 172 00:05:54,600 --> 00:05:56,039 typically there's a resered file path 173 00:05:56,039 --> 00:05:57,360 that's associated with it usually it's 174 00:05:57,360 --> 00:05:58,759 like build kite and the same with that 175 00:05:58,759 --> 00:06:01,039 do GitHub is for gith have actions and 176 00:06:01,039 --> 00:06:02,680 it works with event based triggers very 177 00:06:02,680 --> 00:06:04,199 similar the big difference here is that 178 00:06:04,199 --> 00:06:05,880 it's not natively integrated you do need 179 00:06:05,880 --> 00:06:07,720 to configure this in some way and the 180 00:06:07,720 --> 00:06:09,560 way that you do that is through a web 181 00:06:09,560 --> 00:06:12,120 hook again very similar it has agents 182 00:06:12,120 --> 00:06:14,400 for its identity so you define an agent 183 00:06:14,400 --> 00:06:16,039 inside of the configuration file and 184 00:06:16,039 --> 00:06:18,080 that agent is a token that gets 185 00:06:18,080 --> 00:06:19,880 provisioned on the runners that those 186 00:06:19,880 --> 00:06:22,880 are uh build kites uh compute and then 187 00:06:22,880 --> 00:06:25,599 that gets access through you know I am 188 00:06:25,599 --> 00:06:27,840 rooll I AWS service count if you're in 189 00:06:27,840 --> 00:06:30,960 you know gcp Azure or another cloud 190 00:06:30,960 --> 00:06:32,560 um and we can see an example of this on 191 00:06:32,560 --> 00:06:34,800 the right um so one of the things that 192 00:06:34,800 --> 00:06:37,560 we can see is the agent definition here 193 00:06:37,560 --> 00:06:39,120 about four or five lines down we can see 194 00:06:39,120 --> 00:06:41,120 that deploy artifact to prod this is 195 00:06:41,120 --> 00:06:42,479 just a name that we I kind of you know 196 00:06:42,479 --> 00:06:44,319 it's a bit pseudo code here but it kind 197 00:06:44,319 --> 00:06:45,680 of shows that there's specific 198 00:06:45,680 --> 00:06:47,639 identities that we create to do specific 199 00:06:47,639 --> 00:06:50,280 things like run scripts and assume uh 200 00:06:50,280 --> 00:06:53,360 you know other I am roles or cus 201 00:06:53,360 --> 00:06:55,160 accounts and this is kind of what it 202 00:06:55,160 --> 00:06:56,840 looks like in most our environments so 203 00:06:56,840 --> 00:06:58,560 we're going to go sort of one by one 204 00:06:58,560 --> 00:07:00,080 hopefully those of you in the back have 205 00:07:00,080 --> 00:07:03,199 scanned this code right here if you 206 00:07:03,199 --> 00:07:07,319 can't see but if not uh here it is I 207 00:07:07,319 --> 00:07:08,960 actually realize that I went so fast 208 00:07:08,960 --> 00:07:10,879 you're like hey let me scan it yeah 209 00:07:10,879 --> 00:07:12,199 there you go here I'll give you a couple 210 00:07:12,199 --> 00:07:14,479 seconds it's also on the some of the 211 00:07:14,479 --> 00:07:16,520 desks in the back uh for those of you 212 00:07:16,520 --> 00:07:18,479 just starting to come in okay we're 213 00:07:18,479 --> 00:07:20,479 moving on I've only got 35 minutes so I 214 00:07:20,479 --> 00:07:22,039 apologize if you didn't get a chance to 215 00:07:22,039 --> 00:07:23,319 scan 216 00:07:23,319 --> 00:07:25,759 that okay so this is kind of what the 217 00:07:25,759 --> 00:07:27,560 workflow looks like so kind of starting 218 00:07:27,560 --> 00:07:29,599 with step one someone submits some some 219 00:07:29,599 --> 00:07:32,319 sort of PR or change to a repository 220 00:07:32,319 --> 00:07:33,759 that repository has a handful of 221 00:07:33,759 --> 00:07:35,400 configuration files configured whether 222 00:07:35,400 --> 00:07:37,960 it's using GI up actions build kite etc 223 00:07:37,960 --> 00:07:40,479 those have specific parameters for based 224 00:07:40,479 --> 00:07:41,800 on those event triggers for when they 225 00:07:41,800 --> 00:07:43,879 trigger so this is step two and step 226 00:07:43,879 --> 00:07:46,440 three here when this runs it's going to 227 00:07:46,440 --> 00:07:49,080 run some sort of um CI based check 228 00:07:49,080 --> 00:07:51,360 linting formatting some sort of dry run 229 00:07:51,360 --> 00:07:52,759 something along these lines and it's 230 00:07:52,759 --> 00:07:54,400 going to run on a worker like we see on 231 00:07:54,400 --> 00:07:56,400 step four that has an identity that 232 00:07:56,400 --> 00:07:58,440 allows them to go and fetch uh other 233 00:07:58,440 --> 00:08:00,479 secret material whether it's from get up 234 00:08:00,479 --> 00:08:02,960 Secrets or from say uh Secrets manager 235 00:08:02,960 --> 00:08:05,000 of your cloud provider and then there's 236 00:08:05,000 --> 00:08:06,479 some sort of review step that occurs 237 00:08:06,479 --> 00:08:08,280 here right so someone looks at the pr 238 00:08:08,280 --> 00:08:10,080 looks at the changes gives a plus one 239 00:08:10,080 --> 00:08:12,080 finally that code gets merged and then 240 00:08:12,080 --> 00:08:13,360 after that merge there's some sort of 241 00:08:13,360 --> 00:08:14,800 privileged right based action which we 242 00:08:14,800 --> 00:08:16,759 see in step five this is kind of a 243 00:08:16,759 --> 00:08:18,479 building an artifact deploying to PR 244 00:08:18,479 --> 00:08:20,680 something like this it's worth noting at 245 00:08:20,680 --> 00:08:22,759 this point that GitHub actions in build 246 00:08:22,759 --> 00:08:24,400 I think they're pretty commonly viewed 247 00:08:24,400 --> 00:08:26,440 as CI tools but there's this blurring of 248 00:08:26,440 --> 00:08:28,360 lines where they often are used for 249 00:08:28,360 --> 00:08:30,000 continuous deployment as as well right 250 00:08:30,000 --> 00:08:31,599 that's kind of what step five is here is 251 00:08:31,599 --> 00:08:33,839 this sort of privileged production right 252 00:08:33,839 --> 00:08:36,760 based uh um 253 00:08:36,760 --> 00:08:39,719 action which leads us uh into our next 254 00:08:39,719 --> 00:08:41,440 category of continuous deployment tools 255 00:08:41,440 --> 00:08:43,200 and in this case terraform is probably 256 00:08:43,200 --> 00:08:44,720 one of the more popular ones in this 257 00:08:44,720 --> 00:08:46,720 space and we can start seeing a pattern 258 00:08:46,720 --> 00:08:48,920 here so with the um Enterprise and 259 00:08:48,920 --> 00:08:50,720 cloud-based versions of terraform from 260 00:08:50,720 --> 00:08:53,240 Hashi Corp we have orgs they act very 261 00:08:53,240 --> 00:08:54,800 similar to what we've seen before with 262 00:08:54,800 --> 00:08:56,800 orgs and and GitHub it's a logical 263 00:08:56,800 --> 00:08:58,480 boundary for all of the workspaces and 264 00:08:58,480 --> 00:09:00,200 so these workspaces 265 00:09:00,200 --> 00:09:02,640 uh are basically defined one to one on a 266 00:09:02,640 --> 00:09:04,880 per repo basis uh you might have 267 00:09:04,880 --> 00:09:06,680 subdirectories and repositories mapping 268 00:09:06,680 --> 00:09:08,560 to workspaces but workspaces are 269 00:09:08,560 --> 00:09:11,079 responsible for managing all of the 270 00:09:11,079 --> 00:09:13,079 resources that you wanted to deploy into 271 00:09:13,079 --> 00:09:16,640 your clouds right so if you have a AWS 272 00:09:16,640 --> 00:09:18,000 uh provider for terraform and you want 273 00:09:18,000 --> 00:09:19,920 to deploy AWS resources you'd have a 274 00:09:19,920 --> 00:09:22,560 workspace dedicated for that uh it Dons 275 00:09:22,560 --> 00:09:24,160 on me that this isn't true for the open 276 00:09:24,160 --> 00:09:25,880 source version if of folks use something 277 00:09:25,880 --> 00:09:28,200 like Atlantis this concept doesn't exist 278 00:09:28,200 --> 00:09:29,399 you might have to create something 279 00:09:29,399 --> 00:09:31,200 yourself uh but this is how it works in 280 00:09:31,200 --> 00:09:33,600 the Enterprise version uh next are State 281 00:09:33,600 --> 00:09:36,800 files which uh are aply named they uh 282 00:09:36,800 --> 00:09:38,640 keep state so they know the last known 283 00:09:38,640 --> 00:09:40,560 good configuration of the deployment 284 00:09:40,560 --> 00:09:41,880 that you've performed through a 285 00:09:41,880 --> 00:09:43,680 workspace and that helps so when you 286 00:09:43,680 --> 00:09:45,560 make a PR or an incoming change it can 287 00:09:45,560 --> 00:09:47,200 actually cross reference that last known 288 00:09:47,200 --> 00:09:48,560 good configuration with the incoming 289 00:09:48,560 --> 00:09:50,519 changes and gives you a diff and that's 290 00:09:50,519 --> 00:09:52,440 what the output of your dry runs or your 291 00:09:52,440 --> 00:09:53,360 plans 292 00:09:53,360 --> 00:09:55,519 are uh the way that it does this is 293 00:09:55,519 --> 00:09:57,240 through providers so providers do all 294 00:09:57,240 --> 00:09:58,839 the heavy lifting for terraform they're 295 00:09:58,839 --> 00:10:00,920 a binary that runs on the terraform 296 00:10:00,920 --> 00:10:04,399 worker nodes the compute for them and it 297 00:10:04,399 --> 00:10:05,800 knows how to interact with all your 298 00:10:05,800 --> 00:10:08,000 Downstream API so you have AWS providers 299 00:10:08,000 --> 00:10:09,640 and gcp providers and kubernetes 300 00:10:09,640 --> 00:10:11,200 providers you there's a bunch of them 301 00:10:11,200 --> 00:10:13,320 now and so it knows what API to hit it 302 00:10:13,320 --> 00:10:14,880 knows how the resources are configured 303 00:10:14,880 --> 00:10:16,920 it knows what parameters it needs so on 304 00:10:16,920 --> 00:10:18,160 and so 305 00:10:18,160 --> 00:10:20,240 forth and it's a pretty similar 306 00:10:20,240 --> 00:10:21,560 reference architecture we go through the 307 00:10:21,560 --> 00:10:24,240 same sort of flow here of code push dry 308 00:10:24,240 --> 00:10:27,680 run PR review uh merging and then 309 00:10:27,680 --> 00:10:30,480 deployment steps 1 through 310 00:10:30,480 --> 00:10:34,079 for okay so this is um kind of our 311 00:10:34,079 --> 00:10:36,120 refresher so I've got a couple of 312 00:10:36,120 --> 00:10:38,000 assumptions here based off of the things 313 00:10:38,000 --> 00:10:40,279 that I've just talked about um the first 314 00:10:40,279 --> 00:10:41,920 question I love to pull the audience so 315 00:10:41,920 --> 00:10:44,000 perhaps a show of hands for those of you 316 00:10:44,000 --> 00:10:46,959 current who have currently or have ever 317 00:10:46,959 --> 00:10:49,240 worked at a company how many of you uh 318 00:10:49,240 --> 00:10:51,079 have seen that all of engineering is 319 00:10:51,079 --> 00:10:53,320 allowed to submit PRS to all of the 320 00:10:53,320 --> 00:10:55,880 repositories in your Orcs just 321 00:10:55,880 --> 00:10:58,800 PRS we got we got a bunch of hands for 322 00:10:58,800 --> 00:11:00,440 those of you perhaps viewing at home in 323 00:11:00,440 --> 00:11:02,560 the future on the recording I would say 324 00:11:02,560 --> 00:11:06,040 honestly it was maybe like 55 60% I bet 325 00:11:06,040 --> 00:11:08,600 I'm wondering if it's more actually but 326 00:11:08,600 --> 00:11:10,200 usually when I ask this question because 327 00:11:10,200 --> 00:11:11,240 I've asked this question a couple times 328 00:11:11,240 --> 00:11:14,000 it's around the 60 to 70% but 50 to 55 329 00:11:14,000 --> 00:11:15,480 maybe our practitioners are a bit more 330 00:11:15,480 --> 00:11:17,120 mature at their companies and they're 331 00:11:17,120 --> 00:11:20,279 like no no PRS um we'll see so there are 332 00:11:20,279 --> 00:11:22,720 a couple of other uh assumptions though 333 00:11:22,720 --> 00:11:24,519 the next is that branching strategy for 334 00:11:24,519 --> 00:11:27,040 most of our repositories is largely flat 335 00:11:27,040 --> 00:11:28,399 so what that means is basically you have 336 00:11:28,399 --> 00:11:30,480 one protected branch the main branch and 337 00:11:30,480 --> 00:11:31,800 then all of the other branches that 338 00:11:31,800 --> 00:11:33,800 allow you to submit PRS these are the 339 00:11:33,800 --> 00:11:35,399 things that uh you know you're going to 340 00:11:35,399 --> 00:11:37,399 review once they get merged they move 341 00:11:37,399 --> 00:11:39,480 into this protected Branch so there's no 342 00:11:39,480 --> 00:11:42,000 like um Advanced uh feature branches or 343 00:11:42,000 --> 00:11:43,720 multi-tiered structures chances are it's 344 00:11:43,720 --> 00:11:45,040 just sort of one protected branch and 345 00:11:45,040 --> 00:11:47,959 that's it and then the third assumption 346 00:11:47,959 --> 00:11:49,839 is that it's predominantly up to service 347 00:11:49,839 --> 00:11:52,519 owners Engineers uh to manage their own 348 00:11:52,519 --> 00:11:54,560 cicd workflows and pipelines and what I 349 00:11:54,560 --> 00:11:56,200 mean by this is that there shouldn't be 350 00:11:56,200 --> 00:11:58,440 an expectation there probably isn't an 351 00:11:58,440 --> 00:12:01,040 expectation on the infra teams to White 352 00:12:01,040 --> 00:12:02,639 Glove the creation of all of these 353 00:12:02,639 --> 00:12:04,279 resources for all of these tools there's 354 00:12:04,279 --> 00:12:06,000 probably some work that needs to be done 355 00:12:06,000 --> 00:12:08,120 by engineering teams to actually create 356 00:12:08,120 --> 00:12:11,000 this these you know set things up 357 00:12:11,000 --> 00:12:12,839 themselves probably with the help of 358 00:12:12,839 --> 00:12:13,760 infer 359 00:12:13,760 --> 00:12:16,720 teams so saying all of this here's my 360 00:12:16,720 --> 00:12:19,600 problem statement Engineers have access 361 00:12:19,600 --> 00:12:22,560 to create repositories PRS and cicd 362 00:12:22,560 --> 00:12:24,240 resources unilaterally within our 363 00:12:24,240 --> 00:12:25,880 organizations and as such they can 364 00:12:25,880 --> 00:12:28,240 create and Trigger dry runs for new and 365 00:12:28,240 --> 00:12:30,160 existing workflows pipelines and 366 00:12:30,160 --> 00:12:32,040 terraform plans for all environments 367 00:12:32,040 --> 00:12:35,160 from Dev all the way to PR so why is 368 00:12:35,160 --> 00:12:36,760 this a 369 00:12:36,760 --> 00:12:39,399 problem let's find out now to help 370 00:12:39,399 --> 00:12:41,639 illustrate some of my findings I'm going 371 00:12:41,639 --> 00:12:43,800 to go through some of the creation steps 372 00:12:43,800 --> 00:12:44,880 that we just talked about in our 373 00:12:44,880 --> 00:12:46,279 reference architectures so we're going 374 00:12:46,279 --> 00:12:48,920 to go through creating a repository and 375 00:12:48,920 --> 00:12:50,519 uh seeing how GI up actions can access 376 00:12:50,519 --> 00:12:53,360 some secrets you know just by 377 00:12:53,360 --> 00:12:56,120 design that I'm hoping you guys can see 378 00:12:56,120 --> 00:12:58,000 this it's a little small so okay on the 379 00:12:58,000 --> 00:13:00,240 left side we can see that this is the 380 00:13:00,240 --> 00:13:01,880 create uh the console for creating a new 381 00:13:01,880 --> 00:13:03,560 GitHub repository and we're going and 382 00:13:03,560 --> 00:13:05,760 we're creating a repo called Technologic 383 00:13:05,760 --> 00:13:08,079 temp now on the right side when we do 384 00:13:08,079 --> 00:13:09,760 that we can go into the GitHub actions 385 00:13:09,760 --> 00:13:12,199 Secrets section and you can by default 386 00:13:12,199 --> 00:13:14,120 it gets access to repository Secrets 387 00:13:14,120 --> 00:13:15,399 there won't be any for brand new 388 00:13:15,399 --> 00:13:16,839 repository so you could create some of 389 00:13:16,839 --> 00:13:18,920 them but the the thing worth noting here 390 00:13:18,920 --> 00:13:20,760 is that any sort of org secrets in your 391 00:13:20,760 --> 00:13:22,880 GitHub org are just by default 392 00:13:22,880 --> 00:13:25,120 accessible in a brand new repository so 393 00:13:25,120 --> 00:13:26,600 you just get that for free if you can 394 00:13:26,600 --> 00:13:28,920 create a repository in your organization 395 00:13:28,920 --> 00:13:29,920 and and you might see where I'm going 396 00:13:29,920 --> 00:13:32,120 with this uh but for those of you who 397 00:13:32,120 --> 00:13:33,639 perhaps don't uh don't worry my story 398 00:13:33,639 --> 00:13:34,680 gets 399 00:13:34,680 --> 00:13:36,839 better next up uh we want to go and 400 00:13:36,839 --> 00:13:39,000 create a build kite Pipeline and connect 401 00:13:39,000 --> 00:13:41,279 it to our our GitHub repository and so 402 00:13:41,279 --> 00:13:43,160 what we do here and these are the steps 403 00:13:43,160 --> 00:13:46,000 Step One is uh you can see the settings 404 00:13:46,000 --> 00:13:47,600 of the pipeline itself so we can see 405 00:13:47,600 --> 00:13:49,240 that we've created a buildkite pipeline 406 00:13:49,240 --> 00:13:51,399 called Technologic temp pipeline it's 407 00:13:51,399 --> 00:13:53,199 connected to that Technologic temp uh 408 00:13:53,199 --> 00:13:55,320 repository step number two on the top 409 00:13:55,320 --> 00:13:57,120 right is just showing the event trigger 410 00:13:57,120 --> 00:13:58,639 setting so that's basically saying on a 411 00:13:58,639 --> 00:13:59,839 PO 412 00:13:59,839 --> 00:14:02,079 trigger trigger the the build or the 413 00:14:02,079 --> 00:14:04,079 configuration that we've set up step 414 00:14:04,079 --> 00:14:05,440 three is actually fetching the 415 00:14:05,440 --> 00:14:07,480 configuration file from the repository 416 00:14:07,480 --> 00:14:09,839 so this is done by some sort of um you 417 00:14:09,839 --> 00:14:11,720 can do this either through a personal 418 00:14:11,720 --> 00:14:14,000 access token or a deploy key in GitHub 419 00:14:14,000 --> 00:14:15,560 those aren't necessarily good ways to do 420 00:14:15,560 --> 00:14:17,560 it you could also create a GitHub app 421 00:14:17,560 --> 00:14:18,800 and then just give it access because it 422 00:14:18,800 --> 00:14:20,079 needs to be able to read from the 423 00:14:20,079 --> 00:14:22,160 repository to get that configuration 424 00:14:22,160 --> 00:14:24,680 file to know what jobs it needs to run 425 00:14:24,680 --> 00:14:26,199 and then step number four is the web 426 00:14:26,199 --> 00:14:28,279 hook on on github's end that shows it's 427 00:14:28,279 --> 00:14:30,000 actually sending that trigger based on 428 00:14:30,000 --> 00:14:33,360 the event uh to the to build gu to that 429 00:14:33,360 --> 00:14:36,079 Pipeline and now you may be asking yes 430 00:14:36,079 --> 00:14:38,040 we see how this works what's the problem 431 00:14:38,040 --> 00:14:39,759 uh maybe I'm dating myself here but some 432 00:14:39,759 --> 00:14:41,880 catty Shack fans maybe in the audience 433 00:14:41,880 --> 00:14:43,839 uh we're waiting what's the problem so 434 00:14:43,839 --> 00:14:46,000 let's actually see what the problem is 435 00:14:46,000 --> 00:14:48,959 so uh we're going to show how to create 436 00:14:48,959 --> 00:14:52,000 a GitHub actions f um file a workflow 437 00:14:52,000 --> 00:14:53,360 and so on the left we're creating this 438 00:14:53,360 --> 00:14:56,160 innocent looking file uh spoil alert not 439 00:14:56,160 --> 00:14:58,519 so innocent uh and it's trying to do two 440 00:14:58,519 --> 00:15:00,680 things the F and both things are trying 441 00:15:00,680 --> 00:15:03,199 to uh fetch secrets from the orgs org 442 00:15:03,199 --> 00:15:04,959 secrets that exist natively that have 443 00:15:04,959 --> 00:15:06,759 not actually been configured in any way 444 00:15:06,759 --> 00:15:08,320 that we just have access to so this is 445 00:15:08,320 --> 00:15:10,519 showing this in Orange we can see we're 446 00:15:10,519 --> 00:15:12,639 just trying to Echo the secret and GI up 447 00:15:12,639 --> 00:15:13,759 does a pretty good job actually at 448 00:15:13,759 --> 00:15:15,440 stopping that it's masked however if 449 00:15:15,440 --> 00:15:16,839 we're a little bit more clever and we 450 00:15:16,839 --> 00:15:19,120 perform a memory dump and then base 64 451 00:15:19,120 --> 00:15:21,160 encode it well we just see the blob 452 00:15:21,160 --> 00:15:22,720 right there and if you and that's what's 453 00:15:22,720 --> 00:15:25,759 happening in Red If You decode this what 454 00:15:25,759 --> 00:15:27,440 you'd find is two things one is the kid 455 00:15:27,440 --> 00:15:29,279 up org secret that's just readily 456 00:15:29,279 --> 00:15:31,519 available and two is the GitHub token 457 00:15:31,519 --> 00:15:33,480 that exists that is provisioned as the 458 00:15:33,480 --> 00:15:35,440 identity for the worker and that has 459 00:15:35,440 --> 00:15:36,959 read or write access depending on how 460 00:15:36,959 --> 00:15:38,880 it's configured to your GitHub apis your 461 00:15:38,880 --> 00:15:40,519 repository it just depends on what the 462 00:15:40,519 --> 00:15:42,240 workflow is 463 00:15:42,240 --> 00:15:44,519 doing and the same sort of thing is 464 00:15:44,519 --> 00:15:46,600 possible in build kite so if you look at 465 00:15:46,600 --> 00:15:48,160 lines one and two here we can see that 466 00:15:48,160 --> 00:15:49,959 the agent is being defined now this 467 00:15:49,959 --> 00:15:52,959 agent uh in the queue known as prod is 468 00:15:52,959 --> 00:15:55,079 kind of it's just an arbitrary agent it 469 00:15:55,079 --> 00:15:56,639 has nothing to do with the repository 470 00:15:56,639 --> 00:15:58,639 that we just configured so it actually 471 00:15:58,639 --> 00:16:01,360 is a associated with another repository 472 00:16:01,360 --> 00:16:03,680 probably that has to deal with prod 473 00:16:03,680 --> 00:16:05,279 based actions and we can just 474 00:16:05,279 --> 00:16:06,720 arbitrarily Define it in our own 475 00:16:06,720 --> 00:16:08,600 repository so there's no access control 476 00:16:08,600 --> 00:16:10,279 that exists by default in build kite 477 00:16:10,279 --> 00:16:12,079 that says hey you can only access this 478 00:16:12,079 --> 00:16:14,440 repa or this uh agent but not this agent 479 00:16:14,440 --> 00:16:16,199 and remember these are the identities 480 00:16:16,199 --> 00:16:18,360 that allow you to do things inside of 481 00:16:18,360 --> 00:16:20,360 other environments and we can see that 482 00:16:20,360 --> 00:16:23,120 by running this sort of bash test 483 00:16:23,120 --> 00:16:24,920 command which is just performing a get 484 00:16:24,920 --> 00:16:26,440 caller identity so for those of you in 485 00:16:26,440 --> 00:16:29,040 AWS the get caller identity just shows 486 00:16:29,040 --> 00:16:30,519 you the identity that you actually had 487 00:16:30,519 --> 00:16:31,600 become and we can see that we've been 488 00:16:31,600 --> 00:16:33,680 able to assume multiple roles without 489 00:16:33,680 --> 00:16:36,000 having any sort of configuration of the 490 00:16:36,000 --> 00:16:37,639 the identities before all we did was 491 00:16:37,639 --> 00:16:39,720 create a pipeline to a brand new 492 00:16:39,720 --> 00:16:41,680 repository inside of our 493 00:16:41,680 --> 00:16:43,560 organization now you might say Mike 494 00:16:43,560 --> 00:16:45,079 Engineers can't create repos and 495 00:16:45,079 --> 00:16:47,199 pipelines in my organization we're okay 496 00:16:47,199 --> 00:16:49,800 right uh nope turns out uh that you know 497 00:16:49,800 --> 00:16:51,399 there's still some more problems uh if 498 00:16:51,399 --> 00:16:52,880 that was the only thing that my talk was 499 00:16:52,880 --> 00:16:54,560 about I'd probably be giving off some 500 00:16:54,560 --> 00:16:56,399 Tuxedo Mask Vibes I don't know if 501 00:16:56,399 --> 00:16:58,240 there's any s Mo fans in here I can't 502 00:16:58,240 --> 00:16:59,560 remember one time that he's been helpful 503 00:16:59,560 --> 00:17:01,160 in that show it's been a couple years 504 00:17:01,160 --> 00:17:04,760 but anyway I digress okay uh so what 505 00:17:04,760 --> 00:17:06,640 else is is problematic the next couple 506 00:17:06,640 --> 00:17:08,199 of slides that I'm going to talk about 507 00:17:08,199 --> 00:17:09,679 is what we've been talk I've been sort 508 00:17:09,679 --> 00:17:12,160 of labeling this pre merge remote code 509 00:17:12,160 --> 00:17:14,240 execution so if we go back to the very 510 00:17:14,240 --> 00:17:15,640 first slide that I talked about where we 511 00:17:15,640 --> 00:17:17,199 had some security benefits of 512 00:17:17,199 --> 00:17:19,359 productionizing our cicd tools one of 513 00:17:19,359 --> 00:17:21,240 the benefits we got was removing all of 514 00:17:21,240 --> 00:17:22,959 these right based credentials from our 515 00:17:22,959 --> 00:17:24,839 engineering Workforce laptops because we 516 00:17:24,839 --> 00:17:26,559 could allow our Production Services to 517 00:17:26,559 --> 00:17:29,840 do this for us so what we at here is 518 00:17:29,840 --> 00:17:31,720 GitHub documentation for GitHub actions 519 00:17:31,720 --> 00:17:33,760 and it says warning any user that has 520 00:17:33,760 --> 00:17:35,640 right access which right access is the 521 00:17:35,640 --> 00:17:37,240 term for just being able to submit PRS 522 00:17:37,240 --> 00:17:39,200 to repositories anyone with right access 523 00:17:39,200 --> 00:17:41,760 to your repo actually has read access to 524 00:17:41,760 --> 00:17:43,440 all of the secrets configured in your 525 00:17:43,440 --> 00:17:45,720 repository therefore you should ensure 526 00:17:45,720 --> 00:17:47,280 that the grenal being used Within These 527 00:17:47,280 --> 00:17:49,240 workflows have the least privileges 528 00:17:49,240 --> 00:17:52,160 required so basically to my surprise and 529 00:17:52,160 --> 00:17:54,000 obviously to the shock of little Pikachu 530 00:17:54,000 --> 00:17:56,000 as well uh basically what GitHub is 531 00:17:56,000 --> 00:17:58,360 saying is that this is outside of their 532 00:17:58,360 --> 00:17:59,640 threat model model this you know we 533 00:17:59,640 --> 00:18:01,280 basically lose all of the protections 534 00:18:01,280 --> 00:18:03,400 that we assumed that we had by removing 535 00:18:03,400 --> 00:18:04,679 these credentials from our engineering 536 00:18:04,679 --> 00:18:06,960 endpoints and putting them into our cicd 537 00:18:06,960 --> 00:18:08,679 based tools 538 00:18:08,679 --> 00:18:11,760 instead and why is this let's get into 539 00:18:11,760 --> 00:18:13,559 sort of the specifics this is a meaty 540 00:18:13,559 --> 00:18:16,280 slide so all of the things that we just 541 00:18:16,280 --> 00:18:18,240 showed about Secrets injection for 542 00:18:18,240 --> 00:18:21,240 GitHub actions and for uh buildkite 543 00:18:21,240 --> 00:18:23,799 pipelines can exist for existing 544 00:18:23,799 --> 00:18:25,280 repositories so you don't need to create 545 00:18:25,280 --> 00:18:27,159 a brand new one and what that means is 546 00:18:27,159 --> 00:18:29,440 it opens up two new attack venues one is 547 00:18:29,440 --> 00:18:31,200 if you have a repository already created 548 00:18:31,200 --> 00:18:32,919 in your organization and you can push to 549 00:18:32,919 --> 00:18:34,720 it you can actually Leverage The 550 00:18:34,720 --> 00:18:36,760 pre-existing configurations that exist 551 00:18:36,760 --> 00:18:40,760 such as for um uh oidc based Federation 552 00:18:40,760 --> 00:18:43,360 from GitHub actions to AWS or to gcp or 553 00:18:43,360 --> 00:18:45,760 to Azure as well as terraform 554 00:18:45,760 --> 00:18:47,320 repositories that exist are managing 555 00:18:47,320 --> 00:18:49,679 your infrastructure and why does this 556 00:18:49,679 --> 00:18:51,080 work the reason that this works is 557 00:18:51,080 --> 00:18:53,039 because the configuration of your GitHub 558 00:18:53,039 --> 00:18:54,520 actions and your billai pipelines and 559 00:18:54,520 --> 00:18:56,640 probably other CI and CD tools they 560 00:18:56,640 --> 00:18:58,919 exist alongside the source code that 561 00:18:58,919 --> 00:19:00,080 you're managing in your repositories 562 00:19:00,080 --> 00:19:02,200 they're in source so when you submit a 563 00:19:02,200 --> 00:19:04,080 PR and you were to make malicious 564 00:19:04,080 --> 00:19:06,640 changes to those configuration files 565 00:19:06,640 --> 00:19:08,280 they're just honored in the context of 566 00:19:08,280 --> 00:19:10,840 the pr they'll just run uh so there's no 567 00:19:10,840 --> 00:19:13,120 check that they'll just look at the pr 568 00:19:13,120 --> 00:19:15,440 uh and say oh you've changed those files 569 00:19:15,440 --> 00:19:16,880 we're just going to run those files now 570 00:19:16,880 --> 00:19:18,039 with the integration that we already 571 00:19:18,039 --> 00:19:19,799 have set 572 00:19:19,799 --> 00:19:22,080 up so let's talk a little bit about 573 00:19:22,080 --> 00:19:24,000 these two new use cases uh the first one 574 00:19:24,000 --> 00:19:26,640 is GitHub based oidc Federation uh so 575 00:19:26,640 --> 00:19:28,080 the first step number one here is a 576 00:19:28,080 --> 00:19:29,720 configuration step you can do it in 577 00:19:29,720 --> 00:19:30,760 whatever way you want this is just 578 00:19:30,760 --> 00:19:32,520 showing it being configured through 579 00:19:32,520 --> 00:19:34,919 terraform so infrastructure is code and 580 00:19:34,919 --> 00:19:36,480 the way that this works is that your 581 00:19:36,480 --> 00:19:37,919 GitHub token that we talked about in 582 00:19:37,919 --> 00:19:41,480 GitHub actions uh that token uh is a JWT 583 00:19:41,480 --> 00:19:43,679 a jot and the way that we've configured 584 00:19:43,679 --> 00:19:45,960 this is that it allows it to do identity 585 00:19:45,960 --> 00:19:48,440 based translation to actually go through 586 00:19:48,440 --> 00:19:51,520 AWS STS to get shortlived credentials 587 00:19:51,520 --> 00:19:52,679 and those shortlived credentials are 588 00:19:52,679 --> 00:19:54,360 then provided back to get up actions to 589 00:19:54,360 --> 00:19:56,640 then use and the way that it works is 590 00:19:56,640 --> 00:19:58,440 through a trust policy and this is true 591 00:19:58,440 --> 00:20:00,760 for uh gcp and Azure as well I'm just 592 00:20:00,760 --> 00:20:03,280 using um AWS as an example but it's 593 00:20:03,280 --> 00:20:05,480 supported in all of the clouds here the 594 00:20:05,480 --> 00:20:07,720 way this work is the JWT that's um being 595 00:20:07,720 --> 00:20:11,520 sent to to AWS uh actually has inside of 596 00:20:11,520 --> 00:20:13,720 the subscriber claim all of the details 597 00:20:13,720 --> 00:20:15,799 of the repository the orc all these 598 00:20:15,799 --> 00:20:17,280 types of things so you define it there 599 00:20:17,280 --> 00:20:19,120 and then in the trust policy you say hey 600 00:20:19,120 --> 00:20:21,520 allow this repo to go and get access to 601 00:20:21,520 --> 00:20:23,960 a the you know credential for an AM role 602 00:20:23,960 --> 00:20:27,200 and effectively then it assumes it so we 603 00:20:27,200 --> 00:20:28,919 can uh see that the permissions that are 604 00:20:28,919 --> 00:20:31,200 needed in the GitHub actions uh is in 605 00:20:31,200 --> 00:20:33,400 step three as well and and here's an 606 00:20:33,400 --> 00:20:35,760 example of it so we're creating a GitHub 607 00:20:35,760 --> 00:20:38,400 actions workflow um we can see that it's 608 00:20:38,400 --> 00:20:40,120 trying to assume this GitHub actions 609 00:20:40,120 --> 00:20:41,799 role and then we're just performing a 610 00:20:41,799 --> 00:20:43,720 get caller identity and we can prove 611 00:20:43,720 --> 00:20:45,320 here on the right uh that we actually 612 00:20:45,320 --> 00:20:47,520 have become this GitHub actions user so 613 00:20:47,520 --> 00:20:49,360 this is just a quick little 614 00:20:49,360 --> 00:20:52,000 example okay next up our Second Use case 615 00:20:52,000 --> 00:20:54,280 our second new use case is terraform I'm 616 00:20:54,280 --> 00:20:56,960 calling this the uh apply on plan bypass 617 00:20:56,960 --> 00:20:59,240 so the way that this works 618 00:20:59,240 --> 00:21:01,039 uh we're going to have show a demo of 619 00:21:01,039 --> 00:21:02,559 this real quick on the next slide but 620 00:21:02,559 --> 00:21:03,679 this is sort of the fake demo 621 00:21:03,679 --> 00:21:04,880 architecture it's pretty similar to the 622 00:21:04,880 --> 00:21:06,240 reference architecture that we saw 623 00:21:06,240 --> 00:21:09,600 before so we have this uh fake crypto 624 00:21:09,600 --> 00:21:11,600 exchange co uh company and the way that 625 00:21:11,600 --> 00:21:13,240 it works is you know we'll submit a PR 626 00:21:13,240 --> 00:21:15,120 to the terraform repository they have 627 00:21:15,120 --> 00:21:17,240 two different work um spaces so there's 628 00:21:17,240 --> 00:21:18,919 a Works Space for Dev and a workpace for 629 00:21:18,919 --> 00:21:20,880 prod we're using terraform cloud in this 630 00:21:20,880 --> 00:21:23,080 demo example and they have compute for 631 00:21:23,080 --> 00:21:24,840 the terraform workers so a plan will 632 00:21:24,840 --> 00:21:26,760 kick off there some sort of review is 633 00:21:26,760 --> 00:21:28,600 expected to happen and then some sort of 634 00:21:28,600 --> 00:21:31,640 applying of AWS resources will occur now 635 00:21:31,640 --> 00:21:34,120 what the apply on plan bypass does is it 636 00:21:34,120 --> 00:21:35,799 actually sidesteps the whole review 637 00:21:35,799 --> 00:21:38,200 process so things will be able to we'll 638 00:21:38,200 --> 00:21:40,080 actually be able to perform and apply 639 00:21:40,080 --> 00:21:42,200 during the plan phase without any code 640 00:21:42,200 --> 00:21:44,880 review and without any merging possible 641 00:21:44,880 --> 00:21:46,120 so let's see that 642 00:21:46,120 --> 00:21:47,919 next we're going to go and try and 643 00:21:47,919 --> 00:21:51,039 create an S3 bucket here and so what we 644 00:21:51,039 --> 00:21:53,760 can see is uh the name of the bucket is 645 00:21:53,760 --> 00:21:55,440 going to be removed this test bucket so 646 00:21:55,440 --> 00:21:57,159 we can see that right here so if we go 647 00:21:57,159 --> 00:21:59,279 into our current AWS account 648 00:21:59,279 --> 00:22:00,919 and we refresh it we got to make sure 649 00:22:00,919 --> 00:22:02,679 that that bucket doesn't exist we can 650 00:22:02,679 --> 00:22:04,000 see that that bucket does not exist so 651 00:22:04,000 --> 00:22:05,279 we go and create a 652 00:22:05,279 --> 00:22:07,320 PR and this 653 00:22:07,320 --> 00:22:10,320 PR is going to kick off a web hook to 654 00:22:10,320 --> 00:22:12,279 perform a spective plan a plan and so 655 00:22:12,279 --> 00:22:13,720 here here's the plan right here it 656 00:22:13,720 --> 00:22:15,000 begins to run and we can see our 657 00:22:15,000 --> 00:22:16,960 malicious null resource that exists 658 00:22:16,960 --> 00:22:19,200 inside of it right and inside that null 659 00:22:19,200 --> 00:22:20,600 resource it's actually performing a 660 00:22:20,600 --> 00:22:24,200 terraform apply behind the scenes the 661 00:22:24,200 --> 00:22:25,279 apply 662 00:22:25,279 --> 00:22:27,120 completes and then we go back into our 663 00:22:27,120 --> 00:22:30,320 AWS account and and there's the S3 664 00:22:30,320 --> 00:22:35,240 bucket no code review no merging 665 00:22:35,240 --> 00:22:37,279 required and the reason for this right 666 00:22:37,279 --> 00:22:39,000 is that um you know chances are 667 00:22:39,000 --> 00:22:41,360 terraform needs to manage your Cloud 668 00:22:41,360 --> 00:22:42,960 environments right so it probably has 669 00:22:42,960 --> 00:22:45,799 admin uh and so what's happening is you 670 00:22:45,799 --> 00:22:47,960 actually escape from the context of the 671 00:22:47,960 --> 00:22:49,640 plan down onto the underlying file 672 00:22:49,640 --> 00:22:52,039 system and then use the same permissions 673 00:22:52,039 --> 00:22:53,760 that exist on that worker to instead 674 00:22:53,760 --> 00:22:55,880 perform and apply and you get to do it 675 00:22:55,880 --> 00:22:57,760 kind of for free in the plan phase so 676 00:22:57,760 --> 00:22:59,600 going back to our problem statement 677 00:22:59,600 --> 00:23:02,559 anyone who can push or create PRS to a 678 00:23:02,559 --> 00:23:04,640 repository chances are you so you need 679 00:23:04,640 --> 00:23:06,559 right based access in some way they can 680 00:23:06,559 --> 00:23:08,679 exfiltrate secrets from GitHub actions 681 00:23:08,679 --> 00:23:10,679 build kite pipelines and from terraform 682 00:23:10,679 --> 00:23:13,360 Plans by bypassing Access Control to 683 00:23:13,360 --> 00:23:15,039 apply arbitrary code from unmerged and 684 00:23:15,039 --> 00:23:17,840 non-code reviewed PRS and that in doing 685 00:23:17,840 --> 00:23:19,480 so perform secret sex filtration they 686 00:23:19,480 --> 00:23:21,919 can do prives and they can have lateral 687 00:23:21,919 --> 00:23:23,440 movement into other environments based 688 00:23:23,440 --> 00:23:25,120 off of the permissions of your CIB based 689 00:23:25,120 --> 00:23:26,240 infrastructure and your CD 690 00:23:26,240 --> 00:23:29,080 infrastructure 691 00:23:29,080 --> 00:23:31,120 okay let's talk about 692 00:23:31,120 --> 00:23:33,159 remediations hopefully we do a little 693 00:23:33,159 --> 00:23:37,600 bit better than our Ice Age friend 694 00:23:43,000 --> 00:23:46,000 here 695 00:23:47,039 --> 00:23:49,200 okay so there are a couple of 696 00:23:49,200 --> 00:23:51,159 suggestions that I have and to start 697 00:23:51,159 --> 00:23:53,200 it's really um starting with a basic one 698 00:23:53,200 --> 00:23:54,480 and we can see that there are CP the 699 00:23:54,480 --> 00:23:56,039 assumptions that we made a couple slides 700 00:23:56,039 --> 00:23:57,360 ago they kind of correlate to some of 701 00:23:57,360 --> 00:23:58,840 the mitigations and suggestions that we 702 00:23:58,840 --> 00:24:01,279 have here so this one is about config as 703 00:24:01,279 --> 00:24:03,600 code really whether you use IAS you know 704 00:24:03,600 --> 00:24:05,600 infrastructure as code itself or use a 705 00:24:05,600 --> 00:24:06,840 developer portal something like 706 00:24:06,840 --> 00:24:08,000 backstage if you have that in your 707 00:24:08,000 --> 00:24:10,240 environment whatever it is removing the 708 00:24:10,240 --> 00:24:12,120 manual creation step and having some 709 00:24:12,120 --> 00:24:14,400 sort of check is is good right like 710 00:24:14,400 --> 00:24:17,440 multi-prover is is important and doing 711 00:24:17,440 --> 00:24:18,840 it this way allows you to leverage 712 00:24:18,840 --> 00:24:21,520 modules secure by default patterns that 713 00:24:21,520 --> 00:24:23,279 allows us to keep a good developer 714 00:24:23,279 --> 00:24:26,520 experience so that's the first one um 715 00:24:26,520 --> 00:24:29,039 easy to say maybe somewhat harder to to 716 00:24:29,039 --> 00:24:30,480 implement you know cross functionally 717 00:24:30,480 --> 00:24:31,840 across an entire engineering World 718 00:24:31,840 --> 00:24:34,440 depending on your size the next thing is 719 00:24:34,440 --> 00:24:37,080 GitHub environments now the goal of 720 00:24:37,080 --> 00:24:38,919 GitHub environments and the goal that 721 00:24:38,919 --> 00:24:40,399 we're trying to provide the mitigation 722 00:24:40,399 --> 00:24:42,039 that we're trying to create is we want 723 00:24:42,039 --> 00:24:46,000 an affinity between the GitHub secrets 724 00:24:46,000 --> 00:24:47,679 that exist inside of your organ inside 725 00:24:47,679 --> 00:24:50,960 of your repository with the GitHub 726 00:24:50,960 --> 00:24:53,039 actions that is running and and 727 00:24:53,039 --> 00:24:54,480 specifically against the branch that 728 00:24:54,480 --> 00:24:56,360 you're running it against so you 729 00:24:56,360 --> 00:24:58,640 basically want for all of your sort of 730 00:24:58,640 --> 00:25:01,080 pre merge so all the pr based branches 731 00:25:01,080 --> 00:25:03,559 you want to be able to ensure that the 732 00:25:03,559 --> 00:25:05,559 permissions and the secrets that your GI 733 00:25:05,559 --> 00:25:07,399 of actions workflow is running with are 734 00:25:07,399 --> 00:25:09,120 less permissive right are kind of readon 735 00:25:09,120 --> 00:25:10,600 because this is what we expect sort of 736 00:25:10,600 --> 00:25:12,799 in our CI based environments and then 737 00:25:12,799 --> 00:25:14,640 after a code review after some sort of 738 00:25:14,640 --> 00:25:15,960 review which is something that we sort 739 00:25:15,960 --> 00:25:18,600 of Leverage very highly as a security 740 00:25:18,600 --> 00:25:21,240 control once that code merges and has 741 00:25:21,240 --> 00:25:23,520 been reviewed then in the protected 742 00:25:23,520 --> 00:25:25,480 branch in Maine you can have the more 743 00:25:25,480 --> 00:25:27,360 privileged credentials like right based 744 00:25:27,360 --> 00:25:28,720 credentials to go and put P which is 745 00:25:28,720 --> 00:25:31,120 your sort of continuous deployment based 746 00:25:31,120 --> 00:25:33,600 um setup so what GitHub environments 747 00:25:33,600 --> 00:25:35,440 does is exactly that you can create 748 00:25:35,440 --> 00:25:37,960 multiple environments and store Secrets 749 00:25:37,960 --> 00:25:39,640 inside of those environments so there's 750 00:25:39,640 --> 00:25:41,399 environment specific you have to declare 751 00:25:41,399 --> 00:25:42,880 them and call them inside of your GitHub 752 00:25:42,880 --> 00:25:44,960 actions configurations but furthermore 753 00:25:44,960 --> 00:25:47,320 you can create branch-based affinity and 754 00:25:47,320 --> 00:25:50,360 say hey only allow the main branch your 755 00:25:50,360 --> 00:25:52,080 protected Branch to get access to these 756 00:25:52,080 --> 00:25:54,559 secrets so anything that runs when 757 00:25:54,559 --> 00:25:56,720 something merges in main gets access to 758 00:25:56,720 --> 00:25:57,799 these secrets and you can't get it 759 00:25:57,799 --> 00:26:00,240 beforehand 760 00:26:00,360 --> 00:26:01,480 and we we're looking for something 761 00:26:01,480 --> 00:26:03,360 similar in build kite as well so for 762 00:26:03,360 --> 00:26:05,960 build kites the goal is to create an 763 00:26:05,960 --> 00:26:08,679 affinity between pipelines and the 764 00:26:08,679 --> 00:26:11,080 Agents that those pipelines can call so 765 00:26:11,080 --> 00:26:12,640 that when you create a configuration 766 00:26:12,640 --> 00:26:15,120 file for your pipeline and you randomly 767 00:26:15,120 --> 00:26:17,200 Define the agent like I did you can't 768 00:26:17,200 --> 00:26:19,399 just choose a random uh agent that 769 00:26:19,399 --> 00:26:21,520 exists for another repository you can 770 00:26:21,520 --> 00:26:23,039 actually use build kite clusters to 771 00:26:23,039 --> 00:26:25,600 prevent this now clusters bu clusters 772 00:26:25,600 --> 00:26:26,960 this functionality did not exist up 773 00:26:26,960 --> 00:26:28,720 until the beginning of this year they G8 774 00:26:28,720 --> 00:26:30,840 clusters in February and what it allows 775 00:26:30,840 --> 00:26:33,159 you to do you can kind of see in this uh 776 00:26:33,159 --> 00:26:34,960 diagram here is when you create a 777 00:26:34,960 --> 00:26:36,480 cluster you can put pipelines and you 778 00:26:36,480 --> 00:26:39,360 can put agents in it and if only agents 779 00:26:39,360 --> 00:26:41,440 only the agents that are in that cluster 780 00:26:41,440 --> 00:26:43,320 can be accessed by the pipelines that 781 00:26:43,320 --> 00:26:44,679 are in that cluster so that's what's 782 00:26:44,679 --> 00:26:46,480 creating that Affinity you can't extend 783 00:26:46,480 --> 00:26:48,200 to another cluster or outside of the 784 00:26:48,200 --> 00:26:49,760 cluster to try and leverage an agent 785 00:26:49,760 --> 00:26:51,640 that that exists 786 00:26:51,640 --> 00:26:53,559 there and we've talked about this 787 00:26:53,559 --> 00:26:54,919 already but the last thing that we want 788 00:26:54,919 --> 00:26:56,640 to do is create some sort of branching 789 00:26:56,640 --> 00:26:58,520 strategy so that we create sort of this 790 00:26:58,520 --> 00:27:00,880 Line in the Sand that says hey prior to 791 00:27:00,880 --> 00:27:03,399 merging prior to code review uh we 792 00:27:03,399 --> 00:27:04,760 should have a bunch of branches that can 793 00:27:04,760 --> 00:27:07,360 do some fairly safer things maybe it 794 00:27:07,360 --> 00:27:09,279 only uses readon based credentials and 795 00:27:09,279 --> 00:27:11,720 then we have after code review and after 796 00:27:11,720 --> 00:27:13,640 merge the more privileged identities 797 00:27:13,640 --> 00:27:15,159 that can actually perform maybe right 798 00:27:15,159 --> 00:27:17,000 based things that way you have 799 00:27:17,000 --> 00:27:18,559 environments for pre- merge you have 800 00:27:18,559 --> 00:27:20,000 environments for post merge you've got 801 00:27:20,000 --> 00:27:21,360 pipelines for pre- merge and you have 802 00:27:21,360 --> 00:27:22,919 pipelines for post merge and they're all 803 00:27:22,919 --> 00:27:25,120 associated with very specific branches 804 00:27:25,120 --> 00:27:27,159 that allow you to do very specific 805 00:27:27,159 --> 00:27:29,279 things and with that there's a sort of 806 00:27:29,279 --> 00:27:31,159 an updated um reference architecture 807 00:27:31,159 --> 00:27:32,760 here the big thing to note is kind of 808 00:27:32,760 --> 00:27:36,000 step for in our previous uh cluster uh 809 00:27:36,000 --> 00:27:37,480 Bill Kite reference architecture we were 810 00:27:37,480 --> 00:27:39,120 sort of cheating right we were able to 811 00:27:39,120 --> 00:27:41,399 cut the line and grab this privileged 812 00:27:41,399 --> 00:27:43,600 agent at step four when this sort of PR 813 00:27:43,600 --> 00:27:45,919 was supposed to run and instead we were 814 00:27:45,919 --> 00:27:47,200 doing right based actions that should 815 00:27:47,200 --> 00:27:48,799 have occurred at uh seven you know step 816 00:27:48,799 --> 00:27:50,480 seven here and we can't do that anymore 817 00:27:50,480 --> 00:27:52,159 with clusters because we don't want 818 00:27:52,159 --> 00:27:54,240 those privileged uh build gu pipelines 819 00:27:54,240 --> 00:27:55,399 to be able to get access to the the 820 00:27:55,399 --> 00:27:56,399 privileged 821 00:27:56,399 --> 00:27:58,919 agents okay same sort thing in GitHub 822 00:27:58,919 --> 00:28:00,760 environments we've already saw this um 823 00:28:00,760 --> 00:28:02,720 but we can see an example of it right 824 00:28:02,720 --> 00:28:04,320 here so how do we use GitHub 825 00:28:04,320 --> 00:28:06,799 environments take a look at our innocent 826 00:28:06,799 --> 00:28:08,240 looking file attack that we did 827 00:28:08,240 --> 00:28:09,320 previously we're going to try and 828 00:28:09,320 --> 00:28:11,120 perform it again a second time but now 829 00:28:11,120 --> 00:28:12,480 we're doing it with GitHub environments 830 00:28:12,480 --> 00:28:14,679 in place and the way that this works is 831 00:28:14,679 --> 00:28:16,200 you have to define the environment in 832 00:28:16,200 --> 00:28:17,519 your configuration now so you can see 833 00:28:17,519 --> 00:28:19,360 that in red the second job is trying to 834 00:28:19,360 --> 00:28:21,559 exfiltrate these secrets inside of the 835 00:28:21,559 --> 00:28:23,720 post-merge environment and you can see 836 00:28:23,720 --> 00:28:25,760 in the top right uh shout out to whoever 837 00:28:25,760 --> 00:28:28,120 did the uh ux and design for get up en 838 00:28:28,120 --> 00:28:29,240 ironment I love those little like 839 00:28:29,240 --> 00:28:31,240 rockets uh they look pretty Sleek you 840 00:28:31,240 --> 00:28:32,559 got kind of the green rocket that says 841 00:28:32,559 --> 00:28:33,880 hey that was successful and then this 842 00:28:33,880 --> 00:28:35,799 red one that's like didn't work but the 843 00:28:35,799 --> 00:28:38,000 reason why it didn't work is we can see 844 00:28:38,000 --> 00:28:39,640 down here in the annotations that says 845 00:28:39,640 --> 00:28:42,480 hey this Branch pre merge test which is 846 00:28:42,480 --> 00:28:45,000 a PR based branch that I created is not 847 00:28:45,000 --> 00:28:47,720 allowed to get access to post-merge 848 00:28:47,720 --> 00:28:49,600 environments you can only get access to 849 00:28:49,600 --> 00:28:51,279 it from the main branch so we've 850 00:28:51,279 --> 00:28:52,919 actually prevented the secret Tech 851 00:28:52,919 --> 00:28:54,240 filtration from occurring because the 852 00:28:54,240 --> 00:28:56,120 job never ran that had the secret Tech 853 00:28:56,120 --> 00:29:00,039 filtration memory Dum in it 854 00:29:01,159 --> 00:29:03,279 the same sort of uh implementation with 855 00:29:03,279 --> 00:29:04,480 good home environments works with our 856 00:29:04,480 --> 00:29:07,279 Federated identity use case too and the 857 00:29:07,279 --> 00:29:08,799 way that this works is actually by 858 00:29:08,799 --> 00:29:10,360 defining the environment inside of the 859 00:29:10,360 --> 00:29:11,960 subscriber claim and inside of the trust 860 00:29:11,960 --> 00:29:14,240 policies for your clouds so you actually 861 00:29:14,240 --> 00:29:16,519 add just another string to the end on 862 00:29:16,519 --> 00:29:18,840 the far right side that says hey this 863 00:29:18,840 --> 00:29:21,840 repo from my organization also has this 864 00:29:21,840 --> 00:29:24,600 environment so only allow my pre-merge 865 00:29:24,600 --> 00:29:26,120 environments to get access to my read 866 00:29:26,120 --> 00:29:28,360 only based I IM roles for example and 867 00:29:28,360 --> 00:29:30,120 then also only allow my post marage 868 00:29:30,120 --> 00:29:31,519 environments to get access to my more 869 00:29:31,519 --> 00:29:34,600 privileged admin based roles 870 00:29:34,600 --> 00:29:36,679 for c 871 00:29:36,679 --> 00:29:39,080 triform um we're going to talk about run 872 00:29:39,080 --> 00:29:40,799 tasks is basically the answer here run 873 00:29:40,799 --> 00:29:42,120 tasks used to be called Sentinel 874 00:29:42,120 --> 00:29:43,320 policies for anyone who might be 875 00:29:43,320 --> 00:29:44,799 familiar with that uh we'll talk about 876 00:29:44,799 --> 00:29:46,240 that in a couple slides if you're using 877 00:29:46,240 --> 00:29:47,679 the open source version of Atlantis 878 00:29:47,679 --> 00:29:49,760 though the real answer to how to prevent 879 00:29:49,760 --> 00:29:51,720 these sort of unsafe built-in functions 880 00:29:51,720 --> 00:29:54,480 like n resource or run command if you're 881 00:29:54,480 --> 00:29:56,840 using terragrunt or something like this 882 00:29:56,840 --> 00:29:58,519 is to really since you can control the 883 00:29:58,519 --> 00:30:00,799 whole pipeline of how Atlantis runs you 884 00:30:00,799 --> 00:30:03,320 want to serialize your uh web hooks so 885 00:30:03,320 --> 00:30:05,200 that you can inject some sort of code 886 00:30:05,200 --> 00:30:06,720 check whether it's static code analysis 887 00:30:06,720 --> 00:30:08,679 or some sort of custom code to check for 888 00:30:08,679 --> 00:30:10,840 these dangerous uh resources that are 889 00:30:10,840 --> 00:30:13,000 actually being implemented so that when 890 00:30:13,000 --> 00:30:15,559 you see a no resource come in prior to a 891 00:30:15,559 --> 00:30:17,200 plan running you can say no that looks 892 00:30:17,200 --> 00:30:18,880 unsafe I'm not going to allow this to 893 00:30:18,880 --> 00:30:21,000 run so then the admin can come in take a 894 00:30:21,000 --> 00:30:23,039 look review it see if it actually is 895 00:30:23,039 --> 00:30:24,760 legitimate or if it's perhaps malicious 896 00:30:24,760 --> 00:30:28,600 and then make a decision based on that 897 00:30:28,600 --> 00:30:30,919 okay uh elephant in the room though we 898 00:30:30,919 --> 00:30:33,039 provided a handful of mitigations but we 899 00:30:33,039 --> 00:30:35,679 didn't actually solve the problem did we 900 00:30:35,679 --> 00:30:38,240 because the pre merge rce still works 901 00:30:38,240 --> 00:30:39,600 now it may only be for R onlyy 902 00:30:39,600 --> 00:30:41,399 credentials based off our mitigations 903 00:30:41,399 --> 00:30:44,039 but it still 904 00:30:44,039 --> 00:30:46,760 works uh so what could remediation look 905 00:30:46,760 --> 00:30:48,799 like like if we could Thanos snap our 906 00:30:48,799 --> 00:30:50,480 solution into existence or perhaps more 907 00:30:50,480 --> 00:30:51,840 realistically if we were like in the 908 00:30:51,840 --> 00:30:53,320 shoes of the engineers building these 909 00:30:53,320 --> 00:30:55,279 tools you know what would we want to to 910 00:30:55,279 --> 00:30:57,519 build and put in place and I have some 911 00:30:57,519 --> 00:31:00,960 opinions on this uh these mostly it 912 00:31:00,960 --> 00:31:02,519 belongs to GitHub I think GitHub is 913 00:31:02,519 --> 00:31:04,120 really responsible for providing us with 914 00:31:04,120 --> 00:31:06,480 some of these these answers and you know 915 00:31:06,480 --> 00:31:08,320 how great would it be if we had granular 916 00:31:08,320 --> 00:31:10,960 access control on the subdirectory level 917 00:31:10,960 --> 00:31:12,720 right now when we manage access for 918 00:31:12,720 --> 00:31:14,159 collaborators it's just on the 919 00:31:14,159 --> 00:31:15,760 repository you get read access you get 920 00:31:15,760 --> 00:31:17,200 write access but how cool would it be if 921 00:31:17,200 --> 00:31:19,919 you could say hey this specific team is 922 00:31:19,919 --> 00:31:22,760 allowed to submit PRS and push code that 923 00:31:22,760 --> 00:31:24,720 makes changes to this specific reserved 924 00:31:24,720 --> 00:31:26,760 file path so only maybe repo admins can 925 00:31:26,760 --> 00:31:28,519 go and make changes to do get GitHub 926 00:31:28,519 --> 00:31:30,960 workflows and build kite pipelines and 927 00:31:30,960 --> 00:31:32,919 even better if someone tries to make a 928 00:31:32,919 --> 00:31:34,720 change who's not part of that group 929 00:31:34,720 --> 00:31:37,039 prevent it prior to a push prior to an 930 00:31:37,039 --> 00:31:39,080 Ever hitting remote the remote origin 931 00:31:39,080 --> 00:31:40,279 because we don't actually have that 932 00:31:40,279 --> 00:31:42,799 event support GitHub supports it their 933 00:31:42,799 --> 00:31:44,440 GitHub Advanced security and their 934 00:31:44,440 --> 00:31:46,960 secret solution actually uses pre push 935 00:31:46,960 --> 00:31:48,799 to try and prevent secrets from Landing 936 00:31:48,799 --> 00:31:50,720 in code but they don't give that to us 937 00:31:50,720 --> 00:31:53,000 for free or even if we paid for it 938 00:31:53,000 --> 00:31:55,720 unless uh to to do it ourselves so how 939 00:31:55,720 --> 00:31:57,360 cool would we have pre push as an event 940 00:31:57,360 --> 00:31:59,320 trigger that would awesome and the last 941 00:31:59,320 --> 00:32:01,200 thing is about scoping GitHub secrets so 942 00:32:01,200 --> 00:32:04,840 one of the issues that we have is um if 943 00:32:04,840 --> 00:32:06,360 we wanted to move to GitHub environments 944 00:32:06,360 --> 00:32:08,440 for example from an existing repository 945 00:32:08,440 --> 00:32:09,720 that had a bunch of Secrets we'd 946 00:32:09,720 --> 00:32:11,600 effectively have to rotate all of the 947 00:32:11,600 --> 00:32:13,880 secrets into GitHub environments not a 948 00:32:13,880 --> 00:32:16,159 good uh user experience there how many 949 00:32:16,159 --> 00:32:17,679 secrets you have you have to rotate all 950 00:32:17,679 --> 00:32:18,880 of them who knows where else they're 951 00:32:18,880 --> 00:32:21,559 being used things could break not great 952 00:32:21,559 --> 00:32:23,159 how how much easier would it be if you 953 00:32:23,159 --> 00:32:25,000 could just point you know create some 954 00:32:25,000 --> 00:32:26,720 sort of access rule that says say this 955 00:32:26,720 --> 00:32:28,960 environment can use these Secrets just 956 00:32:28,960 --> 00:32:31,159 to find them in one place cuz this is 957 00:32:31,159 --> 00:32:32,960 possible for get up workc secrets you 958 00:32:32,960 --> 00:32:34,519 know I talked about earlier where by 959 00:32:34,519 --> 00:32:36,720 default any new repository and any new 960 00:32:36,720 --> 00:32:38,519 GitHub action gets access to all the org 961 00:32:38,519 --> 00:32:40,799 secrets you can actually Custom Tailor 962 00:32:40,799 --> 00:32:42,880 those to say hey only these repositories 963 00:32:42,880 --> 00:32:44,120 get access how great would it be if we 964 00:32:44,120 --> 00:32:46,840 could do that for GitHub environments as 965 00:32:46,840 --> 00:32:49,480 well okay uh and for terraform the 966 00:32:49,480 --> 00:32:50,840 Enterprise version let's talk a little 967 00:32:50,840 --> 00:32:52,880 bit about run tasks I talked just for a 968 00:32:52,880 --> 00:32:54,279 brief moment about what they were 969 00:32:54,279 --> 00:32:56,080 Sentinel policies this a custom language 970 00:32:56,080 --> 00:32:57,960 that you can Define in sort of the inter 971 00:32:57,960 --> 00:33:01,240 mediary steps between when jobs run 972 00:33:01,240 --> 00:33:03,039 during plan phases and during apply 973 00:33:03,039 --> 00:33:06,120 based phases my knowledge uh to my 974 00:33:06,120 --> 00:33:08,320 knowledge everything that so there are 975 00:33:08,320 --> 00:33:09,760 some thirdparty marketplaces where you 976 00:33:09,760 --> 00:33:11,519 can actually download these run tasks 977 00:33:11,519 --> 00:33:12,880 from you know security companies and 978 00:33:12,880 --> 00:33:14,480 things like this but to my knowledge and 979 00:33:14,480 --> 00:33:16,240 based on everything I looked at all of 980 00:33:16,240 --> 00:33:17,840 the solutions that are supported are 981 00:33:17,840 --> 00:33:20,240 during the pre-apply phase which you'll 982 00:33:20,240 --> 00:33:22,159 note all of our attacks happened 983 00:33:22,159 --> 00:33:24,039 pre-plan like during the plan phase so 984 00:33:24,039 --> 00:33:26,200 we need some sort of gate like um 985 00:33:26,200 --> 00:33:28,440 mitigations to occur during that 986 00:33:28,440 --> 00:33:31,639 pre-plan phase I have not seen anything 987 00:33:31,639 --> 00:33:33,279 uh that exists now a lot of the 988 00:33:33,279 --> 00:33:34,200 documentation a lot of the 989 00:33:34,200 --> 00:33:35,919 implementations are behind pay walls so 990 00:33:35,919 --> 00:33:37,360 I wasn't able to test everything so if 991 00:33:37,360 --> 00:33:39,519 someone knows actually about uh run 992 00:33:39,519 --> 00:33:42,240 tasks that run prior to plans that stop 993 00:33:42,240 --> 00:33:43,519 these types of things I'd love to hear 994 00:33:43,519 --> 00:33:44,840 about it I'd love to be able to talk 995 00:33:44,840 --> 00:33:46,639 about 996 00:33:46,639 --> 00:33:50,120 that and the last thing I have uh how we 997 00:33:50,120 --> 00:33:52,399 doing on time uh we're just about at it 998 00:33:52,399 --> 00:33:54,440 okay got to go quick all right um so the 999 00:33:54,440 --> 00:33:55,799 last thing I want to talk about is brand 1000 00:33:55,799 --> 00:33:58,039 new uh and this would came out just a 1001 00:33:58,039 --> 00:34:00,399 couple months ago uh beginning of May 1002 00:34:00,399 --> 00:34:02,240 really and it's called GitHub push rule 1003 00:34:02,240 --> 00:34:03,720 set so this is something that's in beta 1004 00:34:03,720 --> 00:34:05,440 by GitHub right now so if we go back a 1005 00:34:05,440 --> 00:34:07,480 couple slides to right here where I 1006 00:34:07,480 --> 00:34:09,119 talked about granular access control and 1007 00:34:09,119 --> 00:34:10,879 event trigger support how great would it 1008 00:34:10,879 --> 00:34:12,960 be to have that well we actually just 1009 00:34:12,960 --> 00:34:15,800 got a feature that kind of does this uh 1010 00:34:15,800 --> 00:34:19,280 for in very specific way so we can see 1011 00:34:19,280 --> 00:34:21,320 in the bottom right the restricted file 1012 00:34:21,320 --> 00:34:23,159 paths that it's defined it allow a push 1013 00:34:23,159 --> 00:34:25,599 rule set actually allows us to set a 1014 00:34:25,599 --> 00:34:27,359 specific file path and say hey these 1015 00:34:27,359 --> 00:34:30,280 specific individuals are allowed to uh 1016 00:34:30,280 --> 00:34:32,399 push to this file path if it makes 1017 00:34:32,399 --> 00:34:34,560 changes anyone else will actually 1018 00:34:34,560 --> 00:34:36,000 prevent it so it's kind of exactly that 1019 00:34:36,000 --> 00:34:38,040 we talked about now because it's still 1020 00:34:38,040 --> 00:34:40,280 in beta and it's brand new uh it might 1021 00:34:40,280 --> 00:34:42,399 be uh apt to break things so if you 1022 00:34:42,399 --> 00:34:43,599 don't want to turn it on in your prod 1023 00:34:43,599 --> 00:34:45,440 environment right away I don't blame you 1024 00:34:45,440 --> 00:34:46,839 but what you can do is you can set it to 1025 00:34:46,839 --> 00:34:49,199 evaluate mode and evaluate mode then 1026 00:34:49,199 --> 00:34:50,960 lets you see what would break in 1027 00:34:50,960 --> 00:34:52,359 insights and then you can go back over 1028 00:34:52,359 --> 00:34:54,639 the next 30 60 90 days and create those 1029 00:34:54,639 --> 00:34:56,719 granular one to one rules that say Hey 1030 00:34:56,719 --> 00:34:58,280 this specific GitHub team and these set 1031 00:34:58,280 --> 00:35:00,000 of collaborators can manage this 1032 00:35:00,000 --> 00:35:02,359 specific you know workflow file because 1033 00:35:02,359 --> 00:35:04,119 they own that one and they this other 1034 00:35:04,119 --> 00:35:05,680 team can manage the specific pipeline in 1035 00:35:05,680 --> 00:35:07,040 the repository and that gets us that 1036 00:35:07,040 --> 00:35:08,320 granular access control that we're 1037 00:35:08,320 --> 00:35:12,280 looking for so last slide main takeaways 1038 00:35:12,280 --> 00:35:13,480 first and foremost these findings 1039 00:35:13,480 --> 00:35:15,240 they're all still exploitable today so 1040 00:35:15,240 --> 00:35:16,960 make sure to uh Implement any of these 1041 00:35:16,960 --> 00:35:18,960 access controls and mitigations uh and 1042 00:35:18,960 --> 00:35:20,960 read the documentation for these tools 1043 00:35:20,960 --> 00:35:22,920 because I'm not the first person to um 1044 00:35:22,920 --> 00:35:24,760 have found any of these findings but I 1045 00:35:24,760 --> 00:35:26,720 don't hear anyone talking about how 1046 00:35:26,720 --> 00:35:29,079 systemic it is how it applies to 1047 00:35:29,079 --> 00:35:31,079 basically all of our cicd tools now I 1048 00:35:31,079 --> 00:35:32,440 only looked at a couple but I'm pretty 1049 00:35:32,440 --> 00:35:33,640 confident that if we start looking at 1050 00:35:33,640 --> 00:35:35,560 other tools this pattern is going to 1051 00:35:35,560 --> 00:35:37,560 emerge because so many of these tools 1052 00:35:37,560 --> 00:35:39,480 manage their configuration files in line 1053 00:35:39,480 --> 00:35:41,359 inside of these repositories right so 1054 00:35:41,359 --> 00:35:43,400 it's really up to us as practitioners to 1055 00:35:43,400 --> 00:35:45,359 solve this problem and provide a paved 1056 00:35:45,359 --> 00:35:47,320 path forward um you know because the 1057 00:35:47,320 --> 00:35:49,000 tooling vendors don't necessarily have 1058 00:35:49,000 --> 00:35:50,599 all the answers yet so it's up to us as 1059 00:35:50,599 --> 00:35:52,560 in an industry to provide these answers 1060 00:35:52,560 --> 00:35:56,040 for them and uh that's it thank you guys 1061 00:35:56,040 --> 00:35:59,640 all for coming to my talk 1062 00:35:59,760 --> 00:36:02,040 I can uh take questions uh out out back 1063 00:36:02,040 --> 00:36:03,720 for anyone who was interested kind of in 1064 00:36:03,720 --> 00:36:06,799 the hallway or whatever