-
Notifications
You must be signed in to change notification settings - Fork 523
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 rules] AWS IAM AdministratorAccess Policy Attached to : User, Group, Role(es|ql) #3735
[New rules] AWS IAM AdministratorAccess Policy Attached to : User, Group, Role(es|ql) #3735
Conversation
...tegrations/aws/privilege_escalation_aws_iam_administratoraccess_policy_attached_to_user.toml
Outdated
Show resolved
Hide resolved
...tegrations/aws/privilege_escalation_aws_iam_administratoraccess_policy_attached_to_user.toml
Outdated
Show resolved
Hide resolved
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.
LGTM, nice ES|QL work!
...egrations/aws/privilege_escalation_aws_iam_administratoraccess_policy_attached_to_group.toml
Outdated
Show resolved
Hide resolved
...tegrations/aws/privilege_escalation_aws_iam_administratoraccess_policy_attached_to_role.toml
Outdated
Show resolved
Hide resolved
...tegrations/aws/privilege_escalation_aws_iam_administratoraccess_policy_attached_to_user.toml
Outdated
Show resolved
Hide resolved
Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com>
from logs-aws.cloudtrail-* | ||
| where event.provider == "iam.amazonaws.com" and event.action == "AttachUserPolicy" and event.outcome == "success" | ||
| dissect aws.cloudtrail.request_parameters "{%{?policyArn}=%{?arn}:%{?aws}:%{?iam}::%{?aws}:%{?policy}/%{policyName},%{?userName}=%{target.userName}}" | ||
| where policyName == "AdministratorAccess" | ||
| keep @timestamp, aws.cloudtrail.user_identity.arn, aws.cloudtrail.user_identity.access_key_id, event.action, policyName, target.userName, user_agent.original, source.address, source.geo.location | ||
| sort aws.cloudtrail.user_identity.arn |
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.
Thoughts on collapsing into one rule with a query like the following?
from logs-aws.cloudtrail-*
| where event.provider == "iam.amazonaws.com" and event.action in ("AttachUserPolicy", "AttachRolePolicy", "AttachGroupPolicy") and event.outcome == "success"
| where aws.cloudtrail.request_parameters rlike "(.*)AdministratorAccess(.*)"
| keep @timestamp, aws.cloudtrail.user_identity.arn, aws.cloudtrail.user_identity.access_key_id, event.action, aws.cloudtrail.request_parameters, user_agent.original, source.address, source.geo.location
| sort aws.cloudtrail.user_identity.arn
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.
I did consider this and thought keeping them seperate may be better for clients to disable or add exclusions if needed since all 3 have slightly different use-cases. For example, I could see the creation of roles with AdministratorAccess
being used as a safer method when necessary since those requested credentials are temporary, vs. granting individual users the AdministratorAccess
policy with long-standing credentials. In this case someone may want to disable the AttachRolePolicy
rule but keep the AttachUserPolicy
.
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.
Approving. Left a comment about potentially collapsing into one rule. Your call, but these are great additions!
…oup, Role(es|ql) (#3735) * [New Rule] AWS IAM AdministratorAccess Policy Attached to User issue... * add source.address and source.geo.location * fix threat tactic ids * AdministratorAccess Policy Attached to Group * AdminstratoAccess Policy Attached to Role * reduce severity to medium Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com> --------- Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com> (cherry picked from commit e1cbf9f)
…oup, Role(es|ql) (#3735) * [New Rule] AWS IAM AdministratorAccess Policy Attached to User issue... * add source.address and source.geo.location * fix threat tactic ids * AdministratorAccess Policy Attached to Group * AdminstratoAccess Policy Attached to Role * reduce severity to medium Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com> --------- Co-authored-by: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com> (cherry picked from commit e1cbf9f)
Issues
Summary
Identifies the use of
iam:AttachUserPolicy
,iam:AttachGroupPolicy
, andiam:AttachRolePolicy
API functions, which are used to attach user policies to user accounts, groups and roles in AWS. Specifically, these rules use ES|QL to dissect theaws.cloudtrail.request_parameters
field to isolate the policyName and alert on theAdministrativeAccess
AWS managed policy, which grants an identity full administrative access over all AWS services and resources. While there are legitimate use-cases, such highly privileged access should be closely monitored and any usage of this policy should be verified for validity.AttachUserPolicy
AttachGroupPolicy
AttachRolePolicy