Does anyone have examples of how to use Splunk to detect basic brute force attacks?
The Splunk Product Best Practices team helped produce this response. Read more about example use cases in the Splunk Platform Use Cases manual.
Discovering real credentials is a key component for any attacker. A time-honored way to find weak passwords is to try hundreds of common passwords. This is effective because most environments use Active Directory as a central storage repository for credentials. It’s important to include a search for brute force activity in Windows Security logs as a component of any security strategy.
This use case is from the Splunk Security Essentials app. Check it out for more examples and demo data for this type of use case.
This use case depends security data from Windows, Unix and Linux, or any data properly tagged for authentication. While only one data source is required to get insights, collecting multiple data sources provides a more comprehensive view of the environment's security.
Best practice: Use the Splunk Add-on for Microsoft Windows to accelerate time to value with Windows data. For details, see Is it a best practice to use the Splunk Add-on for Microsoft Windows? on Splunk Answers.
[WinEventLog://Security]
input in the add-on to collect Windows security data. For details, see How do I collect basic Windows OS Event Log data from my Windows systems? on Splunk Answers.earliest=-1day index=* source=win*security tag=authentication user=* src=* | head 10
Best practice: Use the Splunk Add-on for Unix and Linux to accelerate time to value with Unix and Linux data.
[monitor:///var/log]
input in the add-on to collect the Linux security data. See Enable data and scripted inputs for the Splunk Add-on for Unix and Linux in Splunk docs for the procedure./var/log/secure
file to allow Splunk to monitor the Linux secure data. For details, see Which UNIX permissions are best for monitoring files? on Splunk Answers.earliest=-1day index=* sourcetype=linux_secure tag=authentication user=* src=*| head 10
Best practice: Since Splunk normalizes values from multiple source types regardless of source or format, it’s a best practice to make sure your data is CIM-compliant. For more information about CIM and the Splunk Common Information Model (CIM) add-on see the Splunk Common Information Model Add-on Manual. Run the following search to verify you are searching for normalized authentication data and ready for this use case: earliest=-1day index=* tag=authentication user=* src=* | head 10
The examples below use a simple threshold for Security logs to alert if there are a large number of failed logins, and at least one successful login from the same source.
Best practice: In searches, replace the asterisk in index=*
with name of the index that contains the data. By default, Splunk stores data in the main
index. Therefore, index=*
becomes index=main
. Use the OR
operator to specify one or multiple indexes to search. For example, index=main OR index=security
. See About managing indexes and How indexing works in Splunk docs for details.
index=* action=fail* OR action=block* (source=win*security OR sourcetype=linux_secure OR tag=authentication) user=* user!=""
| bucket _time span=1d
| stats count by user src _time
| stats sum(count) as count by user
| sort - count
index=* action=fail* OR action=block* (source=win*security OR sourcetype=linux_secure OR tag=authentication) user=* user!=""
| bucket _time span=1d
| stats count by user src _time
| stats sum(count) as count by src
| sort - count
index=* action=fail* OR action=block* (source=win*security OR sourcetype=linux_secure OR tag=authentication) user=* user!=""
| bucket _time span=1d
| stats count by user src _time
| timechart span=1d sum(count) as count
index=* (source=win*security OR sourcetype=linux_secure OR tag=authentication) user=* user!=""
| stats count(eval(action="success")) as successes count(eval(action="failure")) as failures by user
| eval perc_failures_to_total = round((100*failures) / (failures + successes), 2)
| sort - perc_failures_to_total failures
How to respond: When this search fires, you can assume that a brute force search was successful. See if it is coming from a host that typically logs in with that account to make sure it is not just coincidental, then reset the password for compromised accounts and look for other places where that username was used.
Known false positives: The only known scenario where this search generates false positives is if a single source, such as a web app, that centralizes the authentication for many people. In that scenario, consider adjusting thresholds for that source, or exclude it and build a separate similar search just using the logs from that host.
If no results appear, you may need to deploy the add-ons to the search heads to use the knowledge objects necessary for simple searching.
The Splunk Product Best Practices team helped produce this response. Read more about example use cases in the Splunk Platform Use Cases manual.
Discovering real credentials is a key component for any attacker. A time-honored way to find weak passwords is to try hundreds of common passwords. This is effective because most environments use Active Directory as a central storage repository for credentials. It’s important to include a search for brute force activity in Windows Security logs as a component of any security strategy.
This use case is from the Splunk Security Essentials app. Check it out for more examples and demo data for this type of use case.
This use case depends security data from Windows, Unix and Linux, or any data properly tagged for authentication. While only one data source is required to get insights, collecting multiple data sources provides a more comprehensive view of the environment's security.
Best practice: Use the Splunk Add-on for Microsoft Windows to accelerate time to value with Windows data. For details, see Is it a best practice to use the Splunk Add-on for Microsoft Windows? on Splunk Answers.
[WinEventLog://Security]
input in the add-on to collect Windows security data. For details, see How do I collect basic Windows OS Event Log data from my Windows systems? on Splunk Answers.earliest=-1day index=* source=win*security tag=authentication user=* src=* | head 10
Best practice: Use the Splunk Add-on for Unix and Linux to accelerate time to value with Unix and Linux data.
[monitor:///var/log]
input in the add-on to collect the Linux security data. See Enable data and scripted inputs for the Splunk Add-on for Unix and Linux in Splunk docs for the procedure./var/log/secure
file to allow Splunk to monitor the Linux secure data. For details, see Which UNIX permissions are best for monitoring files? on Splunk Answers.earliest=-1day index=* sourcetype=linux_secure tag=authentication user=* src=*| head 10
Best practice: Since Splunk normalizes values from multiple source types regardless of source or format, it’s a best practice to make sure your data is CIM-compliant. For more information about CIM and the Splunk Common Information Model (CIM) add-on see the Splunk Common Information Model Add-on Manual. Run the following search to verify you are searching for normalized authentication data and ready for this use case: earliest=-1day index=* tag=authentication user=* src=* | head 10
The examples below use a simple threshold for Security logs to alert if there are a large number of failed logins, and at least one successful login from the same source.
Best practice: In searches, replace the asterisk in index=*
with name of the index that contains the data. By default, Splunk stores data in the main
index. Therefore, index=*
becomes index=main
. Use the OR
operator to specify one or multiple indexes to search. For example, index=main OR index=security
. See About managing indexes and How indexing works in Splunk docs for details.
index=* action=fail* OR action=block* (source=win*security OR sourcetype=linux_secure OR tag=authentication) user=* user!=""
| bucket _time span=1d
| stats count by user src _time
| stats sum(count) as count by user
| sort - count
index=* action=fail* OR action=block* (source=win*security OR sourcetype=linux_secure OR tag=authentication) user=* user!=""
| bucket _time span=1d
| stats count by user src _time
| stats sum(count) as count by src
| sort - count
index=* action=fail* OR action=block* (source=win*security OR sourcetype=linux_secure OR tag=authentication) user=* user!=""
| bucket _time span=1d
| stats count by user src _time
| timechart span=1d sum(count) as count
index=* (source=win*security OR sourcetype=linux_secure OR tag=authentication) user=* user!=""
| stats count(eval(action="success")) as successes count(eval(action="failure")) as failures by user
| eval perc_failures_to_total = round((100*failures) / (failures + successes), 2)
| sort - perc_failures_to_total failures
How to respond: When this search fires, you can assume that a brute force search was successful. See if it is coming from a host that typically logs in with that account to make sure it is not just coincidental, then reset the password for compromised accounts and look for other places where that username was used.
Known false positives: The only known scenario where this search generates false positives is if a single source, such as a web app, that centralizes the authentication for many people. In that scenario, consider adjusting thresholds for that source, or exclude it and build a separate similar search just using the logs from that host.
If no results appear, you may need to deploy the add-ons to the search heads to use the knowledge objects necessary for simple searching.
Added related video.