|
| 1 | +[metadata] |
| 2 | +creation_date = "2025/01/15" |
| 3 | +integration = ["aws"] |
| 4 | +maturity = "production" |
| 5 | +updated_date = "2025/01/15" |
| 6 | + |
| 7 | +[rule] |
| 8 | +author = ["Elastic"] |
| 9 | +description = """ |
| 10 | +Identifies when AWS S3 objects stored in a bucket are encrypted using Server-Side Encryption with Customer-Provided Keys |
| 11 | +(SSE-C). Adversaries with compromised AWS credentials can encrypt objects in an S3 bucket using their own encryption |
| 12 | +keys, rendering the objects unreadable or recoverable without the key. This can be used as a form of ransomware to |
| 13 | +extort the bucket owner for the decryption key. This is a [New |
| 14 | +Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule that flags when |
| 15 | +this behavior is observed for the first time in the last 14 days by the user ARN and target bucket name. |
| 16 | +""" |
| 17 | +false_positives = [ |
| 18 | + """ |
| 19 | + Legitimate use of Server-Side Encryption with Customer-Provided Keys (SSE-C) to encrypt objects in an S3 bucket. |
| 20 | + """, |
| 21 | +] |
| 22 | +from = "now-9m" |
| 23 | +index = ["filebeat-*", "logs-aws.cloudtrail-*"] |
| 24 | +language = "kuery" |
| 25 | +license = "Elastic License v2" |
| 26 | +name = "Unusual AWS S3 Object Encryption with SSE-C" |
| 27 | +note = """### Triage and Analysis |
| 28 | +
|
| 29 | +#### Investigating Unusual AWS S3 Object Encryption with SSE-C |
| 30 | +This rule identifies the use of Server-Side Encryption with Customer-Provided Keys (SSE-C) in AWS S3. This could indicate malicious activity, such as ransomware encrypting objects, rendering them inaccessible without the corresponding encryption keys. |
| 31 | +
|
| 32 | +##### Possible Investigation Steps |
| 33 | +
|
| 34 | +1. **Identify the User and Source**: |
| 35 | + - Review the `aws.cloudtrail.user_identity.arn` to identify the IAM user or role performing the operation. |
| 36 | + - Cross-check the `source.ip` and `user_agent.original` fields for unusual IPs or user agents that could indicate unauthorized access. |
| 37 | + - Review the `aws.cloudtrail.user_identity.access_key_id` to identify the access key used. This could be a compromised key. |
| 38 | +
|
| 39 | +2. **Examine the Targeted Resources**: |
| 40 | + - Check `aws.cloudtrail.flattened.request_parameters.bucketName` to identify the bucket involved. |
| 41 | + - Analyze the object key from `aws.cloudtrail.flattened.request_parameters.key`. |
| 42 | +
|
| 43 | +3. **Evaluate Encryption Behavior**: |
| 44 | + - Confirm the encryption details in `aws.cloudtrail.flattened.request_parameters.x-amz-server-side-encryption-customer-algorithm` and `aws.cloudtrail.flattened.additional_eventdata.SSEApplied`. |
| 45 | + - Note if `SSEApplied` is `SSE-C`, which confirms encryption using a customer-provided key. |
| 46 | +
|
| 47 | +4. **Correlate with Recent Events**: |
| 48 | + - Look for any suspicious activity in proximity to the encryption event, such as new access key creation, policy changes, or unusual access patterns from the same user or IP. |
| 49 | + - Identify `ListBucket` or `GetObject` operations on the same bucket to determine all affected objects. |
| 50 | + - For `PutObject` events, identify any other unusual objecs uploaded such as a ransom note. |
| 51 | +
|
| 52 | +5. **Validate Access Permissions**: |
| 53 | + - Check the IAM policies and roles associated with the user to verify if they had legitimate access to encrypt objects. |
| 54 | +
|
| 55 | +6. **Assess Impact**: |
| 56 | + - Identify the number of encrypted objects in the bucket by examining other similar events. |
| 57 | + - Determine if this encryption aligns with standard business practices or constitutes a deviation. |
| 58 | +
|
| 59 | +### False Positive Analysis |
| 60 | +
|
| 61 | +- **Legitimate Use Cases**: |
| 62 | + - Confirm if SSE-C encryption is part of regular operations for compliance or data protection. |
| 63 | + - Cross-reference known processes or users authorized for SSE-C encryption in the affected bucket. |
| 64 | +
|
| 65 | +### Response and Remediation |
| 66 | +
|
| 67 | +1. **Immediate Actions**: |
| 68 | + - Disable access keys or permissions for the user if unauthorized behavior is confirmed. |
| 69 | + - Rotate the bucket's encryption configuration to mitigate further misuse. |
| 70 | +
|
| 71 | +2. **Data Recovery**: |
| 72 | + - Attempt to identify and contact the party holding the SSE-C encryption keys if recovery is necessary. |
| 73 | +
|
| 74 | +3. **Enhance Monitoring**: |
| 75 | + - Enable alerts for future SSE-C encryption attempts in critical buckets. |
| 76 | + - Review and tighten IAM policies for roles and users accessing S3. |
| 77 | +
|
| 78 | +4. **Post-Incident Review**: |
| 79 | + - Audit logs for additional activities by the same user or IP. |
| 80 | + - Document findings and apply lessons learned to improve preventive measures. |
| 81 | +""" |
| 82 | +references = [ |
| 83 | + "https://www.halcyon.ai/blog/abusing-aws-native-services-ransomware-encrypting-s3-buckets-with-sse-c", |
| 84 | + "https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html", |
| 85 | +] |
| 86 | +risk_score = 73 |
| 87 | +rule_id = "c1a9ed70-d349-11ef-841c-f661ea17fbcd" |
| 88 | +setup = "AWS S3 data event types need to be enabled in the CloudTrail trail configuration." |
| 89 | +severity = "high" |
| 90 | +tags = [ |
| 91 | + "Domain: Cloud", |
| 92 | + "Data Source: AWS", |
| 93 | + "Data Source: Amazon Web Services", |
| 94 | + "Data Source: AWS S3", |
| 95 | + "Resources: Investigation Guide", |
| 96 | + "Use Case: Threat Detection", |
| 97 | + "Tactic: Impact", |
| 98 | +] |
| 99 | +timestamp_override = "event.ingested" |
| 100 | +type = "new_terms" |
| 101 | + |
| 102 | +query = ''' |
| 103 | +event.dataset: "aws.cloudtrail" |
| 104 | + and event.provider: "s3.amazonaws.com" |
| 105 | + and event.action: "PutObject" |
| 106 | + and event.outcome: "success" |
| 107 | + and aws.cloudtrail.flattened.request_parameters.x-amz-server-side-encryption-customer-algorithm: "AES256" |
| 108 | + and aws.cloudtrail.flattened.additional_eventdata.SSEApplied: "SSE_C" |
| 109 | +''' |
| 110 | + |
| 111 | + |
| 112 | +[[rule.threat]] |
| 113 | +framework = "MITRE ATT&CK" |
| 114 | +[[rule.threat.technique]] |
| 115 | +id = "T1486" |
| 116 | +name = "Data Encrypted for Impact" |
| 117 | +reference = "https://attack.mitre.org/techniques/T1486/" |
| 118 | + |
| 119 | + |
| 120 | +[rule.threat.tactic] |
| 121 | +id = "TA0040" |
| 122 | +name = "Impact" |
| 123 | +reference = "https://attack.mitre.org/tactics/TA0040/" |
| 124 | + |
| 125 | +[rule.investigation_fields] |
| 126 | +field_names = [ |
| 127 | + "@timestamp", |
| 128 | + "event.action", |
| 129 | + "event.outcome", |
| 130 | + "aws.cloudtrail.user_identity.arn", |
| 131 | + "aws.cloudtrail.user_identity.type", |
| 132 | + "aws.cloudtrail.user_identity.access_key_id", |
| 133 | + "aws.cloudtrail.flattened.request_parameters.bucketName", |
| 134 | + "aws.cloudtrail.flattened.request_parameters.key", |
| 135 | + "aws.cloudtrail.flattened.request_parameters.x-amz-server-side-encryption-customer-algorithm", |
| 136 | + "aws.cloudtrail.flattened.additional_eventdata.SSEApplied", |
| 137 | + "aws.cloudtrail.response_elements", |
| 138 | + "source.ip", |
| 139 | + "user_agent.original", |
| 140 | + "cloud.region", |
| 141 | + "cloud.account.id", |
| 142 | +] |
| 143 | + |
| 144 | +[rule.new_terms] |
| 145 | +field = "new_terms_fields" |
| 146 | +value = ["aws.cloudtrail.user_identity.arn", "aws.cloudtrail.flattened.request_parameters.bucketName"] |
| 147 | +[[rule.new_terms.history_window_start]] |
| 148 | +field = "history_window_start" |
| 149 | +value = "now-14d" |
| 150 | + |
| 151 | + |
0 commit comments