Detection rules › Panther

Query.CloudTrail.Password.Spraying

Source
github.com/panther-labs/panther-analysis

Detect password spraying in cloudtrail logs

Rule body yaml

AnalysisType: scheduled_query
QueryName: "Query.CloudTrail.Password.Spraying"
Enabled: false
Description: >
  Detect password spraying in cloudtrail logs
Query: |
  SELECT
    -- this information will be in the alert events
    awsRegion as region,
    recipientAccountId as accountid,
    COUNT(DISTINCT useridentity:userName) as distinctUserNames,
    COUNT(1) as failures,
    MIN(p_event_time) as first_attempt,
    MAX(p_event_time) as last_attempt
  FROM
    panther_logs.public.aws_cloudtrail
  WHERE
    p_occurs_since(3600)
    AND
    eventtype = 'AwsConsoleSignIn'
    AND
    responseElements:ConsoleLogin = 'Failure'
  GROUP BY
    region, accountid
  HAVING
    distinctUserNames > 5
    AND
    failures > 10
Schedule:
  RateMinutes: 60
  TimeoutMinutes: 1

Detection logic

Stage 1: source

panther_logs.public.aws_cloudtrail

Stage 2: filter

eventtype eq "AwsConsoleSignIn"
responseElements:ConsoleLogin eq "Failure"

Stage 3: having

distinctUserNames gt "5"
failures gt "10"

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.

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

FieldSource
regionawsRegion
accountidrecipientAccountId
distinctUserNamesCOUNT ( DISTINCT useridentity:userName )
failuresCOUNT ( 1 )
first_attemptMIN ( p_event_time )
last_attemptMAX ( p_event_time )