Abuse of Service Permissions to Hide Services Via Set-Service
Detects usage of the "Set-Service" powershell cmdlet to configure a new SecurityDescriptor that allows a service to be hidden from other utilities such as "sc.exe", "Get-Service"...etc. (Works only in powershell 7)
Sigma rule (View on GitHub)
1title: Abuse of Service Permissions to Hide Services Via Set-Service
2id: 514e4c3a-c77d-4cde-a00f-046425e2301e
3related:
4 - id: a537cfc3-4297-4789-92b5-345bfd845ad0
5 type: derived
6 - id: 953945c5-22fe-4a92-9f8a-a9edc1e522da
7 type: similar
8status: test
9description: Detects usage of the "Set-Service" powershell cmdlet to configure a new SecurityDescriptor that allows a service to be hidden from other utilities such as "sc.exe", "Get-Service"...etc. (Works only in powershell 7)
10references:
11 - https://twitter.com/Alh4zr3d/status/1580925761996828672
12 - https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-service?view=powershell-7.2
13author: Nasreddine Bencherchali (Nextron Systems)
14date: 2022-10-17
15tags:
16 - attack.persistence
17 - attack.privilege-escalation
18 - attack.execution
19 - attack.stealth
20 - attack.t1574.011
21logsource:
22 category: process_creation
23 product: windows
24detection:
25 selection_img:
26 - Image|endswith: '\pwsh.exe'
27 - OriginalFileName: 'pwsh.dll'
28 selection_sddl:
29 # Example would be: "D:(D;;DCLCWPDTSD;;;IU)(D;;DCLCWPDTSD;;;SU)(D;;DCLCWPDTSD;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)"
30 CommandLine|contains|all:
31 - 'Set-Service '
32 - 'DCLCWPDTSD'
33 selection_cmdlet:
34 CommandLine|contains:
35 - '-SecurityDescriptorSddl '
36 - '-sd '
37 condition: all of selection_*
38falsepositives:
39 - Rare intended use of hidden services
40level: high
References
Related rules
- Abuse of Service Permissions to Hide Services Via Set-Service - PS
- Changing Existing Service ImagePath Value Via Reg.EXE
- Possible Privilege Escalation via Weak Service Permissions
- Potential Persistence Attempt Via Existing Service Tampering
- Potential Privilege Escalation via Service Permissions Weakness