1 00:00:06,480 --> 00:00:09,760 hello everyone and welcome to hunting 2 00:00:09,760 --> 00:00:12,080 malicious office macros with myself uh 3 00:00:12,080 --> 00:00:13,440 anton abuski 4 00:00:13,440 --> 00:00:15,120 thank you very much for being here and 5 00:00:15,120 --> 00:00:16,800 for uh for tuning in 6 00:00:16,800 --> 00:00:19,119 um just before i get into kind of the 7 00:00:19,119 --> 00:00:20,960 materials of the talk and everything i 8 00:00:20,960 --> 00:00:22,880 just want to call out the all the 9 00:00:22,880 --> 00:00:25,039 materials all the slides all the data 10 00:00:25,039 --> 00:00:26,880 sets the system configs and everything 11 00:00:26,880 --> 00:00:28,000 like that 12 00:00:28,000 --> 00:00:30,480 will be available on this github link 13 00:00:30,480 --> 00:00:31,840 that's on the slide 14 00:00:31,840 --> 00:00:32,960 right now 15 00:00:32,960 --> 00:00:35,680 uh some quick intro about me um i'm 16 00:00:35,680 --> 00:00:37,760 currently with the sumo logic threat 17 00:00:37,760 --> 00:00:40,000 research team uh previously i was at 18 00:00:40,000 --> 00:00:42,399 lores consulting i love purple teaming 19 00:00:42,399 --> 00:00:44,960 hunting logs queries 20 00:00:44,960 --> 00:00:47,840 general data nerd anything like that 21 00:00:47,840 --> 00:00:50,719 on twitter i'm at anton loves dnb so 22 00:00:50,719 --> 00:00:53,280 just feel free to hit me up anytime 23 00:00:53,280 --> 00:00:55,199 i love talking shop happy to talk to 24 00:00:55,199 --> 00:00:57,680 folks and everything like that 25 00:00:57,680 --> 00:00:59,600 so getting into 26 00:00:59,600 --> 00:01:01,520 the actual agenda of what we're actually 27 00:01:01,520 --> 00:01:03,199 going to be covering today 28 00:01:03,199 --> 00:01:05,600 um i wanted to briefly go over 29 00:01:05,600 --> 00:01:08,640 why a focus on malicious macros is worth 30 00:01:08,640 --> 00:01:09,760 your time 31 00:01:09,760 --> 00:01:11,760 why it's something that is worth paying 32 00:01:11,760 --> 00:01:13,119 attention to 33 00:01:13,119 --> 00:01:15,920 worth putting engineering hours into 34 00:01:15,920 --> 00:01:19,920 um i also also want to cover baselining 35 00:01:19,920 --> 00:01:22,080 there's a lot of talk about baselining 36 00:01:22,080 --> 00:01:24,240 activity on the network but not a lot of 37 00:01:24,240 --> 00:01:26,000 guidance out there on how to actually do 38 00:01:26,000 --> 00:01:26,880 it 39 00:01:26,880 --> 00:01:29,680 and what the benefits of doing it are 40 00:01:29,680 --> 00:01:32,640 and the final and kind of longest 41 00:01:32,640 --> 00:01:34,720 section of the talk will go over some 42 00:01:34,720 --> 00:01:37,520 hunting ideas with particular attention 43 00:01:37,520 --> 00:01:41,119 being paid to alerting and detection 44 00:01:41,119 --> 00:01:43,119 strategies 45 00:01:43,119 --> 00:01:45,520 so why macros uh why are we looking at 46 00:01:45,520 --> 00:01:47,200 macros so heavily you know what's the 47 00:01:47,200 --> 00:01:48,799 big deal about this 48 00:01:48,799 --> 00:01:51,040 um if we do some number crunching with 49 00:01:51,040 --> 00:01:52,720 mitre attack data 50 00:01:52,720 --> 00:01:55,759 we can see that about half of the 51 00:01:55,759 --> 00:01:58,159 tracked threat actor groups out there uh 52 00:01:58,159 --> 00:02:00,079 utilize the t 53 00:02:00,079 --> 00:02:02,880 1024 002 technique uh which is a 54 00:02:02,880 --> 00:02:04,399 malicious file 55 00:02:04,399 --> 00:02:06,240 and if we dug deeper into this i 56 00:02:06,240 --> 00:02:08,399 wouldn't be surprised if even more uh 57 00:02:08,399 --> 00:02:10,720 tracked threat actor groups utilized 58 00:02:10,720 --> 00:02:12,800 these malicious macros in one way or 59 00:02:12,800 --> 00:02:14,080 another 60 00:02:14,080 --> 00:02:15,520 another thing that you can do if you 61 00:02:15,520 --> 00:02:18,160 want to get a feel for just how often 62 00:02:18,160 --> 00:02:20,560 these malicious macros are utilized is 63 00:02:20,560 --> 00:02:23,040 to search for the word macros on the 64 00:02:23,040 --> 00:02:25,760 dfir report site um which if you haven't 65 00:02:25,760 --> 00:02:28,160 checked out i highly recommend you do so 66 00:02:28,160 --> 00:02:29,920 um and you'll see that a lot of 67 00:02:29,920 --> 00:02:32,560 intrusion write-ups uh begin with a 68 00:02:32,560 --> 00:02:34,959 malicious macro being utilized in one 69 00:02:34,959 --> 00:02:36,560 way or another 70 00:02:36,560 --> 00:02:37,440 so 71 00:02:37,440 --> 00:02:39,920 given their prevalence in the threat 72 00:02:39,920 --> 00:02:41,519 actor space 73 00:02:41,519 --> 00:02:43,760 combined with the fact that a lot of 74 00:02:43,760 --> 00:02:44,800 users 75 00:02:44,800 --> 00:02:48,400 live in and use macros every day 76 00:02:48,400 --> 00:02:50,800 combined yet again with the fact that 77 00:02:50,800 --> 00:02:53,840 these um settings are not hardened by 78 00:02:53,840 --> 00:02:56,160 default on end user machines 79 00:02:56,160 --> 00:02:58,879 this all creates a dynamic where 80 00:02:58,879 --> 00:03:01,519 macros used maliciously 81 00:03:01,519 --> 00:03:03,680 begin to pose a lot of risk to your 82 00:03:03,680 --> 00:03:05,519 organization or to your clients or what 83 00:03:05,519 --> 00:03:06,400 have you 84 00:03:06,400 --> 00:03:08,800 um and of course i i do need to mention 85 00:03:08,800 --> 00:03:10,959 that at least at the time that i'm 86 00:03:10,959 --> 00:03:12,400 recording this and making these slides 87 00:03:12,400 --> 00:03:14,640 uh microsoft is currently uh 88 00:03:14,640 --> 00:03:16,480 backpedaling on some of the planned 89 00:03:16,480 --> 00:03:17,840 macro hardening changes which is 90 00:03:17,840 --> 00:03:20,720 obviously unfortunate 91 00:03:20,800 --> 00:03:22,720 so at this point you know we've been 92 00:03:22,720 --> 00:03:24,959 kind of scared enough and have decided 93 00:03:24,959 --> 00:03:27,519 to to do something about this problem so 94 00:03:27,519 --> 00:03:28,799 where do we start 95 00:03:28,799 --> 00:03:31,760 and the graph on this slide 96 00:03:31,760 --> 00:03:33,920 this slide represents what i think at 97 00:03:33,920 --> 00:03:37,360 least is a decent starting point for 98 00:03:37,360 --> 00:03:40,400 beginning to wrangle macro visibility 99 00:03:40,400 --> 00:03:43,200 and it should be noted that 100 00:03:43,200 --> 00:03:46,239 visibility into macro executions and 101 00:03:46,239 --> 00:03:49,280 system hardening done in order to 102 00:03:49,280 --> 00:03:51,440 limit unauthorized macros are kind of 103 00:03:51,440 --> 00:03:53,599 synonymous and what i mean by that is 104 00:03:53,599 --> 00:03:56,000 that you can't really disable macros for 105 00:03:56,000 --> 00:03:57,040 users 106 00:03:57,040 --> 00:04:00,080 unless you understand how and where 107 00:04:00,080 --> 00:04:01,680 they're being used 108 00:04:01,680 --> 00:04:04,319 so the next step after getting some 109 00:04:04,319 --> 00:04:06,560 visibility into macro executions 110 00:04:06,560 --> 00:04:09,360 and by visibility what i mean here is 111 00:04:09,360 --> 00:04:11,760 that this is endpoint level telemetry so 112 00:04:11,760 --> 00:04:15,360 this is process events file network dll 113 00:04:15,360 --> 00:04:18,478 registry events of that nature 114 00:04:18,478 --> 00:04:20,399 and we want to use those events to 115 00:04:20,399 --> 00:04:22,800 baseline macro behavior to understand 116 00:04:22,800 --> 00:04:24,560 more holistically how 117 00:04:24,560 --> 00:04:27,120 macros are behaving in the environment 118 00:04:27,120 --> 00:04:29,199 and and that's what i mean by baselining 119 00:04:29,199 --> 00:04:31,680 it means things like process trees uh 120 00:04:31,680 --> 00:04:34,000 known good locations uh where macros are 121 00:04:34,000 --> 00:04:36,720 executing from what they're doing 122 00:04:36,720 --> 00:04:38,800 so after you've gained uh some 123 00:04:38,800 --> 00:04:41,360 visibility and have started to baseline 124 00:04:41,360 --> 00:04:43,919 the behavior in your environment 125 00:04:43,919 --> 00:04:45,919 you can then start to hunt for or alert 126 00:04:45,919 --> 00:04:48,400 on a suspicious activity 127 00:04:48,400 --> 00:04:50,320 and this could mean dropping of a 128 00:04:50,320 --> 00:04:52,000 suspicious file 129 00:04:52,000 --> 00:04:55,680 editing suspicious register keys 130 00:04:55,680 --> 00:04:58,400 office binaries connecting to odd urls 131 00:04:58,400 --> 00:05:01,759 or abnormal process trees 132 00:05:01,759 --> 00:05:03,919 so rather than just say you know go 133 00:05:03,919 --> 00:05:05,199 baseline 134 00:05:05,199 --> 00:05:07,600 as part of this talk uh three different 135 00:05:07,600 --> 00:05:10,240 system configs will be made available in 136 00:05:10,240 --> 00:05:12,240 the github repo that was linked earlier 137 00:05:12,240 --> 00:05:13,680 in the presentation 138 00:05:13,680 --> 00:05:16,240 um and here office watch 139 00:05:16,240 --> 00:05:18,560 kind of shows you everything that sasmon 140 00:05:18,560 --> 00:05:20,800 is able to capture 141 00:05:20,800 --> 00:05:23,440 about office products 142 00:05:23,440 --> 00:05:24,800 dot xml 143 00:05:24,800 --> 00:05:27,039 then filters those events out 144 00:05:27,039 --> 00:05:28,320 so that you can use them to compare and 145 00:05:28,320 --> 00:05:31,080 contrast activity and then office 146 00:05:31,080 --> 00:05:34,479 sus.xml is an include only suspond 147 00:05:34,479 --> 00:05:36,960 config that includes a kind of 148 00:05:36,960 --> 00:05:39,360 suspicious or suspicious adjacent 149 00:05:39,360 --> 00:05:41,680 activity within its configuration file 150 00:05:41,680 --> 00:05:44,400 and the idea here is that you can use 151 00:05:44,400 --> 00:05:46,000 these three configurations on a test 152 00:05:46,000 --> 00:05:50,000 machine with macros that are benign 153 00:05:50,000 --> 00:05:52,800 but behave suspiciously um so things 154 00:05:52,800 --> 00:05:54,960 like macros that call out to your own 155 00:05:54,960 --> 00:05:57,840 you know kind of like testing uh c2 or 156 00:05:57,840 --> 00:05:59,520 something like the red canary uh atomic 157 00:05:59,520 --> 00:06:02,080 writing framework are really good uh use 158 00:06:02,080 --> 00:06:03,840 cases for this kind of thing 159 00:06:03,840 --> 00:06:05,520 and the idea is that you flip back and 160 00:06:05,520 --> 00:06:07,039 forth between the different 161 00:06:07,039 --> 00:06:10,160 configurations until you lock in 162 00:06:10,160 --> 00:06:12,800 what you think is abnormal behavior and 163 00:06:12,800 --> 00:06:14,560 then you would add these entries to your 164 00:06:14,560 --> 00:06:17,520 main system config file or look for that 165 00:06:17,520 --> 00:06:21,680 telemetry in your existing tool set 166 00:06:21,680 --> 00:06:24,240 so at this point we have some visibility 167 00:06:24,240 --> 00:06:26,319 into macros and let's take a look at 168 00:06:26,319 --> 00:06:29,120 some really basic log examples from 169 00:06:29,120 --> 00:06:30,880 macro executions 170 00:06:30,880 --> 00:06:33,280 and this slide is showing 171 00:06:33,280 --> 00:06:35,360 some sysmont events that will tell you 172 00:06:35,360 --> 00:06:37,280 that a macro executed 173 00:06:37,280 --> 00:06:39,280 including some suspicious function calls 174 00:06:39,280 --> 00:06:40,560 in the top right 175 00:06:40,560 --> 00:06:42,800 and these log examples are great and the 176 00:06:42,800 --> 00:06:45,199 events like look cool 177 00:06:45,199 --> 00:06:46,720 we see an interesting call trace here 178 00:06:46,720 --> 00:06:48,639 with some suspicious memory access 179 00:06:48,639 --> 00:06:50,479 function calls are interesting 180 00:06:50,479 --> 00:06:52,319 and then the top right we see some 181 00:06:52,319 --> 00:06:53,840 registry keys being edited and in the 182 00:06:53,840 --> 00:06:56,160 bottom we see some suspicious dlls being 183 00:06:56,160 --> 00:06:58,319 loaded 184 00:06:58,319 --> 00:06:59,599 so we have good data and we have good 185 00:06:59,599 --> 00:07:01,039 telemetry at this point 186 00:07:01,039 --> 00:07:03,440 so at this point we need to turn this 187 00:07:03,440 --> 00:07:06,160 data into something actionable 188 00:07:06,160 --> 00:07:09,199 something that will give analysts or 189 00:07:09,199 --> 00:07:11,280 whoever is looking at this information 190 00:07:11,280 --> 00:07:13,039 good context 191 00:07:13,039 --> 00:07:15,599 and insight into what happened on the 192 00:07:15,599 --> 00:07:16,880 systems where 193 00:07:16,880 --> 00:07:18,800 uh potentially malicious macros are 194 00:07:18,800 --> 00:07:21,199 being executed 195 00:07:21,199 --> 00:07:23,599 um and here uh for the next few slides 196 00:07:23,599 --> 00:07:25,599 uh i'm using this amazingly useful uh 197 00:07:25,599 --> 00:07:27,680 powershell script uh written by gregor 198 00:07:27,680 --> 00:07:30,400 storek um and that is linked directly in 199 00:07:30,400 --> 00:07:31,840 the slide i highly recommend you check 200 00:07:31,840 --> 00:07:34,319 that out if you work with so small logs 201 00:07:34,319 --> 00:07:37,759 it presents them in a really nice visual 202 00:07:37,759 --> 00:07:41,120 and here we see a super basic example 203 00:07:41,120 --> 00:07:43,039 we were just looking at a macro 204 00:07:43,039 --> 00:07:46,160 that is launched from a file share and 205 00:07:46,160 --> 00:07:48,160 the macro opens notepad and i couldn't 206 00:07:48,160 --> 00:07:50,319 get the full command line in the slide 207 00:07:50,319 --> 00:07:52,080 but if you were to look at the full 208 00:07:52,080 --> 00:07:54,240 command line it would contain the path 209 00:07:54,240 --> 00:07:56,639 uh from where this particular macro was 210 00:07:56,639 --> 00:07:59,360 opened and and the point here is uh that 211 00:07:59,360 --> 00:08:00,960 the point i want to get across is just 212 00:08:00,960 --> 00:08:03,520 by using process creation events uh we 213 00:08:03,520 --> 00:08:06,319 can already see things like 214 00:08:06,319 --> 00:08:08,800 where macros are being opened from 215 00:08:08,800 --> 00:08:09,759 and 216 00:08:09,759 --> 00:08:11,440 uh what processes they're spawning as 217 00:08:11,440 --> 00:08:14,160 well and these are two key pieces of 218 00:08:14,160 --> 00:08:15,520 information 219 00:08:15,520 --> 00:08:17,759 when making a determination as to 220 00:08:17,759 --> 00:08:20,000 whether a particular macro 221 00:08:20,000 --> 00:08:23,039 is malicious or benign 222 00:08:23,039 --> 00:08:25,759 and this process tree on this slide is 223 00:08:25,759 --> 00:08:28,560 the exact same macro however this one is 224 00:08:28,560 --> 00:08:30,639 open directly from a browser instead of 225 00:08:30,639 --> 00:08:32,159 a trusted file share 226 00:08:32,159 --> 00:08:34,479 and we can see that again just by using 227 00:08:34,479 --> 00:08:36,399 process creation events we can already 228 00:08:36,399 --> 00:08:38,000 start to discern 229 00:08:38,000 --> 00:08:40,958 some macro behavior from something that 230 00:08:40,958 --> 00:08:42,719 is probably benign 231 00:08:42,719 --> 00:08:44,959 like opening a macro from an internal 232 00:08:44,959 --> 00:08:46,000 file share 233 00:08:46,000 --> 00:08:48,959 versus opening a macro from a website of 234 00:08:48,959 --> 00:08:50,080 some kind 235 00:08:50,080 --> 00:08:52,640 and you can also use this process 236 00:08:52,640 --> 00:08:54,240 information 237 00:08:54,240 --> 00:08:56,880 knowing that the macro was open from a 238 00:08:56,880 --> 00:08:59,600 website obviously to do some pivoting to 239 00:08:59,600 --> 00:09:02,160 figure out exactly where a particular 240 00:09:02,160 --> 00:09:04,000 macro was downloaded from and i'll have 241 00:09:04,000 --> 00:09:05,440 a little bit more on this 242 00:09:05,440 --> 00:09:06,839 in some later 243 00:09:06,839 --> 00:09:09,760 slides in looking at one 244 00:09:09,760 --> 00:09:12,160 last process tree 245 00:09:12,160 --> 00:09:14,880 this time the macro was opened as an 246 00:09:14,880 --> 00:09:17,360 attachment from outlook 247 00:09:17,360 --> 00:09:20,000 and again just by using process creation 248 00:09:20,000 --> 00:09:22,959 data we can already tell whether a user 249 00:09:22,959 --> 00:09:25,279 opened a macro from a file share as an 250 00:09:25,279 --> 00:09:27,920 attachment or from a website of some 251 00:09:27,920 --> 00:09:28,720 kind 252 00:09:28,720 --> 00:09:30,240 so again this is really important 253 00:09:30,240 --> 00:09:32,720 information to have when conducting an 254 00:09:32,720 --> 00:09:34,640 investigation into 255 00:09:34,640 --> 00:09:36,080 macros that you might think are 256 00:09:36,080 --> 00:09:38,560 suspicious 257 00:09:38,560 --> 00:09:40,959 so now let's look at some events that 258 00:09:40,959 --> 00:09:44,560 occur when a macro is opened from an 259 00:09:44,560 --> 00:09:47,120 encrypted zip which is a really popular 260 00:09:47,120 --> 00:09:49,600 delivery method these days 261 00:09:49,600 --> 00:09:52,320 since time is a factor here 262 00:09:52,320 --> 00:09:54,080 and because different applications are 263 00:09:54,080 --> 00:09:56,720 involved it's difficult to reconstruct a 264 00:09:56,720 --> 00:09:58,880 process tree out of this 265 00:09:58,880 --> 00:10:00,560 and i know the screenshots are probably 266 00:10:00,560 --> 00:10:02,160 a little bit difficult to see 267 00:10:02,160 --> 00:10:04,560 but the main point to get across here 268 00:10:04,560 --> 00:10:07,120 is that you're able to extract user 269 00:10:07,120 --> 00:10:10,000 behavior from telemetry and this 270 00:10:10,000 --> 00:10:12,000 includes understanding 271 00:10:12,000 --> 00:10:15,120 how a user interacted with a potentially 272 00:10:15,120 --> 00:10:18,240 malicious office macro and so far we've 273 00:10:18,240 --> 00:10:20,640 only looked at process creation events 274 00:10:20,640 --> 00:10:23,680 so given that let's broaden our scope a 275 00:10:23,680 --> 00:10:25,680 little bit and look at some other 276 00:10:25,680 --> 00:10:27,839 interesting event types in the context 277 00:10:27,839 --> 00:10:28,800 of 278 00:10:28,800 --> 00:10:31,120 office macros 279 00:10:31,120 --> 00:10:32,240 um 280 00:10:32,240 --> 00:10:34,560 i should have to know and specifically 281 00:10:34,560 --> 00:10:37,600 call out here uh event id15 versus mon 282 00:10:37,600 --> 00:10:40,079 uh which is file stream created and with 283 00:10:40,079 --> 00:10:42,399 this event you can actually see 284 00:10:42,399 --> 00:10:45,040 what processes downloaded a certain file 285 00:10:45,040 --> 00:10:48,000 and where that file came from 286 00:10:48,000 --> 00:10:49,839 in this screenshot you can see that my 287 00:10:49,839 --> 00:10:50,959 macro 288 00:10:50,959 --> 00:10:52,880 which was found in the encrypted zip 289 00:10:52,880 --> 00:10:56,560 file was downloaded from ngrok.io 290 00:10:56,560 --> 00:10:58,399 which is a potentially a suspicious 291 00:10:58,399 --> 00:11:00,399 domain 292 00:11:00,399 --> 00:11:03,200 another bonus here and some more events 293 00:11:03,200 --> 00:11:05,200 that i want to look at in the context of 294 00:11:05,200 --> 00:11:07,440 macros and as i mentioned in the 295 00:11:07,440 --> 00:11:10,880 previous slide if a file is downloaded 296 00:11:10,880 --> 00:11:13,760 with a mark of the web you can see where 297 00:11:13,760 --> 00:11:15,120 it's downloaded from and that's what the 298 00:11:15,120 --> 00:11:17,040 screenshot on the left is showing that 299 00:11:17,040 --> 00:11:19,519 the one that's marked with a number one 300 00:11:19,519 --> 00:11:22,320 and a full examination of mark of the 301 00:11:22,320 --> 00:11:24,320 web behavior is kind of out of the scope 302 00:11:24,320 --> 00:11:25,920 for this talk just because i i don't 303 00:11:25,920 --> 00:11:27,360 have time 304 00:11:27,360 --> 00:11:30,560 however in a typical scenario a file 305 00:11:30,560 --> 00:11:33,120 with a zone identifier applied is is 306 00:11:33,120 --> 00:11:35,279 considered a mark of the web file and a 307 00:11:35,279 --> 00:11:37,279 zone id of three as is shown in the 308 00:11:37,279 --> 00:11:39,519 screenshot here means that the file was 309 00:11:39,519 --> 00:11:42,079 downloaded from the internet zone so if 310 00:11:42,079 --> 00:11:44,079 a user goes ahead and double clicks on 311 00:11:44,079 --> 00:11:45,760 this file they'll get a smart screen 312 00:11:45,760 --> 00:11:47,680 warning pop up and and that the users 313 00:11:47,680 --> 00:11:49,120 can click through that 314 00:11:49,120 --> 00:11:50,720 however the events on the right hand 315 00:11:50,720 --> 00:11:52,079 side here the one that's marked with the 316 00:11:52,079 --> 00:11:53,200 two 317 00:11:53,200 --> 00:11:55,040 and i should mention that the suspend 318 00:11:55,040 --> 00:11:57,279 config snippet that is required to 319 00:11:57,279 --> 00:12:00,000 generate this event is on the git repo 320 00:12:00,000 --> 00:12:01,600 that was linked earlier 321 00:12:01,600 --> 00:12:03,680 and this event is actually generated 322 00:12:03,680 --> 00:12:06,160 when the user right clicks the file with 323 00:12:06,160 --> 00:12:09,279 mark the web applied and clicks unblock 324 00:12:09,279 --> 00:12:12,079 so really handy event to have however a 325 00:12:12,079 --> 00:12:14,800 few gotchas slash caveats 326 00:12:14,800 --> 00:12:17,680 please consider this event experimental 327 00:12:17,680 --> 00:12:19,360 also keep in mind that you'll see 328 00:12:19,360 --> 00:12:23,120 different pits and different goods 329 00:12:23,120 --> 00:12:25,279 and also keep in mind that the 330 00:12:25,279 --> 00:12:27,519 downloading of the file 331 00:12:27,519 --> 00:12:29,920 and the removal of that mark of the web 332 00:12:29,920 --> 00:12:31,200 by a user 333 00:12:31,200 --> 00:12:34,399 uh can happen hours or even days apart 334 00:12:34,399 --> 00:12:36,720 um and and that makes these events a 335 00:12:36,720 --> 00:12:39,279 little bit difficult to correlate 336 00:12:39,279 --> 00:12:41,120 but in my opinion i think this event is 337 00:12:41,120 --> 00:12:43,040 still worth instrumenting in your 338 00:12:43,040 --> 00:12:45,120 environment and worth tinkering with a 339 00:12:45,120 --> 00:12:47,440 little bit 340 00:12:47,440 --> 00:12:49,519 so so far we've looked at isolated 341 00:12:49,519 --> 00:12:52,320 events and looking at isolated events in 342 00:12:52,320 --> 00:12:54,320 this manner is fantastic 343 00:12:54,320 --> 00:12:57,600 um and by now we hopefully have a better 344 00:12:57,600 --> 00:12:59,360 feel for what kind of telemetry is 345 00:12:59,360 --> 00:13:01,760 available to us um in the in the context 346 00:13:01,760 --> 00:13:03,040 of macros 347 00:13:03,040 --> 00:13:06,160 so now let's try to tie this all 348 00:13:06,160 --> 00:13:07,360 together 349 00:13:07,360 --> 00:13:09,279 into an alerting strategy 350 00:13:09,279 --> 00:13:11,519 and this should be somewhat easier now 351 00:13:11,519 --> 00:13:14,720 as we have visibility and baselining in 352 00:13:14,720 --> 00:13:16,240 place 353 00:13:16,240 --> 00:13:17,360 and the diagram that you see on the 354 00:13:17,360 --> 00:13:18,399 slide 355 00:13:18,399 --> 00:13:21,200 i've made it with a mermaid js um and 356 00:13:21,200 --> 00:13:23,519 the code that's used to generate uh this 357 00:13:23,519 --> 00:13:26,240 diagram is on the github repo as well uh 358 00:13:26,240 --> 00:13:27,839 please feel free to use it um if you 359 00:13:27,839 --> 00:13:29,760 find it valuable add your own criteria 360 00:13:29,760 --> 00:13:32,160 um go nuts um 361 00:13:32,160 --> 00:13:35,040 and also uh please note that not every 362 00:13:35,040 --> 00:13:37,760 single factor was added in here uh just 363 00:13:37,760 --> 00:13:39,600 due to space constraints uh but the 364 00:13:39,600 --> 00:13:43,040 basic idea here is that we want to raise 365 00:13:43,040 --> 00:13:45,279 or lower um some kind of 366 00:13:45,279 --> 00:13:48,480 score within our learning paradigm 367 00:13:48,480 --> 00:13:51,199 and alex tierria has described this 368 00:13:51,199 --> 00:13:54,560 paradigm as hyper or qualifier queries 369 00:13:54,560 --> 00:13:56,399 but different vendors have different 370 00:13:56,399 --> 00:13:58,480 names for them 371 00:13:58,480 --> 00:14:01,040 the main goal though is that you want to 372 00:14:01,040 --> 00:14:03,839 take a certain factor or behavior 373 00:14:03,839 --> 00:14:06,639 one that you can observe through your 374 00:14:06,639 --> 00:14:07,920 event logs 375 00:14:07,920 --> 00:14:10,800 and use it to either raise or lower a 376 00:14:10,800 --> 00:14:14,720 score and after baselining when that 377 00:14:14,720 --> 00:14:17,519 score moves past 378 00:14:17,519 --> 00:14:20,320 a certain threshold that you set um you 379 00:14:20,320 --> 00:14:22,240 investigate or you run a playbook a sore 380 00:14:22,240 --> 00:14:24,160 playbook or what have you 381 00:14:24,160 --> 00:14:26,560 um and then in this example we are just 382 00:14:26,560 --> 00:14:28,399 raising a score if certain conditions 383 00:14:28,399 --> 00:14:29,519 are met 384 00:14:29,519 --> 00:14:31,120 like the macro coming from an encrypted 385 00:14:31,120 --> 00:14:34,480 zip loading calm dlls uh generating 386 00:14:34,480 --> 00:14:37,279 abnormal uh suspend event id10s or 387 00:14:37,279 --> 00:14:38,959 exhibiting beaconing behavior or 388 00:14:38,959 --> 00:14:41,519 anything like that 389 00:14:41,519 --> 00:14:42,320 so 390 00:14:42,320 --> 00:14:44,560 at this point we have our we have our 391 00:14:44,560 --> 00:14:46,160 baseline completed we have a great 392 00:14:46,160 --> 00:14:48,000 alerting strategy 393 00:14:48,000 --> 00:14:51,199 and we just need the technical 394 00:14:51,199 --> 00:14:53,600 underpinnings um and the actual query 395 00:14:53,600 --> 00:14:56,320 logic uh that we're going to use um and 396 00:14:56,320 --> 00:14:57,920 that's kind of what i have uh just 397 00:14:57,920 --> 00:14:59,680 displayed on the slide and i should 398 00:14:59,680 --> 00:15:02,720 mention here that um the full query is a 399 00:15:02,720 --> 00:15:03,839 little big so i can fit it in the 400 00:15:03,839 --> 00:15:06,000 screenshot but it's all available um on 401 00:15:06,000 --> 00:15:08,399 the github repo as well 402 00:15:08,399 --> 00:15:12,160 so let's start with a quick baseline and 403 00:15:12,160 --> 00:15:14,639 in this case i'm executing a macro 404 00:15:14,639 --> 00:15:17,279 from a file share that i already know 405 00:15:17,279 --> 00:15:20,000 users open macros from in a legitimate 406 00:15:20,000 --> 00:15:21,040 fashion 407 00:15:21,040 --> 00:15:23,360 and this particular macro 408 00:15:23,360 --> 00:15:25,360 uses wmi 409 00:15:25,360 --> 00:15:27,600 and it spawns a process 410 00:15:27,600 --> 00:15:30,560 so it performs some suspicious uh 411 00:15:30,560 --> 00:15:31,680 behavior 412 00:15:31,680 --> 00:15:32,399 but 413 00:15:32,399 --> 00:15:35,199 the fact that it opens from a file share 414 00:15:35,199 --> 00:15:37,440 means that we can trust it uh just a 415 00:15:37,440 --> 00:15:38,720 little bit more 416 00:15:38,720 --> 00:15:40,320 this doesn't mean that we fully exclude 417 00:15:40,320 --> 00:15:41,920 it it just means that we can trust it 418 00:15:41,920 --> 00:15:44,240 just a little bit more and by trusting 419 00:15:44,240 --> 00:15:45,759 it a little bit more 420 00:15:45,759 --> 00:15:48,079 we lower the score when we see 421 00:15:48,079 --> 00:15:50,800 this particular macro running from 422 00:15:50,800 --> 00:15:52,800 my file share or another file share that 423 00:15:52,800 --> 00:15:55,360 you trust and in this example 424 00:15:55,360 --> 00:15:57,600 uh this baseline macro scores at about 425 00:15:57,600 --> 00:15:59,120 35 points 426 00:15:59,120 --> 00:16:01,759 and i should also note that the scoring 427 00:16:01,759 --> 00:16:04,560 here is is kind of arbitrary right 428 00:16:04,560 --> 00:16:07,279 you set all this kind of based on what 429 00:16:07,279 --> 00:16:10,320 you're seeing in your environments 430 00:16:10,320 --> 00:16:11,920 so let's compare 431 00:16:11,920 --> 00:16:14,880 the baseline macro and the score that it 432 00:16:14,880 --> 00:16:16,079 received 433 00:16:16,079 --> 00:16:18,000 to some red canary tests 434 00:16:18,000 --> 00:16:20,880 the first test is an os tap style macro 435 00:16:20,880 --> 00:16:23,920 execution uh this score is at about a 48 436 00:16:23,920 --> 00:16:26,320 and the score is higher for this 437 00:16:26,320 --> 00:16:28,720 particular macro uh due to it containing 438 00:16:28,720 --> 00:16:31,600 a suspicious call trace and spawning via 439 00:16:31,600 --> 00:16:34,320 c script process as well 440 00:16:34,320 --> 00:16:37,519 the second macro is a choice flag 441 00:16:37,519 --> 00:16:40,399 execution and this macro scores at about 442 00:16:40,399 --> 00:16:41,680 a 58 443 00:16:41,680 --> 00:16:44,399 and here this score is higher 444 00:16:44,399 --> 00:16:46,880 due to the command line switches as well 445 00:16:46,880 --> 00:16:49,440 as a command prompt being spawned from 446 00:16:49,440 --> 00:16:50,399 word 447 00:16:50,399 --> 00:16:53,519 and the third and final macro 448 00:16:53,519 --> 00:16:55,600 which is at the bottom of the slide 449 00:16:55,600 --> 00:16:58,480 is in excel for macro and this scores at 450 00:16:58,480 --> 00:16:59,839 about 60 451 00:16:59,839 --> 00:17:02,720 and this score is higher due to the 452 00:17:02,720 --> 00:17:05,039 creation of a vbs file 453 00:17:05,039 --> 00:17:06,400 and as well 454 00:17:06,400 --> 00:17:08,240 some suspicious call trace entries as 455 00:17:08,240 --> 00:17:09,039 well 456 00:17:09,039 --> 00:17:11,359 and all these macros are scoring at 457 00:17:11,359 --> 00:17:14,319 about double our baseline macro 458 00:17:14,319 --> 00:17:16,559 and again the actual scores and 459 00:17:16,559 --> 00:17:18,559 different techniques used in these 460 00:17:18,559 --> 00:17:20,079 particular macros 461 00:17:20,079 --> 00:17:21,919 kind of matter less than the general 462 00:17:21,919 --> 00:17:23,599 dynamic of 463 00:17:23,599 --> 00:17:25,760 you have a good baseline of what normal 464 00:17:25,760 --> 00:17:26,959 is in your environment and you're 465 00:17:26,959 --> 00:17:29,200 alerting on things that deviate from 466 00:17:29,200 --> 00:17:31,600 that baseline 467 00:17:31,600 --> 00:17:33,919 uh wmi techniques that i kind of touched 468 00:17:33,919 --> 00:17:36,799 on on the previous slide are worth 469 00:17:36,799 --> 00:17:39,039 calling out specifically 470 00:17:39,039 --> 00:17:41,360 um they could be pretty dangerous when 471 00:17:41,360 --> 00:17:44,240 it comes to macros because they break 472 00:17:44,240 --> 00:17:47,280 parent-child process relationships and 473 00:17:47,280 --> 00:17:49,840 also may confuse detection logic 474 00:17:49,840 --> 00:17:50,880 however 475 00:17:50,880 --> 00:17:53,280 dll or image events 476 00:17:53,280 --> 00:17:55,760 especially when combined with process 477 00:17:55,760 --> 00:17:57,600 access events 478 00:17:57,600 --> 00:17:59,200 as well as a careful review of the call 479 00:17:59,200 --> 00:18:01,120 trace being generated 480 00:18:01,120 --> 00:18:03,760 will kind of bubble this activity up 481 00:18:03,760 --> 00:18:07,440 and the image on the left is showing wmi 482 00:18:07,440 --> 00:18:10,400 prvc spawning calculator as opposed to 483 00:18:10,400 --> 00:18:12,559 windward and we could also see on the 484 00:18:12,559 --> 00:18:14,480 right hand side of the slide 485 00:18:14,480 --> 00:18:17,960 wmi prvse accessing the memory space of 486 00:18:17,960 --> 00:18:19,760 calc.exe 487 00:18:19,760 --> 00:18:21,840 with a suspicious function called and 488 00:18:21,840 --> 00:18:23,520 all this information can be correlated 489 00:18:23,520 --> 00:18:26,080 back up to windward but the process tree 490 00:18:26,080 --> 00:18:27,600 will look a little different and will 491 00:18:27,600 --> 00:18:29,520 not show calc being spawned from 492 00:18:29,520 --> 00:18:31,280 windward so it's just something to watch 493 00:18:31,280 --> 00:18:33,120 out for 494 00:18:33,120 --> 00:18:35,840 another technique worth calling out 495 00:18:35,840 --> 00:18:38,240 specifically is p-pit spoofing 496 00:18:38,240 --> 00:18:42,559 and similar to wmi the goal of this 497 00:18:42,559 --> 00:18:44,559 particular technique is to break the 498 00:18:44,559 --> 00:18:46,799 process relationship chain and the goal 499 00:18:46,799 --> 00:18:49,520 of this particular uh pps moving macro 500 00:18:49,520 --> 00:18:51,039 is to make it look like powershell 501 00:18:51,039 --> 00:18:53,039 spawned from explorer as opposed to 502 00:18:53,039 --> 00:18:54,080 windward 503 00:18:54,080 --> 00:18:56,160 however if we look at the process access 504 00:18:56,160 --> 00:18:57,200 events 505 00:18:57,200 --> 00:18:59,919 and look at the right function calls we 506 00:18:59,919 --> 00:19:02,480 can see the real uh parent process of 507 00:19:02,480 --> 00:19:04,400 powershell which in this case is one 508 00:19:04,400 --> 00:19:07,200 word so if we see this mismatch between 509 00:19:07,200 --> 00:19:10,320 event id 10 and event id 1 it may be a p 510 00:19:10,320 --> 00:19:13,120 pit spoofing taking place and of course 511 00:19:13,120 --> 00:19:15,280 we could add this logic to our qualifier 512 00:19:15,280 --> 00:19:19,440 query and score it appropriately 513 00:19:19,520 --> 00:19:21,919 dot net based macros can also be 514 00:19:21,919 --> 00:19:24,400 detected using the methods we've been 515 00:19:24,400 --> 00:19:25,840 outlining 516 00:19:25,840 --> 00:19:27,600 so let's look at a few examples and 517 00:19:27,600 --> 00:19:30,559 we'll start with gadget to jscript and 518 00:19:30,559 --> 00:19:32,320 this is a really interesting technique 519 00:19:32,320 --> 00:19:34,559 that and this is a super simplified 520 00:19:34,559 --> 00:19:35,760 explanation 521 00:19:35,760 --> 00:19:38,240 basically makes it so you can load net 522 00:19:38,240 --> 00:19:41,039 assemblies from vba code um i've 523 00:19:41,039 --> 00:19:42,799 personally executed this technique in 524 00:19:42,799 --> 00:19:44,240 various environments and i've 525 00:19:44,240 --> 00:19:47,520 successfully seen it skirt around edr 526 00:19:47,520 --> 00:19:50,160 and other controls however 527 00:19:50,160 --> 00:19:52,080 with the right visibility in place we 528 00:19:52,080 --> 00:19:54,960 can see our qualifier query lighting up 529 00:19:54,960 --> 00:19:57,840 uh super brightly and the score that 530 00:19:57,840 --> 00:19:59,360 this particular macro is getting is 531 00:19:59,360 --> 00:20:01,280 about 139 532 00:20:01,280 --> 00:20:05,039 and if we compare that score of 139 with 533 00:20:05,039 --> 00:20:07,760 the score of 35 that our baseline macro 534 00:20:07,760 --> 00:20:09,840 got we could see that 535 00:20:09,840 --> 00:20:12,159 suspicious activity is starting to to 536 00:20:12,159 --> 00:20:14,159 bubble up to the surface here uh where 537 00:20:14,159 --> 00:20:16,159 we can kind of get some visibility into 538 00:20:16,159 --> 00:20:16,799 it 539 00:20:16,799 --> 00:20:18,720 and the reason why 540 00:20:18,720 --> 00:20:20,799 this particular macro is scoring so high 541 00:20:20,799 --> 00:20:23,200 is because is because of all the the the 542 00:20:23,200 --> 00:20:25,120 suspicious image loads that that it has 543 00:20:25,120 --> 00:20:26,880 to do in order to perform its 544 00:20:26,880 --> 00:20:29,520 functionality 545 00:20:29,600 --> 00:20:33,760 for uh vsto uh plugins 546 00:20:33,760 --> 00:20:36,240 is a lot happening under the hood when 547 00:20:36,240 --> 00:20:38,320 this kind of tradecraft is used and uh 548 00:20:38,320 --> 00:20:41,200 daniel shell has an excellent write-up 549 00:20:41,200 --> 00:20:42,799 for this kind of tradecraft that i 550 00:20:42,799 --> 00:20:44,799 highly recommend you check out and it's 551 00:20:44,799 --> 00:20:47,520 linked on the bottom of the slide 552 00:20:47,520 --> 00:20:50,400 however from a detection standpoint in 553 00:20:50,400 --> 00:20:54,320 addition to loading a bunch of net dlls 554 00:20:54,320 --> 00:20:57,360 vsco plugin executions also drop a 555 00:20:57,360 --> 00:20:59,039 suspicious file 556 00:20:59,039 --> 00:21:00,840 which is what the screenshot here is 557 00:21:00,840 --> 00:21:03,760 showing and we could see the file being 558 00:21:03,760 --> 00:21:06,720 dropped in the middle column it has a 559 00:21:06,720 --> 00:21:10,320 qx one uh extension which is really odd 560 00:21:10,320 --> 00:21:12,240 and we could all we could include all 561 00:21:12,240 --> 00:21:15,360 this behavior both in our system configs 562 00:21:15,360 --> 00:21:18,720 and the subsequent qualifier queries and 563 00:21:18,720 --> 00:21:20,720 if you're interested in exploring the 564 00:21:20,720 --> 00:21:22,960 telemetry generated by 565 00:21:22,960 --> 00:21:24,640 this kind of tradecraft 566 00:21:24,640 --> 00:21:26,720 check out the gist that i linked at the 567 00:21:26,720 --> 00:21:30,159 bottom of the slide as well 568 00:21:30,159 --> 00:21:33,200 uh i have to mention uh office zero days 569 00:21:33,200 --> 00:21:35,520 uh because of the folena uh dumpster 570 00:21:35,520 --> 00:21:38,080 fire that happened a few months ago um 571 00:21:38,080 --> 00:21:40,240 and i'll mention here that 572 00:21:40,240 --> 00:21:42,960 just because an office zero day is out 573 00:21:42,960 --> 00:21:45,200 there that that doesn't mean that you're 574 00:21:45,200 --> 00:21:46,559 totally blind 575 00:21:46,559 --> 00:21:48,480 and in my experience uh the following 576 00:21:48,480 --> 00:21:49,840 factors 577 00:21:49,840 --> 00:21:52,159 greatly help when dealing with a zero 578 00:21:52,159 --> 00:21:53,039 day 579 00:21:53,039 --> 00:21:54,720 especially in something like an office 580 00:21:54,720 --> 00:21:56,400 product 581 00:21:56,400 --> 00:21:58,480 the relevant telemetry 582 00:21:58,480 --> 00:22:01,520 needs to be generated in our examples uh 583 00:22:01,520 --> 00:22:04,159 this means a good working uh system 584 00:22:04,159 --> 00:22:07,840 config installed on hosts where offices 585 00:22:07,840 --> 00:22:10,480 um work concretely this also means 586 00:22:10,480 --> 00:22:14,080 looking at events that go beyond your 587 00:22:14,080 --> 00:22:16,480 standard process creation events and 588 00:22:16,480 --> 00:22:19,039 this is especially true when dealing 589 00:22:19,039 --> 00:22:21,360 with more advanced office macro 590 00:22:21,360 --> 00:22:23,280 tradecraft 591 00:22:23,280 --> 00:22:26,880 the relevant telemetry that's generated 592 00:22:26,880 --> 00:22:29,200 also needs to be available 593 00:22:29,200 --> 00:22:32,159 and that is the telemetry needs to be 594 00:22:32,159 --> 00:22:33,919 found in a sim 595 00:22:33,919 --> 00:22:36,960 or log analytics platform that allows 596 00:22:36,960 --> 00:22:39,039 you to slice and dice the data 597 00:22:39,039 --> 00:22:41,120 and build queries 598 00:22:41,120 --> 00:22:43,760 particularly more advanced data 599 00:22:43,760 --> 00:22:45,600 crunching queries like hyper or 600 00:22:45,600 --> 00:22:48,159 qualifier or risk-based queries 601 00:22:48,159 --> 00:22:50,559 a the telemetry 602 00:22:50,559 --> 00:22:53,280 also needs to be flexible 603 00:22:53,280 --> 00:22:55,919 for example if you test this vsdo 604 00:22:55,919 --> 00:22:58,080 tradecraft and you see that a file 605 00:22:58,080 --> 00:22:59,600 creation event 606 00:22:59,600 --> 00:23:01,520 as we kind of covered in the last slide 607 00:23:01,520 --> 00:23:04,400 needs to be added to your sysmon config 608 00:23:04,400 --> 00:23:06,960 to generate the right logs how quickly 609 00:23:06,960 --> 00:23:10,000 can you roll that out to your fleet 610 00:23:10,000 --> 00:23:13,280 um behavior has to be baselined 611 00:23:13,280 --> 00:23:15,360 and this means that you generally 612 00:23:15,360 --> 00:23:18,799 understand who uses macros and where 613 00:23:18,799 --> 00:23:20,640 they're being used from 614 00:23:20,640 --> 00:23:23,679 and finally a good alerting strategy 615 00:23:23,679 --> 00:23:26,240 needs to be put in place and here i want 616 00:23:26,240 --> 00:23:27,520 to argue that 617 00:23:27,520 --> 00:23:29,840 the standard kind of alerting paradigm 618 00:23:29,840 --> 00:23:32,480 for office products spawning processes 619 00:23:32,480 --> 00:23:34,720 or did x thing 620 00:23:34,720 --> 00:23:37,360 is probably not going to be enough for 621 00:23:37,360 --> 00:23:40,000 the more advanced office trade craft and 622 00:23:40,000 --> 00:23:42,960 i would strongly urge uh the collection 623 00:23:42,960 --> 00:23:45,520 and analysis of additional or more 624 00:23:45,520 --> 00:23:48,960 telemetry aimed at office 625 00:23:49,039 --> 00:23:52,000 so as part of this talk we covered a lot 626 00:23:52,000 --> 00:23:54,080 of alerting strategies including image 627 00:23:54,080 --> 00:23:56,880 load events process trees call traces 628 00:23:56,880 --> 00:23:59,679 however with the rich telemetry that you 629 00:23:59,679 --> 00:24:01,919 will hopefully gain after watching this 630 00:24:01,919 --> 00:24:02,880 talk 631 00:24:02,880 --> 00:24:04,400 we can do a lot more 632 00:24:04,400 --> 00:24:06,400 and i just wanted to cover some super 633 00:24:06,400 --> 00:24:08,159 basic ideas here 634 00:24:08,159 --> 00:24:09,840 the first one being you know is this the 635 00:24:09,840 --> 00:24:12,400 first time that the user ran this macro 636 00:24:12,400 --> 00:24:14,240 this can be used in 637 00:24:14,240 --> 00:24:16,640 deciding whether a particular macro was 638 00:24:16,640 --> 00:24:18,480 malicious or not 639 00:24:18,480 --> 00:24:20,960 regarding beaconing alerts 640 00:24:20,960 --> 00:24:23,360 beaconing alerts are a little bit tricky 641 00:24:23,360 --> 00:24:26,000 at the proxy level or firewall level 642 00:24:26,000 --> 00:24:27,120 however 643 00:24:27,120 --> 00:24:30,720 if you have a telemetry that ties a 644 00:24:30,720 --> 00:24:33,279 process to a network connection 645 00:24:33,279 --> 00:24:35,440 um i think beaconing detections become 646 00:24:35,440 --> 00:24:36,640 more feasible 647 00:24:36,640 --> 00:24:38,480 and here i'm thinking of suspended event 648 00:24:38,480 --> 00:24:39,679 id3 649 00:24:39,679 --> 00:24:43,039 and generally speaking office products 650 00:24:43,039 --> 00:24:45,279 maybe other than telemetry that they 651 00:24:45,279 --> 00:24:47,840 send back to the mothership 652 00:24:47,840 --> 00:24:50,960 usually don't exhibit beaconing behavior 653 00:24:50,960 --> 00:24:52,559 so i think there's quite a bit to 654 00:24:52,559 --> 00:24:55,600 explore in this particular area 655 00:24:55,600 --> 00:24:57,120 regarding dns 656 00:24:57,120 --> 00:24:59,919 dns requests made by office products i 657 00:24:59,919 --> 00:25:01,840 think our gold mine for detection 658 00:25:01,840 --> 00:25:05,200 efforts and these leave threat actors 659 00:25:05,200 --> 00:25:07,679 with very little wiggle room in terms of 660 00:25:07,679 --> 00:25:09,679 obfuscation and evasions and things like 661 00:25:09,679 --> 00:25:10,880 that 662 00:25:10,880 --> 00:25:13,120 and all this data can be used in your 663 00:25:13,120 --> 00:25:15,919 qualifier or hyper or risk based queries 664 00:25:15,919 --> 00:25:18,000 as well 665 00:25:18,000 --> 00:25:20,480 i would really urge you to take a very 666 00:25:20,480 --> 00:25:23,279 close look at where office products are 667 00:25:23,279 --> 00:25:24,480 connecting to 668 00:25:24,480 --> 00:25:26,240 where they're establishing network 669 00:25:26,240 --> 00:25:28,240 connections 670 00:25:28,240 --> 00:25:30,480 they may connect to a lot of microsoft 671 00:25:30,480 --> 00:25:33,520 owned ap addresses but typically they do 672 00:25:33,520 --> 00:25:35,760 not connect to things like azure blob 673 00:25:35,760 --> 00:25:38,640 storage onedrive sharepoint or 674 00:25:38,640 --> 00:25:41,200 azure public ip spaces 675 00:25:41,200 --> 00:25:42,480 and here of course 676 00:25:42,480 --> 00:25:44,240 your mileage may vary because different 677 00:25:44,240 --> 00:25:47,200 networks behave in very different ways 678 00:25:47,200 --> 00:25:50,159 um the last point there uh macros 679 00:25:50,159 --> 00:25:53,440 containing uh zips or 680 00:25:53,440 --> 00:25:55,279 macros that are downloaded from google 681 00:25:55,279 --> 00:25:58,400 drive or untrusted sharepoint sites 682 00:25:58,400 --> 00:26:01,200 should be treated with extreme caution 683 00:26:01,200 --> 00:26:04,240 and here a great exercise for defensive 684 00:26:04,240 --> 00:26:05,200 teams 685 00:26:05,200 --> 00:26:07,679 is to download benign macros 686 00:26:07,679 --> 00:26:09,360 from these sites 687 00:26:09,360 --> 00:26:11,679 and see if your telemetry allows you to 688 00:26:11,679 --> 00:26:12,880 rebuild 689 00:26:12,880 --> 00:26:14,880 where a particular macro came from and 690 00:26:14,880 --> 00:26:16,559 what that macro does 691 00:26:16,559 --> 00:26:19,120 uh try this with macros and zips macros 692 00:26:19,120 --> 00:26:21,840 and iso files as well as raw macros and 693 00:26:21,840 --> 00:26:24,400 i i'm pretty sure you'll be surprised at 694 00:26:24,400 --> 00:26:26,720 how many gaps you have in your telemetry 695 00:26:26,720 --> 00:26:29,840 and how difficult it is to rebuild that 696 00:26:29,840 --> 00:26:31,120 chain 697 00:26:31,120 --> 00:26:33,120 um the last thing i want to mention here 698 00:26:33,120 --> 00:26:35,840 is uh the response portion 699 00:26:35,840 --> 00:26:37,600 um and due to time constraints i just 700 00:26:37,600 --> 00:26:39,360 didn't have the time to talk about uh 701 00:26:39,360 --> 00:26:41,440 some of the awesome and amazing response 702 00:26:41,440 --> 00:26:44,080 tools that exist uh in the context of 703 00:26:44,080 --> 00:26:46,559 office macros um things like 704 00:26:46,559 --> 00:26:49,120 velociraptor and tools made by 705 00:26:49,120 --> 00:26:52,000 decolitch2 are very powerful in terms of 706 00:26:52,000 --> 00:26:54,480 response and they allow you to really 707 00:26:54,480 --> 00:26:57,440 dig into macro internals from a dfir 708 00:26:57,440 --> 00:26:58,880 standpoint 709 00:26:58,880 --> 00:27:01,520 here an awesome soar playbook would be 710 00:27:01,520 --> 00:27:04,159 to take every macro executed in your 711 00:27:04,159 --> 00:27:05,120 environment 712 00:27:05,120 --> 00:27:07,840 run it through viper monkey and pipe 713 00:27:07,840 --> 00:27:10,159 your results back into your sim for 714 00:27:10,159 --> 00:27:11,840 further analysis that way that would be 715 00:27:11,840 --> 00:27:13,840 amazing 716 00:27:13,840 --> 00:27:16,720 so to wrap things up um 717 00:27:16,720 --> 00:27:18,720 i just want to call out 718 00:27:18,720 --> 00:27:20,640 and remind uh 719 00:27:20,640 --> 00:27:23,440 the viewers here that a malicious macro 720 00:27:23,440 --> 00:27:25,760 executing in the environment 721 00:27:25,760 --> 00:27:29,919 is just one aspect of the kill chain 722 00:27:29,919 --> 00:27:32,559 the phishing email had to land in a 723 00:27:32,559 --> 00:27:34,640 mailbox and the macro has to do 724 00:27:34,640 --> 00:27:37,039 something after it executed the threat 725 00:27:37,039 --> 00:27:38,960 actor has to perform some kind of 726 00:27:38,960 --> 00:27:40,799 subsequent actions 727 00:27:40,799 --> 00:27:42,480 and all these are 728 00:27:42,480 --> 00:27:44,240 obviously detection opportunities in 729 00:27:44,240 --> 00:27:46,960 addition to the actual malicious macro 730 00:27:46,960 --> 00:27:48,559 itself 731 00:27:48,559 --> 00:27:49,919 the second point there 732 00:27:49,919 --> 00:27:52,320 building a good telemetry and detection 733 00:27:52,320 --> 00:27:54,880 pipeline is very difficult it involves a 734 00:27:54,880 --> 00:27:58,159 lot of engineering effort people hours 735 00:27:58,159 --> 00:28:00,720 and it all gets combined with the 736 00:28:00,720 --> 00:28:03,120 requirement for a very specialized skill 737 00:28:03,120 --> 00:28:03,919 set 738 00:28:03,919 --> 00:28:05,200 uh however 739 00:28:05,200 --> 00:28:07,039 even if macros are disabled by default 740 00:28:07,039 --> 00:28:09,600 tomorrow i would argue that this effort 741 00:28:09,600 --> 00:28:11,840 is still worth it um office will always 742 00:28:11,840 --> 00:28:13,840 be an attractive attack surface just by 743 00:28:13,840 --> 00:28:17,120 the nature of how users interact with it 744 00:28:17,120 --> 00:28:19,200 and how ubiquitous it is in the 745 00:28:19,200 --> 00:28:21,120 workplace 746 00:28:21,120 --> 00:28:23,200 and as we've hopefully seen 747 00:28:23,200 --> 00:28:25,520 with the examples presented here 748 00:28:25,520 --> 00:28:27,600 we can get a lot of information from 749 00:28:27,600 --> 00:28:30,000 process creation events particularly 750 00:28:30,000 --> 00:28:32,960 process trees however you can do a lot 751 00:28:32,960 --> 00:28:36,880 more with file creation image loads and 752 00:28:36,880 --> 00:28:39,120 process access events especially if 753 00:28:39,120 --> 00:28:42,640 combined with network level telemetry 754 00:28:42,640 --> 00:28:45,600 the last point there a lot of macro a 755 00:28:45,600 --> 00:28:47,440 tradecraft was 756 00:28:47,440 --> 00:28:49,760 crammed into this presentation 757 00:28:49,760 --> 00:28:54,000 however the macro tradecraft well runs 758 00:28:54,000 --> 00:28:55,279 very deep 759 00:28:55,279 --> 00:28:58,399 and if macro executions concern you i 760 00:28:58,399 --> 00:29:00,799 would strongly suggest looking at 761 00:29:00,799 --> 00:29:02,480 various hardening options for your 762 00:29:02,480 --> 00:29:03,600 endpoints 763 00:29:03,600 --> 00:29:06,799 and this is not just the disabling of 764 00:29:06,799 --> 00:29:08,159 macros 765 00:29:08,159 --> 00:29:10,240 but the introduction of 766 00:29:10,240 --> 00:29:12,559 deny by default application control as 767 00:29:12,559 --> 00:29:13,760 well 768 00:29:13,760 --> 00:29:16,080 and i'll leave it there uh thank you 769 00:29:16,080 --> 00:29:18,960 very much for listening for attending 770 00:29:18,960 --> 00:29:23,080 and have a wonderful day