Detection rules › Panther
IAM Change
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.
| Field | Kind | Excluded values |
|---|---|---|
errorCode | is_not_null | |
errorMessage | is_not_null | |
eventSource | ne | iam.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.
| Field | Kind | Values |
|---|---|---|
eventName | starts_with |
|
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 |