Windows Access Token Manipulation SeDebugPrivilege

Original Source: [splunk source]
Name:Windows Access Token Manipulation SeDebugPrivilege
id:6ece9ed0-5f92-4315-889d-48560472b188
version:5
date:2024-11-28
author:Teoderick Contreras, Splunk
status:production
type:Anomaly
Description:The following analytic detects a process enabling the "SeDebugPrivilege" privilege token. It leverages Windows Security Event Logs with EventCode 4703, filtering out common legitimate processes. This activity is significant because SeDebugPrivilege allows a process to inspect and modify the memory of other processes, potentially leading to credential dumping or code injection. If confirmed malicious, an attacker could gain extensive control over system processes, enabling them to escalate privileges, persist in the environment, or access sensitive information.
Data_source:
  • -Windows Event Log Security 4703
search:`wineventlog_security` EventCode=4703 EnabledPrivilegeList = "*SeDebugPrivilege*" AND NOT(ProcessName IN ("*\\Program File*", "*\\System32\\lsass.exe*", "*\\SysWOW64\\lsass.exe*", "*\\SysWOW64\\svchost.exe*", "*\\System32\\svchost.exe*"))
| stats count min(_time) as firstTime max(_time) as lastTime by Computer ProcessName ProcessId SubjectDomainName SubjectUserName SubjectUserSid TargetUserName TargetLogonId TargetDomainName EnabledPrivilegeList action
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `windows_access_token_manipulation_sedebugprivilege_filter`


how_to_implement:To successfully implement this search, you need to be ingesting Windows Security Event Logs with 4703 EventCode enabled. The Windows TA is also required.
known_false_positives:Some native binaries and browser applications may request SeDebugPrivilege. Filter as needed.
References:
  -https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4703
  -https://devblogs.microsoft.com/oldnewthing/20080314-00/?p=23113
  -https://blog.palantir.com/windows-privilege-abuse-auditing-detection-and-defense-3078a403d74e
  -https://atomicredteam.io/privilege-escalation/T1134.001/#atomic-test-2---%60sedebugprivilege%60-token-duplication
  -https://malpedia.caad.fkie.fraunhofer.de/details/win.asyncrat
drilldown_searches:
name:'View the detection results for - "$Computer$"'
search:'%original_detection_search% | search Computer = "$Computer$"'
earliest_offset:'$info_min_time$'
latest_offset:'$info_max_time$'
name:'View risk events for the last 7 days for - "$Computer$"'
search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$Computer$") 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:
    - 'Brute Ratel C4'
    - 'AsyncRAT'
    - 'DarkGate Malware'
    - 'CISA AA23-347A'
    - 'PlugX'
    - 'ValleyRAT'
    - 'Meduza Stealer'
  asset_type:Endpoint
  confidence:60
  impact:60
  message:A process $ProcessName$ adjust its privileges with SeDebugPrivilege on $Computer$.
  mitre_attack_id:
    - 'T1134.002'
    - 'T1134'
  observable:
    name:'Computer'
    type:'Endpoint'
    - role:
      - 'Victim'
  product:
    - 'Splunk Enterprise'
    - 'Splunk Enterprise Security'
    - 'Splunk Cloud'
  required_fields:
    - '_time'
    - 'ProcessName'
    - 'Security_ID'
    - 'action'
    - 'result'
    - 'Process_ID'
    - 'Message'
    - 'member_dn'
    - 'ComputerName'
    - 'user'
  risk_score:36
  security_domain:endpoint

tests:
name:'True Positive Test'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/malware/brute_ratel/sedebugprivilege_token/security-xml.log
  source: XmlWinEventLog:Security
  sourcetype: XmlWinEventLog
  update_timestamp: True
manual_test:None