-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[New Rule] AWS EC2 Instance Interaction with IAM Service #3920
[New Rule] AWS EC2 Instance Interaction with IAM Service #3920
Conversation
Rule: New - GuidelinesThese guidelines serve as a reminder set of considerations when proposing a new rule. Documentation and Context
Rule Metadata Checks
New BBR Rules
Testing and Validation
|
rules/integrations/aws/persistence_ec2_instance_request_to_iam_service.toml
Outdated
Show resolved
Hide resolved
type = "eql" | ||
|
||
query = ''' | ||
any where event.dataset == "aws.cloudtrail" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imays11 is there any indication in the data that the source of this API request is from an EC2 instance? Would be nice to have entity store to add this context :)
Maybe the source IP is in a common EC2 CIDR or the ARN of the source indicates EC2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@terrancedejesus Yes, the indicator that this is an EC2 instance is the instance id attached to the end of the user.id
field and aws.cloudtrail.user_identity.arn
which starts with i-
You can see that detection method described here by the AWS CIRT team
…_service.toml Co-authored-by: Terrance DeJesus <99630311 [email protected]>
* [New Rule] AWS EC2 Instance Interaction with IAM Service * Update rules/integrations/aws/persistence_ec2_instance_request_to_iam_service.toml Co-authored-by: Terrance DeJesus <99630311 [email protected]> --------- Co-authored-by: Terrance DeJesus <99630311 [email protected]> (cherry picked from commit a28af59)
* [New Rule] AWS EC2 Instance Interaction with IAM Service * Update rules/integrations/aws/persistence_ec2_instance_request_to_iam_service.toml Co-authored-by: Terrance DeJesus <99630311 [email protected]> --------- Co-authored-by: Terrance DeJesus <99630311 [email protected]> (cherry picked from commit a28af59)
* [New Rule] AWS EC2 Instance Interaction with IAM Service * Update rules/integrations/aws/persistence_ec2_instance_request_to_iam_service.toml Co-authored-by: Terrance DeJesus <99630311 [email protected]> --------- Co-authored-by: Terrance DeJesus <99630311 [email protected]> (cherry picked from commit a28af59)
* [New Rule] AWS EC2 Instance Interaction with IAM Service * Update rules/integrations/aws/persistence_ec2_instance_request_to_iam_service.toml Co-authored-by: Terrance DeJesus <99630311 [email protected]> --------- Co-authored-by: Terrance DeJesus <99630311 [email protected]> (cherry picked from commit a28af59)
* [New Rule] AWS EC2 Instance Interaction with IAM Service * Update rules/integrations/aws/persistence_ec2_instance_request_to_iam_service.toml Co-authored-by: Terrance DeJesus <99630311 [email protected]> --------- Co-authored-by: Terrance DeJesus <99630311 [email protected]> (cherry picked from commit a28af59)
* [New Rule] AWS EC2 Instance Interaction with IAM Service * Update rules/integrations/aws/persistence_ec2_instance_request_to_iam_service.toml Co-authored-by: Terrance DeJesus <99630311 [email protected]> --------- Co-authored-by: Terrance DeJesus <99630311 [email protected]> (cherry picked from commit a28af59)
* [New Rule] AWS EC2 Instance Interaction with IAM Service * Update rules/integrations/aws/persistence_ec2_instance_request_to_iam_service.toml Co-authored-by: Terrance DeJesus <99630311 [email protected]> --------- Co-authored-by: Terrance DeJesus <99630311 [email protected]>
Issue link(s):
Summary - What I changed
Identifies when an EC2 instance interacts with the AWS IAM service via an assumed role. This is uncommon behavior and could indicate an attacker using compromised creadentials to further exploit an environment. For example, an assumed role could be used to create new users for persistence or add permissions for privilege escalation. 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.
--
I chose to use the
user.id
field over theaws.cloudtrail.user_identity.arn
because this field is able to be ingested via telemtry as PII has been stripped but the session name necessary to identify the identity as an EC2 instance is still included