Event ID 4726
Event ID 4726: User Account Deleted
A user account was deleted
- Log source
- Security
- How to enable it
- Account Management > Audit User Account Management (Success)
- Category
- Account Management
- Priority
- High
- Typical volume
- Low
- MITRE ATT&CK
What Event ID 4726 means
4726 is logged when a user object is removed, on a domain controller for domain accounts and on the host for local accounts. Afterwards the name no longer resolves, and file permissions and older log entries show a bare SID.
That side effect is why deletion interests an investigator. A temporary account that exists for an hour and then disappears leaves almost nothing for a later review of the directory. The pair of 4720 and 4726 for one SID may be the only record that it ever existed.
Mature organizations disable first and delete weeks later. In such a place a deletion with no earlier 4725 breaks the process, and that alone is a simple and effective rule.
Key fields to inspect
| Field | Meaning | Suspicious when |
|---|---|---|
TargetUserName | Account that was deleted. | A name created shortly before, or one with administrator membership. |
TargetSid | Security identifier of the deleted account. | Search all logs for this value to recover what the account did. |
SubjectUserName | Who deleted it. | The same account that created it an hour ago. |
SubjectLogonId | Session that deleted it. | A session that also cleared a log. |
TargetDomainName | Domain, or computer for local accounts. | A single server's local database. |
Detection queries
Find accounts that were created and deleted within one day. Adjust names and thresholds to your environment. About these queries.
Splunk SPL
index=windows source="XmlWinEventLog:Security" (EventCode=4720 OR EventCode=4726)
| stats earliest(eval(if(EventCode=4720,_time,null()))) AS created latest(eval(if(EventCode=4726,_time,null()))) AS deleted values(TargetUserName) AS name values(SubjectUserName) AS actors BY TargetSid
| eval hours=round((deleted-created)/3600, 1)
| where hours>=0 AND hours<=24 Microsoft Sentinel KQL
let created = SecurityEvent
| where EventID == 4720
| project TargetSid, Created = TimeGenerated, Creator = SubjectUserName;
SecurityEvent
| where EventID == 4726
| join kind=inner created on TargetSid
| extend Hours = datetime_diff("minute", TimeGenerated, Created) / 60.0
| where Hours between (0.0 .. 24.0)
| project Created, Deleted = TimeGenerated, Computer, TargetUserName, Creator, SubjectUserName, Hours PowerShell
Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4726; StartTime = (Get-Date).AddDays(-30) } |
ForEach-Object { $d = @{ Time = $_.TimeCreated }; ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }; [pscustomobject]$d } |
Select-Object Time, SubjectUserName, TargetUserName, TargetSid | Format-Table -AutoSize Attack scenarios
Short-lived backdoor account
The intruder creates an administrator, uses it for remote access, and deletes it before leaving. Creation and deletion share a TargetSid, and the logons between them show which systems were reached.
Destructive deletion
A disgruntled administrator or an attacker removes accounts in bulk. Directory recovery is possible from the AD Recycle Bin if it was enabled beforehand, so speed and scope matter more than attribution at first.
Investigation checklist
- Search for TargetSid, and not the name, across every log source.
- Find the creation event and compare the two subjects.
- List group memberships the account held, from 4728 and 4732.
- Restore from the AD Recycle Bin if the deletion was malicious.
Common benign causes
- Scheduled cleanup of accounts that were disabled earlier.
- Software removal that deletes its service user.
- Test and training environments.
Event ID 4726 FAQ
Can I see what a deleted account did?
Yes. Its SID remains in earlier events and in file permissions. Search for the TargetSid from the deletion event to rebuild its logons, processes and group changes.
Is 4726 logged when a computer account is deleted?
No. Deleting a computer account produces 4743, and deleting a group produces 4730, 4734 or 4758 according to its type.
Can a deleted Active Directory account be recovered?
If the AD Recycle Bin was enabled, the object can be restored with its SID and memberships within the retention period. Otherwise an authoritative restore from backup is needed.