Detection rules › Splunk
Detect AWS Console Login by User from New Region
The following analytic identifies AWS console login attempts by users from a new region. It leverages AWS CloudTrail events and compares current login regions against a baseline of previously seen regions for each user. This activity is significant as it may indicate unauthorized access attempts or compromised credentials. If confirmed malicious, an attacker could gain unauthorized access to AWS resources, potentially leading to data breaches, resource manipulation, or further lateral movement within the cloud environment.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Resource Development | T1586.003 Compromise Accounts: Cloud Accounts |
| Stealth | T1535 Unused/Unsupported Cloud Regions |
Rule body splunk
name: Detect AWS Console Login by User from New Region
id: 9f31aa8e-e37c-46bc-bce1-8b3be646d026
version: 9
creation_date: '2020-04-29'
modification_date: '2026-05-13'
author: Bhavin Patel, Eric McGinnis Splunk
status: production
type: Hunting
description: The following analytic identifies AWS console login attempts by users from a new region. It leverages AWS CloudTrail events and compares current login regions against a baseline of previously seen regions for each user. This activity is significant as it may indicate unauthorized access attempts or compromised credentials. If confirmed malicious, an attacker could gain unauthorized access to AWS resources, potentially leading to data breaches, resource manipulation, or further lateral movement within the cloud environment.
data_source:
- AWS CloudTrail
search: |-
| tstats earliest(_time) as firstTime latest(_time) as lastTime FROM datamodel=Authentication
WHERE Authentication.signature=ConsoleLogin
BY Authentication.user Authentication.src
| iplocation Authentication.src
| `drop_dm_object_name(Authentication)`
| rename Region as justSeenRegion
| table firstTime lastTime user justSeenRegion
| join user type=outer [
| inputlookup previously_seen_users_console_logins
| rename Region as previouslySeenRegion
| stats min(firstTime) AS earliestseen
BY user previouslySeenRegion
| fields earliestseen user previouslySeenRegion]
| eval userRegion=if(firstTime >= relative_time(now(), "-24h@h"), "New Region","Previously Seen Region")
| where userRegion= "New Region"
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| table firstTime lastTime user previouslySeenRegion justSeenRegion userRegion
| `detect_aws_console_login_by_user_from_new_region_filter`
how_to_implement: You must install and configure the Splunk Add-on for AWS (version 5.1.0 or later) and Enterprise Security 6.2, which contains the required updates to the Authentication data model for cloud use cases. Run the `Previously Seen Users in AWS CloudTrail - Initial` support search only once to create a baseline of previously seen IAM users within the last 30 days. Run `Previously Seen Users in AWS CloudTrail - Update` hourly (or more frequently depending on how often you run the detection searches) to refresh the baselines. You can also provide additional filtering for this search by customizing the `detect_aws_console_login_by_user_from_new_region_filter` macro.
known_false_positives: When a legitimate new user logins for the first time, this activity will be detected. Check how old the account is and verify that the user activity is legitimate.
references: []
analytic_story:
- Suspicious AWS Login Activities
- Suspicious Cloud Authentication Activities
- AWS Identity and Access Management Account Takeover
- Compromised User Account
asset_type: AWS Instance
mitre_attack_id:
- T1535
- T1586.003
product:
- Splunk Enterprise
- Splunk Enterprise Security
- Splunk Cloud
category: cloud
security_domain: threat
baselines:
- Previously Seen Users in CloudTrail - Initial
- Previously Seen Users In CloudTrail - Update
tests:
- name: True Positive Test
attack_data:
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/suspicious_behaviour/abnormally_high_cloud_instances_launched/cloudtrail_behavioural_detections.json
sourcetype: aws:cloudtrail
source: aws_cloudtrail
description: PORTED MANUAL TEST - This search needs the baseline to be run first to create a lookup. It also requires that the timestamps in the dataset be updated.
test_type: experimental
Stages and Predicates
Stage 1: tstats
| tstats earliest(_time) as firstTime latest(_time) as lastTime FROM datamodel=Authentication
WHERE Authentication.signature=ConsoleLogin
BY Authentication.user Authentication.src
Stage 2: search
| iplocation Authentication.src
Stage 3: search
| `drop_dm_object_name(Authentication)`
Stage 4: rename
| rename Region as justSeenRegion
Stage 5: table
| table firstTime lastTime user justSeenRegion
Stage 6: join
| join user type=outer [
| inputlookup previously_seen_users_console_logins
| rename Region as previouslySeenRegion
| stats min(firstTime) AS earliestseen
BY user previouslySeenRegion
| fields earliestseen user previouslySeenRegion]
Stage 7: eval
| eval userRegion=if(firstTime >= relative_time(now(), "-24h@h"), "New Region","Previously Seen Region")
userRegion ="New Region""Previously Seen Region"Stage 8: where
| where userRegion= "New Region"
Stage 9: search
| `security_content_ctime(firstTime)`
Stage 10: search
| `security_content_ctime(lastTime)`
Stage 11: table
| table firstTime lastTime user previouslySeenRegion justSeenRegion userRegion
Stage 12: search
| `detect_aws_console_login_by_user_from_new_region_filter`
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 |
|---|---|---|
Authentication.signature | eq |
|
userRegion | eq |
|
Search terms
Bare-string tokens in the SPL search body. Splunk matches each token against _raw (the untyped raw event text) anywhere it appears, not against a specific field. These don't surface in the Indicators table because they aren't predicates on a known field.
| Stage | Term |
|---|---|
| 2 | iplocation |
| 2 | Authentication.src |