AWS IAM CompromisedKeyQuarantine Policy Attached to User

This rule looks for use of the IAM AttachUserPolicy API operation to attach the CompromisedKeyQuarantine or CompromisedKeyQuarantineV2 AWS managed policies to an existing IAM user. This policy denies access to certain actions and is applied by the AWS team in the event that an IAM user's credentials have been compromised or exposed publicly.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2024/07/20"
 3integration = ["aws"]
 4maturity = "production"
 5updated_date = "2024/07/20"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10This rule looks for use of the IAM `AttachUserPolicy` API operation to attach the `CompromisedKeyQuarantine` or `CompromisedKeyQuarantineV2` AWS managed policies to an existing IAM user.
11This policy denies access to certain actions and is applied by the AWS team in the event that an IAM user's credentials have been compromised or exposed publicly.
12"""
13false_positives = [
14    """
15    This is an intentional action taken by AWS in the event of compromised credentials. Follow the instructions specified in the support case created for you regarding this event.
16    """,
17]
18from = "now-6m"
19index = ["filebeat-*", "logs-aws.cloudtrail-*"]
20language = "eql"
21license = "Elastic License v2"
22name = "AWS IAM CompromisedKeyQuarantine Policy Attached to User"
23note = """
24## Triage and Analysis
25
26### Investigating AWS IAM CompromisedKeyQuarantine Policy Attached to User
27
28The AWS IAM `CompromisedKeyQuarantine` and `CompromisedKeyQuarantineV2` managed policies deny certain action and is applied by the AWS team to a user with exposed credentials. 
29This action is accompanied by a support case which specifies instructions to follow before detaching the policy. 
30
31#### Possible Investigation Steps
32
33- **Identify Potentially Compromised Identity**: Review the `userName` parameter of the `aws.cloudtrail.request_parameters` to determine the quarantined IAM entity.
34- **Contextualize with AWS Support Case**: Review any information from AWS comtaining additional information about the quarantined account and the reasoning for quarantine.
35- **Follow Support Case Instructions**: Do not revert the quarantine policy attachment or delete the compromised keys. Instead folow the instructions given in your support case.
36- **Correlate with Other Activities**: Search for related CloudTrail events before and after this change to see if the same actor or IP address engaged in potentially suspicious activities.
37- **Interview Relevant Personnel**: If the compromised key belongs to a user, verify the intent and authorization for these correlated actions with the person or team responsible for managing the compromised key.
38
39### False Positive Analysis
40
41- There shouldn't be many false positives related to this action as it is inititated by AWS in response to compromised or publicly exposed credentials.
42
43### Response and Remediation
44
45- **Immediate Review and Reversal**: Update the user IAM permissions to remove the quarantine policy and disable the compromised credentials.
46- **Policy Update**: Review and possibly update your organization’s policies on credential storage to tighten control and prevent public exposure.
47- **Incident Response**: If malicious intent is confirmed, consider it a data breach incident and initiate the incident response protocol. This includes further investigation, containment, and recovery.
48
49### Additional Information:
50
51For further guidance on managing and securing credentials in AWS environments, refer to the [AWS IAM User Guide](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) regarding security best practices and guidance on [Remediating Potentially Compromised AWS Credentials](https://docs.aws.amazon.com/guardduty/latest/ug/compromised-creds.html).
52"""
53references = [
54    "https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSCompromisedKeyQuarantine.html/",
55    "https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSCompromisedKeyQuarantineV2.html/",
56]
57risk_score = 73
58rule_id = "0b79f5c0-2c31-4fea-86cd-e62644278205"
59severity = "high"
60tags = [
61    "Domain: Cloud",
62    "Data Source: AWS",
63    "Data Source: Amazon Web Services",
64    "Data Source: AWS IAM",
65    "Resources: Investigation Guide",
66    "Use Case: Identity and Access Audit",
67    "Tactic: Credential Access",
68]
69timestamp_override = "event.ingested"
70type = "eql"
71
72query = '''
73any where event.dataset == "aws.cloudtrail" 
74   and event.action == "AttachUserPolicy"
75   and event.outcome == "success" 
76   and stringContains(aws.cloudtrail.request_parameters, "AWSCompromisedKeyQuarantine")
77'''
78
79[[rule.threat]]
80framework = "MITRE ATT&CK"
81[[rule.threat.technique]]
82id = "T1552"
83name = "Unsecured Credentials"
84reference = "https://attack.mitre.org/techniques/T1552/"
85
86
87[rule.threat.tactic]
88id = "TA0006"
89name = "Credential Access"
90reference = "https://attack.mitre.org/tactics/TA0006/"

Triage and Analysis

Investigating AWS IAM CompromisedKeyQuarantine Policy Attached to User

The AWS IAM CompromisedKeyQuarantine and CompromisedKeyQuarantineV2 managed policies deny certain action and is applied by the AWS team to a user with exposed credentials. This action is accompanied by a support case which specifies instructions to follow before detaching the policy.

Possible Investigation Steps

  • Identify Potentially Compromised Identity: Review the userName parameter of the aws.cloudtrail.request_parameters to determine the quarantined IAM entity.
  • Contextualize with AWS Support Case: Review any information from AWS comtaining additional information about the quarantined account and the reasoning for quarantine.
  • Follow Support Case Instructions: Do not revert the quarantine policy attachment or delete the compromised keys. Instead folow the instructions given in your support case.
  • Correlate with Other Activities: Search for related CloudTrail events before and after this change to see if the same actor or IP address engaged in potentially suspicious activities.
  • Interview Relevant Personnel: If the compromised key belongs to a user, verify the intent and authorization for these correlated actions with the person or team responsible for managing the compromised key.

False Positive Analysis

  • There shouldn't be many false positives related to this action as it is inititated by AWS in response to compromised or publicly exposed credentials.

Response and Remediation

  • Immediate Review and Reversal: Update the user IAM permissions to remove the quarantine policy and disable the compromised credentials.
  • Policy Update: Review and possibly update your organization’s policies on credential storage to tighten control and prevent public exposure.
  • Incident Response: If malicious intent is confirmed, consider it a data breach incident and initiate the incident response protocol. This includes further investigation, containment, and recovery.

Additional Information:

For further guidance on managing and securing credentials in AWS environments, refer to the AWS IAM User Guide regarding security best practices and guidance on Remediating Potentially Compromised AWS Credentials.

References

Related rules

to-top