Detection rules › Panther

IAM Change

Severity
informational
Compliance
Stratus Red Team aws.persistence.iam-backdoor-role, aws.persistence.iam-backdoor-user, aws.persistence.iam-create-admin-user, aws.persistence.iam-create-backdoor-role, aws.persistence.iam-create-user-login-profile, aws.privilege-escalation.iam-update-user-login-profile
Log types
AWS.CloudTrail
Tags
AWS, Identity and Access Management
Reference
https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html
Source
github.com/panther-labs/panther-analysis

A change occurred in the IAM configuration. This could be a resource being created, deleted, or modified. This is a high level view of changes, helfpul to indicate how dynamic a certain IAM environment is.

Rule body yaml

AnalysisType: rule
Filename: aws_iam_anything_changed.py
RuleID: "AWS.CloudTrail.IAMAnythingChanged"
DisplayName: "IAM Change"
Enabled: true
LogTypes:
  - AWS.CloudTrail
Tags:
  - AWS
  - Identity and Access Management
Reports:
  Stratus Red Team:
    - aws.persistence.iam-backdoor-role
    - aws.persistence.iam-backdoor-user
    - aws.persistence.iam-create-admin-user
    - aws.persistence.iam-create-backdoor-role
    - aws.persistence.iam-create-user-login-profile
    - aws.privilege-escalation.iam-update-user-login-profile
Severity: Info
DedupPeriodMinutes: 720 # 12 hours
Description: >
  A change occurred in the IAM configuration. This could be a resource being created, deleted, or modified. This is a high level view of changes, helfpul to indicate how dynamic a certain IAM environment is.
Runbook: >
  Ensure this was an approved IAM configuration change.
Reference: https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html
SummaryAttributes:
  - eventName
  - userAgent
  - sourceIpAddress
  - recipientAccountId
  - p_any_aws_arns
Tests:
  - Name: IAM Change
    ExpectedResult: true
    Log:
      {
        "awsRegion": "us-east-1",
        "eventID": "1111",
        "eventName": "AttachRolePolicy",
        "eventSource": "iam.amazonaws.com",
        "eventTime": "2019-01-01T00:00:00Z",
        "eventType": "AwsApiCall",
        "eventVersion": "1.05",
        "recipientAccountId": "123456789012",
        "requestID": "1111",
        "requestParameters":
          {
            "policyArn": "arn:aws:iam::aws:policy/example-policy",
            "roleName": "LambdaFunctionRole-1111",
          },
        "responseElements": null,
        "sourceIPAddress": "111.111.111.111",
        "userAgent": "cloudformation.amazonaws.com",
        "userIdentity":
          {
            "accesKeyId": "1111",
            "accessKeyId": "1111",
            "accountId": "123456789012",
            "arn": "arn:aws:sts::123456789012:assumed-role/example-role/example-user",
            "invokedBy": "cloudformation.amazonaws.com",
            "principalId": "1111:example-user",
            "sessionContext":
              {
                "attributes":
                  {
                    "creationDate": "2019-01-01T00:00:00Z",
                    "mfaAuthenticated": "true",
                  },
                "sessionIssuer":
                  {
                    "accountId": "123456789012",
                    "arn": "arn:aws:iam::123456789012:role/example-role",
                    "principalId": "1111",
                    "type": "Role",
                    "userName": "example-user",
                  },
              },
            "type": "AssumedRole",
          },
      }
  - Name: IAM Read Only Activity
    ExpectedResult: false
    Log:
      {
        "awsRegion": "us-east-1",
        "eventID": "1111",
        "eventName": "DescribePolicy",
        "eventSource": "iam.amazonaws.com",
        "eventTime": "2019-01-01T00:00:00Z",
        "eventType": "AwsApiCall",
        "eventVersion": "1.05",
        "recipientAccountId": "123456789012",
        "requestID": "1111",
        "requestParameters": { "roleName": "LambdaFunctionRole-1111" },
        "responseElements": null,
        "sourceIPAddress": "111.111.111.111",
        "userAgent": "cloudformation.amazonaws.com",
        "userIdentity":
          {
            "accesKeyId": "1111",
            "accessKeyId": "1111",
            "accountId": "123456789012",
            "arn": "arn:aws:sts::123456789012:assumed-role/example-role/example-user",
            "invokedBy": "cloudformation.amazonaws.com",
            "principalId": "1111:example-user",
            "sessionContext":
              {
                "attributes":
                  {
                    "creationDate": "2019-01-01T00:00:00Z",
                    "mfaAuthenticated": "true",
                  },
                "sessionIssuer":
                  {
                    "accountId": "123456789012",
                    "arn": "arn:aws:iam::123456789012:role/example-role",
                    "principalId": "1111",
                    "type": "Role",
                    "userName": "example-user",
                  },
              },
            "type": "AssumedRole",
          },
      }
  - Name: Error Making IAM Change
    ExpectedResult: false
    Log:
      {
        "awsRegion": "us-east-1",
        "errorCode": "NoSuchEntity",
        "eventID": "1111",
        "eventName": "AttachRolePolicy",
        "eventSource": "iam.amazonaws.com",
        "eventTime": "2019-01-01T00:00:00Z",
        "eventType": "AwsApiCall",
        "eventVersion": "1.05",
        "recipientAccountId": "123456789012",
        "requestID": "1111",
        "requestParameters":
          {
            "policyArn": "arn:aws:iam::aws:policy/example-policy",
            "roleName": "LambdaFunctionRole-1111",
          },
        "responseElements": null,
        "sourceIPAddress": "111.111.111.111",
        "userAgent": "cloudformation.amazonaws.com",
        "userIdentity":
          {
            "accesKeyId": "1111",
            "accessKeyId": "1111",
            "accountId": "123456789012",
            "arn": "arn:aws:sts::123456789012:assumed-role/example-role/example-user",
            "invokedBy": "cloudformation.amazonaws.com",
            "principalId": "1111:example-user",
            "sessionContext":
              {
                "attributes":
                  {
                    "creationDate": "2019-01-01T00:00:00Z",
                    "mfaAuthenticated": "true",
                  },
                "sessionIssuer":
                  {
                    "accountId": "123456789012",
                    "arn": "arn:aws:iam::123456789012:role/example-role",
                    "principalId": "1111",
                    "type": "Role",
                    "userName": "example-user",
                  },
              },
            "type": "AssumedRole",
          },
      }

Detection logic

Condition

not (errorCode is_not_null or errorMessage is_not_null or eventSource ne "iam.amazonaws.com")
eventName starts_with "Add" or eventName starts_with "Attach" or eventName starts_with "Change" or eventName starts_with "Create" or eventName starts_with "Deactivate" or eventName starts_with "Delete" or eventName starts_with "Detach" or eventName starts_with "Enable" or eventName starts_with "Put" or eventName starts_with "Remove" or eventName starts_with "Set" or eventName starts_with "Update" or eventName starts_with "Upload"

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)
eventSourceneiam.amazonaws.com

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
eventNamestarts_with
  • Add
  • Attach
  • Change
  • Create
  • Deactivate
  • Delete
  • Detach
  • Enable
  • Put
  • Remove
  • Set
  • Update
  • Upload

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