Detection rules › Panther
Detect Reconnaissance from IAM Users
An IAM user has a high volume of access denied API calls.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Discovery | T1526 Cloud Service Discovery |
Rule body yaml
AnalysisType: rule
Filename: aws_iam_user_recon_denied.py
RuleID: "AWS.IAMUser.ReconAccessDenied"
DisplayName: "Detect Reconnaissance from IAM Users"
Enabled: true
LogTypes:
- AWS.CloudTrail
Tags:
- AWS
- Discovery:Cloud Service Discovery
Reports:
MITRE ATT&CK:
- TA0007:T1526
Severity: Info
Threshold: 15
DedupPeriodMinutes: 10
Description: An IAM user has a high volume of access denied API calls.
Runbook: Analyze the IP they came from, and other actions taken before/after.
Reference: https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_access-denied.html
SummaryAttributes:
- eventName
- userAgent
- sourceIpAddress
- recipientAccountId
- errorMessage
- p_any_aws_arns
Tests:
- Name: Unauthorized API Call
LogType: AWS.CloudTrail
ExpectedResult: true
Log:
{
"eventVersion": "1.05",
"userIdentity":
{
"type": "IAMUser",
"principalId": "1111",
"arn": "arn:aws:iam::123456789012:user/tester",
"accountId": "123456789012",
"accessKeyId": "1",
"userName": "tester",
"sessionContext":
{
"attributes":
{
"mfaAuthenticated": "true",
"creationDate": "2019-01-01T00:00:00Z",
},
},
"invokedBy": "signin.amazonaws.com",
},
"eventTime": "2019-01-01T00:00:00Z",
"eventSource": "iam.amazonaws.com",
"eventName": "GetRole",
"awsRegion": "us-east-1",
"sourceIPAddress": "40.185.186.6",
"errorCode": "AccessDenied",
"errorMessage": "User: arn:aws:iam::123456789012:user/tester is not authorized to perform: iam:GetRole on resource: arn:aws:iam::123456789012:role/FooBar",
"userAgent": "aws-sdk-go/1.32.7 (go1.14.6; linux; amd64) exec-env/AWS_Lambda_go1.x",
"requestParameters": null,
"responseElements": null,
"requestID": "1",
"eventID": "1",
"eventType": "AwsApiCall",
"recipientAccountId": "123456789012",
}
- Name: Unauthorized API Call from Within AWS (FQDN)
ExpectedResult: false
Log:
{
"eventVersion": "1.05",
"userIdentity":
{
"type": "IAMUser",
"principalId": "1111",
"arn": "arn:aws:iam::123456789012:user/tester",
"accountId": "123456789012",
"accessKeyId": "1",
"userName": "tester",
"sessionContext":
{
"attributes":
{
"mfaAuthenticated": "true",
"creationDate": "2019-01-01T00:00:00Z",
},
},
"invokedBy": "signin.amazonaws.com",
},
"eventTime": "2019-01-01T00:00:00Z",
"eventSource": "iam.amazonaws.com",
"eventName": "CreateServiceLinkedRole",
"awsRegion": "us-east-1",
"sourceIPAddress": "sqs.amazonaws.com",
"errorCode": "AccessDenied",
"errorMessage": "User: arn:aws:iam::123456789012:user/tester is not authorized to perform: iam:Action on resource: arn:aws:iam::123456789012:resource",
"userAgent": "sqs.amazonaws.com",
"requestParameters": null,
"responseElements": null,
"requestID": "1",
"eventID": "1",
"eventType": "AwsApiCall",
"recipientAccountId": "123456789012",
}
- Name: Authorized API Call
ExpectedResult: false
Log:
{
"eventVersion": "1.05",
"userIdentity":
{
"type": "IAMUser",
"principalId": "1111",
"arn": "arn:aws:iam::123456789012:user/tester",
"accountId": "123456789012",
"accessKeyId": "1",
"userName": "tester",
"sessionContext":
{
"attributes":
{
"mfaAuthenticated": "true",
"creationDate": "2019-01-01T00:00:00Z",
},
},
"invokedBy": "signin.amazonaws.com",
},
"eventTime": "2019-01-01T00:00:00Z",
"eventSource": "iam.amazonaws.com",
"eventName": "CreateServiceLinkedRole",
"awsRegion": "us-east-1",
"sourceIPAddress": "111.111.111.111",
"userAgent": "signin.amazonaws.com",
"requestParameters": null,
"responseElements": null,
"requestID": "1",
"eventID": "1",
"eventType": "AwsApiCall",
"recipientAccountId": "123456789012",
}
- Name: Unauthorized API Call - From AWS console
LogType: AWS.CloudTrail
ExpectedResult: false
Log:
{
"eventVersion": "1.05",
"userIdentity":
{
"type": "IAMUser",
"principalId": "1111",
"arn": "arn:aws:iam::123456789012:user/tester",
"accountId": "123456789012",
"accessKeyId": "1",
"userName": "tester",
"sessionContext":
{
"attributes":
{
"mfaAuthenticated": "true",
"creationDate": "2019-01-01T00:00:00Z",
},
},
"invokedBy": "signin.amazonaws.com",
},
"eventTime": "2019-01-01T00:00:00Z",
"eventSource": "iam.amazonaws.com",
"eventName": "GetRole",
"awsRegion": "us-east-1",
"sourceIPAddress": "40.185.186.6",
"errorCode": "AccessDenied",
"errorMessage": "User: arn:aws:iam::123456789012:user/tester is not authorized to perform: iam:GetRole on resource: arn:aws:iam::123456789012:role/FooBar",
"userAgent": "aws-internal/3 aws-sdk-java/1.12.124 Linux/4.9.273-0.1.ac.226.84.332.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.312-b07 java/1.8.0_312 vendor/Oracle_Corporation cfg/retry-mode/standard",
"requestParameters": null,
"responseElements": null,
"requestID": "1",
"eventID": "1",
"eventType": "AwsApiCall",
"recipientAccountId": "123456789012",
}
Detection logic
Condition
errorCode eq "AccessDenied"
userIdentity.type eq "IAMUser"
userAgent not starts_with "aws-internal/3"
This rule also runs imperative logic the parser cannot express as a filter; the conditions above are the structured part it could extract.
Exclusions
Top-level NOT(...) conjuncts: predicates this rule actively suppresses.
| Field | Kind | Excluded values |
|---|---|---|
userAgent | starts_with | aws-internal/3 |
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 |
|---|---|---|
errorCode | eq |
|
userIdentity.type | eq |
|
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 |