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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...