-
Notifications
You must be signed in to change notification settings - Fork 603
[Rule Tunings] AWS EC2 EBS Snapshot and Encryption Rules #5229
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
base: main
Are you sure you want to change the base?
Conversation
AWS EC2 Encryption Disabled rule performance is good, telemetry looks low as expected - additional context to description to emphasize the security concern and purpose of the rule - updated investigation guide - added highlighted fields - reduced execution window AWS EC2 EBS Snapshot Access Removed rule alerts as expected, telemetry volume is low as expected. however, this rule can be accomplished using EQL so I've changed the rule type - changed rule type to eql - added index - updated IG - added highlighted fields note: I have to use `any` for the query since there is no `event.category` defined for `event.action: ModifySnapshotAttribute` AWS EC2 EBS Snapshot Shared or Made Public Converted to EQL. As an ESQL rule the primary benefit was being able to definitely exclude instances where a user adds their own account id when calling the ModifySnapshotAttribute instead of an external account id. This is a redundant action as the snapshot when created is automatically shared with the account it's created in. But this could be a false positive if it's done by mistake. Instead of keeping this as an ESQL rule, I still think there is more value to converting this to EQL for both customer alert context and telemetry. When looking at production data, I saw no instances where the owning account id was added in this way. Its a rare mistake that shouldn't happen often enough to support keeping this as an ESQL rule. - converted to EQL - added index - updated IG - updated description - added highlighted fields
Rule: Tuning - GuidelinesThese guidelines serve as a reminder set of considerations when tuning an existing rule. Documentation and Context
Rule Metadata Checks
Testing and Validation
|
If verified as legitimate, document the event under change management and reconcile it against organizational policies for snapshot sharing. | ||
### Additional Information: | ||
### Response and Remediation: |
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.
nit: Response and Remediation
-> Response and remediation
to stay consistent with other rules. Same for FP analysis and investigation steps.
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.
Thank you!
from logs-aws.cloudtrail-* metadata _id, _version, _index | ||
| where | ||
event.provider == "ec2.amazonaws.com" | ||
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.
Noticed we dont have an ECS event.category
for the docs but aws.cloudtrail.event_category
exists. I wonder if we can get these mapped and cover more categories that way. Just a thought
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.
Here's an example of what @terrancedejesus has done in the past. Although im not sure why he added an override matching the default. 🤔
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 don’t recall much beyond a suggestion to override it: #3278 (comment)
Okta categories will be fixed here: elastic/integrations#15235
In my opinion, overriding with the provider does remove the need to use any, but it also changes the query’s context. Instead of saying event type WHERE, we’re now effectively saying service WHERE. I could be mistaken, but my understanding is that the override functionality was introduced to allow specifying a different field from the integration’s data stream that categorizes events.
While event.provider works well and is consistent in AWS, that may not be the case for other CSP audit logs, so this approach might make sense in some cases but could introduce inconsistency overall. Ideally, this should be solved at the data source level rather than in the rule itself.
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 I do agree with the ultimate changes being made at the data source level. When I'm finished with the audit I will create an Integrations request that consolidates all the API calls that we currently use in our ruleset that don't have a defined category. However, if performance is an issue, we may want to just implement a solution that we can control for now. It's probably worth putting some thought into normalizing what "backup" fields we should use. I chose event.provider
simply because it's a way to group all the events associated with a single AWS service, which we always include in the AWS queries any way. But I'm open to suggestions for a better field.
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.
Nice changes!
rules/integrations/aws/exfiltration_ec2_ebs_snapshot_shared_with_another_account.toml
Outdated
Show resolved
Hide resolved
override event.category to event.provider to account for the use of "any" in EQL query
normalizing IG title capitalization
cc: @terrancedejesus After doing some testing in the stack with @Mikaayenson, I changed the EQL queries to rely on ![]() ![]() |
unit tests failing on the EQL queries but this is valid syntax |
since EC2 snapshot data can be sensitive, unauthorized sharing or access removal should be triaged
Pull Request
Issue link(s):
Summary - What I changed
AWS EC2 Encryption Disabled
rule performance is good, telemetry looks low as expected. No major changed needed
AWS EC2 EBS Snapshot Access Removed
rule alerts as expected, telemetry volume is low as expected. however, this rule can be accomplished using EQL so I've changed the rule type
any
for the query since there is noevent.category
defined forevent.action: ModifySnapshotAttribute
AWS EC2 EBS Snapshot Shared or Made Public
Converted to EQL. As an ESQL rule the primary benefit was being able to definitely exclude instances where a user adds their own account id when calling the ModifySnapshotAttribute instead of an external account id. This is a redundant action as the snapshot when created is automatically shared with the account it's created in. But this could be a false positive if it's done by mistake. Instead of keeping this as an ESQL rule, I still think there is more value to converting this to EQL for both customer alert context and telemetry. When looking at production data, I saw no instances where the owning account id was added in this way. Its a rare mistake that shouldn't happen often enough to support keeping this as an ESQL rule.
How To Test
There is test data in our stack that each of the queries can be run against. You can find scripts for testing each rule here:
Screenshot of AWS EC2 Encryption Disabled expected alert
Screenshot of AWS EC2 EBS Snapshot Access Removed
Screenshot of AWS EC2 EBS Snapshot Shared or Made Public