Security

How to write a search to find an account that failed authentication more than 3 times in a 10 minute period?

mmaier_splunk
Splunk Employee
Splunk Employee

Hello,

i want to create a search that shows me when an account failed authentication of more than (3) times in a (10) minute period.

data structure:

alt text

tested:

tag=authentication sourcetype="juniper:sslvpn" | bin _time span=10m | stats count by user, _time | where count>3

however - that is only from 00:00 to 00:10, 00:10 - 00:20 and so on. it's not really a 10 minute period...

in my sample the last two events should have a count together of 2....

thanks for any help

0 Karma

maciep
Champion

maybe a good use case for autoregress or delta? Something like this (not really tested)?

tag=authentication sourcetype="juniper:sslvpn"
| sort 0 user _time
| autoregress _time as prev_time p=2
| autoregress user as prev_user p=2
| fillnull value=0
| eval diff = _time - prev_time
| where diff <= 600 AND user = prev_user
| table _time prev_time user prev_user diff
| convert ctime(prev_time)

0 Karma

musskopf
Builder

Have a look at the transaction command. You might be able to build a transaction on each user, where the maxspan=10m.

Here the link for the command reference: http://docs.splunk.com/Documentation/Splunk/6.2.2/SearchReference/Transaction

After that, just use the eventcount to evaluate the ones where are greater than 3. Here how I think it'll look:

tag=authentication sourcetype="juniper:sslvpn" | transacion user maxspan=10m | where eventcount>3 | table _time,user

Cheers

triest
Communicator

For long periods of time, transaction tends to be more efficient then stream stats as after its 10m away, it knows it can quit tracking things.

With that said, somesoni2's answer could be simplified a bit and for shorter periods of time, it could perform better due to the overhead of the transaction command.

0 Karma

somesoni2
Revered Legend

Give this a try

tag=authentication sourcetype="juniper:sslvpn" | table _time user | streamstats current=f window=1 first(_time) as prevTime by user| eval diff=coalesce(prevTime-_time,0) | streamstats current=t window=3 sum(diff) as duration count by user| where count=3 AND duration < 600 | stats count by user | table user
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...