EXPLORE
← Back to Explore
sigmamediumHunting

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

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

defense-evasionexecutionpersistenceprivilege-escalation

Detection Query

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_*

Author

Andreas Braathen (mnemonic.io)

Created

2023-12-01

Data Sources

windowsRegistry Set Events

Platforms

windows

Tags

attack.defense-evasionattack.executionattack.persistenceattack.privilege-escalationattack.t1059.001attack.t1027.010attack.t1547.001detection.threat-hunting
Raw Content
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.defense-evasion
    - attack.execution
    - attack.persistence
    - attack.privilege-escalation
    - 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