Windows AD Cross Domain SID History Addition

Original Source: [splunk source]
Name:Windows AD Cross Domain SID History Addition
id:41bbb371-28ba-439c-bb5c-d9930c28365d
version:4
date:2024-11-28
author:Dean Luxton
status:production
type:TTP
Description:The following analytic detects changes to the sIDHistory attribute of user or computer objects across different domains. 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 allows users to inherit permissions from other AD accounts, which can be exploited by adversaries for inter-domain privilege escalation and persistence. If confirmed malicious, this could enable attackers to gain unauthorized access to resources, maintain persistence, and escalate privileges across domain boundaries.
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 AND SidHistoryMatch!=TargetDomainName
| rename TargetSid as userSid
| table _time action status host user userSid SidHistory Logon_ID src_user
| `windows_ad_cross_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.
known_false_positives:Domain mergers and migrations may generate large volumes of false positives for this analytic.
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
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$") starthoursago=168 | 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:'$info_min_time$'
latest_offset:'$info_max_time$'
tags:
  analytic_story:
    - 'Compromised Windows Host'
    - 'Sneaky Active Directory Persistence Tricks'
  asset_type:Endpoint
  confidence:80
  impact:100
  message:Active Directory SID History Attribute was added to $user$ by $src_user$
  mitre_attack_id:
    - 'T1134.005'
    - 'T1134'
  observable:
    name:'src_user'
    type:'User'
    - role:
      - 'Victim'
    name:'user'
    type:'User'
    - role:
      - 'Victim'
  product:
    - 'Splunk Enterprise'
    - 'Splunk Enterprise Security'
    - 'Splunk Cloud'
  required_fields:
    - '_time'
    - 'EventCode'
    - 'SidHistory'
    - 'TargetSid'
    - 'TargetDomainName'
    - 'user'
    - 'src_user'
    - 'Logon_ID'
  risk_score:80
  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
manual_test:None