Detection rules › Splunk

Windows AD Same Domain SID History Addition

Status
production
Severity
medium
Author
Dean Luxton
Source
github.com/splunk/security_content

The following analytic detects changes to the sIDHistory attribute of user or computer objects within the same domain. It leverages Windows Security Event Codes 4738 and 4742 to identify when the sIDHistory attribute is modified. This activity is significant because the sIDHistory attribute can be abused by adversaries to grant unauthorized access by inheriting permissions from another account. If confirmed malicious, this could allow attackers to maintain persistent access or escalate privileges within the domain, posing a severe security risk.

MITRE ATT&CK coverage

Event coverage

Rule body splunk

name: Windows AD Same Domain SID History Addition
id: 5fde0b7c-df7a-40b1-9b3a-294c00f0289d
version: 13
creation_date: '2022-09-08'
modification_date: '2026-05-13'
author: Dean Luxton
status: production
type: TTP
description: The following analytic detects changes to the sIDHistory attribute of user or computer objects within the same domain. It leverages Windows Security Event Codes 4738 and 4742 to identify when the sIDHistory attribute is modified. This activity is significant because the sIDHistory attribute can be abused by adversaries to grant unauthorized access by inheriting permissions from another account. If confirmed malicious, this could allow attackers to maintain persistent access or escalate privileges within the domain, posing a severe security risk.
data_source:
    - Windows Event Log Security 4742
    - Windows Event Log Security 4738
search: '`wineventlog_security` (EventCode=4742 OR EventCode=4738) NOT SidHistory IN ("%%1793", -) | rex field=SidHistory "(^%{|^)(?P<SidHistoryMatch>.*)(\-|\\\)" | rex field=TargetSid "^(?P<TargetSidmatch>.*)(\-|\\\)" | where SidHistoryMatch=TargetSidmatch OR SidHistoryMatch=TargetDomainName | rename TargetSid as userSid, TargetDomainName as userDomainName | table _time action status host user userSid userDomainName SidHistory Logon_ID src_user dest | `windows_ad_same_domain_sid_history_addition_filter`'
how_to_implement: To successfully implement this search, you need to be ingesting eventcodes `4738` and `4742`. The Advanced Security Audit policy settings `Audit User Account Management` and  `Audit Computer Account Management` within `Account Management` all need to be enabled. SID resolution is not required..
known_false_positives: No false positives have been identified at this time.
references:
    - https://adsecurity.org/?p=1772
    - https://learn.microsoft.com/en-us/windows/win32/adschema/a-sidhistory?redirectedfrom=MSDN
    - https://learn.microsoft.com/en-us/defender-for-identity/security-assessment-unsecure-sid-history-attribute
    - https://book.hacktricks.xyz/windows-hardening/active-directory-methodology/sid-history-injection
drilldown_searches:
    - name: View the detection results for - "$src_user$" and "$user$"
      search: '%original_detection_search% | search  src_user = "$src_user$" user = "$user$"'
      earliest_offset: $info_min_time$
      latest_offset: $info_max_time$
    - name: View risk events for the last 7 days for - "$src_user$" and "$user$"
      search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$src_user$", "$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: Active Directory SID History Attribute was added to $user$ by $src_user$
    entity:
        field: src_user
        type: user
        score: 50
intermediate_findings:
    entities:
        - field: user
          type: user
          score: 50
          message: Active Directory SID History Attribute was added to $user$ by $src_user$
analytic_story:
    - Compromised Windows Host
    - Windows Persistence Techniques
    - 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
      test_type: unit

Stages and Predicates

Stage 1: search

`wineventlog_security` (EventCode=4742 OR EventCode=4738) NOT SidHistory IN ("%%1793", -)

Stage 2: rex

| rex field=SidHistory "(^%{|^)(?P<SidHistoryMatch>.*)(\-|\\\)"

Stage 3: rex

| rex field=TargetSid "^(?P<TargetSidmatch>.*)(\-|\\\)"

Stage 4: where

| where SidHistoryMatch=TargetSidmatch OR SidHistoryMatch=TargetDomainName

Stage 5: rename

| rename TargetSid as userSid, TargetDomainName as userDomainName

Stage 6: table

| table _time action status host user userSid userDomainName SidHistory Logon_ID src_user dest

Stage 7: search

| `windows_ad_same_domain_sid_history_addition_filter`

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
SidHistoryin"%%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.

FieldKindValues
EventCodeeq
  • 4738 corpus 6 (splunk 4, elastic 1, kusto 1)
  • 4742 corpus 6 (splunk 6)