Intrusion Detection
Last updated
Last updated
Threat hunting in not trivial, this page is here to provide a methodological example into finding an IOC within a given dataset.
Certain queries in Splunk can take up time. Effective threat hunting relies on crafting efficient queries that target relevant data.
Start by viewing all available sources in index:
Let's see what we're dealing with by viewing Sysmon events.
Clicking the arrow allows us to view all data in the row.
Note: It's effective to search for concatenated instances ** and non-concatenated.
NOTE: By providing ComputerName=*name* it is much faster. This is because we are specifying the point in where we are trying to filter from by lessening resource consumption.
Our dataset includes Sysmon events, we can retrieve a count of all Sysmon Event id's with the following query:
Doing so retrieves 20 different Sysmon event code ID's:
We can search the Sysmon documentation and view the respective event code ID numbers and their behavior.
Sysmon's event code 1 signifies a created process. Let's search for it.
The following query searches for the following:
ParentImage: The filepath that spawned the process.
Image: The filepath to the new process.
Description: A description of the spawned process image
ComputerName: The name of the computer that the process spawned on.
Let's try and narrow this count down and search for some low hanging fruit. We'll search for powershell.exe & cmd.exe
NOTE: It's important we add quotes (") and the a wildcard (*) around the Image we're filtering for.
We get 622 results!
notepad.exe
to powershell.exe
chain stands out immediately. It implies that notepad.exe was run, which then spawned a child powershell to execute a command. Let's add to the query, and this time look for ParentImage
as notepad.exe.
Here we discover an IOC: a web request to an external ip address.
Below is a SQL query that will go through Sysmon events and search the Callstack for UNKNOWN memory regions as well as weeding out legitimate applications to prevent false positives. Normal Sysmon process access events starts with ntdll (hosting Windows Syscalls), if the CallTrace starts with an UNKNOWN module instead of ntdll then its suspicious and may indicate a direct syscall evasion.