Detection rules › Sigma

PowerView PowerShell Cmdlets - ScriptBlock

Status
test
Severity
high
Log source
product windows, category ps_script
Author
Bhabesh Raj
Source
github.com/SigmaHQ/sigma

Detects Cmdlet names from PowerView of the PowerSploit exploitation framework.

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: PowerView PowerShell Cmdlets - ScriptBlock
id: dcd74b95-3f36-4ed9-9598-0490951643aa
related:
    - id: b2317cfa-4a47-4ead-b3ff-297438c0bc2d
      type: similar
status: test
description: Detects Cmdlet names from PowerView of the PowerSploit exploitation framework.
references:
    - https://powersploit.readthedocs.io/en/stable/Recon/README
    - https://github.com/PowerShellMafia/PowerSploit/tree/master/Recon
    - https://thedfirreport.com/2020/10/08/ryuks-return
    - https://adsecurity.org/?p=2277
author: Bhabesh Raj
date: 2021-05-18
modified: 2023-11-22
tags:
    - attack.execution
    - attack.t1059.001
logsource:
    product: windows
    category: ps_script
    definition: 'Requirements: Script Block Logging must be enabled'
detection:
    selection:
        ScriptBlockText|contains:
            - 'Export-PowerViewCSV'
            - 'Find-DomainLocalGroupMember'
            - 'Find-DomainObjectPropertyOutlier'
            - 'Find-DomainProcess'
            - 'Find-DomainShare'
            - 'Find-DomainUserEvent'
            - 'Find-DomainUserLocation'
            - 'Find-ForeignGroup'
            - 'Find-ForeignUser'
            - 'Find-GPOComputerAdmin'
            - 'Find-GPOLocation'
            - 'Find-InterestingDomain' # Covers: Find-InterestingDomainAcl, Find-InterestingDomainShareFile
            - 'Find-InterestingFile'
            - 'Find-LocalAdminAccess'
            - 'Find-ManagedSecurityGroups'
            - 'Get-CachedRDPConnection'
            - 'Get-DFSshare'
            - 'Get-DomainDFSShare'
            - 'Get-DomainDNSRecord'
            - 'Get-DomainDNSZone'
            - 'Get-DomainFileServer'
            - 'Get-DomainGPOComputerLocalGroupMapping'
            - 'Get-DomainGPOLocalGroup'
            - 'Get-DomainGPOUserLocalGroupMapping'
            - 'Get-LastLoggedOn'
            - 'Get-LoggedOnLocal'
            - 'Get-NetFileServer'
            - 'Get-NetForest' # Covers: Get-NetForestCatalog, Get-NetForestDomain, Get-NetForestTrust
            - 'Get-NetGPOGroup'
            - 'Get-NetProcess'
            - 'Get-NetRDPSession'
            - 'Get-RegistryMountedDrive'
            - 'Get-RegLoggedOn'
            - 'Get-WMIRegCachedRDPConnection'
            - 'Get-WMIRegLastLoggedOn'
            - 'Get-WMIRegMountedDrive'
            - 'Get-WMIRegProxy'
            - 'Invoke-ACLScanner'
            - 'Invoke-CheckLocalAdminAccess'
            - 'Invoke-EnumerateLocalAdmin'
            - 'Invoke-EventHunter'
            - 'Invoke-FileFinder'
            - 'Invoke-Kerberoast'
            - 'Invoke-MapDomainTrust'
            - 'Invoke-ProcessHunter'
            - 'Invoke-RevertToSelf'
            - 'Invoke-ShareFinder'
            - 'Invoke-UserHunter'
            - 'Invoke-UserImpersonation'
            - 'Remove-RemoteConnection'
            - 'Request-SPNTicket'
            - 'Resolve-IPAddress'
            # - 'Get-ADObject'  # prone to FPs
            # - 'Get-Domain'  # too many FPs  # Covers Cmdlets like: DomainComputer, DomainController, DomainDFSShare, DomainDNSRecord, DomainGPO, etc.
            # - 'Add-DomainGroupMember'
            # - 'Add-DomainObjectAcl'
            # - 'Add-ObjectAcl'
            # - 'Add-RemoteConnection'
            # - 'Convert-ADName'
            # - 'Convert-NameToSid'
            # - 'ConvertFrom-UACValue'
            # - 'ConvertTo-SID'
            # - 'Get-DNSRecord'
            # - 'Get-DNSZone'
            # - 'Get-DomainComputer'
            # - 'Get-DomainController'
            # - 'Get-DomainGroup'
            # - 'Get-DomainGroupMember'
            # - 'Get-DomainManagedSecurityGroup'
            # - 'Get-DomainObject'
            # - 'Get-DomainObjectAcl'
            # - 'Get-DomainOU'
            # - 'Get-DomainPolicy'
            # - 'Get-DomainSID'
            # - 'Get-DomainSite'
            # - 'Get-DomainSPNTicket'
            # - 'Get-DomainSubnet'
            # - 'Get-DomainUser'
            # - 'Get-DomainUserEvent'
            # - 'Get-Forest' # Covers: Get-ForestDomain, Get-ForestGlobalCatalog, Get-ForestTrust
            # - 'Get-IPAddress'
            # - 'Get-NetComputer' # Covers: Get-NetComputerSiteName
            # - 'Get-NetDomain' # Covers: Get-NetDomainController, Get-NetDomainTrust
            # - 'Get-NetGroup' # Covers: Get-NetGroupMember
            # - 'Get-NetLocalGroup' # Covers: NetLocalGroupMember
            # - 'Get-NetLoggedon'
            # - 'Get-NetOU'
            # - 'Get-NetSession'
            # - 'Get-NetShare'
            # - 'Get-NetSite'
            # - 'Get-NetSubnet'
            # - 'Get-NetUser'
            # - 'Get-ObjectAcl'
            # - 'Get-PathAcl'
            # - 'Get-Proxy'
            # - 'Get-SiteName'
            # - 'Get-UserEvent'
            # - 'Get-WMIProcess'
            # - 'New-DomainGroup'
            # - 'New-DomainUser'
            # - 'Set-ADObject'
            # - 'Set-DomainObject'
            # - 'Set-DomainUserPassword'
            # - 'Test-AdminAccess'
    condition: selection
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

selection

Stage 1: selection

selection:
    ScriptBlockText|contains:
        - 'Export-PowerViewCSV'
        - 'Find-DomainLocalGroupMember'
        - 'Find-DomainObjectPropertyOutlier'
        - 'Find-DomainProcess'
        - 'Find-DomainShare'
        - 'Find-DomainUserEvent'
        - 'Find-DomainUserLocation'
        - 'Find-ForeignGroup'
        - 'Find-ForeignUser'
        - 'Find-GPOComputerAdmin'
        - 'Find-GPOLocation'
        - 'Find-InterestingDomain'
        - 'Find-InterestingFile'
        - 'Find-LocalAdminAccess'
        - 'Find-ManagedSecurityGroups'
        - 'Get-CachedRDPConnection'
        - 'Get-DFSshare'
        - 'Get-DomainDFSShare'
        - 'Get-DomainDNSRecord'
        - 'Get-DomainDNSZone'
        - 'Get-DomainFileServer'
        - 'Get-DomainGPOComputerLocalGroupMapping'
        - 'Get-DomainGPOLocalGroup'
        - 'Get-DomainGPOUserLocalGroupMapping'
        - 'Get-LastLoggedOn'
        - 'Get-LoggedOnLocal'
        - 'Get-NetFileServer'
        - 'Get-NetForest'
        - 'Get-NetGPOGroup'
        - 'Get-NetProcess'
        - 'Get-NetRDPSession'
        - 'Get-RegistryMountedDrive'
        - 'Get-RegLoggedOn'
        - 'Get-WMIRegCachedRDPConnection'
        - 'Get-WMIRegLastLoggedOn'
        - 'Get-WMIRegMountedDrive'
        - 'Get-WMIRegProxy'
        - 'Invoke-ACLScanner'
        - 'Invoke-CheckLocalAdminAccess'
        - 'Invoke-EnumerateLocalAdmin'
        - 'Invoke-EventHunter'
        - 'Invoke-FileFinder'
        - 'Invoke-Kerberoast'
        - 'Invoke-MapDomainTrust'
        - 'Invoke-ProcessHunter'
        - 'Invoke-RevertToSelf'
        - 'Invoke-ShareFinder'
        - 'Invoke-UserHunter'
        - 'Invoke-UserImpersonation'
        - 'Remove-RemoteConnection'
        - 'Request-SPNTicket'
        - 'Resolve-IPAddress'

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
ScriptBlockTextmatch
  • Export-PowerViewCSV
  • Find-DomainLocalGroupMember
  • Find-DomainObjectPropertyOutlier
  • Find-DomainProcess
  • Find-DomainShare
  • Find-DomainUserEvent
  • Find-DomainUserLocation
  • Find-ForeignGroup
  • Find-ForeignUser
  • Find-GPOComputerAdmin
  • Find-GPOLocation corpus 2 (sigma 2)
  • Find-InterestingDomain
  • Find-InterestingFile
  • Find-LocalAdminAccess corpus 2 (sigma 1, splunk 1)
  • Find-ManagedSecurityGroups
  • Get-CachedRDPConnection
  • Get-DFSshare
  • Get-DomainDFSShare
  • Get-DomainDNSRecord
  • Get-DomainDNSZone
  • Get-DomainFileServer
  • Get-DomainGPOComputerLocalGroupMapping
  • Get-DomainGPOLocalGroup
  • Get-DomainGPOUserLocalGroupMapping
  • Get-LastLoggedOn
  • Get-LoggedOnLocal
  • Get-NetFileServer
  • Get-NetForest
  • Get-NetGPOGroup
  • Get-NetProcess
  • Get-NetRDPSession
  • Get-RegLoggedOn
  • Get-RegistryMountedDrive
  • Get-WMIRegCachedRDPConnection
  • Get-WMIRegLastLoggedOn
  • Get-WMIRegMountedDrive
  • Get-WMIRegProxy
  • Invoke-ACLScanner corpus 2 (sigma 2)
  • Invoke-CheckLocalAdminAccess
  • Invoke-EnumerateLocalAdmin
  • Invoke-EventHunter
  • Invoke-FileFinder
  • Invoke-Kerberoast
  • Invoke-MapDomainTrust
  • Invoke-ProcessHunter
  • Invoke-RevertToSelf
  • Invoke-ShareFinder
  • Invoke-UserHunter corpus 2 (sigma 2)
  • Invoke-UserImpersonation
  • Remove-RemoteConnection
  • Request-SPNTicket
  • Resolve-IPAddress