Detection rules › Sigma

PowerShell SAM Copy

Status
test
Severity
high
Log source
product windows, category process_creation
Author
Florian Roth (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects suspicious PowerShell scripts accessing SAM hives

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: PowerShell SAM Copy
id: 1af57a4b-460a-4738-9034-db68b880c665
status: test
description: Detects suspicious PowerShell scripts accessing SAM hives
references:
    - https://twitter.com/splinter_code/status/1420546784250769408
author: Florian Roth (Nextron Systems)
date: 2021-07-29
modified: 2023-01-06
tags:
    - attack.credential-access
    - attack.t1003.002
logsource:
    category: process_creation
    product: windows
detection:
    selection_1:
        CommandLine|contains|all:
            - '\HarddiskVolumeShadowCopy'
            - 'System32\config\sam'
    selection_2:
        CommandLine|contains:
            - 'Copy-Item'
            - 'cp $_.'
            - 'cpi $_.'
            - 'copy $_.'
            - '.File]::Copy('
    condition: all of selection*
falsepositives:
    - Some rare backup scenarios
    - PowerShell scripts fixing HiveNightmare / SeriousSAM ACLs
level: high

Stages and Predicates

Stage 0: condition

all of selection*

Stage 1: selection_1

selection_1:
    CommandLine|contains|all:
        - '\HarddiskVolumeShadowCopy'
        - 'System32\config\sam'

Stage 2: selection_2

selection_2:
    CommandLine|contains:
        - 'Copy-Item'
        - 'cp $_.'
        - 'cpi $_.'
        - 'copy $_.'
        - '.File]::Copy('

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
  • .File]::Copy(
  • Copy-Item corpus 6 (sigma 5, chronicle 1)
  • System32\config\sam
  • \HarddiskVolumeShadowCopy
  • copy $_.
  • cp $_.
  • cpi $_.