Detection: Windows Handle Duplication in Known UAC-Bypass Binaries

Description

The following analytic detects duplicate-handle access to known UAC-bypass binaries from a non-standard source path. It leverages Sysmon EventCode 10, converts GrantedAccess from hexadecimal, and checks for PROCESS_DUP_HANDLE.

 1`sysmon`
 2EventCode=10
 3TargetImage IN(
 4    "*\\colorcpl.exe",
 5    "*\\ComputerDefaults.exe",
 6    "*\\esentutl.exe",
 7    "*\\eventvwr.exe",
 8    "*\\fodhelper.exe",
 9    "*\\mmc.exe",
10    "*\\sdclt.exe",
11    "*\\slui.exe",
12    "*\\wsreset.exe",
13    "*\\PkgMgr.exe"
14)
15NOT SourceImage IN (
16    "C:\\Windows\\System32\\*",
17    "C:\\Windows\\SysWOW64\\*",
18    "C:\\Program Files\\*",
19    "C:\\Program Files (x86)\\*",
20    "%SystemRoot%\\*"
21)
22
23
24| eval g_access_decimal = tonumber(replace(GrantedAccess,"0x",""),16)
25
26| eval PROCESS_DUP_HANDLE = 64
27
28| eval dup_handle_set = bit_and (g_access_decimal, PROCESS_DUP_HANDLE)
29
30| where dup_handle_set == PROCESS_DUP_HANDLE
31
32
33| stats count min(_time) as firstTime
34                max(_time) as lastTime
35    BY user_id dest
36       signature_id signature granted_access Opcode
37       SourceImage SourceProcessGUID SourceProcessId
38       TargetImage TargetProcessGUID TargetProcessId
39       CallTrace vendor_product
40
41
42| eval CallTrace=split(CallTrace, "
43|")
44
45
46| `security_content_ctime(firstTime)`
47
48| `security_content_ctime(lastTime)`
49
50| `windows_handle_duplication_in_known_uac_bypass_binaries_filter`

Data Source

Name Platform Sourcetype Source
Sysmon EventID 10 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
windows_handle_duplication_in_known_uac_bypass_binaries_filter search *
windows_handle_duplication_in_known_uac_bypass_binaries_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1134.001 Token Impersonation/Theft Privilege Escalation
Exploitation
DE.AE
CIS 10

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Finding (Notable) No
Creates Intermediate Finding (Risk Event) Yes
Anomaly detections generate Intermediate Findings (Risk Events). They do not generate a Finding (Notable) directly.

Implementation

To successfully implement this search, you must be ingesting data that records process activity from your hosts to populate the endpoint data model in the processes node. If you are using Sysmon, you must have at least version 6.0.4 of the Sysmon TA.

Known False Positives

It is possible legitimate applications will request access to list of know abused Windows UAC binaries process, filter as needed.

Associated Analytic Story

Intermediate Findings

Message Entity Field Entity Type Risk Score
The process [$SourceImage$] requested duplicate-handle access [$granted_access$] to [$TargetImage$] on [$dest$] dest system 20

Threat Objects

Field Type
SourceImage file_path

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation ✅ Passing N/A N/A N/A
Unit ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub |

Version: 5