Detection rules › Kusto Query Language

Account Creation

Source
upstream

User accounts may be created to achieve persistence on a machine. Read more here: https://attack.mitre.org/wiki/Technique/T1136. Tags: #CreateAccount. Query #1: Query for users being created using "net user" command. "net user" commands are noisy, so needs to be joined with another signal -. E.g. in this example we look for use of uncommon & undocumented commandline switches (e.g. /ad instead of /add).

MITRE ATT&CK coverage

TacticTechniques
PersistenceT1136 Create Account

Event coverage

ProviderEvent IDTitle
Sysmon1Process creation
Security-Auditing4688A new process has been created.
Defender-DeviceProcessEvents9001000Process activity (any)

Stages and Predicates

Stage 1: source

DeviceProcessEvents

Stage 2: where

FileName in ["net.exe", "net1.exe"]

Stage 3: parse

Stage 4: where

CreatedUser is_not_null

Stage 5: where

not
  and
    FileName eq "net1.exe"
    InitiatingProcessFileName eq "net.exe"
     macro "(replace(\"net\", \"net1\", InitiatingProcessCommandLine) =~ ProcessCommandLine)"

Stage 6: extend

Stage 7: where

or
  and
    not
      ProcessCommandLine contains "/domain"
    CreatedOnLocalMachine eq "0"
  not
    ProcessCommandLine contains "/add"

Stage 8: summarize

Stage 9: extend

Stage 10: extend

Exclusions

Top-level NOT(...) conjuncts — predicates this rule actively suppresses.

StageFieldKindExcluded values
1FileNameeqnet1.exe
2InitiatingProcessFileNameeqnet.exe

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
CreatedOnLocalMachineeq
  • 0
FileNamein
  • net.exe
  • net1.exe