Latest alertCVE-2018-11776 in Apache Struts Confirmed Exploited in the WildRead
Search all news in the platform

Detection rule

User Added to Remote Desktop Users Group

HighTest-data validatedSigmaHQ (community)T1021.001T1133T1136.001

Overview

Detects addition of users to the local Remote Desktop Users group via "Net" or "Add-LocalGroupMember".

Rule id
ffa28e60-bdb1-46e0-9f82-05f7a61cc06e
ATT&CK techniques
T1021.001 Remote Services: Remote Desktop Protocol, T1133 External Remote Services, T1136.001 Create Account: Local Account
Severity
High
Confidence
Low
Origin
SigmaHQ (community)
SigmaHQ status
test
Used in defense packs
n0n, The Gentlemen, qilin, INC Ransom, Akira, safepay, Play, nightspire

Validation

  1. ExperimentalSyntax checked only. Not yet tested on events.
  2. Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
  3. SIEM-validatedRun in a real SIEM, with a recorded result.

1 of 1 positive test events matched; 1 of 1 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.

Detection logic and queries

Queries are shown exactly as generated. Test them in your environment before you deploy them.

Sigma

Sigma (YAML) · ffa28e60-bdb1-46e0-9f82-05f7a61cc06e

Download
title: User Added to Remote Desktop Users Group
id: ffa28e60-bdb1-46e0-9f82-05f7a61cc06e
related:
    - id: ad720b90-25ad-43ff-9b5e-5c841facc8e5 # Admin groups
      type: similar
    - id: 10fb649c-3600-4d37-b1e6-56ea90bb7e09 # Privileged groups
      type: similar
status: test
description: Detects addition of users to the local Remote Desktop Users group via "Net" or "Add-LocalGroupMember".
references:
    - https://www.microsoft.com/security/blog/2021/11/16/evolving-trends-in-iranian-threat-actor-activity-mstic-presentation-at-cyberwarcon-2021/
author: Florian Roth (Nextron Systems)
date: 2021-12-06
modified: 2022-09-09
tags:
    - attack.initial-access
    - attack.persistence
    - attack.lateral-movement
    - attack.t1133
    - attack.t1136.001
    - attack.t1021.001
logsource:
    category: process_creation
    product: windows
detection:
    selection_main:
        - CommandLine|contains|all:
              - 'localgroup '
              - ' /add'
        - CommandLine|contains|all:
              - 'Add-LocalGroupMember '
              - ' -Group '
    selection_group:
        CommandLine|contains:
            - 'Remote Desktop Users'
            - 'Utilisateurs du Bureau à distance' # French for "Remote Desktop Users"
            - 'Usuarios de escritorio remoto' # Spanish for "Remote Desktop Users"
    condition: all of selection_*
falsepositives:
    - Administrative activity
level: high

QRadar AQL

IBM QRadar AQL (hunting query)Hunting query

Hunting search for the Log Activity tab or the API. It is not a QRadar rule.

AQL search for the Log Activity tab or the API. It is NOT a deployable QRadar rule: real-time detection in QRadar is a CRE (Custom Rule Engine) rule, for which this build only writes a design specification (qradar_cre).

SELECT * FROM events WHERE devicetype=12 AND ((LOWER(Command) LIKE '%localgroup %' AND LOWER(Command) LIKE '% /add%') OR (LOWER(Command) LIKE '%add-localgroupmember %' AND LOWER(Command) LIKE '% -group %')) AND (LOWER(Command) LIKE '%remote desktop users%' OR LOWER(Command) LIKE '%utilisateurs du bureau à distance%' OR LOWER(Command) LIKE '%usuarios de escritorio remoto%')

QRadar CRE

Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.

Rule name
OffSet7: User Added to Remote Desktop Users Group
Rule type
Event rule (Local)
Log source types
Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1

Building blocks

  • BB:OffSet7:User Added to Remote Desktop Users Group:selection_main (match)
    Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.
    • Command contains: localgroup, /add
    • Command contains: Add-LocalGroupMember, -Group
  • BB:OffSet7:User Added to Remote Desktop Users Group:selection_group (match)
    All test lines must match (AND).
    • Command contains: Remote Desktop Users, Utilisateurs du Bureau à distance, Usuarios de escritorio remoto

Main rule, option A (building blocks)

  1. when the event(s) were detected by one or more of these log source types: Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1
  2. when an event matches the condition built from these building blocks: (ALL of [BB:OffSet7:User Added to Remote Desktop Users Group:selection_main, BB:OffSet7:User Added to Remote Desktop Users Group:selection_group])

Main rule, option B (AQL filter test)

  1. when the event matches this AQL filter query: devicetype=12 AND ((LOWER(Command) LIKE '%localgroup %' AND LOWER(Command) LIKE '% /add%') OR (LOWER(Command) LIKE '%add-localgroupmember %' AND LOWER(Command) LIKE '% -group %')) AND (LOWER(Command) LIKE '%remote desktop users%' OR LOWER(Command) LIKE '%utilisateurs du bureau à distance%' OR LOWER(Command) LIKE '%usuarios de escritorio remoto%')

Rule response

  • Severity 7, credibility 6, relevance 7
  • Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
  • Respond no more than once per 30 minutes per Log Source (tune per environment)

Limitations

  • QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.

Splunk

Splunk SPLSearch

Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.

((CommandLine="*localgroup *" CommandLine="* /add*") OR (CommandLine="*Add-LocalGroupMember *" CommandLine="* -Group *")) (CommandLine IN ("*Remote Desktop Users*", "*Utilisateurs du Bureau à distance*", "*Usuarios de escritorio remoto*"))

Splunk savedsearches.conf stanzaScheduled search template

Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.

[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now

[User Added to Remote Desktop Users Group]
description = Detects addition of users to the local Remote Desktop Users group via "Net" or "Add-LocalGroupMember".
search = ((CommandLine="*localgroup *" CommandLine="* /add*") OR (CommandLine="*Add-LocalGroupMember *" CommandLine="* -Group *")) (CommandLine IN ("*Remote Desktop Users*", "*Utilisateurs du Bureau à distance*", "*Usuarios de escritorio remoto*"))

Microsoft Sentinel

Microsoft Sentinel KQL (ASIM)Hunting query

Hunting query over ASIM-normalized tables. An analytics rule also needs a schedule, entity mapping and alert grouping.

imProcessCreate
| where ((TargetProcessCommandLine contains "localgroup " and TargetProcessCommandLine contains " /add") or (TargetProcessCommandLine contains "Add-LocalGroupMember " and TargetProcessCommandLine contains " -Group ")) and (TargetProcessCommandLine contains "Remote Desktop Users" or TargetProcessCommandLine contains "Utilisateurs du Bureau à distance" or TargetProcessCommandLine contains "Usuarios de escritorio remoto")

Defender XDR

Microsoft Defender XDR KQLHunting query

Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.

DeviceProcessEvents
| where ((ProcessCommandLine contains "localgroup " and ProcessCommandLine contains " /add") or (ProcessCommandLine contains "Add-LocalGroupMember " and ProcessCommandLine contains " -Group ")) and (ProcessCommandLine contains "Remote Desktop Users" or ProcessCommandLine contains "Utilisateurs du Bureau à distance" or ProcessCommandLine contains "Usuarios de escritorio remoto")

Elastic

Elastic Lucene (ECS)Hunting query

Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.

((process.command_line:*localgroup\ * AND process.command_line:*\ \/add*) OR (process.command_line:*Add\-LocalGroupMember\ * AND process.command_line:*\ \-Group\ *)) AND (process.command_line:(*Remote\ Desktop\ Users* OR *Utilisateurs\ du\ Bureau\ à\ distance* OR *Usuarios\ de\ escritorio\ remoto*))

Elastic EQL (ECS)Hunting query

EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.

any where ((process.command_line:"*localgroup *" and process.command_line:"* /add*") or (process.command_line:"*Add-LocalGroupMember *" and process.command_line:"* -Group *")) and (process.command_line like~ ("*Remote Desktop Users*", "*Utilisateurs du Bureau à distance*", "*Usuarios de escritorio remoto*"))

Elastic ES|QL (ECS)Hunting query

ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.

from * metadata _id, _index, _version | where (process.command_line like "*localgroup *" and process.command_line like "* /add*" or process.command_line like "*Add-LocalGroupMember *" and process.command_line like "* -Group *") and (process.command_line like "*Remote Desktop Users*" or process.command_line like "*Utilisateurs du Bureau à distance*" or process.command_line like "*Usuarios de escritorio remoto*")

Required telemetry

Log source
product: windows · category: process_creation
Fields used
CommandLine

False positives

  • Administrative activity

Investigation and response

No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.

References

Author and attribution

Author
Florian Roth (Nextron Systems)
Source
SigmaHQ · rules/windows/process_creation/proc_creation_win_susp_add_user_remote_desktop_group.yml
Upstream commit
9688134317a2
Licence
Detection Rule License (DRL) 1.1

Version history

  1. Version 1Imported from SigmaHQ
  2. OffSet7 build · SigmaHQ 9688134317a2

Related rules