Splunk Enterprise Security

How do I create a search which detects password changes and finds the last time the password was changed?

eputnam
Engager

Hello,

I am working on a Splunk search to see which users have changed their passwords more than a specific number of times over a specific timeframe.

Basically, I want to create a search which detects any Password changes and then looks back to find the last time the password was changed. If it was too soon, alert.

Here is what I currently have for my search which shows password changes. Any assistance on what else I need to add to this search string would be a great help.

index=wineventlog EventCode=4723 status=success user=* |fields user, _time | table user, _time | rename user AS "User"
1 Solution

DalJeanis
Legend

Okay, for Splunk searches, any time you start talking about "first I get THIS information... then I go back and get THIS information..." you probably will end up with a really inefficient search.

Instead, you should usually think in terms of "I gather all the events that are like THIS, and then aggregate them THIS way to see whether they meet THESE criteria."

In this case, however, I think you can do it the way you said, but you will have to set explicit earliest and latest time modifiers for each part of the search. In this sample, this is coded for finding all password changes in the last fifteen minutes and adding up how many times each of those users changed their passwords in the last 24 hours. We use eventstats for the calculation, so it will add up the information and add it to the event records but retain the entire selected events for review in the case of the users that have

index=wineventlog EventCode=4723 status=success user=* earliest=-24h@m latest=@m
   [ index=wineventlog EventCode=4723 status=success user=* earliest=-15m@m latest=@m|table user]
| eventstats count as PwdChanges max(_time) as maxtime by user
| where PwdChanges>=3
| sort 0 user - _time

View solution in original post

DalJeanis
Legend

Okay, for Splunk searches, any time you start talking about "first I get THIS information... then I go back and get THIS information..." you probably will end up with a really inefficient search.

Instead, you should usually think in terms of "I gather all the events that are like THIS, and then aggregate them THIS way to see whether they meet THESE criteria."

In this case, however, I think you can do it the way you said, but you will have to set explicit earliest and latest time modifiers for each part of the search. In this sample, this is coded for finding all password changes in the last fifteen minutes and adding up how many times each of those users changed their passwords in the last 24 hours. We use eventstats for the calculation, so it will add up the information and add it to the event records but retain the entire selected events for review in the case of the users that have

index=wineventlog EventCode=4723 status=success user=* earliest=-24h@m latest=@m
   [ index=wineventlog EventCode=4723 status=success user=* earliest=-15m@m latest=@m|table user]
| eventstats count as PwdChanges max(_time) as maxtime by user
| where PwdChanges>=3
| sort 0 user - _time

danielransell
Path Finder

After collecting your events and specifying your fields you need to get a count of events by user. To do that you add the following after “fields user, _time”:
|stats count by user | ...rest of search

Once you have a count, you will likely want to only show users that have changed their password x number of times during your specified timeframe. To do that add the following after |stats count by user
|where count > 24 |...rest of search.
By adding that, only users who have changed their password more than 24 times will be returned.

Try adding and tweaking those two suggestions and let us know if that gets you what you were looking for.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.


Introducing Unified TDIR with the New Enterprise Security 8.2

Read the blog
Get Updates on the Splunk Community!

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...