Archive
Highlighted

Is there a search for a set commands in quick succession?

Communicator

Hey Guys,

IS there a simple way to search for a set of commands being ran in quick succession on a single system and then maybe even table the results if it happens on multiple systems, for example

Mr Hackerman gains access to workstation 1 and within the space of a min or two types in whoami, ipconfig, systeminfo ?

Obviously these commands could be in any order so that would need to be taken into account too.

0 Karma
Highlighted

Re: Is there a search for a set commands in quick succession?

Communicator

Streamstats and the time_window parameter could be useful here. Something like this

base_search
| streamstats time_window=1m dc(command) AS unique_commands values(command) AS commands_executed by user host
| sort - unique_commands

You could look for it happening on multiple systems by adding eventstats to it with something like this:

base_search
| streamstats time_window=1m dc(command) AS unique_commands values(command) AS commands_executed by user host
| where unique_commands>4
| eventstats dc(host) AS unique_hosts by user
| sort - unique_hosts

That should at least get you pointed in the right direction. Here is the streamstats and eventstats docs for reference. They will be pretty useful for use cases such as these

Streamstats: https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchReference/Streamstats
Eventstats: https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchReference/Eventstats

Also a cool blog: https://www.splunk.com/blog/2014/04/01/search-command-stats-eventstats-and-streamstats-2.html

Highlighted

Re: Is there a search for a set commands in quick succession?

Communicator

Hey, Thank you ill give this a shot 🙂

0 Karma