Splunk Search

A user account was changed 4738 642

MrWh1t3
Path Finder

All,

I am at a loss. I am trying to pull EventCode 642 and 4738 so i can identify when a user account has been changed.

I currently have;
sourcetype="WinEventLog:Security" EventCode="642" OR EventCode="4738" | rex "(?ms)A user account was changed.+?Display Name:\s(?<wanted_user>\V+)" | table _time Display_Name Account_Name ComputerName

It works, but... There are two Account Name in the 642/4738 event logs. Our Display Name wasn't populated like it should be within AD so i don't get much useful information from it.

What I would like to see is:

_time "Account name that was changed" "Account name of the person who changed it" and the ComputerName.

Any help would be much appreciated!

0 Karma

DalJeanis
Legend

You are best off pulling samples of each and using the wording on the events, and your resulting knowledge of what fields are populated in your particular environment, to pull information off the events via rex.

The standard general wording for each is here, but it occasionally varies based on specific OS version.
https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=642
https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=4738

For instance, this pulls the Target account name off of the standard 528 and the 4738 events, respectively. Since the words "Account Name" occur twice, you need to take the second occurrence as the target account. This is one way to do that.

| rex "Target Account Name:\s+?(<TargetName>[^\s]*)"
| rex  "Account Name:\s+?(<AccountName>[^\s]*) max_match=2
| eval TargetName=coalesce(TargetName,mvindex(AccountName,1))
0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...