1 00:00:02,560 --> 00:00:05,120 hello welcome to blue team village we 2 00:00:05,120 --> 00:00:07,120 are so happy to see you tune in i'm 3 00:00:07,120 --> 00:00:09,840 excited and pumped to be part of ptv as 4 00:00:09,840 --> 00:00:12,480 this is my first time at btv 5 00:00:12,480 --> 00:00:14,240 thanks for all the btb team for making 6 00:00:14,240 --> 00:00:15,679 this happen and providing the feedback 7 00:00:15,679 --> 00:00:16,640 of the stock 8 00:00:16,640 --> 00:00:17,680 that said 9 00:00:17,680 --> 00:00:19,520 welcome to my talk 10 00:00:19,520 --> 00:00:22,080 this talk is about hunting adversary 11 00:00:22,080 --> 00:00:23,760 schedule 12 00:00:23,760 --> 00:00:26,480 once an adversary gained a foothold they 13 00:00:26,480 --> 00:00:27,840 typically would like to keep their 14 00:00:27,840 --> 00:00:28,800 access 15 00:00:28,800 --> 00:00:31,039 this is called persistence and those who 16 00:00:31,039 --> 00:00:35,360 you speak miter it's called ta003 17 00:00:35,360 --> 00:00:36,960 we will take a look at one such 18 00:00:36,960 --> 00:00:40,239 persistence technique or method called 19 00:00:40,239 --> 00:00:42,320 scheduled task 20 00:00:42,320 --> 00:00:44,239 schedule task is one of the most 21 00:00:44,239 --> 00:00:46,960 observed techniques across three 22 00:00:46,960 --> 00:00:49,200 different miter tactics 23 00:00:49,200 --> 00:00:51,360 according to mandy and trent's 2022 24 00:00:51,360 --> 00:00:53,520 report please go check that out it's a 25 00:00:53,520 --> 00:00:54,800 pretty interesting report that you can 26 00:00:54,800 --> 00:00:55,920 find 27 00:00:55,920 --> 00:00:58,160 we will focus on this talk we will focus 28 00:00:58,160 --> 00:00:59,920 mostly on this on threat hunting for 29 00:00:59,920 --> 00:01:02,320 this talk and uh how to perform it as 30 00:01:02,320 --> 00:01:03,440 well 31 00:01:03,440 --> 00:01:06,640 though scheduled task is one of the 385 32 00:01:06,640 --> 00:01:09,040 sub techniques that mentioned in mitre 33 00:01:09,040 --> 00:01:10,880 you can follow the process discussed 34 00:01:10,880 --> 00:01:13,040 here for any of them 35 00:01:13,040 --> 00:01:15,520 before we move further a little bit 36 00:01:15,520 --> 00:01:16,799 about myself 37 00:01:16,799 --> 00:01:19,040 my name is sai malike and i go by cyber 38 00:01:19,040 --> 00:01:20,000 hawk too 39 00:01:20,000 --> 00:01:22,400 i'm an avid lover of death that is 40 00:01:22,400 --> 00:01:24,159 detection engineering and threat hunting 41 00:01:24,159 --> 00:01:26,640 not the actual one currently i work as a 42 00:01:26,640 --> 00:01:28,240 stock late for a company called sisif 43 00:01:28,240 --> 00:01:30,400 recently acquired by for scout 44 00:01:30,400 --> 00:01:32,000 apart from work 45 00:01:32,000 --> 00:01:34,640 i love to travel especially road trips i 46 00:01:34,640 --> 00:01:36,640 volunteered for any security conferences 47 00:01:36,640 --> 00:01:38,560 and non-profit organizations 48 00:01:38,560 --> 00:01:41,280 focusing on cyber and its journey so if 49 00:01:41,280 --> 00:01:43,360 you have anything 50 00:01:43,360 --> 00:01:45,360 i would love to be part of it 51 00:01:45,360 --> 00:01:46,560 last night 52 00:01:46,560 --> 00:01:48,560 but not least 53 00:01:48,560 --> 00:01:51,759 i'm a student of everything so uh if you 54 00:01:51,759 --> 00:01:53,520 want to teach me something i'm all for 55 00:01:53,520 --> 00:01:54,799 it 56 00:01:54,799 --> 00:01:56,240 enough about me 57 00:01:56,240 --> 00:01:58,399 let's see what we have on the schedule 58 00:01:58,399 --> 00:01:59,840 today 59 00:01:59,840 --> 00:02:02,000 we'll go over what schedule task is and 60 00:02:02,000 --> 00:02:03,280 its basics 61 00:02:03,280 --> 00:02:05,360 we will see quirks and features of 62 00:02:05,360 --> 00:02:07,040 threat hunting 63 00:02:07,040 --> 00:02:09,520 process of data gathering and getting to 64 00:02:09,520 --> 00:02:10,800 know it 65 00:02:10,800 --> 00:02:12,959 we'll see detection engineering uh not 66 00:02:12,959 --> 00:02:14,879 all portions of it just the basics or 67 00:02:14,879 --> 00:02:17,040 how to proceed it with the threat 68 00:02:17,040 --> 00:02:18,239 hunting 69 00:02:18,239 --> 00:02:19,599 finally we will recap everything 70 00:02:19,599 --> 00:02:22,160 together what we learned together right 71 00:02:22,160 --> 00:02:23,360 perfect 72 00:02:23,360 --> 00:02:25,440 a very important note before we dive 73 00:02:25,440 --> 00:02:28,720 deep into the weeds is note taking 74 00:02:28,720 --> 00:02:31,680 i know it sounds boring for some but if 75 00:02:31,680 --> 00:02:34,000 you are anything like me 76 00:02:34,000 --> 00:02:36,560 i don't remember what i did 15 minutes 77 00:02:36,560 --> 00:02:39,360 before uh you know when i'm into a case 78 00:02:39,360 --> 00:02:41,920 or a of any kind of data 79 00:02:41,920 --> 00:02:43,760 and sometimes you will have this crazy 80 00:02:43,760 --> 00:02:46,400 thoughts and ideas on how to progress on 81 00:02:46,400 --> 00:02:48,160 another investigation when you're doing 82 00:02:48,160 --> 00:02:49,840 an investigation 83 00:02:49,840 --> 00:02:52,000 for something else if you don't jog it 84 00:02:52,000 --> 00:02:53,920 down you will lose it 85 00:02:53,920 --> 00:02:56,080 right finally your notes should be your 86 00:02:56,080 --> 00:02:59,200 guide and for others who want to follow 87 00:02:59,200 --> 00:03:01,519 or reproduce your steps so be sure to 88 00:03:01,519 --> 00:03:03,599 take notes while we are going at 89 00:03:03,599 --> 00:03:05,680 and i'll mention it whenever i whenever 90 00:03:05,680 --> 00:03:06,879 possible 91 00:03:06,879 --> 00:03:07,760 good 92 00:03:07,760 --> 00:03:09,440 let's get to it 93 00:03:09,440 --> 00:03:11,200 scheduled task 94 00:03:11,200 --> 00:03:13,200 this is the definition microsoft gave to 95 00:03:13,200 --> 00:03:15,920 schedule task on one of its stocks it's 96 00:03:15,920 --> 00:03:18,080 a scheduled task is basically a code 97 00:03:18,080 --> 00:03:20,480 unit that runs logic in a background 98 00:03:20,480 --> 00:03:23,920 session at a specific time 99 00:03:23,920 --> 00:03:25,519 basically you know you want to do 100 00:03:25,519 --> 00:03:27,680 something in the future or just one time 101 00:03:27,680 --> 00:03:29,840 you can use schedule desk do it but it's 102 00:03:29,840 --> 00:03:31,920 more than that schedule tasks help 103 00:03:31,920 --> 00:03:34,000 operating system programs to run at a 104 00:03:34,000 --> 00:03:36,480 defined time it helps administrators to 105 00:03:36,480 --> 00:03:39,200 take action when a certain event happens 106 00:03:39,200 --> 00:03:42,319 it helps update your anti-virus software 107 00:03:42,319 --> 00:03:44,239 at a defined interval 108 00:03:44,239 --> 00:03:46,480 you get the idea right 109 00:03:46,480 --> 00:03:47,680 we'll go over some of the main 110 00:03:47,680 --> 00:03:49,360 components that make scheduled task 111 00:03:49,360 --> 00:03:53,200 aerial tasks uh among them the first one 112 00:03:53,200 --> 00:03:55,280 is triggers 113 00:03:55,280 --> 00:03:58,319 so we will see these components of in in 114 00:03:58,319 --> 00:04:00,480 terms of what is necessary for us if you 115 00:04:00,480 --> 00:04:02,400 are more interested in it you can go 116 00:04:02,400 --> 00:04:04,239 ahead and you know look at microsoft 117 00:04:04,239 --> 00:04:06,799 docs they do a good job in documenting 118 00:04:06,799 --> 00:04:08,959 most of their most of their products and 119 00:04:08,959 --> 00:04:10,640 services how they do it 120 00:04:10,640 --> 00:04:12,400 so triggers 121 00:04:12,400 --> 00:04:14,080 triggers is one of the component of 122 00:04:14,080 --> 00:04:16,160 schedule task which starts a schedule 123 00:04:16,160 --> 00:04:19,680 task it answers when a certain indicator 124 00:04:19,680 --> 00:04:21,440 or indicators are met 125 00:04:21,440 --> 00:04:23,040 like i want to 126 00:04:23,040 --> 00:04:25,360 schedule a task or start a task every 127 00:04:25,360 --> 00:04:28,320 day at 9 00 am that's your trigger then 128 00:04:28,320 --> 00:04:31,280 actions this is the main thing that be 129 00:04:31,280 --> 00:04:33,759 as a threat hunter or 130 00:04:33,759 --> 00:04:35,919 your detection engineering folks or 131 00:04:35,919 --> 00:04:38,479 forensics is interested in because it 132 00:04:38,479 --> 00:04:41,759 answers when or sorry it answers what a 133 00:04:41,759 --> 00:04:44,720 task is actually doing for example a 134 00:04:44,720 --> 00:04:47,120 program will execute when the about 135 00:04:47,120 --> 00:04:50,800 trigger is met that program is what 136 00:04:50,800 --> 00:04:53,280 principles this answers who is allowed 137 00:04:53,280 --> 00:04:54,880 to run the task 138 00:04:54,880 --> 00:04:56,720 the other components are 139 00:04:56,720 --> 00:04:59,520 settings which answers where the task 140 00:04:59,520 --> 00:05:01,840 should look if there is any error there 141 00:05:01,840 --> 00:05:03,840 is a detailed documentation on these 142 00:05:03,840 --> 00:05:04,960 component 143 00:05:04,960 --> 00:05:07,759 if you check the microsoft doc 144 00:05:07,759 --> 00:05:09,039 and then 145 00:05:09,039 --> 00:05:10,880 we will have other two things called 146 00:05:10,880 --> 00:05:13,039 registration in uh registration 147 00:05:13,039 --> 00:05:15,440 information and uh data 148 00:05:15,440 --> 00:05:17,919 answers how to look for data related to 149 00:05:17,919 --> 00:05:19,840 schedule tasks like 150 00:05:19,840 --> 00:05:21,600 there is a help information for schedule 151 00:05:21,600 --> 00:05:23,759 task or metadata info you can find all 152 00:05:23,759 --> 00:05:26,080 those things uh in in these two 153 00:05:26,080 --> 00:05:27,199 components 154 00:05:27,199 --> 00:05:30,639 we will see how they will help us and uh 155 00:05:30,639 --> 00:05:33,440 we will refer back if necessary 156 00:05:33,440 --> 00:05:34,560 so 157 00:05:34,560 --> 00:05:37,199 why are scheduled tasks important right 158 00:05:37,199 --> 00:05:39,039 after successfully 159 00:05:39,039 --> 00:05:40,479 getting their foothold into their 160 00:05:40,479 --> 00:05:42,800 desired enterprise 161 00:05:42,800 --> 00:05:45,280 do you think an adversary will uh want 162 00:05:45,280 --> 00:05:47,120 to lose their access or afford to lose 163 00:05:47,120 --> 00:05:49,840 their access because they accidentally 164 00:05:49,840 --> 00:05:52,720 control seeing their terminal all right 165 00:05:52,720 --> 00:05:54,720 they want to keep access as long as 166 00:05:54,720 --> 00:05:56,880 possible or they want to keep their 167 00:05:56,880 --> 00:05:58,000 access 168 00:05:58,000 --> 00:06:00,319 to figure it out what to do with it or 169 00:06:00,319 --> 00:06:02,479 until they achieve their objectives 170 00:06:02,479 --> 00:06:05,039 so and it is also interesting for 171 00:06:05,039 --> 00:06:07,280 especially for scheduled tasks because 172 00:06:07,280 --> 00:06:09,919 it can be used in different stages of 173 00:06:09,919 --> 00:06:12,000 attacker life cycle like persistence 174 00:06:12,000 --> 00:06:15,120 privilege escalation and execution 175 00:06:15,120 --> 00:06:16,800 but in this talk we will only talk about 176 00:06:16,800 --> 00:06:18,400 persistence 177 00:06:18,400 --> 00:06:20,479 and who can create schedule tasks 178 00:06:20,479 --> 00:06:22,400 administrators or members in the 179 00:06:22,400 --> 00:06:24,400 administrators group can create schedule 180 00:06:24,400 --> 00:06:27,120 tasks and also administrators can create 181 00:06:27,120 --> 00:06:29,680 uh can give certain permissions for 182 00:06:29,680 --> 00:06:31,759 users in order for them to view or 183 00:06:31,759 --> 00:06:34,720 perform actions on scheduled tasks 184 00:06:34,720 --> 00:06:36,560 okay that's all good 185 00:06:36,560 --> 00:06:39,039 finally we came here uh we come to the 186 00:06:39,039 --> 00:06:40,720 topic we came here for 187 00:06:40,720 --> 00:06:42,240 threat hunting 188 00:06:42,240 --> 00:06:45,199 but let's see what it is 189 00:06:45,199 --> 00:06:47,520 threat hunting is a process of being 190 00:06:47,520 --> 00:06:48,639 proactive 191 00:06:48,639 --> 00:06:51,680 to unveil unknown loans and unknown 192 00:06:51,680 --> 00:06:55,120 unknowns to better our security posture 193 00:06:55,120 --> 00:06:58,240 the main keywords are process because it 194 00:06:58,240 --> 00:07:00,800 is not set and done but rather a 195 00:07:00,800 --> 00:07:03,840 continuous thing 196 00:07:03,919 --> 00:07:06,560 it is proactive as we are not working 197 00:07:06,560 --> 00:07:09,120 for something to happen 198 00:07:09,120 --> 00:07:12,479 but taking charge before it happens 199 00:07:12,479 --> 00:07:15,280 unknown not knowns and unknown unknowns 200 00:07:15,280 --> 00:07:18,000 are a topic on its own but in a nutshell 201 00:07:18,000 --> 00:07:20,240 there are things we don't know and we 202 00:07:20,240 --> 00:07:21,919 want to know 203 00:07:21,919 --> 00:07:24,000 we are doing all these things to better 204 00:07:24,000 --> 00:07:26,479 our security posture 205 00:07:26,479 --> 00:07:28,400 this is a process 206 00:07:28,400 --> 00:07:30,960 but what is it what is the process 207 00:07:30,960 --> 00:07:32,800 this is the process we are talking about 208 00:07:32,800 --> 00:07:34,800 or we are following in this this is not 209 00:07:34,800 --> 00:07:36,240 the only one but this is the one we are 210 00:07:36,240 --> 00:07:37,919 following today 211 00:07:37,919 --> 00:07:40,800 first we will create our hypothesis 212 00:07:40,800 --> 00:07:43,120 then we will find what data we need and 213 00:07:43,120 --> 00:07:45,199 what artifacts are related to our 214 00:07:45,199 --> 00:07:46,800 hypothesis 215 00:07:46,800 --> 00:07:49,280 then we need to know what we are working 216 00:07:49,280 --> 00:07:51,360 with exactly familiarizing ourselves 217 00:07:51,360 --> 00:07:52,560 with the data 218 00:07:52,560 --> 00:07:54,720 from it we will create queries to search 219 00:07:54,720 --> 00:07:56,400 for the data we gathered i'm 220 00:07:56,400 --> 00:07:58,879 familiarized with 221 00:07:58,879 --> 00:08:01,440 finally interpreting the results and 222 00:08:01,440 --> 00:08:03,280 documenting it all you can follow this 223 00:08:03,280 --> 00:08:05,360 process with detection engineering too 224 00:08:05,360 --> 00:08:08,000 but we will not go there yet but this is 225 00:08:08,000 --> 00:08:09,680 the process that we can follow but 226 00:08:09,680 --> 00:08:12,319 there's a lot to unveil here let's break 227 00:08:12,319 --> 00:08:14,879 it down by each component 228 00:08:14,879 --> 00:08:16,800 first thing is hypothesis 229 00:08:16,800 --> 00:08:18,960 a possible or one of the definitions i 230 00:08:18,960 --> 00:08:21,680 found pretty interesting is this 231 00:08:21,680 --> 00:08:23,919 you can read the hypothesis but the main 232 00:08:23,919 --> 00:08:25,360 things are 233 00:08:25,360 --> 00:08:27,039 research interest 234 00:08:27,039 --> 00:08:30,160 most important questions and decision 235 00:08:30,160 --> 00:08:32,719 because in order to be proactive we need 236 00:08:32,719 --> 00:08:35,599 to know what our interests are 237 00:08:35,599 --> 00:08:38,000 what questions we need to ask to create 238 00:08:38,000 --> 00:08:40,640 a structure to our hunt and lastly 239 00:08:40,640 --> 00:08:42,559 decision because we need to know what we 240 00:08:42,559 --> 00:08:44,800 will do with it after all this hunting 241 00:08:44,800 --> 00:08:45,440 and 242 00:08:45,440 --> 00:08:47,440 whatever came out of it what we will do 243 00:08:47,440 --> 00:08:50,560 with it that's the decision process 244 00:08:50,560 --> 00:08:53,360 in thread hunting we will typically have 245 00:08:53,360 --> 00:08:55,680 broad hypothesis and narrow hypothesis 246 00:08:55,680 --> 00:08:57,839 uh that's not a law or you know you 247 00:08:57,839 --> 00:08:59,839 could you need to follow but it gives a 248 00:08:59,839 --> 00:09:02,800 a a kind of structure a possible 249 00:09:02,800 --> 00:09:05,839 structure to your hands 250 00:09:06,720 --> 00:09:09,920 broad hypothesis is just an overall 251 00:09:09,920 --> 00:09:12,959 statement which can serve us to start a 252 00:09:12,959 --> 00:09:14,800 whole lot of hunts 253 00:09:14,800 --> 00:09:16,880 like our broad hypothesis could be 254 00:09:16,880 --> 00:09:19,360 adversaries use persistence mechanisms 255 00:09:19,360 --> 00:09:21,360 to stay connected 256 00:09:21,360 --> 00:09:23,519 as you see it is broad 257 00:09:23,519 --> 00:09:26,640 and can lead to n number of things 258 00:09:26,640 --> 00:09:28,320 you can use this broad hypothesis to 259 00:09:28,320 --> 00:09:30,800 schedule multiple hunts the reason it's 260 00:09:30,800 --> 00:09:33,519 bored is is just give you a glimpse of 261 00:09:33,519 --> 00:09:36,399 what you want but not exactly 262 00:09:36,399 --> 00:09:39,040 how you can do it or you know what what 263 00:09:39,040 --> 00:09:43,200 uh detailed what information right 264 00:09:43,200 --> 00:09:45,600 then narrow hypothesis 265 00:09:45,600 --> 00:09:48,720 for narrow hypothesis is specific 266 00:09:48,720 --> 00:09:51,920 applicable and actionable today 267 00:09:51,920 --> 00:09:54,160 to form the narrow hypothesis we will 268 00:09:54,160 --> 00:09:56,399 answer some questions from one of plug 269 00:09:56,399 --> 00:09:59,600 stock on silver sparrow in shellcon 2021 270 00:09:59,600 --> 00:10:01,360 if you didn't check that talk please go 271 00:10:01,360 --> 00:10:03,200 ahead it has awesome information not 272 00:10:03,200 --> 00:10:05,120 only just the 273 00:10:05,120 --> 00:10:06,640 singular sparrow but the threat handling 274 00:10:06,640 --> 00:10:08,079 process itself we will answer some of 275 00:10:08,079 --> 00:10:10,079 the questions from it right 276 00:10:10,079 --> 00:10:12,160 the first question is who who are we 277 00:10:12,160 --> 00:10:14,079 trying to hunt 278 00:10:14,079 --> 00:10:16,480 what we want to hunt 279 00:10:16,480 --> 00:10:19,680 and why we are doing all this 280 00:10:19,680 --> 00:10:20,800 where 281 00:10:20,800 --> 00:10:26,160 answers what data we want to hunt for 282 00:10:26,560 --> 00:10:29,519 when is the time frame uh related to the 283 00:10:29,519 --> 00:10:31,440 hunts every hunt should have a time 284 00:10:31,440 --> 00:10:33,839 frame so that's the where when portion 285 00:10:33,839 --> 00:10:36,880 of it and how is 286 00:10:36,880 --> 00:10:40,800 how are we querying the data uh in our 287 00:10:40,800 --> 00:10:43,600 sim or analytical platform and how we 288 00:10:43,600 --> 00:10:46,160 want the platform to present the data to 289 00:10:46,160 --> 00:10:46,880 us 290 00:10:46,880 --> 00:10:49,760 so let's fill them up 291 00:10:49,839 --> 00:10:52,480 we want to hunt for adversaries you can 292 00:10:52,480 --> 00:10:55,040 add insider threads to it if you are if 293 00:10:55,040 --> 00:10:58,079 you want to include that in your hands 294 00:10:58,079 --> 00:11:00,320 we want to hunt for specifically 295 00:11:00,320 --> 00:11:02,320 scheduled tasks 296 00:11:02,320 --> 00:11:05,040 and we would like to check this data uh 297 00:11:05,040 --> 00:11:07,760 for endpoints because that's one of the 298 00:11:07,760 --> 00:11:09,760 data points you can check for scheduled 299 00:11:09,760 --> 00:11:11,600 tasks 300 00:11:11,600 --> 00:11:13,760 we are doing this to unveil persistence 301 00:11:13,760 --> 00:11:17,519 mechanisms achieved by scheduled tasks 302 00:11:17,519 --> 00:11:19,440 and if you fill them all of them we can 303 00:11:19,440 --> 00:11:21,040 find this 304 00:11:21,040 --> 00:11:22,640 here we are saying adversaries might 305 00:11:22,640 --> 00:11:25,360 create or change schedule tasks on local 306 00:11:25,360 --> 00:11:28,079 or remote endpoints using gui or command 307 00:11:28,079 --> 00:11:30,720 line tools to execute additional or new 308 00:11:30,720 --> 00:11:33,360 executables files for maintaining 309 00:11:33,360 --> 00:11:35,600 persistence in our environment and we 310 00:11:35,600 --> 00:11:37,920 are doing for as long as the data exists 311 00:11:37,920 --> 00:11:39,680 in our analytical platform and we are 312 00:11:39,680 --> 00:11:41,360 using some of the mechanisms like 313 00:11:41,360 --> 00:11:44,079 searching grouping and stacking but 314 00:11:44,079 --> 00:11:47,440 as you see this is very specific 315 00:11:47,440 --> 00:11:49,600 we can hunt for this today and our 316 00:11:49,600 --> 00:11:52,240 hypothesis will guide us through what we 317 00:11:52,240 --> 00:11:53,920 will search for in our analytical 318 00:11:53,920 --> 00:11:55,200 platform 319 00:11:55,200 --> 00:11:58,320 great we have our broad and narrow 320 00:11:58,320 --> 00:11:59,519 hypothesis 321 00:11:59,519 --> 00:12:00,639 but 322 00:12:00,639 --> 00:12:02,320 what we can do with it 323 00:12:02,320 --> 00:12:04,560 where we will use it 324 00:12:04,560 --> 00:12:06,000 i like this meme 325 00:12:06,000 --> 00:12:07,279 a lot 326 00:12:07,279 --> 00:12:09,519 because most of the threat hunting is 327 00:12:09,519 --> 00:12:10,399 about 328 00:12:10,399 --> 00:12:12,720 pre-hunt preparation 329 00:12:12,720 --> 00:12:14,160 if you remember our threat hunting 330 00:12:14,160 --> 00:12:17,040 process this is our second step data 331 00:12:17,040 --> 00:12:19,440 gathering and what artifacts are related 332 00:12:19,440 --> 00:12:22,320 to what portion of it 333 00:12:22,320 --> 00:12:23,839 if you are performing threat hands most 334 00:12:23,839 --> 00:12:26,079 of your time will be going at this 335 00:12:26,079 --> 00:12:28,320 portion of it because this will define 336 00:12:28,320 --> 00:12:31,680 what you can do in the next sections 337 00:12:31,680 --> 00:12:33,600 so let's get that data 338 00:12:33,600 --> 00:12:36,160 here when you say data it's data coming 339 00:12:36,160 --> 00:12:38,399 from our point products are different 340 00:12:38,399 --> 00:12:40,160 mechanisms where you can gather or 341 00:12:40,160 --> 00:12:44,240 achieve the data in this case endpoint 342 00:12:45,920 --> 00:12:47,839 for things we don't know we will google 343 00:12:47,839 --> 00:12:50,240 it the first thing i googled is monitor 344 00:12:50,240 --> 00:12:54,079 schedule tasks miter is 345 00:12:54,079 --> 00:12:56,079 you know our dear friends where 346 00:12:56,079 --> 00:12:58,639 they have a beautiful website where they 347 00:12:58,639 --> 00:13:00,880 document most of the 348 00:13:00,880 --> 00:13:02,800 techniques sub techniques i spoke about 349 00:13:02,800 --> 00:13:04,800 before so when i googled this the first 350 00:13:04,800 --> 00:13:07,360 link came out to be mitre attack miter 351 00:13:07,360 --> 00:13:09,680 enterprise techniques and then when i 352 00:13:09,680 --> 00:13:11,760 when you go there check 353 00:13:11,760 --> 00:13:14,240 at the detections portion of it 354 00:13:14,240 --> 00:13:16,160 under it 355 00:13:16,160 --> 00:13:18,399 we can find data related to scheduled 356 00:13:18,399 --> 00:13:20,399 tasks 357 00:13:20,399 --> 00:13:22,240 so this is specific to technique so each 358 00:13:22,240 --> 00:13:24,000 second will have the section so when you 359 00:13:24,000 --> 00:13:26,240 go there this is important to see our 360 00:13:26,240 --> 00:13:29,200 how to interpret it is data source is 361 00:13:29,200 --> 00:13:31,120 what data you are collecting or you can 362 00:13:31,120 --> 00:13:33,920 search for and detect is some of the 363 00:13:33,920 --> 00:13:37,440 artifacts they have observed 364 00:13:37,440 --> 00:13:39,440 using a first schedule task which was 365 00:13:39,440 --> 00:13:42,639 used in attacks in the past 366 00:13:42,639 --> 00:13:45,360 so we will take a note of all this so 367 00:13:45,360 --> 00:13:47,680 first data is command file process 368 00:13:47,680 --> 00:13:49,600 scheduled job 369 00:13:49,600 --> 00:13:52,240 lack of data is also important to us we 370 00:13:52,240 --> 00:13:54,079 will discuss that in the in the coming 371 00:13:54,079 --> 00:13:56,399 slides but uh please take a note of all 372 00:13:56,399 --> 00:13:58,320 these data sources we will check from 373 00:13:58,320 --> 00:13:59,360 the bottom 374 00:13:59,360 --> 00:14:00,880 the scheduled job 375 00:14:00,880 --> 00:14:03,440 just get your job creation in specific 376 00:14:03,440 --> 00:14:05,199 in that we will see some of the event 377 00:14:05,199 --> 00:14:07,839 ids uh like specifically we went id four 378 00:14:07,839 --> 00:14:10,720 six nine eight 379 00:14:10,720 --> 00:14:14,720 okay so we will start with that event id 380 00:14:14,720 --> 00:14:17,040 let's check that in google again here 381 00:14:17,040 --> 00:14:19,600 i'm saying i want uh scheduled task 382 00:14:19,600 --> 00:14:22,240 event ids but i want only from 383 00:14:22,240 --> 00:14:25,279 microsoft sites that's the site notation 384 00:14:25,279 --> 00:14:27,360 when i do it the first link came from 385 00:14:27,360 --> 00:14:29,440 from microsoft documentation and when i 386 00:14:29,440 --> 00:14:30,560 went in there 387 00:14:30,560 --> 00:14:34,160 you can search for scheduled uh task in 388 00:14:34,160 --> 00:14:36,240 the left because it has all the events 389 00:14:36,240 --> 00:14:38,560 necessary and we will see all these 390 00:14:38,560 --> 00:14:40,560 events that are produced 391 00:14:40,560 --> 00:14:43,600 by or when action is performed on 392 00:14:43,600 --> 00:14:45,120 schedule task 393 00:14:45,120 --> 00:14:47,680 here you see 4698s 394 00:14:47,680 --> 00:14:50,480 s is a security channel uh so 395 00:14:50,480 --> 00:14:53,760 one thing is event ids are specific are 396 00:14:53,760 --> 00:14:56,839 unique to a channel but not unique 397 00:14:56,839 --> 00:14:59,600 overall okay so let's take a note of all 398 00:14:59,600 --> 00:15:01,199 this like four six nine eight four six 399 00:15:01,199 --> 00:15:02,639 nine and everything 400 00:15:02,639 --> 00:15:03,839 perfect 401 00:15:03,839 --> 00:15:06,079 and we go back to mitra again in the 402 00:15:06,079 --> 00:15:08,720 same section i see another one microsoft 403 00:15:08,720 --> 00:15:10,839 windows task scheduler 404 00:15:10,839 --> 00:15:13,120 operational this one 405 00:15:13,120 --> 00:15:15,519 is related to a specific channel which 406 00:15:15,519 --> 00:15:16,880 has all the information related to 407 00:15:16,880 --> 00:15:18,959 schedule tasks but if you read on it it 408 00:15:18,959 --> 00:15:20,720 says enable the 409 00:15:20,720 --> 00:15:23,519 channel that means in my mind it says 410 00:15:23,519 --> 00:15:26,480 it's not enabled by default uh so we 411 00:15:26,480 --> 00:15:28,720 will check what if it is enabled or not 412 00:15:28,720 --> 00:15:30,240 but we will take a note of that 413 00:15:30,240 --> 00:15:32,399 particular channel too 414 00:15:32,399 --> 00:15:34,800 the second thing we will see is the file 415 00:15:34,800 --> 00:15:37,600 modifications specifically file creation 416 00:15:37,600 --> 00:15:38,800 events 417 00:15:38,800 --> 00:15:41,519 in this it says uh it will be done in 418 00:15:41,519 --> 00:15:44,480 the system 32 tasks folder uh which 419 00:15:44,480 --> 00:15:47,120 whichever is not related to a software 420 00:15:47,120 --> 00:15:49,440 or path cycle or etc so we will search 421 00:15:49,440 --> 00:15:50,480 for it 422 00:15:50,480 --> 00:15:53,519 but unlike before we will search for 423 00:15:53,519 --> 00:15:55,680 sysmond data right because why not 424 00:15:55,680 --> 00:15:57,519 because that is being rolled out in 425 00:15:57,519 --> 00:16:00,000 current enterprises as a cheap version 426 00:16:00,000 --> 00:16:01,920 of edr uh 427 00:16:01,920 --> 00:16:03,360 sorts but 428 00:16:03,360 --> 00:16:05,519 we will search versus mod data 429 00:16:05,519 --> 00:16:08,160 when i search for file creation sysmon i 430 00:16:08,160 --> 00:16:10,639 have seen that event id 11 is related to 431 00:16:10,639 --> 00:16:12,639 it you can see some description related 432 00:16:12,639 --> 00:16:15,519 to the event and also from mitre and 433 00:16:15,519 --> 00:16:18,079 some blogs we see that they happen in 434 00:16:18,079 --> 00:16:21,120 tasks folder and under spc host.exe 435 00:16:21,120 --> 00:16:23,040 process specifically 436 00:16:23,040 --> 00:16:27,120 okay pure we will take it out of it 437 00:16:27,120 --> 00:16:29,519 again we go back to mitre 438 00:16:29,519 --> 00:16:31,680 you can see other things like command 439 00:16:31,680 --> 00:16:33,839 execution and process creations for 440 00:16:33,839 --> 00:16:35,920 command executions there are several 441 00:16:35,920 --> 00:16:39,279 types you can do it schedule scs tasks 442 00:16:39,279 --> 00:16:42,720 exe powershell wmi and many more 443 00:16:42,720 --> 00:16:46,560 so i will uh take a note of that too uh 444 00:16:46,560 --> 00:16:48,240 because i want to search for this as 445 00:16:48,240 --> 00:16:49,920 this one of the data points that i want 446 00:16:49,920 --> 00:16:52,320 to search for 447 00:16:52,320 --> 00:16:54,240 in mitre there is an interesting section 448 00:16:54,240 --> 00:16:57,040 called procedure examples 449 00:16:57,040 --> 00:16:59,360 this is interesting because here is 450 00:16:59,360 --> 00:17:02,000 where mitre documents 451 00:17:02,000 --> 00:17:04,480 all the previous attacks that had 452 00:17:04,480 --> 00:17:07,599 happened uh using scheduled tasks or 453 00:17:07,599 --> 00:17:10,319 where attacks a schedule task is used in 454 00:17:10,319 --> 00:17:11,599 such uh 455 00:17:11,599 --> 00:17:13,199 attacks 456 00:17:13,199 --> 00:17:14,319 okay 457 00:17:14,319 --> 00:17:15,359 so 458 00:17:15,359 --> 00:17:17,359 we while searching for one of those 459 00:17:17,359 --> 00:17:19,919 blocks i have seen that 460 00:17:19,919 --> 00:17:22,240 there is a new data point 461 00:17:22,240 --> 00:17:24,880 that data point is registry keys so it 462 00:17:24,880 --> 00:17:27,679 says that registry keys are also 463 00:17:27,679 --> 00:17:29,760 important in searching for scheduled 464 00:17:29,760 --> 00:17:32,320 tasks specifically registry events 12 13 465 00:17:32,320 --> 00:17:35,360 14 according to sysmon and 466 00:17:35,360 --> 00:17:37,280 some of the registry like create key 467 00:17:37,280 --> 00:17:39,440 delete key and search if you ever 468 00:17:39,440 --> 00:17:42,160 performed registry analysis and or 469 00:17:42,160 --> 00:17:44,840 checked the registry it is messy and 470 00:17:44,840 --> 00:17:48,000 ugly but it could be a lot of fun if you 471 00:17:48,000 --> 00:17:51,039 are into that source i'll show you why 472 00:17:51,039 --> 00:17:52,960 here 473 00:17:52,960 --> 00:17:54,720 we will just check what we want i know 474 00:17:54,720 --> 00:17:56,080 this is scary but we will just check 475 00:17:56,080 --> 00:17:58,240 only the things that we want for the 476 00:17:58,240 --> 00:18:00,960 registry so if you go to the registry 477 00:18:00,960 --> 00:18:03,200 path mentioned above specifically till 478 00:18:03,200 --> 00:18:05,360 the tree portion of it 479 00:18:05,360 --> 00:18:06,559 uh 480 00:18:06,559 --> 00:18:08,559 you can see all these scheduled tasks 481 00:18:08,559 --> 00:18:10,160 that are there these some of the 482 00:18:10,160 --> 00:18:11,600 scheduled tasks are under microsoft 483 00:18:11,600 --> 00:18:14,240 which are operating system specific and 484 00:18:14,240 --> 00:18:14,960 the 485 00:18:14,960 --> 00:18:16,640 the task which is highlighted here is 486 00:18:16,640 --> 00:18:18,400 daily task is the name of the sample 487 00:18:18,400 --> 00:18:20,640 skill test that we created 488 00:18:20,640 --> 00:18:21,919 in this 489 00:18:21,919 --> 00:18:24,320 there are many four sub keys the 490 00:18:24,320 --> 00:18:27,520 interesting words are id and sd 491 00:18:27,520 --> 00:18:30,000 id is a gibriq 492 00:18:30,000 --> 00:18:32,880 kud that is unique to our scheduled desk 493 00:18:32,880 --> 00:18:35,520 here id is correlated with the daily 494 00:18:35,520 --> 00:18:38,799 task name of it and sd is where our 495 00:18:38,799 --> 00:18:40,880 principal or security context under 496 00:18:40,880 --> 00:18:43,039 which schedule task is created 497 00:18:43,039 --> 00:18:45,679 sd is also important because it acts as 498 00:18:45,679 --> 00:18:47,919 a bond between what you can see versus 499 00:18:47,919 --> 00:18:50,000 what schedule task is there 500 00:18:50,000 --> 00:18:52,160 and it's one used in one of the 501 00:18:52,160 --> 00:18:54,799 cases recently with aphnium microsoft 502 00:18:54,799 --> 00:18:56,880 has a great documentation on it if you 503 00:18:56,880 --> 00:18:59,520 uh are interested please check that out 504 00:18:59,520 --> 00:19:02,000 we will see that uh case if we have some 505 00:19:02,000 --> 00:19:03,440 time so 506 00:19:03,440 --> 00:19:05,120 all right but 507 00:19:05,120 --> 00:19:07,600 if you see all this we don't see the 508 00:19:07,600 --> 00:19:08,720 things that we checked for the 509 00:19:08,720 --> 00:19:10,640 components right 510 00:19:10,640 --> 00:19:13,120 the trigger action data components and 511 00:19:13,120 --> 00:19:16,960 stuff we don't see it for that to see id 512 00:19:16,960 --> 00:19:19,840 we'll take a note of the good and paste 513 00:19:19,840 --> 00:19:23,120 it here it's just the same path but 514 00:19:23,120 --> 00:19:25,039 one above uh instead of trees we are 515 00:19:25,039 --> 00:19:27,760 doing tasks and the keyword that we have 516 00:19:27,760 --> 00:19:29,760 here you see a lot of information and 517 00:19:29,760 --> 00:19:31,600 all the information which is familiar to 518 00:19:31,600 --> 00:19:33,039 us 519 00:19:33,039 --> 00:19:34,799 we will not discuss the whole things but 520 00:19:34,799 --> 00:19:38,880 the basic ones uh like actions which is 521 00:19:38,880 --> 00:19:40,720 the thing which we should be interested 522 00:19:40,720 --> 00:19:44,160 in what uh which answers what like uh 523 00:19:44,160 --> 00:19:46,960 the here it is running dnspy.exe from 524 00:19:46,960 --> 00:19:49,679 the downloads folder um you can see 525 00:19:49,679 --> 00:19:51,760 author information who created it you 526 00:19:51,760 --> 00:19:54,080 can see date information 527 00:19:54,080 --> 00:19:56,320 like what date the scheduled task is 528 00:19:56,320 --> 00:19:57,520 created 529 00:19:57,520 --> 00:19:58,720 you can see 530 00:19:58,720 --> 00:20:00,640 the triggers or the conditions when the 531 00:20:00,640 --> 00:20:01,840 scheduled task will be triggered it's 532 00:20:01,840 --> 00:20:03,440 binary you have to convert it and 533 00:20:03,440 --> 00:20:05,360 dynamic info if you are into forensics 534 00:20:05,360 --> 00:20:06,799 some of the interesting timestamps are 535 00:20:06,799 --> 00:20:07,840 here 536 00:20:07,840 --> 00:20:10,240 but we will not go to it but this is the 537 00:20:10,240 --> 00:20:12,400 registry structure i'll we will see how 538 00:20:12,400 --> 00:20:14,240 it is important to us or while you're 539 00:20:14,240 --> 00:20:17,200 searching for your data 540 00:20:17,200 --> 00:20:18,880 all right you better be taking all those 541 00:20:18,880 --> 00:20:22,320 notes which we spoke about so this is 542 00:20:22,320 --> 00:20:24,000 what i have 543 00:20:24,000 --> 00:20:26,080 for my notes 544 00:20:26,080 --> 00:20:27,919 so it says 545 00:20:27,919 --> 00:20:30,080 i have windows events 546 00:20:30,080 --> 00:20:32,559 task scheduler operational channels file 547 00:20:32,559 --> 00:20:34,320 creation events registry keys iron 548 00:20:34,320 --> 00:20:36,080 command line arguments all those things 549 00:20:36,080 --> 00:20:37,760 that we see 550 00:20:37,760 --> 00:20:39,120 perfect 551 00:20:39,120 --> 00:20:40,880 that's a lot about scheduled tasks and 552 00:20:40,880 --> 00:20:42,880 how what artifacts like i said most of 553 00:20:42,880 --> 00:20:44,960 our time will be in 554 00:20:44,960 --> 00:20:47,679 getting those artifacts ready and seeing 555 00:20:47,679 --> 00:20:50,159 what artifacts are generated for a 556 00:20:50,159 --> 00:20:53,440 specific technique or a tactic 557 00:20:53,440 --> 00:20:55,520 but enough said let's see let's put that 558 00:20:55,520 --> 00:20:58,080 into practice and see how it can 559 00:20:58,080 --> 00:21:01,799 give us some information 560 00:21:03,840 --> 00:21:06,400 all right here 561 00:21:06,400 --> 00:21:10,840 let me split this one up 562 00:21:16,640 --> 00:21:18,720 all right here we are using splunk as 563 00:21:18,720 --> 00:21:21,679 our sim uh but you can use any any sim 564 00:21:21,679 --> 00:21:23,440 and you can convert the queries which we 565 00:21:23,440 --> 00:21:26,400 are using here using sites like uncoder 566 00:21:26,400 --> 00:21:28,799 uh dot io and stuff uh but we will not 567 00:21:28,799 --> 00:21:31,280 be doing it we will using splunk uh and 568 00:21:31,280 --> 00:21:33,360 we will explain some of the queries that 569 00:21:33,360 --> 00:21:35,520 uh whenever we are searching for it 570 00:21:35,520 --> 00:21:36,559 right 571 00:21:36,559 --> 00:21:37,360 so 572 00:21:37,360 --> 00:21:39,679 let's see it 573 00:21:39,679 --> 00:21:40,960 zoom in 574 00:21:40,960 --> 00:21:43,280 so the first thing we will do is in our 575 00:21:43,280 --> 00:21:45,440 threat hunting process in our in data 576 00:21:45,440 --> 00:21:47,760 gathering process is data sources if you 577 00:21:47,760 --> 00:21:50,799 remember that we did with using miter 578 00:21:50,799 --> 00:21:53,360 so here i want to do the same i want to 579 00:21:53,360 --> 00:21:55,280 get what data sources is available let 580 00:21:55,280 --> 00:21:56,799 me run it and see 581 00:21:56,799 --> 00:21:59,360 what i have before that 582 00:21:59,360 --> 00:22:00,799 uh here 583 00:22:00,799 --> 00:22:01,520 the 584 00:22:01,520 --> 00:22:03,840 we we want to answer the question where 585 00:22:03,840 --> 00:22:06,240 in our narrow hypothesis uh that we said 586 00:22:06,240 --> 00:22:08,240 we want to search for all the data that 587 00:22:08,240 --> 00:22:10,080 is available to us so that's why i 588 00:22:10,080 --> 00:22:12,240 changed the time to all time i and 589 00:22:12,240 --> 00:22:14,480 schedule tasks are you know time frame 590 00:22:14,480 --> 00:22:17,360 based so you can sorry threat hunting 591 00:22:17,360 --> 00:22:19,840 can be time frame based so you can check 592 00:22:19,840 --> 00:22:21,280 for those 593 00:22:21,280 --> 00:22:22,400 right 594 00:22:22,400 --> 00:22:24,880 the query says that index which is the 595 00:22:24,880 --> 00:22:27,120 splunk way 596 00:22:27,120 --> 00:22:28,880 of saying a 597 00:22:28,880 --> 00:22:30,799 data that we ingested from a point 598 00:22:30,799 --> 00:22:33,120 product or somewhere else then we will 599 00:22:33,120 --> 00:22:35,679 with the help of splunk command ddip 600 00:22:35,679 --> 00:22:38,400 which exactly says deduplication we get 601 00:22:38,400 --> 00:22:41,679 unique instances of uh indexes and 602 00:22:41,679 --> 00:22:43,360 finally we are saying 603 00:22:43,360 --> 00:22:46,240 they uh give us in a table or follow 604 00:22:46,240 --> 00:22:47,919 uh so if you 605 00:22:47,919 --> 00:22:50,159 think back this to our 606 00:22:50,159 --> 00:22:52,640 narrow hypothesis this and the table 607 00:22:52,640 --> 00:22:54,960 answers how like how i want to get the 608 00:22:54,960 --> 00:22:57,360 data uh and the 609 00:22:57,360 --> 00:22:59,039 index and the 610 00:22:59,039 --> 00:23:02,320 other the time frame answers where the 611 00:23:02,320 --> 00:23:03,520 question 612 00:23:03,520 --> 00:23:05,919 okay among these the first one is zeke 613 00:23:05,919 --> 00:23:07,679 which is network based logs we didn't 614 00:23:07,679 --> 00:23:09,440 see anything according to our hypothesis 615 00:23:09,440 --> 00:23:12,159 so we'll skip that os query which is 616 00:23:12,159 --> 00:23:15,039 important uh it's which is endpoint uh 617 00:23:15,039 --> 00:23:17,840 data uh but in our research we didn't 618 00:23:17,840 --> 00:23:19,679 come across we can 619 00:23:19,679 --> 00:23:21,600 maybe use it in the future 620 00:23:21,600 --> 00:23:23,760 or we can use it in for this technique 621 00:23:23,760 --> 00:23:25,679 in a different way but we will keep that 622 00:23:25,679 --> 00:23:28,960 in place uh sysmon uh 623 00:23:28,960 --> 00:23:31,760 which is the data source that we are we 624 00:23:31,760 --> 00:23:33,600 searched for uh if you remember this 625 00:23:33,600 --> 00:23:35,840 file creation events and registry events 626 00:23:35,840 --> 00:23:39,120 so we will use them wind log events 627 00:23:39,120 --> 00:23:41,279 is also important we check that that's 628 00:23:41,279 --> 00:23:42,799 our first step actually 629 00:23:42,799 --> 00:23:44,240 to check some of the windows events 630 00:23:44,240 --> 00:23:46,400 using microsoft site so 631 00:23:46,400 --> 00:23:48,080 let's start with it 632 00:23:48,080 --> 00:23:50,000 and we have other things like hmail and 633 00:23:50,000 --> 00:23:52,559 velociraptor and stuff let's start with 634 00:23:52,559 --> 00:23:55,600 the bin log beats 635 00:23:58,480 --> 00:24:00,320 so if i search for wind lock beads the 636 00:24:00,320 --> 00:24:02,720 first thing we should do is the second 637 00:24:02,720 --> 00:24:05,760 uh once the data gathering has happened 638 00:24:05,760 --> 00:24:07,200 the third step in our thing is data 639 00:24:07,200 --> 00:24:09,279 familiarization this is important 640 00:24:09,279 --> 00:24:12,080 because this is also one which 641 00:24:12,080 --> 00:24:13,840 narrates how 642 00:24:13,840 --> 00:24:16,000 we will search the data or what fields 643 00:24:16,000 --> 00:24:18,559 that we search for data i just threw a 644 00:24:18,559 --> 00:24:20,640 term called fields let's see what it is 645 00:24:20,640 --> 00:24:23,279 so if you see the left hand 646 00:24:23,279 --> 00:24:25,840 the red column they are 647 00:24:25,840 --> 00:24:29,440 called fields and the green ones are 648 00:24:29,440 --> 00:24:32,559 the values associated with that fields 649 00:24:32,559 --> 00:24:35,120 here we have some basic information uh 650 00:24:35,120 --> 00:24:37,039 about uh this is a sample log that we 651 00:24:37,039 --> 00:24:39,360 just picked out of uh you know seeing 652 00:24:39,360 --> 00:24:41,600 all the windows event logs and in that 653 00:24:41,600 --> 00:24:44,559 we see some host information we see the 654 00:24:44,559 --> 00:24:46,880 agent information like here winlockbit 655 00:24:46,880 --> 00:24:49,760 how we get the data from the endpoint we 656 00:24:49,760 --> 00:24:52,880 used the winlogbeat in this word in this 657 00:24:52,880 --> 00:24:54,240 scenario 658 00:24:54,240 --> 00:24:56,640 event.code this if you remember is 659 00:24:56,640 --> 00:24:58,559 equivalent to event id 660 00:24:58,559 --> 00:25:01,440 that we are interested in uh and event 661 00:25:01,440 --> 00:25:04,480 provider uh like i said event ids are 662 00:25:04,480 --> 00:25:07,840 specific to a provider and there are a 663 00:25:07,840 --> 00:25:09,520 channel they are not specific they are 664 00:25:09,520 --> 00:25:12,240 not unique uh to the whole windows 665 00:25:12,240 --> 00:25:14,559 environment so here it says the provider 666 00:25:14,559 --> 00:25:16,960 is microsoft windows time service 667 00:25:16,960 --> 00:25:18,960 think about it how we can use this one 668 00:25:18,960 --> 00:25:21,520 we have host information like ip and mac 669 00:25:21,520 --> 00:25:23,600 addresses we have os specific 670 00:25:23,600 --> 00:25:25,679 information we have a message field 671 00:25:25,679 --> 00:25:26,559 which 672 00:25:26,559 --> 00:25:29,919 how it looks for uh how it how we if we 673 00:25:29,919 --> 00:25:31,919 see this in the windows event logs this 674 00:25:31,919 --> 00:25:33,679 is how you see it 675 00:25:33,679 --> 00:25:35,840 we have again the other information to 676 00:25:35,840 --> 00:25:37,919 it user information also all right 677 00:25:37,919 --> 00:25:40,640 perfect so according to our research 678 00:25:40,640 --> 00:25:42,799 what we saw is we want specific event 679 00:25:42,799 --> 00:25:45,919 ids so let's search for them 680 00:25:45,919 --> 00:25:48,720 so here i'm saying i want 681 00:25:48,720 --> 00:25:50,640 instead of all indexes i only want 682 00:25:50,640 --> 00:25:53,039 windows event logs and i'm using 683 00:25:53,039 --> 00:25:55,440 event.code which you remember is event 684 00:25:55,440 --> 00:25:57,840 id and i'm searching for specific event 685 00:25:57,840 --> 00:25:59,760 ids 686 00:25:59,760 --> 00:26:01,840 but 687 00:26:01,840 --> 00:26:03,919 i did not see anything i don't get 688 00:26:03,919 --> 00:26:06,400 anything why is that the case 689 00:26:06,400 --> 00:26:09,960 so let's see 690 00:26:15,039 --> 00:26:17,039 all right let's see what it is so here 691 00:26:17,039 --> 00:26:20,000 i'm using in operator that means you can 692 00:26:20,000 --> 00:26:20,880 do 693 00:26:20,880 --> 00:26:21,919 uh 694 00:26:21,919 --> 00:26:25,039 i want to search something some data in 695 00:26:25,039 --> 00:26:27,360 a specific field here i want to search 696 00:26:27,360 --> 00:26:30,799 4698 in event code and the rest of them 697 00:26:30,799 --> 00:26:32,720 instead of this you can also use even 698 00:26:32,720 --> 00:26:34,159 dot code 699 00:26:34,159 --> 00:26:35,200 is equal to 700 00:26:35,200 --> 00:26:36,720 [Music] 701 00:26:36,720 --> 00:26:39,360 four six nine eight 702 00:26:39,360 --> 00:26:41,679 um our 703 00:26:41,679 --> 00:26:43,279 event dot 704 00:26:43,279 --> 00:26:44,240 code 705 00:26:44,240 --> 00:26:45,679 equal to 706 00:26:45,679 --> 00:26:47,039 four six 707 00:26:47,039 --> 00:26:49,039 nine nine you can do it this way too but 708 00:26:49,039 --> 00:26:51,360 this is a concise way to 709 00:26:51,360 --> 00:26:53,360 search for data but we didn't find 710 00:26:53,360 --> 00:26:54,640 anything 711 00:26:54,640 --> 00:26:57,520 like i mentioned lack of data back of 712 00:26:57,520 --> 00:26:59,279 written of results is also an 713 00:26:59,279 --> 00:27:00,960 interesting part in threat hunting and 714 00:27:00,960 --> 00:27:04,159 we will see why in our recap okay let's 715 00:27:04,159 --> 00:27:05,760 take a note of that we didn't find 716 00:27:05,760 --> 00:27:08,720 anything right 717 00:27:08,720 --> 00:27:11,840 okay let's search for other data in our 718 00:27:11,840 --> 00:27:13,760 little notes that we took in other 719 00:27:13,760 --> 00:27:15,840 things we saw that we have another 720 00:27:15,840 --> 00:27:18,320 channel called microsoft 721 00:27:18,320 --> 00:27:20,559 task scheduler operational channel that 722 00:27:20,559 --> 00:27:23,360 we can check even data logs related to 723 00:27:23,360 --> 00:27:25,919 so let's check if it if it is there 724 00:27:25,919 --> 00:27:27,679 uh that we are collecting them because 725 00:27:27,679 --> 00:27:29,200 if you remember 726 00:27:29,200 --> 00:27:32,399 miter said that if you enable it right 727 00:27:32,399 --> 00:27:34,159 so here what i'm doing is i'm again 728 00:27:34,159 --> 00:27:35,360 saying that 729 00:27:35,360 --> 00:27:37,760 i want uh specifically logs from wind 730 00:27:37,760 --> 00:27:41,039 log events and i'm using the operator 731 00:27:41,039 --> 00:27:43,039 even dot provider that we checked in our 732 00:27:43,039 --> 00:27:45,360 example uh before 733 00:27:45,360 --> 00:27:47,840 to getting familiarized with the data in 734 00:27:47,840 --> 00:27:50,480 there i think it's i believe it's uh 735 00:27:50,480 --> 00:27:53,200 related to prime provider uh here i'm 736 00:27:53,200 --> 00:27:55,760 saying that i want any provider that has 737 00:27:55,760 --> 00:27:58,320 a name task in it the has to sphere you 738 00:27:58,320 --> 00:27:59,840 see they are 739 00:27:59,840 --> 00:28:01,679 related to a 740 00:28:01,679 --> 00:28:03,919 wild cards so you can use them to find 741 00:28:03,919 --> 00:28:06,559 any key what you want uh and using the 742 00:28:06,559 --> 00:28:09,039 dupe exact detail command i'm wanting 743 00:28:09,039 --> 00:28:11,840 only unique instances of 744 00:28:11,840 --> 00:28:14,559 event provider and i'm asking to give me 745 00:28:14,559 --> 00:28:17,039 in the tabler form and all this if you 746 00:28:17,039 --> 00:28:19,279 observe we are using all time so we are 747 00:28:19,279 --> 00:28:21,840 searching for all the data that is there 748 00:28:21,840 --> 00:28:22,799 perfect 749 00:28:22,799 --> 00:28:25,600 i see one hit which is better than the 750 00:28:25,600 --> 00:28:28,080 last one so what i will do is i'll take 751 00:28:28,080 --> 00:28:30,799 all this and just search for it so this 752 00:28:30,799 --> 00:28:32,880 one here i'm specifically saying same 753 00:28:32,880 --> 00:28:35,200 windows event logs but i want only from 754 00:28:35,200 --> 00:28:36,080 this 755 00:28:36,080 --> 00:28:38,720 uh event provider let's see how the data 756 00:28:38,720 --> 00:28:39,600 goes 757 00:28:39,600 --> 00:28:40,880 let's unv 758 00:28:40,880 --> 00:28:44,679 control all the things 759 00:28:45,679 --> 00:28:48,159 okay here you see similar information 760 00:28:48,159 --> 00:28:50,720 like agent information event code uh 761 00:28:50,720 --> 00:28:53,279 here it says event code is 719. but in 762 00:28:53,279 --> 00:28:55,440 event action it says something like 763 00:28:55,440 --> 00:28:57,600 scheduled task operational 764 00:28:57,600 --> 00:29:01,039 log was disabled and if you also see the 765 00:29:01,039 --> 00:29:02,720 number of events that we see we only 766 00:29:02,720 --> 00:29:05,120 have five which doesn't seem right 767 00:29:05,120 --> 00:29:06,640 right 768 00:29:06,640 --> 00:29:08,720 so that means 769 00:29:08,720 --> 00:29:10,720 i cannot use 770 00:29:10,720 --> 00:29:13,679 any of the first two 771 00:29:13,679 --> 00:29:15,760 data points that 772 00:29:15,760 --> 00:29:18,000 we have searched for or we took note 773 00:29:18,000 --> 00:29:20,960 from miter and other things 774 00:29:20,960 --> 00:29:21,840 okay 775 00:29:21,840 --> 00:29:24,240 not an issue let's go move forward with 776 00:29:24,240 --> 00:29:26,559 it let's see file creation events 777 00:29:26,559 --> 00:29:28,960 let's see what we have there 778 00:29:28,960 --> 00:29:31,600 for file creation events if you remember 779 00:29:31,600 --> 00:29:33,120 we checked for 780 00:29:33,120 --> 00:29:35,600 sysmon events so let's see what sysmon 781 00:29:35,600 --> 00:29:36,799 looks like 782 00:29:36,799 --> 00:29:38,720 so for that if you remember we have 783 00:29:38,720 --> 00:29:40,880 different indices and in that's this one 784 00:29:40,880 --> 00:29:42,480 is one of them 785 00:29:42,480 --> 00:29:44,720 we will check for smart data 786 00:29:44,720 --> 00:29:47,360 i'll just pause this to see what sample 787 00:29:47,360 --> 00:29:50,720 looks like so i will do the same that we 788 00:29:50,720 --> 00:29:53,200 did for the windows event logs 789 00:29:53,200 --> 00:29:55,600 let's unroll everything and see what 790 00:29:55,600 --> 00:29:57,840 data we have so that we can use 791 00:29:57,840 --> 00:29:59,840 we can see if we can use any of these 792 00:29:59,840 --> 00:30:01,679 fields in our search 793 00:30:01,679 --> 00:30:03,520 uh creation 794 00:30:03,520 --> 00:30:05,760 so let's see 795 00:30:05,760 --> 00:30:07,360 here i'm seeing 796 00:30:07,360 --> 00:30:10,240 most of the data that 797 00:30:10,240 --> 00:30:11,919 we seen in 798 00:30:11,919 --> 00:30:13,840 windows event logs like the agent 799 00:30:13,840 --> 00:30:14,960 version 800 00:30:14,960 --> 00:30:17,200 event category event action event code 801 00:30:17,200 --> 00:30:19,679 um but event category is uh kind of 802 00:30:19,679 --> 00:30:22,320 interesting because event category says 803 00:30:22,320 --> 00:30:26,320 the bulk or the grouping sysmon does uh 804 00:30:26,320 --> 00:30:29,360 for a specific event uh action like in 805 00:30:29,360 --> 00:30:32,480 this case file and event action is 806 00:30:32,480 --> 00:30:34,240 specific to 807 00:30:34,240 --> 00:30:36,320 this particular category like category 808 00:30:36,320 --> 00:30:39,440 here is file and action is file created 809 00:30:39,440 --> 00:30:41,039 in the same way you might have actions 810 00:30:41,039 --> 00:30:43,360 for other things too 811 00:30:43,360 --> 00:30:45,600 in other categories 812 00:30:45,600 --> 00:30:47,840 the first the next thing is event code 813 00:30:47,840 --> 00:30:48,840 which is 814 00:30:48,840 --> 00:30:52,240 the system on event id that we 815 00:30:52,240 --> 00:30:53,440 gathered 816 00:30:53,440 --> 00:30:56,080 provider is the same and then file 817 00:30:56,080 --> 00:30:58,159 information we have it because this is 818 00:30:58,159 --> 00:31:00,080 related to the file category and file 819 00:31:00,080 --> 00:31:02,960 creation events we have file information 820 00:31:02,960 --> 00:31:05,440 associated with it like file directory 821 00:31:05,440 --> 00:31:07,440 name extension path 822 00:31:07,440 --> 00:31:09,360 if you think about it this will come 823 00:31:09,360 --> 00:31:11,120 handy to us because we are checking for 824 00:31:11,120 --> 00:31:13,200 a specific path according to our 825 00:31:13,200 --> 00:31:14,640 research 826 00:31:14,640 --> 00:31:17,120 and hosts information we have it as we 827 00:31:17,120 --> 00:31:18,799 see before 828 00:31:18,799 --> 00:31:22,240 we have what else we have 829 00:31:22,240 --> 00:31:23,840 we have this rule name this is 830 00:31:23,840 --> 00:31:25,919 interesting we have process information 831 00:31:25,919 --> 00:31:28,000 because what process creates that file 832 00:31:28,000 --> 00:31:29,919 we have rule name it specifically says 833 00:31:29,919 --> 00:31:32,240 technique id technique name which 834 00:31:32,240 --> 00:31:33,840 resembles two 835 00:31:33,840 --> 00:31:36,399 monitor techniques and their names 836 00:31:36,399 --> 00:31:38,960 this comes very handy too 837 00:31:38,960 --> 00:31:42,240 this is coming from the sysmon 838 00:31:42,240 --> 00:31:45,120 config file when you are configuring 839 00:31:45,120 --> 00:31:46,399 your sysmon events 840 00:31:46,399 --> 00:31:48,080 we will not go into details but from 841 00:31:48,080 --> 00:31:50,399 there you can get this 842 00:31:50,399 --> 00:31:52,960 okay good so as we are familiarized with 843 00:31:52,960 --> 00:31:56,480 our data set uh we know what category 844 00:31:56,480 --> 00:31:58,320 fields we need we need the event 845 00:31:58,320 --> 00:32:00,720 category or even the action field we 846 00:32:00,720 --> 00:32:02,320 need the because we are searching for 847 00:32:02,320 --> 00:32:04,559 file creation events we need event code 848 00:32:04,559 --> 00:32:05,519 field 849 00:32:05,519 --> 00:32:08,399 uh we need the file path because we are 850 00:32:08,399 --> 00:32:10,559 looking for a specific path and also we 851 00:32:10,559 --> 00:32:12,159 can use the process information because 852 00:32:12,159 --> 00:32:13,360 we are looking also looking for a 853 00:32:13,360 --> 00:32:15,679 specific process 854 00:32:15,679 --> 00:32:18,399 so that said 855 00:32:18,399 --> 00:32:19,840 let's check 856 00:32:19,840 --> 00:32:22,799 what we have here 857 00:32:24,799 --> 00:32:26,799 so let me paste that 858 00:32:26,799 --> 00:32:28,480 okay 859 00:32:28,480 --> 00:32:31,519 mac this is a mac issue sorry 860 00:32:31,519 --> 00:32:34,559 uh yeah let me paste that so here i'm 861 00:32:34,559 --> 00:32:37,840 saying that i want things from sysmon 862 00:32:37,840 --> 00:32:41,200 only and i want specific to event id 11 863 00:32:41,200 --> 00:32:44,399 which is equivalent to the file creation 864 00:32:44,399 --> 00:32:46,559 events like we see before 865 00:32:46,559 --> 00:32:48,399 i want process executable to be 866 00:32:48,399 --> 00:32:49,919 svchost.exe 867 00:32:49,919 --> 00:32:52,320 because if you think our notes 868 00:32:52,320 --> 00:32:53,840 we have seen that 869 00:32:53,840 --> 00:32:56,799 this one exists from it uh sorry the 870 00:32:56,799 --> 00:32:58,919 file creation events happen from 871 00:32:58,919 --> 00:33:02,399 svchost.exe and it happens in a specific 872 00:33:02,399 --> 00:33:04,399 folder or a path and that's what we are 873 00:33:04,399 --> 00:33:05,840 mentioning here 874 00:33:05,840 --> 00:33:09,039 and i'm using a thing called transaction 875 00:33:09,039 --> 00:33:11,600 it's a way to group events together and 876 00:33:11,600 --> 00:33:13,840 i'm asking splunk to give me in tabular 877 00:33:13,840 --> 00:33:16,080 form 878 00:33:17,039 --> 00:33:19,600 you get 75 results but this is where the 879 00:33:19,600 --> 00:33:22,240 true threat hunting begins 880 00:33:22,240 --> 00:33:23,440 because 881 00:33:23,440 --> 00:33:25,440 one of your uh 882 00:33:25,440 --> 00:33:26,960 if in our third handing process if you 883 00:33:26,960 --> 00:33:29,519 remember after querying is interpreting 884 00:33:29,519 --> 00:33:32,559 the results and filtering them 885 00:33:32,559 --> 00:33:35,679 interpreting results is uh difficult it 886 00:33:35,679 --> 00:33:37,600 based on your 887 00:33:37,600 --> 00:33:40,480 normal of the environment it based on 888 00:33:40,480 --> 00:33:43,840 the os behavior is based on 889 00:33:43,840 --> 00:33:45,600 the process behavior that we are 890 00:33:45,600 --> 00:33:47,519 checking so there are 891 00:33:47,519 --> 00:33:50,080 different things that can 892 00:33:50,080 --> 00:33:53,919 influence how you interpret your results 893 00:33:53,919 --> 00:33:56,559 uh while performing the threat hunt for 894 00:33:56,559 --> 00:33:58,399 this we will use a simple methodology i 895 00:33:58,399 --> 00:34:00,640 don't know where i heard this from uh 896 00:34:00,640 --> 00:34:02,399 but i heard in one of the conferences or 897 00:34:02,399 --> 00:34:03,519 talks but 898 00:34:03,519 --> 00:34:06,240 it goes like commonly observed events 899 00:34:06,240 --> 00:34:08,399 across multiple end points could be 900 00:34:08,399 --> 00:34:10,239 common or something really bad is 901 00:34:10,239 --> 00:34:11,760 happening 902 00:34:11,760 --> 00:34:14,000 that means if you see something in 903 00:34:14,000 --> 00:34:16,320 different endpoints like this one office 904 00:34:16,320 --> 00:34:18,239 microsoft office office performance 905 00:34:18,239 --> 00:34:20,719 monitor you're seeing in 906 00:34:20,719 --> 00:34:23,440 most of the endpoints that we have that 907 00:34:23,440 --> 00:34:26,320 means this might be common for a os 908 00:34:26,320 --> 00:34:29,839 behavior or our environment or something 909 00:34:29,839 --> 00:34:31,520 has already happened and we are in a 910 00:34:31,520 --> 00:34:32,399 doodle 911 00:34:32,399 --> 00:34:34,239 but let's go with the first happy 912 00:34:34,239 --> 00:34:36,159 thought that it is common in the 913 00:34:36,159 --> 00:34:38,480 environment right 914 00:34:38,480 --> 00:34:40,239 by doing that 915 00:34:40,239 --> 00:34:45,359 we are getting to this monstrous query 916 00:34:46,560 --> 00:34:49,040 oh 917 00:34:49,040 --> 00:34:51,280 we'll get to this monstrous query let me 918 00:34:51,280 --> 00:34:52,960 run it and i'll tell you what we are 919 00:34:52,960 --> 00:34:55,119 doing here we are doing the exact same 920 00:34:55,119 --> 00:34:58,079 thing sysmon event id11 svc host and 921 00:34:58,079 --> 00:34:59,760 task folder but 922 00:34:59,760 --> 00:35:00,880 we are 923 00:35:00,880 --> 00:35:04,800 removing or filtering out certain things 924 00:35:04,800 --> 00:35:06,960 that filtering happens because of os 925 00:35:06,960 --> 00:35:08,800 behavior like this one create 926 00:35:08,800 --> 00:35:11,839 exploration and elevated task this could 927 00:35:11,839 --> 00:35:15,280 happen because of software updates or 928 00:35:15,280 --> 00:35:17,119 software related to operating system 929 00:35:17,119 --> 00:35:19,599 like in this case microsoft something uh 930 00:35:19,599 --> 00:35:21,599 or a specific 931 00:35:21,599 --> 00:35:24,400 program that we have like here google 932 00:35:24,400 --> 00:35:25,920 update 933 00:35:25,920 --> 00:35:28,240 so let's say this filtering in our 934 00:35:28,240 --> 00:35:31,280 environment ccleaner is not 935 00:35:31,280 --> 00:35:32,400 a 936 00:35:32,400 --> 00:35:34,400 genuine process or not an allowed 937 00:35:34,400 --> 00:35:36,400 process you can find those things here 938 00:35:36,400 --> 00:35:38,320 too so 939 00:35:38,320 --> 00:35:40,240 it's a catch-22 940 00:35:40,240 --> 00:35:42,160 threat hunting can be 941 00:35:42,160 --> 00:35:44,800 can help you in finding your no normal 942 00:35:44,800 --> 00:35:47,520 but also if you know you're no normal 943 00:35:47,520 --> 00:35:49,920 then only you can find threshold you can 944 00:35:49,920 --> 00:35:51,119 get more software for your thread 945 00:35:51,119 --> 00:35:53,440 hunting so you know 946 00:35:53,440 --> 00:35:55,599 you can figure it out how you want to 947 00:35:55,599 --> 00:35:58,640 use it or in threat hunting but most of 948 00:35:58,640 --> 00:36:00,800 the time if you have a solid no normal 949 00:36:00,800 --> 00:36:03,440 then it is easier for you to hunt for 950 00:36:03,440 --> 00:36:05,599 different things which are abnormal or 951 00:36:05,599 --> 00:36:08,480 anomaly in the in circumstances 952 00:36:08,480 --> 00:36:09,440 okay 953 00:36:09,440 --> 00:36:12,160 a by filtering it and by the way a good 954 00:36:12,160 --> 00:36:13,680 task for you is 955 00:36:13,680 --> 00:36:16,720 you can check for all these events and 956 00:36:16,720 --> 00:36:19,040 think of ways why we filtered it because 957 00:36:19,040 --> 00:36:20,480 the reason we filtered it like we 958 00:36:20,480 --> 00:36:22,560 mentioned is operating system and stuff 959 00:36:22,560 --> 00:36:24,320 but just 960 00:36:24,320 --> 00:36:26,640 see what they do so that if you see this 961 00:36:26,640 --> 00:36:29,680 bef anytime in your hunts you can say 962 00:36:29,680 --> 00:36:32,240 that huh i know what that is and it's 963 00:36:32,240 --> 00:36:35,359 common i can filter it out or uh 964 00:36:35,359 --> 00:36:37,359 i can filter these out and if i don't 965 00:36:37,359 --> 00:36:40,000 find anything i can see for edge cases 966 00:36:40,000 --> 00:36:42,480 on might be an attacker using or a 967 00:36:42,480 --> 00:36:44,480 perpetrator using legitimate functions 968 00:36:44,480 --> 00:36:46,640 in order to do it which happens in a lot 969 00:36:46,640 --> 00:36:48,880 of ways so 970 00:36:48,880 --> 00:36:52,079 anyways after filtering we have one task 971 00:36:52,079 --> 00:36:55,520 happening on two end points interesting 972 00:36:55,520 --> 00:36:56,880 this is not 973 00:36:56,880 --> 00:36:59,760 to say suspicious uh yet but it is 974 00:36:59,760 --> 00:37:02,000 interesting to see that we have a 975 00:37:02,000 --> 00:37:05,760 certain process that is running on uh 976 00:37:05,760 --> 00:37:08,560 two things so let's search for what it 977 00:37:08,560 --> 00:37:09,920 is doing 978 00:37:09,920 --> 00:37:12,079 so let's take this 979 00:37:12,079 --> 00:37:15,040 and do a blind search 980 00:37:15,040 --> 00:37:16,640 for that 981 00:37:16,640 --> 00:37:17,440 uh 982 00:37:17,440 --> 00:37:19,680 book 983 00:37:20,400 --> 00:37:22,640 so we will we will do a blind search on 984 00:37:22,640 --> 00:37:24,240 what it is doing 985 00:37:24,240 --> 00:37:26,560 in this we are seeing uh some of the 986 00:37:26,560 --> 00:37:28,640 things like registry value sets this is 987 00:37:28,640 --> 00:37:31,440 interesting because we have seen that uh 988 00:37:31,440 --> 00:37:33,119 registry events will be created when a 989 00:37:33,119 --> 00:37:35,119 scheduled task is created 990 00:37:35,119 --> 00:37:37,839 we are seeing most of them are 991 00:37:37,839 --> 00:37:39,280 yeah most of them are related to 992 00:37:39,280 --> 00:37:40,480 registry 993 00:37:40,480 --> 00:37:42,320 but easier way instead of going through 994 00:37:42,320 --> 00:37:43,680 each log 995 00:37:43,680 --> 00:37:46,880 easier way to find about what we have is 996 00:37:46,880 --> 00:37:47,839 this 997 00:37:47,839 --> 00:37:51,839 uh let me put epic query 998 00:37:55,280 --> 00:37:57,119 so here i'm using the exact command but 999 00:37:57,119 --> 00:37:59,200 transactions i'm trying to 1000 00:37:59,200 --> 00:38:00,880 see what 1001 00:38:00,880 --> 00:38:02,079 hosts 1002 00:38:02,079 --> 00:38:03,599 are there and 1003 00:38:03,599 --> 00:38:05,760 grouping things by the host name and i'm 1004 00:38:05,760 --> 00:38:07,359 saying the event category field which we 1005 00:38:07,359 --> 00:38:10,000 saw for sysmon uh to see what exact 1006 00:38:10,000 --> 00:38:11,599 actions or even category and event 1007 00:38:11,599 --> 00:38:13,599 actions to see what exactly it is doing 1008 00:38:13,599 --> 00:38:15,359 so here we see file creation events 1009 00:38:15,359 --> 00:38:17,599 registry uh events 1010 00:38:17,599 --> 00:38:19,680 on both the endpoints this is 1011 00:38:19,680 --> 00:38:21,760 interesting because we seen the exact 1012 00:38:21,760 --> 00:38:23,760 same things that we have checked in our 1013 00:38:23,760 --> 00:38:25,599 artifacts whenever a schedule task is 1014 00:38:25,599 --> 00:38:28,640 created this is what will happen 1015 00:38:28,640 --> 00:38:30,320 okay perfect 1016 00:38:30,320 --> 00:38:31,440 but 1017 00:38:31,440 --> 00:38:34,000 any time you see these interesting 1018 00:38:34,000 --> 00:38:34,800 things 1019 00:38:34,800 --> 00:38:36,880 taken out of it and wait until it 1020 00:38:36,880 --> 00:38:38,000 becomes 1021 00:38:38,000 --> 00:38:39,119 uh 1022 00:38:39,119 --> 00:38:41,040 suspicious so here we are doing the 1023 00:38:41,040 --> 00:38:43,520 exact same thing so as we see there are 1024 00:38:43,520 --> 00:38:45,440 several ways to create 1025 00:38:45,440 --> 00:38:47,040 command line arguments for scheduled 1026 00:38:47,040 --> 00:38:49,119 tasks i'm checking for some of the 1027 00:38:49,119 --> 00:38:51,040 keywords that can happen while 1028 00:38:51,040 --> 00:38:53,920 performing schedule tasks like 1029 00:38:53,920 --> 00:38:55,040 here 1030 00:38:55,040 --> 00:38:56,720 i'm checking 1031 00:38:56,720 --> 00:38:57,839 for 1032 00:38:57,839 --> 00:38:59,599 different things but you can you can 1033 00:38:59,599 --> 00:39:01,359 filter out all this 1034 00:39:01,359 --> 00:39:04,640 let's see just plain 1035 00:39:07,839 --> 00:39:10,560 so let's check this 1036 00:39:10,560 --> 00:39:12,799 oh 1037 00:39:12,880 --> 00:39:14,400 i okay 1038 00:39:14,400 --> 00:39:15,280 this 1039 00:39:15,280 --> 00:39:17,280 if i type properly it will make sense 1040 00:39:17,280 --> 00:39:20,640 okay so here we are checking that i want 1041 00:39:20,640 --> 00:39:23,119 the i want to check for a parent 1042 00:39:23,119 --> 00:39:24,640 powershell.exe 1043 00:39:24,640 --> 00:39:28,079 and a child cmd.exe 1044 00:39:28,079 --> 00:39:29,280 to see 1045 00:39:29,280 --> 00:39:32,800 some of the key line arguments for 1046 00:39:32,800 --> 00:39:34,560 scheduled task creations 1047 00:39:34,560 --> 00:39:37,119 so this one i found it in different ways 1048 00:39:37,119 --> 00:39:39,359 i can find it in different ways one is 1049 00:39:39,359 --> 00:39:41,280 you can see in 1050 00:39:41,280 --> 00:39:43,599 microsoft documentation like you can go 1051 00:39:43,599 --> 00:39:44,640 to 1052 00:39:44,640 --> 00:39:47,598 microsoft 1053 00:39:49,760 --> 00:39:53,359 sch tasks 1054 00:39:54,640 --> 00:39:56,800 in here you can check uh what are the 1055 00:39:56,800 --> 00:39:59,119 commands that you can use using 1056 00:39:59,119 --> 00:40:01,200 microsoft like change create and stuff 1057 00:40:01,200 --> 00:40:03,760 uh you can use powershell documentation 1058 00:40:03,760 --> 00:40:05,760 similarly you can use wmi these are 1059 00:40:05,760 --> 00:40:08,079 basic keywords that you are using in 1060 00:40:08,079 --> 00:40:11,280 order to find a particular scheduled 1061 00:40:11,280 --> 00:40:14,400 task or what it is what a schedule task 1062 00:40:14,400 --> 00:40:16,720 is doing right 1063 00:40:16,720 --> 00:40:18,000 perfect 1064 00:40:18,000 --> 00:40:19,760 let's say with our 1065 00:40:19,760 --> 00:40:21,680 previous things if we're using registry 1066 00:40:21,680 --> 00:40:23,200 and file creations we determined that 1067 00:40:23,200 --> 00:40:25,359 particular schedule task daily magnus 1068 00:40:25,359 --> 00:40:29,920 task is uh there is a suspicious one and 1069 00:40:29,920 --> 00:40:32,640 in order to check what it is doing we 1070 00:40:32,640 --> 00:40:34,640 saw that 1071 00:40:34,640 --> 00:40:36,800 process creation events in that process 1072 00:40:36,800 --> 00:40:39,359 creation events we see a command line 1073 00:40:39,359 --> 00:40:42,480 which matches our 1074 00:40:42,800 --> 00:40:44,880 the command that we are saying here 1075 00:40:44,880 --> 00:40:48,319 c slash c start that means command.txt 1076 00:40:48,319 --> 00:40:51,240 is used to start 1077 00:40:51,240 --> 00:40:53,119 cleanup.exe and we don't know what 1078 00:40:53,119 --> 00:40:55,760 cleanup.exe is or we don't know anything 1079 00:40:55,760 --> 00:40:56,960 about but we just search for the 1080 00:40:56,960 --> 00:40:59,680 keywords and this is what we found in it 1081 00:40:59,680 --> 00:41:02,160 and we saw powershell.exe and if you 1082 00:41:02,160 --> 00:41:04,640 think about it think of a general things 1083 00:41:04,640 --> 00:41:06,440 like temp folder 1084 00:41:06,440 --> 00:41:09,760 cleanup.exe it is using powershell.exe 1085 00:41:09,760 --> 00:41:12,720 to spin up command.exe and starting 1086 00:41:12,720 --> 00:41:14,640 something from a 1087 00:41:14,640 --> 00:41:16,240 cleanup folder 1088 00:41:16,240 --> 00:41:17,760 okay let's see what cleanup folder is 1089 00:41:17,760 --> 00:41:21,359 doing sorry cleanup.ex is doing so for 1090 00:41:21,359 --> 00:41:24,079 that we will do the basic thing 1091 00:41:24,079 --> 00:41:25,839 if i type it 1092 00:41:25,839 --> 00:41:29,200 so cleanup.exe we have 113 events again 1093 00:41:29,200 --> 00:41:31,680 the best way to do what actions it is 1094 00:41:31,680 --> 00:41:33,280 performing is 1095 00:41:33,280 --> 00:41:34,560 using the 1096 00:41:34,560 --> 00:41:36,240 specific command that we have checked 1097 00:41:36,240 --> 00:41:38,400 like tdp and here we are seeing 1098 00:41:38,400 --> 00:41:40,000 different things file created process 1099 00:41:40,000 --> 00:41:41,839 terminated process accessed blah blah 1100 00:41:41,839 --> 00:41:43,040 blah 1101 00:41:43,040 --> 00:41:45,839 this is a good task now we have searched 1102 00:41:45,839 --> 00:41:47,760 for the scheduled task which is needed 1103 00:41:47,760 --> 00:41:49,599 we found something which looks 1104 00:41:49,599 --> 00:41:51,680 suspicious and 1105 00:41:51,680 --> 00:41:53,440 we have seen several things that we can 1106 00:41:53,440 --> 00:41:56,720 do it so take any of your things like 1107 00:41:56,720 --> 00:41:59,520 network creation events or 1108 00:41:59,520 --> 00:42:01,599 any network detected events image loaded 1109 00:42:01,599 --> 00:42:02,480 events 1110 00:42:02,480 --> 00:42:04,079 here we are checking for 1111 00:42:04,079 --> 00:42:07,040 so let's go back to the 1112 00:42:07,040 --> 00:42:09,920 presentation 1113 00:42:12,640 --> 00:42:14,240 so 1114 00:42:14,240 --> 00:42:16,720 here i we are just checking for one such 1115 00:42:16,720 --> 00:42:19,920 events process creation and we have seen 1116 00:42:19,920 --> 00:42:21,520 this particular thing that we have seen 1117 00:42:21,520 --> 00:42:23,920 before that something is starting from a 1118 00:42:23,920 --> 00:42:25,119 temp folder 1119 00:42:25,119 --> 00:42:26,800 so 1120 00:42:26,800 --> 00:42:29,920 think of it cleanup.txt starting with 1121 00:42:29,920 --> 00:42:32,560 cmd.exe using powershell from a temp 1122 00:42:32,560 --> 00:42:35,119 folder on the host that we have checked 1123 00:42:35,119 --> 00:42:38,079 a suspicious or an interesting scheduled 1124 00:42:38,079 --> 00:42:39,920 task is present 1125 00:42:39,920 --> 00:42:42,319 this starts your haunt again most of the 1126 00:42:42,319 --> 00:42:45,359 time hunting is chasing that cruise but 1127 00:42:45,359 --> 00:42:46,160 uh 1128 00:42:46,160 --> 00:42:49,440 with a solid data backing up like if one 1129 00:42:49,440 --> 00:42:51,280 data says something is suspicious pack 1130 00:42:51,280 --> 00:42:53,359 it up with another data which produces 1131 00:42:53,359 --> 00:42:56,000 similar artifacts 1132 00:42:56,000 --> 00:42:59,440 and that's it but there is more than 1133 00:42:59,440 --> 00:43:01,440 that to threat hunting we only checked 1134 00:43:01,440 --> 00:43:04,000 one such events so you can go ahead and 1135 00:43:04,000 --> 00:43:06,880 check what else is present in all the 1136 00:43:06,880 --> 00:43:09,359 data or all the artifacts that we 1137 00:43:09,359 --> 00:43:10,640 gathered 1138 00:43:10,640 --> 00:43:13,440 all right let's recap everything with a 1139 00:43:13,440 --> 00:43:16,240 small template 1140 00:43:16,560 --> 00:43:19,280 we are using a template for that uh the 1141 00:43:19,280 --> 00:43:21,119 title of our hunt is hunting for 1142 00:43:21,119 --> 00:43:23,040 adversary schedule 1143 00:43:23,040 --> 00:43:26,480 uh we created this on the date 1144 00:43:26,480 --> 00:43:30,079 we are notifying noting our hypothesis 1145 00:43:30,079 --> 00:43:32,480 uh this is our uh 1146 00:43:32,480 --> 00:43:34,960 this is our hypothesis in in 1147 00:43:34,960 --> 00:43:37,440 the narrow hypothesis that we got we are 1148 00:43:37,440 --> 00:43:39,119 mentioning some of the miter techniques 1149 00:43:39,119 --> 00:43:41,119 and tactics we are using simulation 1150 00:43:41,119 --> 00:43:42,720 techniques like this is very important 1151 00:43:42,720 --> 00:43:44,240 if you are simulating something to in 1152 00:43:44,240 --> 00:43:45,280 order to 1153 00:43:45,280 --> 00:43:47,520 perform threat hunting or detections 1154 00:43:47,520 --> 00:43:49,119 this is interesting you can note what 1155 00:43:49,119 --> 00:43:51,200 simulation has performed 1156 00:43:51,200 --> 00:43:53,599 and then we are using a proposed search 1157 00:43:53,599 --> 00:43:55,680 query here this query could be anything 1158 00:43:55,680 --> 00:43:57,680 i just mentioned the last search query 1159 00:43:57,680 --> 00:43:59,359 but if you can mention all your search 1160 00:43:59,359 --> 00:44:02,160 queries in it it helps if someone wants 1161 00:44:02,160 --> 00:44:04,800 to take this template and wants to 1162 00:44:04,800 --> 00:44:06,560 reproduce these steps it helps them a 1163 00:44:06,560 --> 00:44:07,680 lot 1164 00:44:07,680 --> 00:44:10,160 and here i'm noting some of the 1165 00:44:10,160 --> 00:44:12,000 limitations of my third hunting like i 1166 00:44:12,000 --> 00:44:14,160 mentioned if something didn't turn up in 1167 00:44:14,160 --> 00:44:16,880 thread hunting it's also interesting if 1168 00:44:16,880 --> 00:44:19,440 you remember in our case we haven't seen 1169 00:44:19,440 --> 00:44:21,839 any logs related to windows event logs 1170 00:44:21,839 --> 00:44:23,520 and also task scheduler operational 1171 00:44:23,520 --> 00:44:25,359 which says it got disabled because there 1172 00:44:25,359 --> 00:44:27,040 was no space or something 1173 00:44:27,040 --> 00:44:29,599 so this is important because 1174 00:44:29,599 --> 00:44:33,359 this helps in getting that visibility of 1175 00:44:33,359 --> 00:44:36,160 where how and why i'm not getting this 1176 00:44:36,160 --> 00:44:37,920 particular data if i'm not getting how 1177 00:44:37,920 --> 00:44:40,640 can i get it and we also observed when 1178 00:44:40,640 --> 00:44:42,720 using this uh our methodology for 1179 00:44:42,720 --> 00:44:44,880 command.exe where you where we run 1180 00:44:44,880 --> 00:44:46,720 through different artifacts 1181 00:44:46,720 --> 00:44:49,359 only we saw workstation one has 1182 00:44:49,359 --> 00:44:52,000 cleanup.exe but if you remember our 1183 00:44:52,000 --> 00:44:53,760 scheduled task it is running on two 1184 00:44:53,760 --> 00:44:56,319 workstations why that's the case these 1185 00:44:56,319 --> 00:44:58,079 questions helps you answer a lot of 1186 00:44:58,079 --> 00:45:00,880 other things which direct doesn't always 1187 00:45:00,880 --> 00:45:03,359 mean that you want to find this 1188 00:45:03,359 --> 00:45:05,680 grand apt that you're seeing but these 1189 00:45:05,680 --> 00:45:07,839 are also byproducts of your threat 1190 00:45:07,839 --> 00:45:11,680 running it helps you achieve that 1191 00:45:12,000 --> 00:45:15,119 on to know unknown unknowns and unknown 1192 00:45:15,119 --> 00:45:16,640 knowns 1193 00:45:16,640 --> 00:45:19,680 to help secure internet products good 1194 00:45:19,680 --> 00:45:22,079 and the last what we did we find we 1195 00:45:22,079 --> 00:45:24,640 found a particular task called 1196 00:45:24,640 --> 00:45:28,079 magnum tempest id cleanup on a couple of 1197 00:45:28,079 --> 00:45:30,800 computers and a cleanup.exe is also 1198 00:45:30,800 --> 00:45:32,400 launched from 1199 00:45:32,400 --> 00:45:33,680 a 1200 00:45:33,680 --> 00:45:36,000 you know a strange location like temp 1201 00:45:36,000 --> 00:45:38,079 and also has some interesting artifacts 1202 00:45:38,079 --> 00:45:41,119 even related to network artifacts 1203 00:45:41,119 --> 00:45:43,280 perfect like i mentioned uh the 1204 00:45:43,280 --> 00:45:45,359 detection coverage and visibility uh 1205 00:45:45,359 --> 00:45:48,319 here through our hands we have mentioned 1206 00:45:48,319 --> 00:45:50,560 we have noted that event logs are not 1207 00:45:50,560 --> 00:45:51,520 there 1208 00:45:51,520 --> 00:45:53,520 or at least specific to schedule tasks 1209 00:45:53,520 --> 00:45:56,319 are not there so we want to see a way we 1210 00:45:56,319 --> 00:45:58,160 can get that data 1211 00:45:58,160 --> 00:45:59,359 we are 1212 00:45:59,359 --> 00:46:01,520 by the looks of it we have not enabled 1213 00:46:01,520 --> 00:46:03,280 that operational 1214 00:46:03,280 --> 00:46:05,440 channel so we want to enable it so that 1215 00:46:05,440 --> 00:46:07,760 we can get more data and weigh the 1216 00:46:07,760 --> 00:46:10,720 benefits and risks of enabling it we 1217 00:46:10,720 --> 00:46:13,119 also seen that workstation one only 1218 00:46:13,119 --> 00:46:15,359 produced the cleanup.exe process 1219 00:46:15,359 --> 00:46:17,200 creation we didn't see the works other 1220 00:46:17,200 --> 00:46:21,279 workstation uh performing it 1221 00:46:21,359 --> 00:46:23,839 so that's our visibility coming to our 1222 00:46:23,839 --> 00:46:25,760 detection coverage like i said you can 1223 00:46:25,760 --> 00:46:29,680 stop your hunts at the findings and 1224 00:46:29,680 --> 00:46:31,599 documentation using the 1225 00:46:31,599 --> 00:46:32,930 template that we have 1226 00:46:32,930 --> 00:46:34,240 [Music] 1227 00:46:34,240 --> 00:46:36,880 we did here but we can also move it a 1228 00:46:36,880 --> 00:46:39,119 little further we can use 1229 00:46:39,119 --> 00:46:41,599 it for our detection coverage here we 1230 00:46:41,599 --> 00:46:44,160 are saying that 1231 00:46:44,160 --> 00:46:46,160 we can use our query whichever we used 1232 00:46:46,160 --> 00:46:48,560 for the thread hunting uh queries like 1233 00:46:48,560 --> 00:46:53,119 our process creation events uh from uh 1234 00:46:53,119 --> 00:46:53,920 or 1235 00:46:53,920 --> 00:46:57,520 we can use our based on our no normal 1236 00:46:57,520 --> 00:47:00,720 our filtering capabilities we have seen 1237 00:47:00,720 --> 00:47:02,400 we have filtered everything and only one 1238 00:47:02,400 --> 00:47:05,359 event was left we can use that 1239 00:47:05,359 --> 00:47:07,520 as our detection query you can use a 1240 00:47:07,520 --> 00:47:10,240 combination of them right but that is 1241 00:47:10,240 --> 00:47:13,119 only one portion of what 1242 00:47:13,119 --> 00:47:16,319 we did there are several other use cases 1243 00:47:16,319 --> 00:47:18,400 in this schedule thus making unusual 1244 00:47:18,400 --> 00:47:20,880 communications uh 1245 00:47:20,880 --> 00:47:23,119 it is downloading powershell cradles and 1246 00:47:23,119 --> 00:47:24,960 several other things you can either 1247 00:47:24,960 --> 00:47:27,760 create hunts for each of each and every 1248 00:47:27,760 --> 00:47:29,839 of these or you can hunt for the 1249 00:47:29,839 --> 00:47:32,400 behaviors like we we can do let's say 1250 00:47:32,400 --> 00:47:34,000 scheduled test 1251 00:47:34,000 --> 00:47:36,559 how it is based on the artifacts that we 1252 00:47:36,559 --> 00:47:38,800 gathered so you can you can use either 1253 00:47:38,800 --> 00:47:40,640 one of them right 1254 00:47:40,640 --> 00:47:43,119 these are all the uh 1255 00:47:43,119 --> 00:47:46,079 detections that we can create uh if we 1256 00:47:46,079 --> 00:47:48,319 have gathered all the tasks and if we 1257 00:47:48,319 --> 00:47:50,960 can do this information and if you see 1258 00:47:50,960 --> 00:47:53,680 here hidden scheduled tasks if you 1259 00:47:53,680 --> 00:47:56,720 remember uh i i said if you have some 1260 00:47:56,720 --> 00:47:59,040 time we will talk about haphnium 1261 00:47:59,040 --> 00:48:02,720 this is what it did it hide hid its 1262 00:48:02,720 --> 00:48:05,040 scheduled tasks from 1263 00:48:05,040 --> 00:48:08,400 viewing it it does using that sd key 1264 00:48:08,400 --> 00:48:10,559 that we spoke about in registry where it 1265 00:48:10,559 --> 00:48:13,920 automatically removed that 1266 00:48:13,920 --> 00:48:17,440 free using com i guess uh but it removed 1267 00:48:17,440 --> 00:48:19,200 it and 1268 00:48:19,200 --> 00:48:21,359 when when you remove that you don't have 1269 00:48:21,359 --> 00:48:23,359 the connection between what you see 1270 00:48:23,359 --> 00:48:25,599 versus what is what scheduled task is 1271 00:48:25,599 --> 00:48:27,760 running so you cannot uh 1272 00:48:27,760 --> 00:48:29,280 it gives a 1273 00:48:29,280 --> 00:48:32,400 a nice behavior to evade uh 1274 00:48:32,400 --> 00:48:34,800 the regular hunts that you have so you 1275 00:48:34,800 --> 00:48:36,000 can also 1276 00:48:36,000 --> 00:48:37,920 check for that particular behavior 1277 00:48:37,920 --> 00:48:39,680 something uh 1278 00:48:39,680 --> 00:48:42,000 like let's say sd 1279 00:48:42,000 --> 00:48:45,280 registry sub key is deleted uh using 1280 00:48:45,280 --> 00:48:47,920 cis1 or any other etr that you have so 1281 00:48:47,920 --> 00:48:50,720 these queries that you use are specific 1282 00:48:50,720 --> 00:48:53,920 to ed uh splunk here but you can convert 1283 00:48:53,920 --> 00:48:56,160 them into and use it like we said to any 1284 00:48:56,160 --> 00:48:57,680 others 1285 00:48:57,680 --> 00:48:59,119 finally 1286 00:48:59,119 --> 00:49:01,520 that's our talk uh all the differences 1287 00:49:01,520 --> 00:49:05,040 uh i have followed is mentioned here 1288 00:49:05,040 --> 00:49:07,200 and thank you so much for everyone for 1289 00:49:07,200 --> 00:49:10,400 being patiently watching this uh we ran 1290 00:49:10,400 --> 00:49:13,359 through some of the artifacts uh but 1291 00:49:13,359 --> 00:49:15,760 please go through those artifacts one by 1292 00:49:15,760 --> 00:49:19,920 one you can find your own rhythm in uh 1293 00:49:19,920 --> 00:49:21,119 find in 1294 00:49:21,119 --> 00:49:23,200 searching for those artifacts we will be 1295 00:49:23,200 --> 00:49:25,200 releasing a blog post which has detailed 1296 00:49:25,200 --> 00:49:27,359 information on everything so 1297 00:49:27,359 --> 00:49:29,200 please go ahead and check please join 1298 00:49:29,200 --> 00:49:32,480 our discord channel if possible so thank 1299 00:49:32,480 --> 00:49:35,480 you