Detection rules › Sigma

Private Keys Reconnaissance Via CommandLine Tools

Status
test
Severity
medium
Log source
product windows, category process_creation
Author
frack113, Nasreddine Bencherchali (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Adversaries may search for private key certificate files on compromised systems for insecurely stored credential

MITRE ATT&CK coverage

TacticTechniques
Credential AccessT1552.004 Unsecured Credentials: Private Keys

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Private Keys Reconnaissance Via CommandLine Tools
id: 213d6a77-3d55-4ce8-ba74-fcfef741974e
status: test
description: Adversaries may search for private key certificate files on compromised systems for insecurely stored credential
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1552.004/T1552.004.md
author: frack113, Nasreddine Bencherchali (Nextron Systems)
date: 2021-07-20
modified: 2023-03-06
tags:
    - attack.credential-access
    - attack.t1552.004
logsource:
    category: process_creation
    product: windows
detection:
    selection_cmd_img:
        - Image|endswith: '\cmd.exe'
        - OriginalFileName: 'Cmd.Exe'
    selection_cmd_cli:
        CommandLine|contains: 'dir '
    selection_pwsh_img:
        - Image|endswith:
              - '\powershell.exe'
              - '\pwsh.exe'
        - OriginalFileName:
              - 'PowerShell.EXE'
              - 'pwsh.dll'
    selection_pwsh_cli:
        CommandLine|contains: 'Get-ChildItem '
    selection_findstr:
        - Image|endswith: '\findstr.exe'
        - OriginalFileName: 'FINDSTR.EXE'
    selection_ext:
        CommandLine|contains:
            - '.key'
            - '.pgp'
            - '.gpg'
            - '.ppk'
            - '.p12'
            - '.pem'
            - '.pfx'
            - '.cer'
            - '.p7b'
            - '.asc'
    condition: selection_ext and (all of selection_cmd_* or all of selection_pwsh_* or selection_findstr)
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

selection_ext and (all of selection_cmd_* or all of selection_pwsh_* or selection_findstr)

Stage 1: selection_ext

selection_ext:
    CommandLine|contains:
        - '.key'
        - '.pgp'
        - '.gpg'
        - '.ppk'
        - '.p12'
        - '.pem'
        - '.pfx'
        - '.cer'
        - '.p7b'
        - '.asc'

Stage 2: selection_cmd_img

selection_cmd_img:
    - Image|endswith: '\cmd.exe'
    - OriginalFileName: 'Cmd.Exe'

Stage 3: selection_cmd_cli

selection_cmd_cli:
    CommandLine|contains: 'dir '

Stage 4: selection_pwsh_img

selection_pwsh_img:
    - Image|endswith:
          - '\powershell.exe'
          - '\pwsh.exe'
    - OriginalFileName:
          - 'PowerShell.EXE'
          - 'pwsh.dll'

Stage 5: selection_pwsh_cli

selection_pwsh_cli:
    CommandLine|contains: 'Get-ChildItem '

Stage 6: selection_findstr

selection_findstr:
    - Image|endswith: '\findstr.exe'
    - OriginalFileName: 'FINDSTR.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
CommandLinematch
  • .asc
  • .cer
  • .gpg
  • .key
  • .p12
  • .p7b
  • .pem
  • .pfx
  • .pgp
  • .ppk
  • Get-ChildItem corpus 2 (sigma 2)
  • dir corpus 8 (sigma 5, splunk 2, chronicle 1)
Imageends_with
  • \cmd.exe corpus 130 (sigma 130)
  • \findstr.exe corpus 12 (sigma 12)
  • \powershell.exe corpus 182 (sigma 182)
  • \pwsh.exe corpus 168 (sigma 168)
OriginalFileNameeq
  • Cmd.Exe corpus 65 (sigma 43, splunk 17, elastic 5)
  • FINDSTR.EXE corpus 12 (sigma 12)
  • PowerShell.EXE corpus 120 (sigma 84, splunk 30, elastic 6)
  • pwsh.dll corpus 112 (sigma 79, splunk 30, elastic 3)