| ID | Technique | Tactic |
|---|---|---|
| T1134.001 | Token Impersonation/Theft | Privilege Escalation |
Detection: Windows Access Token Manipulation Winlogon Duplicate Token Handle
Description
The following analytic detects a process requesting duplicate-handle and query-limited-information access to winlogon.exe. It leverages Sysmon EventCode 10 and checks for access masks that combine PROCESS_DUP_HANDLE (0x40) and PROCESS_QUERY_LIMITED_INFORMATION (0x1000).
Search
1`sysmon`
2EventCode=10
3TargetImage="*:\\Windows\\system32\\winlogon.exe"
4
5NOT SourceImage IN (
6 "C:\\Windows\\system32\\LogonUI.exe",
7 "C:\\Windows\\system32\\lsass.exe",
8 "C:\\Windows\\system32\\smss.exe",
9 "C:\\Windows\\system32\\svchost.exe",
10 "C:\\Windows\\system32\\wbem\\wmiprvse.exe"
11)
Convert GrantedAccess from hexadecimal to decimal. 0x1040 combines PROCESS_DUP_HANDLE (0x40) and PROCESS_QUERY_LIMITED_INFORMATION (0x1000).
1
2| eval g_access_decimal = tonumber(replace(GrantedAccess,"0x",""),16)
3
4| eval PROCESS_DUP_HANDLE = 64
5
6| eval PROCESS_QUERY_LIMITED_INFORMATION = 4096
7
8| eval duplicate_handle_set = bit_and(g_access_decimal, PROCESS_DUP_HANDLE)
9
10| eval query_limited_set = bit_and(g_access_decimal, PROCESS_QUERY_LIMITED_INFORMATION)
11
12| where duplicate_handle_set == PROCESS_DUP_HANDLE
13 AND query_limited_set == PROCESS_QUERY_LIMITED_INFORMATION
14
15
16| stats count min(_time) as firstTime
17 max(_time) as lastTime
18 BY user_id dest
19 signature_id signature granted_access Opcode
20 SourceImage SourceProcessGUID SourceProcessId
21 TargetImage TargetProcessGUID TargetProcessId
22 CallTrace vendor_product
23
24
25| eval CallTrace=split(CallTrace, "
26|")
27
28
29| `security_content_ctime(firstTime)`
30
31| `security_content_ctime(lastTime)`
32
33| `windows_access_token_manipulation_winlogon_duplicate_token_handle_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| Sysmon EventID 10 | 'XmlWinEventLog' |
'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational' |
Macros Used
| Name | Value |
|---|---|
| security_content_ctime | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$) |
| windows_access_token_manipulation_winlogon_duplicate_token_handle_filter | search * |
windows_access_token_manipulation_winlogon_duplicate_token_handle_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
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) | No |
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 winlogon, filter as needed.
Associated Analytic Story
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 |
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: 10