hello and welcome to project obsidian this station is a cyber threat hunting station the title of this section is called sniffing compromise hunting for bloodhound presented by me serial or serial killer a little bit about myself I've been in the security space for about five years I also enjoy playing video games I enjoy music I used to love playing live as a DJ when I'm not doing those things I am trying to expand my knowledge of all things security technology and life in general in this section we will learn briefly about threat hunting or at least an intro into threat hunting what is bloodhound what it does what it's used for we'll also be talking about what the ingester is what it actually does when the ingester is ran a brief overview of the UI not too much but yeah we will also be covering how to hunt for bloodhound right and we'll be using network and host level activity to detect this so threat hunting what is it to me threat hunting is a practice to proactively look and search and understand what you know and we don't know within an environment all right you can use start hunting to confirm that windows event logs are actually going to your scene right that would be an unknown unknown and unknown would be if somebody with an organization had to turn off the shipping of those logs from windows to your scene and you could use threat hunting to discover that or if some of the data is misconfigured corrupted any of that kind of stuff now that we have a short understanding of what threat hunting is let's talk about bloodhound so bloodhound is a tool used by many security professionals there either on the red team or blue team but it's also used by adversaries and the reason for this is because bloodhound gives a great view of the data when it comes to windows active directory so it's used for enumeration it gives you access to information like user groups workstations servers that are connected to a windows ad it also gives you the ability to query this data with its own query language so bloodhound is comprised of two components the ui or the gui the graphic user interface which this is usually installed on workstations that are ingesting the data and this is what it looks like there is a search at the top left each uh thing within an ad is represented as a node so here we have three user nodes on the left hand side and a group node on the right hand side the lines between them is a relationship between them so you can query for misconfigurations and relationships between different nodes or different ous users servers so on and so forth and you can see this picture on the bloodhound read the docs website the other part is the ingester or the collector right so the ingester the collector right it's uh usually a binary egg or a script there are two there's like three methods of ingesting the ones that we are currently looking at is the dot exe which is called char pound and the powershell script which is sharp pound.ps1 the ingestor or collector what it does it queries domain controllers via ldaps and it's trying to gather information using windows apis for user information security groups domain joined workstations and servers the other thing that it does is that it connects with the other high end partners connects to workstations that are online, and it talks to them via RPC via SMB. What it's trying to collect is user sessions, logged on users, more workstation information, and local group members. Now that we have a good understanding of what Bloodhound is and the various parts of it and the components of it, let's talk about how it's used, or when it's used. Usually it's used by adversaries after a compromise has happened or once they get into a network. Let's say they get access to a server or workstation. This is when they would run Bloodhound to see if they can find a misconfiguration, an overly permissive security group or a user that has access to a network. The other way that it's used is by security teams. They do an audit of a Windows AD, or at least some of the organizations I've worked with. That's what they do. But for us, what this means is that if we are hunting for Bloodhound, we are assuming that the adversary has gotten it. We want to know. We want to know if they have ran Bloodhound, or if they have it, how can we tell if they will? What kind of detections we can set up there. So now that we've talked about Bloodhound and how it's being used and a little bit about what threat hunting is, I say let's go hunt. Let's go find this within the data set that we have. I didn't want to use too many slides, so this is going to be a somewhat prerecorded live demo. So let's go hunt. Okay. We are now inside my virtual machine that has access to our Splunk instance that's containing the data that we're going to be working with today. So on the top left-hand side, under apps, we have search and reporting. This is where we want to go so that we can conduct searches. The first thing we want to know is what kind of indexes or data we're working with. So we're going to go over here and go to date range. We're going to choose between, and we're going to select February 18th through June 18th. And I'm doing this because this is when we ran our simulation. The simulation is just an activity when somebody within your organization or a third party comes in and pretends that they are an adversary. It's a good way to test your detections and your threat hunting. All righty. So let's start with... What I'm entering here is a query that I found online to get all the indexes that exist within this time frame. Okay. So let's go ahead and do that. So here we see we have HTML, main, OS query, PCAPS, summary, Cercada, syslog, sysmon, Velociraptor, WinEvent logs, and Zeek. Awesome. All righty. Now that we know what kind of data we have available to us, let's start with a simple query. Let's start with Bloodhound. Okay. So we get a singular hit. This happened on Saturday, February 19th. But if we look at this, this is not well parsed. So there's probably a problem here. All right. Okay. So we see that this is unparsed, right? Well, I always like to take notes on everything that I do, especially for threat hunting. Notes are very important. So let's go over here to Visual Studio Code and let's start a note. Okay. I like to use Markdown for everything that I do. You choose your preferred method. So what did we do? We ran... We ran Bloodhound. Okay. And the result is an unparsed document, but we do get a host name, right? So let's save that. We do get a host name. Okay. RUP0. Cool. Well, now that we have this, well, usually when Bloodhound has run, it's either ran in memory or it's ran from disk. In order to run it from disk or from memory, we need to download something. So I remember... I remember back when we did the other search that we had sysmon and winEventLogs. I know from working with sysmon and winEventLogs that sysmon has an event ID for file creation. So let's see if we can find that. First let's figure out what do we have inside those indexes? So here I put index in. So this makes it an array that it's searching in both, right? Another way that you could do this is by using OR. So you could do index equals sysmon OR, capital OR, index equals winEventLogs. This will give us the same results. I just prefer the other way that I did it. It's much cleaner to read. All righty. So looking at these events, we see that this is a file created. It has these fields, a directory, an extension, a name, a path. This seems useful for what we're trying to get. But this... I don't want to keep looking through every single one. Every single event like this. So let's see if we can come up with another query that will help us and clear things up a bit. All righty. So we can do index in and then let's do stats. Let's get a count by win log that event ID. So this will give us the count, like how many times a certain Windows event log ID has happened during this time period. Okay. So we get a bunch of them here. Event ID one, we got 3,000. Oh, no, 5,000. Keeps going up. So we'll give this a little bit for it to finish. All righty. So we see a lot of different Windows event IDs here. But I specifically said six. All right. So let's see if we can figure out sysmon file create event ID. Oh. Here we go. So it looks like sysmon event ID 11 is for file create. Okay. Taking this, let's go and put this into our search. All right. All right. So we want to, so we can append this to the top of our search. So win log dot event underscore ID equals 11. That means we're looking specifically at Windows sysmon event ID 11. Let's see how many we get. Okay. Looks like we get around 8,000 events. 7,000. I know. 77,000 events. Okay. That's quite a bit of events. Okay. We can look at the events over here. That's the same. We got file information. Let's see if we can make this into a pretty table that will help us identify a bit more of what's going on here. All right. So let's add the table. So what things do we want? Let's do table. And I'm pretty curious about this information. So let's do host dot name. Let's see where it lives. File dot name. File dot path. And I think that's good for now to start. There we go. Okay. Okay. We get a bunch of events. A lot of dat files. Looks like some sort of health trick. That's cool. All right. Well, we see that there is a file dot extension. Okay. So maybe we can use that to our benefit, right? We're just looking for .exes and .ps1s, which is PowerShell scripts. So let's go back up here, and let's add file.extension. Let's do the same thing. Let's do in exe and ps1, right? Let's see. All right. That's much better. We got 4,000 events, a little bit over. We get a bunch of information on exes, a lot of temp files, probably updates. Who knows? But this is a much smaller data set that we can work with. Let's see if we can continue scoping down our search and seeing if we can figure something out. If you remember, we did take notes. So let's see if we can use this to help us with our search. Well, we have this host name that we know showed a singular log that had Bloodhound in it. So why not take this and put it in our search? All right. This is the place that we suspect. Let's see. Okay. We get some results. 700. 730-ish. Not bad. But still looking at all this, nothing really pops out. We can... Go through all this, or we can, you know, look for filename. And we can do something like bloodhound.exe. Oh. But is it bloodhound.exe? I don't think so. Let's go look at, like, GitHub. Let's go see what the collector is actually called. We have these collectors here. Oh, it's Sharphound. Let's copy that. Let's go over here. Replace this. See if we get any results. No. The other one is .ps1, let's give that a shot, doesn't look like it, maybe it's case sensitive or insensitive, who knows, let's try it all, okay, so looking at this, it doesn't seem like SharpHound was downloaded or created on the system, but we do get a lot of different events here, right, so myself being a detection engineer, something that I would set up here is, hey, I want to know if and when .ps1, let's give that a shot, doesn't look like it, maybe it's case sensitive, maybe SharpHound.exe or SharpHound.ps1 is being ran within my environment, so we could do something like this, where we have this type of search, maybe not this host name, right, but we would look for file.name in, and we can do SharpHound.exe, SharpHound.ps1, and then if this ever returns a result, hey, notified, so since this is a pretty good search, I'm going to put this over here in my notes, for file creation, because this is Markdown, I'm going to do this, right, so this gave us no result, either we did not log this, or Bloodhound slash SharpHound was ran from memory, right, okay, so what do we do now? Well, if we think back to it, to our first query. When we were looking at indexes, we did have pcaps, Zeek, Manoa's query, right, so maybe SharpHound will work there, so let's just do a broader search, oh, look at this, so this console is coming from Windows PowerShell logging, awesome, that's another way we can search for this, right, Windows PowerShell logging, let's see if some things are being run. Here is another event that doesn't look parsed, but looks like most of this is coming from Yeah, executing a remote command from the same hostname. This is coming from WinEventLogs, right, yep, WinEventLogs, WinLogEvent4104, interesting, interesting. Okay, so index equals WinEventLogs, WinEventLogs, and then, what is the event, WinLog.EventID, okay. WinEventLogs 410, okay, get a thousand results from this, okay, okay, this is cool. But we're looking specifically for SharpHound. This is . . . Let's see. doesn't like maybe this there's a couple places where this sharpens showing up so this is another way that we can set up a detection for this all right do do there's not much we get the scripts but it's not we're necessarily parsed there's no file name to this either so I think this would be a broader I think this would be a broader I think this would be a broader detection the other place that we can look for is in Zeek Network telemetry Network index so let's see what's going on with Zeek, okay I get a bunch of information well if we remember back to my slides we know that Bloodhound uses SMB and LDAPS right I know that SMB uses 4 4 4 5 and 1 3 9 so let's see if we can find any of this okay this search shows us about 11,000 events that's quite a bit it looks like we have a pretty big spike here so let's see can you manipulate this data at this so we can understand it a bit better now we're gonna do values and this is just so that we are looking for the specific count of a certain value I'm going to do ID dot response port now I'm getting this from this right here okay so let's see oh awesome this is pretty indicative that something's going on with RDP 01 340 counts for using 445 as an RDP host that's pretty strange right let's see if we can use other stale stats here I remember that there was a type there's an IP address there's very different types of source types as these are connections so let's see what type of source type Zeek has source by service okay so there's a bunch of connection let's just do my source type actually that didn't work okay sorry about that okay so we have connection history connection summary DNS files and TLM SMB SMB mapping let's see if we can find the events for this okay ah so this is for a file file server file open file open okay close these out until that let's let's see what this has I guess it is connections from workstations to our file server oh this is interesting so this is RDP talking to workstations okay so maybe we keep this sorts type let's see if we can do stats count on values using a host name right a host name by server DNS computer name. Oh, did I misspell something? Computer name, oh, there we go, awesome. So, if we look here, we see that RP01 has been getting around. Bunch of events going to workstation one, two, three, so on and so forth, it looks like mostly all of them. Hmm, that's interesting. So, I think this is another query we should probably save in our notes. This looks like interesting. SMB connections by host. All right, and to me, something like this is something that will also try and convert into a detection, especially when, or I guess it depends on your environment, a RDP host or a jump host is making these types of connections. I expect something like files to have this many connections from various different hosts, but all these hosts to have connections from an RDP host, when it's like, when it's not an SMB server or something like that, that's sort of abnormal. So, that's probably a good way to detect this, right? Even, this could even cover not Bloodhound. This could cover manual enumeration from an attacker, if they are trying to be stealthy and they don't want to trigger downloading Bloodhound, they could do a manual. Just in case if you want to do them Do the thing, you can do a manual enumeration, but we could still see this on the network side, and all these types of connections. Well, I think I have shown different ways that we can be hunting for Bloodhound in, or other Windows enumeration. This has been pretty interesting. But now that we, I think we have concluded that RDP host 01 has RadioD perceived Sществ. been compromised and has been doing this type of telemetry we would have the forensics team run forensics on it or seeing what other kind of things we can hunt for let's close this out I think we should cover the threat hunting template so this is something that I like to use and other members of the blue team villains like to use it comes to threat hunting and it's pretty basic yeah there's a playbook title no matter a tactic no matter sub technique the hypothesis we didn't really go into detail about hypothesis but there are other recordings and other stations or within this station that will go over hypothesis and then there is a proposed detection query simulation details if there are any the limitations and observation notes from what we conducted right like we did find certain things like certain logs not being parsed or not being able to find certain lungs yeah and then our conclusion our findings of like what we found when we're going through this and so we can fill this out right we're gonna title this title this a bloodhound being run thin I don't think I spelled that correctly that's true no one divided by this so the that's true no one divided by this so we can do a quick search right here then so mitre is a framework for different techniques and attack paths and there are plenty of resources out there on understanding what miter is but what we need from here is what tactic what's going on here all right so there's a bunch of them here usually the one I go for is this one which is account discovery because that's the best use case at least in my eyes for this so there is this which this is just account discovery and local account discovery to be specific at least with the sub technique my hypothesis and a event system that's been attacker Murray so what is our proposed detection query at least for on the network side we'd have something like this is this actually maybe we can switch this around this and then to host name here yes right there you go yes right there you go run decoding so this is much nicer so let's take this or actually let's do this where count is above what's like this is like when it comes to files right like we're gonna get some false positives here if anything that's it above a hundred like we want to get alerted on let's take this let's put this detection query here markdown there are no simulation details here what are some observations and limitations so a limitation that we add here is some lungs were parsing correctly person correctly we did not see creation bloodhound binaries right it is what else can we say that we observed I think that covers it mostly as to findings well well well well well well well well well well well well well well well well well well well well well well well well well well well well well well we found that RDP I still one has been making various connections to other workstations right this is normal for this type of workstation And that's it. That's our threat hunting template filled out with everything needed. And I want to say thank you for joining me on this journey. And if you feel like continuing this conversation, please join us on the Blue Team Village Discord. Thank you.