Good morning, good evening, and good afternoon to those at DEF CON. I am Danny Henderson. I go by Bandito or Bandit Zero. I am part of the forensics team, and we're going to learn how to use chainsaw to identify malicious activity. Now, what is chainsaw, you ask? Well, we're going to go over that. This is going to be quick. The slides are going to be quick because we're going to get right into the action. But to give an overview of chainsaw, it is an incident response tool that you can use to quickly gather the data from the Windows event logs. It is a command line tool that uses a SIGMA rule detection logic. You can either search by keyword, regex, or specific IDs, or you can hunt using its built-in tools or SIGMA rules. The useful thing about it is that you can. You can export the data to text files or csvs to put in a spreadsheet. So you want to carve more information out. So let's get right into it. Sigma rules. Now this is a generic signature for sims that is, like I said, targeted Windows events. So it is to event logs as Yara is the malware, and we have an example here from integer. In fact, of how you would generally set up a sigma rule. Now, without further ado, let's let it rip. So the first thing we want to do is just pull up chainsaw itself. You get the nice view of the console with the use with the instructions of how to use it. So let's take a look at the help. Same thing in version, which is already on the screen. But There we go. Well, that's it. We want to go to various each part. So let's go. We're gonna go for 2 things. There's 2 things that we're gonna use throughout the event. So let me clear this log right quick. There's 2 aspects that we're gonna go for. Search is gonna be our first one. Search and hunt are the ones that we use the most. Now, searching, as I mentioned in the first slide, and one of the slides that you can serve through the event Ids or keywords, or even use rejects. The hunt is where you're gonna be doing is a little more automated. So let's go through the search first. So we want to look into the search help. So we're doing this case step by step. Now the flags here you can put the search for case insensitive. Now this is only usable for string search. Because I've attempted this with the rejects, and that's not gonna work. Now we can use the flags for either the events. Red X and strings, and we may want to make an output of it. So let's begin on that. So we also this for the obsidian event. We have kill chain one in 3. We're gonna start with kill chain. 3 for the search aspects. So we got 2 posts that was part of the compromise. So we're gonna use that for the example of how rejects can help you identify what's going on. So what we're gonna do here, we're gonna use the event Id 4104, which is associated with the PowerShell. We're gonna use the event Id 4104, which is associated with the PowerShell. And let it rip. So let's scroll up for just a bit. Let's scroll up as much as we can, because things happen very fast, and it may actually be better if we just did it more. Let's let it go slowly. Now note it searched through 311 logs, and this is part of the output that it found. You have diff many attributes such as the event data that paths what that text is. And for this is a big chunk. So we broke this. Now next we're gonna do the strings next. Oh, there's 2 things that we could do it for the strings. We're gonna go with the we're gonna remove the insensitive one. We're not gonna use that one. We will instead just use as is. You will find in this example. This actually did work. So in this case you see signs of cover roasting. So only one event was found, which is part of the Windows event logs. And this is pulled from the PowerShell operational log. 1, 2, 3. So we found that aspect. Now we're going to do something different. We're gonna do a regex. Now this, as I mentioned before, is also able to do regex. This time. We're gonna do another. Ah, device, which was the domain controller. Think about it. Oops, what was that? Not a reason why. Let's get one moment. Oops, that's why. Now, here we do have this gone fast. So first we're going to do two things. We're going to do more just to go through it slowly. So here we can see PS exec service or PS executive service. The create keys, sysmon. We have a service here from the sysmon. Now, let's do this. That's to show you another way of seeing how much did we grab. So most of this has been part of the service. Okay, so now we're going to go ahead and create a new service. Next up, now we want to do, oh, and here we actually have PS exec with one of the keys. So that's another example of what we have of a different one. So the Regix was used to find the service as well as the PS exec, which we found with the RDP key associated. And now we want to save it to an output. So there we go. Okay, so now we're going to go ahead and create a new service. Here we go. All right. Let's go ahead and create a new service. So let's go ahead and create a new service. On one hand, we do have it as an output on here. On the other hand, it doesn't look the greatest. But hey, you do have a way of putting it on here. And even more, let's take a look at the downloads. Okay, now back to the next part. So then we're going to move on to the other capability of chainsaw. Now, this is the other aspect called the hunt. This we can use the built-in tools of hut. So we're going to go with. Do some cleanup here. Okay, clean up done. First, we're going to take a look at the help. Now there is very. There are various flags. We can. We can save it as a C. As the individual. As the individual CSV files. We can ask it to not use the built-in tools. Go full, which. This can be useful for the PowerShell, because some of it's going to truncate. We can also leverage the lateral all. So let's do this one first. We're going to check on one of the workstations. This one's going to be with the built-in tools. So we went back to the actual plant, the one that we wanted. So we're going to do a hunt. So now we're going to run that once more. We didn't add anything new to it, but we do have a nice outline, as well. output out of this. Now we also see that it takes everything out. So here we at least have some activity from the built-in logic, such as the security audit being cleared at 0.35. We also have users added to the local group. We have indications of brute forcing. Now we're going to, let's actually go to workstation 2. Then we're going to add lateral all to if there's indications of lateral movement. Now here you have potential activity related with lateral movement, such as the user added into the local group, as well the system logs being cleared, and the 4624 successful connections where you see a lot of connections. On to workstation 2, whereas others you see a system associated with it. Now what we want to do next is use the SIGMA rules. So this one's handled differently. You have to, in order to use the SIGMA rule, you have to add a certain, you have to add multiple flags to it so we're going to put rules so we've added the signal rules and then mapping uh let's do more just uh not have it take everything at once so no no one screens are scrolled on here now this one is going through 835 detection rules out of the 311 event logs of those detection rules we see 90 of them were not loaded so here we see activity that was not associated with the built-in logic so powershell indications now when i mentioned about the full this part here is where it talks about the use the full flag to show all content so we're probably going to do that on the next go um i'm going to cut off here and this time we're going to go through this fully so we can scroll up and see the other events that happens at once it'd be easier that way so we're letting it let the chainsaw rip through once more the nice thing about this is that it can go a through the logs very quickly now we see indications of the user being added create audit and as i mentioned before more suspicious activity now sometimes these may be noise itself suspicious file creation these may be more noise but what this allows you to do is it gives you it gives you a little bit more of a sense of what's going on in the file that's probably what we're not going to talk about in this seo but one of the nice things about to analyze a file with data effects so you can use this a lot of times with a lot of other things but it's also a great way of analyzing a file in short terms they're able to analyze it and if you do decide that this to be an option to analyze it so despite the automation behind it you still have to be part of you still have to have the analysts behind it to decipher what's going on and mentioned earlier we're going to add the csv flag now you see that it for here it created multiple file on csv files one space off of the external rules and then also the built-in logic so it separates them so let's open this back up and take a look at the csv itself yep this folder and we're going to open up the external rule here yep so it'll use the system time of the activity as well as the id the event id associated the detection rules and the data and let's take a look at the file suspicious file loading so you see indications of suspicious modules that's worth investigating to rule out if this was malicious or not but the thing about the tool is that it gives you a faster way to analyze the data treat it as a collector a triage collector that's the important thing about this and we're just going to open it with pluma just to see the actual csv itself and that is actually a way of chainsaw now if you want to use chainsaw for your own investigations foreign you can grab it at github github just remember the installation side remember to tag the sub modules to recurse because if you don't you will not have access to the attack samples or the Sigma rules to work with I'll leave you all with one final note chainsaw has been a great tool to which has helped us with the investigation for the obsidian project and every and I personally recommend everyone having this in their library when they're doing their own event their own incident investigation so penny for the questions I will see you all later foreign