Splunk Enterprise Security

Temporal sequence between a search and a multisearch

SIEMStudent
Path Finder

Hi Splunkers,

today I'm facing a problem related to temporal sequence between a multisearch and a search, but let me introduce the context and explain better.

In ES, I have to build a correlation search that must verify 2 events in time order:

1. First, check if a trojan, backdoor or exploit is founded on a destination host, from some source.
2. Then, check is from the same source on the same destination a login and/or an account change is performed.
Bonds: use datamodels (if possible) and avoid transaction.

Now, I know that I can use:

1. Intrusion Detection for point 1.
2. Authentication and Change for point 2

Now, the search for point one is something like that:

| tstats summariesonly=true fillnull_value="N/D" count from datamodel=Intrusion_Detection
where IDS_Attacks.signature IN ("*trojan*","*backdoor*","*exploit*")
by IDS_Attacks.dest, IDS_Attacks.src, IDS_Attacks.signature, index, host
| `drop_dm_object_name("IDS_Attacks")`

while, for point 2, due I have 2 different datamodels I builded it with a multisearch:

| multisearch 
    [| tstats summariesonly=true prestats=true fillnull_value="N/D" count from datamodel=Authentication where nodename="Authentication.Successful_Authentication" by index, host, Authentication.src, Authentication.dest
    | `drop_dm_object_name("Authentication")`] 
    [| tstats summariesonly=true prestats=true fillnull_value="N/D" count from datamodel=Change where nodename="All_Changes.Account_Management" by index, host, All_Changes.src, All_Changes.dest
    | `drop_dm_object_name("All_Changes")` ] 
| stats count by src, dest, index, host
| stats count values(host) as host, values(index) as inde by src, dest

I tested both search separately and they work well.

Now the point is: how to tell to Splunk that search 1 must trigger before search 2 without transaction? 
I thougth about funcion 

min(_time)
max(_time)

and the use of 

eval

to check is first time occurrence of block 2 is greater than last time occurrence of block 1, but I'm struggling about the correct use of this functions, because the field with time occurrence is always empty, so it's clear I'm wrong in my combined code.
Consider for example the multisearch of block 2, where I tested the use of min:

| multisearch 
    [| tstats prestats=true fillnull_value="N/D" min(_time) as firstSuccess, count from datamodel=Authentication where nodename="Authentication.Successful_Authentication" AND by index, host, Authentication.src, Authentication.dest
    | `drop_dm_object_name("Authentication")`] 
    [| tstats prestats=true summariesonly=true fillnull_value="N/D" min(_time) as firstSuccess, count from datamodel=Change where nodename="All_Changes.Account_Management" by index, host, All_Changes.src, All_Changes.dest
    | `drop_dm_object_name("All_Changes")` ] 
| stats count min(firstSuccess) as firstSuccess by log_region, log_country, src, dest, index, host

The idea is to find the first occurrence in both search of multisearch with min(_time) and then, in the following stats, use min(firstSuccess) to find the smaller one between them; the search show me in output the required fields, except fisrtSuccess which is empty.



Labels (1)
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...