Other Usage

splunk SPL for who deleted user account

AL3Z
Builder

Hi,

Just wanted to know Ad account activity who deleted user account ?

0 Karma

AL3Z
Builder

..

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@AL3Z - I don't know your use-case for above searches and stuff but I have combined the searches for you.

index=winsec sourcetype=XmlWinEventLog (EventCode=4743 NOT SubjectUserName="Win_Dir") OR (EventCode=4726 NOT SubjectUserName="EC_Okta") OR (EventCode=4725 NOT (SubjectUserName="EC_Okta" OR SubjectUserName="Win_Dir"))
| bin _time span=5m
| stats values(signature) as EventCodeDescription, values(TargetUserName) as TargetUserName, values(TargetDomainName) as User_Domain dc(TargetUserName) as TargetUserName_count, values(object) as User_account_deleted, dc(object) as User_account_deleted_count by EventCode, _time SubjectUserName
| eval Computer_user_deleted=if(EventCode==4743, TargetUserName, null())
| eval computeruser_count=if(EventCode==4743, TargetUserName_count, null())
| eval disabled_account=if(EventCode==4725, TargetUserName, null())
| eval disabledaccount_count=if(EventCode==4725, TargetUserName_count, null())
| eval src_user=if(EventCode=4725 OR EventCode=4726, SubjectUserName, null())
| eval Deleted_by_User=if(EventCode=4734, SubjectUserName, null())
| where computeruser_count > 10 OR User_account_deleted_count > 10 OR disabledaccount_count > 10

 

I hope this helps!! Kindly upvote if it does!!!

VatsalJagani
SplunkTrust
SplunkTrust

@AL3Z - In order to get the Windows/AD user account deletion events, try below search query:

index=wineventlog EventCode=4726 
| table _time, ComputerName, Subject_Account_Name, Target_Account_name

 

Here,

  • Subject_Account_Name is admin who took the action
  • Target_Account_Name is the account which got deleted

 

Ensure you have installed Splunk_TA_windows on your environment, even on the search head.

 

I hope this helps!!!

AL3Z
Builder

.

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@AL3Z - Splunk_TA_windows Add-on is for field extraction.

 

A query if 100 systems gets deleted in a span of 1 minute.

index=wineventlog EventCode=4726 
| table _time, ComputerName, Subject_Account_Name, Target_Account_Name
| bin span=1m
| stats count, values(Target_Account_Name) as deleted_accounts, values(Subject_Account_Name) as admins by _time
| where count>100

 

I hope this helps!!! Kindly upvote/karma if this helps!!!

AL3Z
Builder

@VatsalJagani ,

If in that one sec let say 10 computers deleted we will not be able to get that right?

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@AL3Z - of course not, that's a different logic right.!

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@AL3Z - Do you mean to use accounts on Splunk? Or do you mean user accounts in Windows/AD as mentioned by @richgalloway ?

Please provide additional information about your question.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Search your index of Windows event logs (often wineventlog or windows) for the event code corresponding to a user account deletion.  See https://ultimatewindowssecurity.com for the event code.

---
If this reply helps you, Karma would be appreciated.
0 Karma
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!

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...

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

Ready to make your IT operations smarter and more efficient? Discover how to automate Splunk alerts with Red ...