Files
splunk-security_content/detections/cloud/aws_createaccesskey.yml
Bhavin Patel 7115026c81 mionr
2023-06-22 14:46:26 -07:00

71 lines
3.3 KiB
YAML

name: AWS CreateAccessKey
id: 2a9b80d3-6340-4345-11ad-212bf3d0d111
version: 3
date: '2022-03-03'
author: Bhavin Patel, Splunk
status: production
type: Hunting
description: This detection rule monitors for the creation of AWS Identity and Access Management (IAM) access keys.
An IAM access key consists of an access key ID and secret access key, which are used to sign programmatic requests to AWS services.
While IAM access keys can be legitimately used by developers and administrators for API access, their creation can also be indicative
of malicious activity. Attackers who have gained unauthorized access to an AWS environment might create access keys as a means to
establish persistence or to exfiltrate data through the APIs. Moreover, because access keys can be used to authenticate with AWS
services without the need for further interaction, they can be particularly appealing for bad actors looking to operate under the radar.
Consequently, it's important to vigilantly monitor and scrutinize access key creation events, especially if they are associated with
unusual activity or are created by users who don't typically perform these actions. This hunting query identifies when a potentially compromised user
creates a IAM access key for another user who may have higher privilleges, which can be a sign for privilege escalation. Hunting queries are designed to be executed
manual during threat hunting.
data_source: []
search: '`cloudtrail` eventName = CreateAccessKey userAgent !=console.amazonaws.com
errorCode = success | eval match=if(match(userIdentity.userName,requestParameters.userName),1,0)
| search match=0 | stats count min(_time) as firstTime max(_time) as lastTime by
requestParameters.userName src eventName eventSource aws_account_id errorCode userAgent
eventID awsRegion userIdentity.principalId user_arn | `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)` |`aws_createaccesskey_filter`'
how_to_implement: You must install splunk AWS add on and Splunk App for AWS. This
search works with AWS CloudTrail logs.
known_false_positives: While this search has no known false positives, it is possible
that an AWS admin has legitimately created keys for another user.
references:
- https://bishopfox.com/blog/privilege-escalation-in-aws
- https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation-part-2/
tags:
analytic_story:
- AWS IAM Privilege Escalation
asset_type: AWS Account
confidence: 90
impact: 70
message: User $user_arn$ is attempting to create access keys for $requestParameters.userName$
from this IP $src$
mitre_attack_id:
- T1136.003
- T1136
observable:
- name: src
type: IP Address
role:
- Attacker
- name: user_arn
type: User
role:
- Attacker
product:
- Splunk Enterprise
- Splunk Enterprise Security
- Splunk Cloud
required_fields:
- _time
- eventName
- userAgent
- errorCode
- requestParameters.userName
risk_score: 63
security_domain: network
tests:
- name: True Positive Test
attack_data:
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1078/aws_createaccesskey/aws_cloudtrail_events.json
sourcetype: aws:cloudtrail
source: aws_cloudtrail
update_timestamp: true