Detection rules › Sigma

Privilege escalation via runas (command)

Status
experimental
Severity
medium
Log source
product windows, service security
Author
mdecrevoisier
Source
github.com/mdecrevoisier/SIGMA-detection-rules

Detects scenarios where attack attempts to elevate privileges via the command runas.

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Privilege escalation via runas (command)
description: Detects scenarios where attack attempts to elevate privileges via the command runas.
correlation: correlation between the 3 event IDs can be done over SubjectLogonId in order to get more context.
references:
- https://github.com/mdecrevoisier/EVTX-to-MITRE-Attack/tree/master/TA0004-Privilege%20Escalation/T1134-Access%20Token%20Manipulation
- https://www.elastic.co/fr/blog/how-attackers-abuse-access-token-manipulation
- http://www.pseale.com/pretend-youre-on-the-domain-with-runas-netonly
- https://blog.palantir.com/windows-privilege-abuse-auditing-detection-and-defense-3078a403d74e
tags:
- attack.privilege_escalation
- attack.t1134.002
author: mdecrevoisier
status: experimental
logsource:
  product: windows
  service: security
detection: # Full command: 'runas /user:<domain>\<user> cmd.exe'

  selection_command:
    EventID: 4688
    NewProcessName|endswith: '\runas.exe'
    CommandLine|contains|all:
      - runas
      - '/user:'

  selection_login:
    EventID: 4624
    LogonType: 2
    LogonProcessName: seclogo
    #AuthenticationPackageName: Negotiate
    ProcessName|endswith: '\svchost.exe'
    IpAddress: '::1'

  selection_swtich_cred:
    EventID: 4648
    TargetServerName: localhost
    ProcessName|endswith: '\svchost.exe'
    IpAddress: '::1 '

  condition: selection_login and selection_command and selection_swtich_cred
falsepositives:
- Administrator activity
level: medium

Stages and Predicates

Stage 0: condition

selection_login and selection_command and selection_swtich_cred

Stage 1: selection_login

selection_login:
  EventID: 4624
  LogonType: 2
  LogonProcessName: seclogo
  ProcessName|endswith: '\svchost.exe'
  IpAddress: '::1'

Stage 2: selection_command

selection_command:
  EventID: 4688
  NewProcessName|endswith: '\runas.exe'
  CommandLine|contains|all:
    - runas
    - '/user:'

Stage 3: selection_swtich_cred

selection_swtich_cred:
  EventID: 4648
  TargetServerName: localhost
  ProcessName|endswith: '\svchost.exe'
  IpAddress: '::1 '

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
CommandLinematch
  • /user: corpus 7 (sigma 5, splunk 2)
  • runas corpus 2 (sigma 1, splunk 1)
IpAddresseq
  • ::1 corpus 6 (sigma 5, elastic 1)
  • ::1
LogonProcessNameeq
  • seclogo corpus 5 (sigma 4, elastic 1)
LogonTypeeq
  • 2 corpus 5 (sigma 2, splunk 2, elastic 1)
NewProcessNameends_with
  • \runas.exe
ProcessNameends_with
  • \svchost.exe
TargetServerNameeq
  • localhost