Detection rules › Sigma

PUA - PingCastle Execution From Potentially Suspicious Parent

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

Detects the execution of PingCastle, a tool designed to quickly assess the Active Directory security level via a script located in a potentially suspicious or uncommon location.

MITRE ATT&CK coverage

TacticTechniques
ReconnaissanceT1595 Active Scanning

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: PUA - PingCastle Execution From Potentially Suspicious Parent
id: b37998de-a70b-4f33-b219-ec36bf433dc0
related:
    - id: b1cb4ab6-ac31-43f4-adf1-d9d08957419c
      type: derived
status: test
description: |
    Detects the execution of PingCastle, a tool designed to quickly assess the Active Directory security level via a script located in a potentially suspicious or uncommon location.
references:
    - https://github.com/vletoux/pingcastle
    - https://thedfirreport.com/2023/10/30/netsupport-intrusion-results-in-domain-compromise/
    - https://github.com/fengjixuchui/Start-ADEnum/blob/e237a739db98b6104427d833004836507da36a58/Functions/Start-ADEnum.ps1#L450
    - https://github.com/lkys37en/Start-ADEnum/blob/5b42c54215fe5f57fc59abc52c20487d15764005/Functions/Start-ADEnum.ps1#L680
    - https://github.com/projectHULK/AD_Recon/blob/dde2daba9b3393a9388cbebda87068972cc0bd3b/SecurityAssessment.ps1#L2699
    - https://github.com/802-1x/Compliance/blob/2e53df8b6e89686a0b91116b3f42c8f717dca820/Ping%20Castle/Get-PingCastle-HTMLComplianceReport.ps1#L8
    - https://github.com/EvotecIT/TheDashboard/blob/481a9ce8f82f2fd55fe65220ee6486bae6df0c9d/Examples/RunReports/PingCastle.ps1
author: Nasreddine Bencherchali (Nextron Systems), X__Junior (Nextron Systems)
date: 2024-01-11
tags:
    - attack.reconnaissance
    - attack.t1595
logsource:
    category: process_creation
    product: windows
detection:
    selection_parent_ext:
        ParentCommandLine|contains:
            - '.bat'
            - '.chm'
            - '.cmd'
            - '.hta'
            - '.htm'
            - '.html'
            - '.js'
            - '.lnk'
            - '.ps1'
            - '.vbe'
            - '.vbs'
            - '.wsf'
    selection_parent_path_1:
        ParentCommandLine|contains:
            - ':\Perflogs\'
            - ':\Temp\'
            - ':\Users\Public\'
            - ':\Windows\Temp\'
            - '\AppData\Local\Temp'
            - '\AppData\Roaming\'
            - '\Temporary Internet'
    selection_parent_path_2:
        - ParentCommandLine|contains|all:
              - ':\Users\'
              - '\Favorites\'
        - ParentCommandLine|contains|all:
              - ':\Users\'
              - '\Favourites\'
        - ParentCommandLine|contains|all:
              - ':\Users\'
              - '\Contacts\'
    selection_cli:
        - Image|endswith: '\PingCastle.exe'
        - OriginalFileName: PingCastle.exe
        - Product: 'Ping Castle'
        - CommandLine|contains:
              - '--scanner aclcheck'
              - '--scanner antivirus'
              - '--scanner computerversion'
              - '--scanner foreignusers'
              - '--scanner laps_bitlocker'
              - '--scanner localadmin'
              - '--scanner nullsession'
              - '--scanner nullsession-trust'
              - '--scanner oxidbindings'
              - '--scanner remote'
              - '--scanner share'
              - '--scanner smb'
              - '--scanner smb3querynetwork'
              - '--scanner spooler'
              - '--scanner startup'
              - '--scanner zerologon'
        - CommandLine|contains: '--no-enum-limit'
        - CommandLine|contains|all:
              - '--healthcheck'
              - '--level Full'
        - CommandLine|contains|all:
              - '--healthcheck'
              - '--server '
    condition: 1 of selection_parent_* and selection_parent_ext and selection_cli
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

1 of selection_parent_* and selection_parent_ext and selection_cli

Stage 1: selection_parent_ext

selection_parent_ext:
    ParentCommandLine|contains:
        - '.bat'
        - '.chm'
        - '.cmd'
        - '.hta'
        - '.htm'
        - '.html'
        - '.js'
        - '.lnk'
        - '.ps1'
        - '.vbe'
        - '.vbs'
        - '.wsf'

Stage 2: selection_parent_path_1

selection_parent_path_1:
    ParentCommandLine|contains:
        - ':\Perflogs\'
        - ':\Temp\'
        - ':\Users\Public\'
        - ':\Windows\Temp\'
        - '\AppData\Local\Temp'
        - '\AppData\Roaming\'
        - '\Temporary Internet'

Stage 3: selection_parent_path_2

selection_parent_path_2:
    - ParentCommandLine|contains|all:
          - ':\Users\'
          - '\Favorites\'
    - ParentCommandLine|contains|all:
          - ':\Users\'
          - '\Favourites\'
    - ParentCommandLine|contains|all:
          - ':\Users\'
          - '\Contacts\'

Stage 4: selection_parent_ext

selection_parent_ext:
    ParentCommandLine|contains:
        - '.bat'
        - '.chm'
        - '.cmd'
        - '.hta'
        - '.htm'
        - '.html'
        - '.js'
        - '.lnk'
        - '.ps1'
        - '.vbe'
        - '.vbs'
        - '.wsf'

Stage 5: selection_cli

selection_cli:
    - Image|endswith: '\PingCastle.exe'
    - OriginalFileName: PingCastle.exe
    - Product: 'Ping Castle'
    - CommandLine|contains:
          - '--scanner aclcheck'
          - '--scanner antivirus'
          - '--scanner computerversion'
          - '--scanner foreignusers'
          - '--scanner laps_bitlocker'
          - '--scanner localadmin'
          - '--scanner nullsession'
          - '--scanner nullsession-trust'
          - '--scanner oxidbindings'
          - '--scanner remote'
          - '--scanner share'
          - '--scanner smb'
          - '--scanner smb3querynetwork'
          - '--scanner spooler'
          - '--scanner startup'
          - '--scanner zerologon'
    - CommandLine|contains: '--no-enum-limit'
    - CommandLine|contains|all:
          - '--healthcheck'
          - '--level Full'
    - CommandLine|contains|all:
          - '--healthcheck'
          - '--server '

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
  • --healthcheck corpus 3 (sigma 3)
  • --level Full corpus 3 (sigma 3)
  • --no-enum-limit corpus 3 (sigma 3)
  • --scanner aclcheck corpus 3 (sigma 3)
  • --scanner antivirus corpus 3 (sigma 3)
  • --scanner computerversion corpus 3 (sigma 3)
  • --scanner foreignusers corpus 3 (sigma 3)
  • --scanner laps_bitlocker corpus 3 (sigma 3)
  • --scanner localadmin corpus 3 (sigma 3)
  • --scanner nullsession corpus 3 (sigma 3)
  • --scanner nullsession-trust corpus 3 (sigma 3)
  • --scanner oxidbindings corpus 3 (sigma 3)
  • --scanner remote corpus 3 (sigma 3)
  • --scanner share corpus 3 (sigma 3)
  • --scanner smb corpus 3 (sigma 3)
  • --scanner smb3querynetwork corpus 3 (sigma 3)
  • --scanner spooler corpus 3 (sigma 3)
  • --scanner startup corpus 3 (sigma 3)
  • --scanner zerologon corpus 3 (sigma 3)
  • --server corpus 3 (sigma 3)
Imageends_with
  • \PingCastle.exe corpus 2 (sigma 2)
OriginalFileNameeq
  • PingCastle.exe corpus 3 (sigma 3)
ParentCommandLinematch
  • .bat corpus 2 (sigma 1, splunk 1)
  • .chm
  • .cmd
  • .hta
  • .htm
  • .html
  • .js corpus 2 (sigma 2)
  • .lnk corpus 2 (sigma 2)
  • .ps1
  • .vbe
  • .vbs corpus 2 (sigma 2)
  • .wsf
  • :\Perflogs\ corpus 2 (sigma 2)
  • :\Temp\
  • :\Users\ corpus 2 (sigma 2)
  • :\Users\Public\ corpus 2 (sigma 2)
  • :\Windows\Temp\ corpus 2 (sigma 2)
  • \AppData\Local\Temp corpus 2 (sigma 2)
  • \AppData\Roaming\
  • \Contacts\ corpus 2 (sigma 2)
  • \Favorites\ corpus 2 (sigma 2)
  • \Favourites\ corpus 2 (sigma 2)
  • \Temporary Internet corpus 2 (sigma 2)
Producteq
  • Ping Castle corpus 2 (sigma 2)