AWS EC2 Instance Console Login via Assumed Role

Last updated 7 months ago on 2025-01-15
Created a year ago on 2024-07-24

About

Identifies a successful console login activity by an EC2 instance profile using an assumed role. This is uncommon behavior and could indicate an attacker using compromised credentials to further exploit an environment. An EC2 instance assumes a role using their EC2 ID as the session name. This rule looks for the pattern "i-" which is the beginning pattern for assumed role sessions started by an EC2 instance and a successful `ConsoleLogin` or `GetSigninToken` API call.
Tags
Domain: CloudData Source: AWSData Source: Amazon Web ServicesData Source: AWS EC2Data Source: AWS STSUse Case: Identity and Access AuditTactic: Lateral MovementTactic: Credential AccessLanguage: eql
Severity
high
Risk Score
73
MITRE ATT&CK™

Lateral Movement (TA0008)(opens in a new tab or window)

Credential Access (TA0006)(opens in a new tab or window)

False Positive Examples
This is very uncommon behavior and should result in minimal false positives, ensure validity of the triggered event and include exceptions where necessary.
License
Elastic License v2(opens in a new tab or window)

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
filebeat-*logs-aws.cloudtrail-*
Related Integrations

aws(opens in a new tab or window)

Query
any where event.dataset == "aws.cloudtrail"
   and event.provider == "signin.amazonaws.com"
   and event.action in ("ConsoleLogin", "GetSigninToken")
   and event.outcome == "success"
   and aws.cloudtrail.user_identity.type == "AssumedRole"
   and stringContains (user.id, ":i-")

Install detection rules in Elastic Security

Detect AWS EC2 Instance Console Login via Assumed 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(opens in a new tab or window).