Detection rules › Sigma

Registry Set With Crypto-Classes From The "Cryptography" PowerShell Namespace

Status
test
Severity
medium
Log source
product windows, category registry_set
Author
Andreas Braathen (mnemonic.io)
Source
github.com/SigmaHQ/sigma

Detects the setting of a registry inside the "\Shell\Open\Command" value with PowerShell classes from the "System.Security.Cryptography" namespace. The PowerShell namespace "System.Security.Cryptography" provides classes for on-the-fly encryption and decryption. These can be used for example in decrypting malicious payload for defense evasion.

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 13RegistryEvent (Value Set)

Rule body yaml

title: Registry Set With Crypto-Classes From The "Cryptography" PowerShell Namespace
id: 1c2a3268-3881-414a-80af-a5b313b14c0e
status: test
description: |
    Detects the setting of a registry inside the "\Shell\Open\Command" value with PowerShell classes from the "System.Security.Cryptography" namespace.
    The PowerShell namespace "System.Security.Cryptography" provides classes for on-the-fly encryption and decryption.
    These can be used for example in decrypting malicious payload for defense evasion.
references:
    - https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography?view=net-8.0
    - https://squiblydoo.blog/2023/11/07/october-2023-solarmarker/
author: Andreas Braathen (mnemonic.io)
date: 2023-12-01
tags:
    - attack.execution
    - attack.persistence
    - attack.privilege-escalation
    - attack.stealth
    - attack.t1059.001
    - attack.t1027.010
    - attack.t1547.001
    - detection.threat-hunting
logsource:
    product: windows
    category: registry_set
detection:
    selection_key:
        TargetObject|contains: '\Shell\Open\Command'
    selection_value_img:
        Details|contains:
            - 'powershell'
            - 'pwsh'
    selection_value_namespace:
        Details|contains: 'System.Security.Cryptography.'
    selection_value_classes:
        Details|contains:
            - '.AesCryptoServiceProvider'
            - '.DESCryptoServiceProvider'
            - '.DSACryptoServiceProvider'
            - '.RC2CryptoServiceProvider'
            - '.Rijndael'
            - '.RSACryptoServiceProvider'
            - '.TripleDESCryptoServiceProvider'
    condition: all of selection_*
falsepositives:
    - Classes are legitimately used, but less so when e.g. parents with low prevalence or decryption of content in temporary folders.
level: medium

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_key

selection_key:
    TargetObject|contains: '\Shell\Open\Command'

Stage 2: selection_value_img

selection_value_img:
    Details|contains:
        - 'powershell'
        - 'pwsh'

Stage 3: selection_value_namespace

selection_value_namespace:
    Details|contains: 'System.Security.Cryptography.'

Stage 4: selection_value_classes

selection_value_classes:
    Details|contains:
        - '.AesCryptoServiceProvider'
        - '.DESCryptoServiceProvider'
        - '.DSACryptoServiceProvider'
        - '.RC2CryptoServiceProvider'
        - '.Rijndael'
        - '.RSACryptoServiceProvider'
        - '.TripleDESCryptoServiceProvider'

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
Detailsmatch
  • .AesCryptoServiceProvider
  • .DESCryptoServiceProvider
  • .DSACryptoServiceProvider
  • .RC2CryptoServiceProvider
  • .RSACryptoServiceProvider
  • .Rijndael
  • .TripleDESCryptoServiceProvider
  • System.Security.Cryptography.
  • powershell corpus 10 (sigma 9, chronicle 1)
  • pwsh corpus 5 (sigma 5)
TargetObjectmatch
  • \Shell\Open\Command