Detection rules › Splunk
Windows AD Privileged Account SID History Addition
The following analytic identifies when the SID of a privileged user is added to the SID History attribute of another user. It leverages Windows Security Event Codes 4742 and 4738, combined with identity lookups, to detect this activity. This behavior is significant as it may indicate an attempt to abuse SID history for unauthorized access across multiple domains. If confirmed malicious, this activity could allow an attacker to escalate privileges or maintain persistent access within the environment, posing a significant security risk.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation | T1134.005 Access Token Manipulation: SID-History Injection |
| Stealth | T1134.005 Access Token Manipulation: SID-History Injection |
Event coverage
| Provider | Event | Title |
|---|---|---|
| Security-Auditing | Event ID 4738 | A user account was changed. |
| Security-Auditing | Event ID 4742 | A computer account was changed. |
Rule body splunk
name: Windows AD Privileged Account SID History Addition
id: 6b521149-b91c-43aa-ba97-c2cac59ec830
version: 13
creation_date: '2023-04-11'
modification_date: '2026-05-13'
author: Dean Luxton
status: production
type: TTP
description: The following analytic identifies when the SID of a privileged user is added to the SID History attribute of another user. It leverages Windows Security Event Codes 4742 and 4738, combined with identity lookups, to detect this activity. This behavior is significant as it may indicate an attempt to abuse SID history for unauthorized access across multiple domains. If confirmed malicious, this activity could allow an attacker to escalate privileges or maintain persistent access within the environment, posing a significant security risk.
data_source:
- Windows Event Log Security 4742
- Windows Event Log Security 4738
search: |-
`wineventlog_security`
EventCode IN (4742, 4738)
NOT SidHistory IN ("%%1793", -)
| rex field=SidHistory "(^%{|^)(?P<SidHistory>.*?)(}$|$)"
| eval category="privileged"
| lookup identity_lookup_expanded category, identity as SidHistory OUTPUT identity_tag as match
| where isnotnull(match)
| rename TargetSid as userSid
| table _time action status host user userSid SidHistory Logon_ID src_user dest
| `windows_ad_privileged_account_sid_history_addition_filter`
how_to_implement: Ensure you have objectSid and the Down Level Logon Name `DOMAIN\sAMACountName` added to the identity field of your Asset and Identities lookup, along with the category of privileged for the applicable users. Ensure you are ingesting eventcodes 4742 and 4738. Two advanced audit policies `Audit User Account Management` and `Audit Computer Account Management` under `Account Management` are required to generate these event codes.
known_false_positives: Migration of privileged accounts.
references:
- https://adsecurity.org/?p=1772
drilldown_searches:
- name: View the detection results for - "$src_user$"
search: '%original_detection_search% | search src_user = "$src_user$"'
earliest_offset: $info_min_time$
latest_offset: $info_max_time$
- name: View risk events for the last 7 days for - "$src_user$"
search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$src_user$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
earliest_offset: 7d
latest_offset: "0"
finding:
title: A Privileged User Account SID History Attribute was added to $userSid$ by $src_user$
entity:
field: src_user
type: user
score: 50
analytic_story:
- Compromised Windows Host
- Sneaky Active Directory Persistence Tricks
asset_type: Endpoint
mitre_attack_id:
- T1134.005
product:
- Splunk Enterprise
- Splunk Enterprise Security
- Splunk Cloud
category: endpoint
security_domain: endpoint
tests:
- name: True Positive Test
attack_data:
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1134.005/mimikatz/windows-security-xml.log
source: XmlWinEventLog:Security
sourcetype: XmlWinEventLog
description: PORTED MANUAL TEST - This search uses a lookup provided by Enterprise Security and needs to be manually tested.
test_type: experimental
Stages and Predicates
Stage 1: search
`wineventlog_security`
EventCode IN (4742, 4738)
NOT SidHistory IN ("%%1793", -)
Stage 2: rex
| rex field=SidHistory "(^%{|^)(?P<SidHistory>.*?)(}$|$)"
Stage 3: eval
| eval category="privileged"
Stage 4: lookup
| lookup identity_lookup_expanded category, identity as SidHistory OUTPUT identity_tag as match
Stage 5: where
| where isnotnull(match)
Stage 6: rename
| rename TargetSid as userSid
Stage 7: table
| table _time action status host user userSid SidHistory Logon_ID src_user dest
Stage 8: search
| `windows_ad_privileged_account_sid_history_addition_filter`
Exclusions
Top-level NOT(...) conjuncts: predicates this rule actively suppresses.
| Field | Kind | Excluded values |
|---|---|---|
SidHistory | in | "%%1793", - |
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.