Splunk Search

Help with writing this search to detect users accessing unauthorized devices?

alaking
Explorer

Hello,

I am trying to create a correlation search that will detect users accessing devices for which they aren't authorized to use. For example, Vendor A should not be able to Access a specific file server because that is not part of their assigned role. My theory is as follows:

Create a summary index search that logs AD events including username, src, dest etc. based on whether their username is in a lookup table. This lookup table has 2 fields: User and Vendor Name. I have tried the following search with little success:

 index=wineventlog dest!=mailServer dest!=DomainController Account_Domain=Domain  
| search [| inputlookup vendor_users.csv | return 1000 $user] | stats count by user
| rename user as username
| appendcols [| inputlookup vendor_users.csv| search user=$username$ | return 1000 $vendor_name]

All I expect from the search above is a table with user, vendor_name and count as fields. However, this just creates and empty column called "search", when I omit the search part it shows "VendorA OR VendorB or VendorC" etc.
This summary index will contain |table _time,user,vendor_name,src, dest which will then be used in another search using other lookup tables that provide an ACL matrix based on Vendor.

Can anyone provide any insight into what is wrong with my logic?

Regards,

0 Karma
1 Solution

DalJeanis
Legend

Not sure where you got that syntax. Try this...

  index=wineventlog dest!=mailServer dest!=DomainController Account_Domain=Domain  
 | search  [| inputlookup vendor_users.csv | table user] 
 | stats count by user
 | lookup vendor_users.csv user OUTPUT vendor_name

If you want to see what the inputlookup language turns into as it returns from the subsearch, then play with this...

| inputlookup vendor_users.csv | table user | format

View solution in original post

0 Karma

DalJeanis
Legend

Not sure where you got that syntax. Try this...

  index=wineventlog dest!=mailServer dest!=DomainController Account_Domain=Domain  
 | search  [| inputlookup vendor_users.csv | table user] 
 | stats count by user
 | lookup vendor_users.csv user OUTPUT vendor_name

If you want to see what the inputlookup language turns into as it returns from the subsearch, then play with this...

| inputlookup vendor_users.csv | table user | format
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...