Detection rules › Panther

CloudTrail Stopped

Severity
medium
Group by
requestParameters.name
Compliance
CIS 3.5; Stratus Red Team aws.defense-evasion.cloudtrail-delete, aws.defense-evasion.cloudtrail-stop
Log types
AWS.CloudTrail
Tags
AWS, Security Control, DemoThreatHunting, Defense Evasion:Impair Defenses
Reference
https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-delete-trails-console.html
Source
github.com/panther-labs/panther-analysis

A CloudTrail Trail was modified.

MITRE ATT&CK coverage

TacticTechniques
StealthT1562 Impair Defenses

Rules detecting the same action

Other rules on this platform that filter on the same API call or operation.

Rule body yaml

AnalysisType: rule
Filename: aws_cloudtrail_stopped.py
RuleID: "AWS.CloudTrail.Stopped"
DisplayName: "CloudTrail Stopped"
Enabled: true
LogTypes:
  - AWS.CloudTrail
Tags:
  - AWS
  - Security Control
  - DemoThreatHunting
  - Defense Evasion:Impair Defenses
Reports:
  CIS:
    - 3.5
  MITRE ATT&CK:
    - TA0005:T1562
  Stratus Red Team:
    - aws.defense-evasion.cloudtrail-delete
    - aws.defense-evasion.cloudtrail-stop
Severity: Medium
Description: >
  A CloudTrail Trail was modified.
Runbook: https://docs.runpanther.io/alert-runbooks/built-in-rules/aws-cloudtrail-modified
Reference: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-delete-trails-console.html
SummaryAttributes:
  - eventName
  - userAgent
  - sourceIpAddress
  - recipientAccountId
  - p_any_aws_arns
Tests:
  - Name: CloudTrail Was Stopped
    ExpectedResult: true
    Log:
      {
        "eventVersion": "1.05",
        "userIdentity":
          {
            "type": "AssumedRole",
            "principalId": "tester",
            "arn": "arn:aws:sts::123456789012:assumed-role/tester",
            "accountId": "123456789012",
            "accessKeyId": "1",
            "sessionContext":
              {
                "sessionIssuer":
                  {
                    "type": "Role",
                    "principalId": "1111",
                    "arn": "arn:aws:iam::123456789012:role/tester",
                    "accountId": "123456789012",
                    "userName": "Tester",
                  },
                "webIdFederationData": {},
                "attributes":
                  {
                    "mfaAuthenticated": "true",
                    "creationDate": "2019-01-01T00:00:00Z",
                  },
              },
          },
        "eventTime": "2019-01-01T00:00:00Z",
        "eventSource": "cloudtrail.amazonaws.com",
        "eventName": "StopLogging",
        "awsRegion": "us-west-2",
        "sourceIPAddress": "111.111.111.111",
        "userAgent": "console.amazonaws.com",
        "requestParameters":
          {
            "name": "arn:aws:cloudtrail:us-west-2:123456789012:trail/example-trail",
          },
        "responseElements": null,
        "requestID": "1",
        "eventID": "1",
        "readOnly": false,
        "eventType": "AwsApiCall",
        "recipientAccountId": "123456789012",
      }
  - Name: CloudTrail Was Started
    ExpectedResult: false
    Log:
      {
        "eventVersion": "1.05",
        "userIdentity":
          {
            "type": "AssumedRole",
            "principalId": "111:panther-snapshot-scheduler",
            "arn": "arn:aws:sts::123456789012:assumed-role/tester",
            "accountId": "123456789012",
            "accessKeyId": "1",
            "sessionContext":
              {
                "attributes":
                  {
                    "mfaAuthenticated": "false",
                    "creationDate": "2019-01-01T00:00:00Z",
                  },
                "sessionIssuer":
                  {
                    "type": "Role",
                    "principalId": "1111",
                    "arn": "arn:aws:iam::123456789012:role/tester",
                    "accountId": "123456789012",
                    "userName": "tester",
                  },
              },
          },
        "eventTime": "2019-01-01T00:00:00Z",
        "eventSource": "cloudtrail.amazonaws.com",
        "eventName": "StartLogging",
        "awsRegion": "us-west-2",
        "sourceIPAddress": "111.111.111.111",
        "userAgent": "Mozilla",
        "requestParameters":
          {
            "encryptionContext":
              {
                "aws:lambda:FunctionArn": "arn:aws:lambda:us-west-2:123456789012:function:test-function",
              },
          },
        "responseElements": null,
        "requestID": "1",
        "eventID": "1",
        "readOnly": true,
        "resources":
          [
            {
              "ARN": "arn:aws:kms:us-west-2:123456789012:key/1",
              "accountId": "123456789012",
              "type": "AWS::KMS::Key",
            },
          ],
        "eventType": "AwsApiCall",
        "recipientAccountId": "123456789012",
      }
  - Name: Error Stopping CloudTrail
    ExpectedResult: false
    Log:
      {
        "eventVersion": "1.05",
        "errorCode": "InvalidTrailNameException",
        "userIdentity":
          {
            "type": "AssumedRole",
            "principalId": "tester",
            "arn": "arn:aws:sts::123456789012:assumed-role/tester",
            "accountId": "123456789012",
            "accessKeyId": "1",
            "sessionContext":
              {
                "sessionIssuer":
                  {
                    "type": "Role",
                    "principalId": "1111",
                    "arn": "arn:aws:iam::123456789012:role/tester",
                    "accountId": "123456789012",
                    "userName": "Tester",
                  },
                "webIdFederationData": {},
                "attributes":
                  {
                    "mfaAuthenticated": "true",
                    "creationDate": "2019-01-01T00:00:00Z",
                  },
              },
          },
        "eventTime": "2019-01-01T00:00:00Z",
        "eventSource": "cloudtrail.amazonaws.com",
        "eventName": "StopLogging",
        "awsRegion": "us-west-2",
        "sourceIPAddress": "111.111.111.111",
        "userAgent": "console.amazonaws.com",
        "requestParameters":
          {
            "name": "arn:aws:cloudtrail:us-west-2:123456789012:trail/example-trail",
          },
        "responseElements": null,
        "requestID": "1",
        "eventID": "1",
        "readOnly": false,
        "eventType": "AwsApiCall",
        "recipientAccountId": "123456789012",
      }

Detection logic

Condition

not (errorCode is_not_null or errorMessage is_not_null)
eventName in ["DeleteTrail", "StopLogging"]

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
errorCodeis_not_null(no value, null check)
errorMessageis_not_null(no value, null check)

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
eventNamein
  • DeleteTrail
  • StopLogging

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.

Field
eventName
eventSource
awsRegion
recipientAccountId
sourceIPAddress
userAgent
userIdentity