AWS IAM Sensitive Operations via Lambda Execution Role

Last updated a month ago on 2026-04-04
Created a month ago on 2026-04-04

About

Detects successful IAM API calls that create or empower IAM users and roles, attach or embed policies, or wire roles to instance profiles when the caller is an assumed role session associated with AWS Lambda. Serverless execution roles are often over-permissioned; an adversary who can run or compromise function code can abuse these APIs for privilege escalation and persistence—for example creating users or roles, issuing keys, attaching managed or inline policies, or preparing EC2 instance profiles for lateral movement.
Tags
Domain: CloudDomain: IdentityData Source: AWSData Source: Amazon Web ServicesData Source: AWS IAMData Source: AWS LambdaUse Case: Threat DetectionTactic: Privilege EscalationTactic: PersistenceLanguage: kuery
Severity
high
Risk Score
73
MITRE ATT&CK™

Privilege Escalation (TA0004)(external, opens in a new tab or window)

Persistence (TA0003)(external, opens in a new tab or window)

False Positive Examples
Some organizations intentionally use Lambda functions to provision IAM principals, bootstrap accounts, or run identity automation (including roles and instance profiles). Confirm the function name in `user_identity.arn`, deployment pipelines, and change records. Exclude known automation roles or specific `session_context.session_issuer.arn` values after validation.
License
Elastic License v2(external, opens in a new tab or window)

Definition

Rule Type
Query (Kibana Query Language)
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
filebeat-*logs-aws.cloudtrail-*
Related Integrations

aws(external, opens in a new tab or window)

Query
text code block:
event.dataset: "aws.cloudtrail" and event.provider: "iam.amazonaws.com" and event.outcome: "success" and aws.cloudtrail.user_identity.type: "AssumedRole" and ( aws.cloudtrail.user_identity.invoked_by: "lambda.amazonaws.com" or user_agent.original : *AWS_Lambda* ) and event.action: ( "AddRoleToInstanceProfile" or "AddUserToGroup" or "AttachGroupPolicy" or "AttachRolePolicy" or "AttachUserPolicy" or "CreateAccessKey" or "CreateInstanceProfile" or "CreateRole" or "CreateUser" or "PutRolePolicy" or "PutUserPolicy" )

Install detection rules in Elastic Security

Detect AWS IAM Sensitive Operations via Lambda Execution Role in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).