Skip to content

Conversation

imays11
Copy link
Contributor

@imays11 imays11 commented Oct 16, 2025

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

  • 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

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 2025-10-16 at 6 20 38 PM

Screenshot of AWS EC2 EBS Snapshot Access Removed

Screenshot 2025-10-16 at 6 16 43 PM

Screenshot of AWS EC2 EBS Snapshot Shared or Made Public

Screenshot 2025-10-16 at 5 45 25 PM

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
Copy link
Contributor

Rule: Tuning - Guidelines

These guidelines serve as a reminder set of considerations when tuning an existing rule.

Documentation and Context

  • Detailed description of the suggested changes.
  • Provide example JSON data or screenshots.
  • Provide evidence of reducing benign events mistakenly identified as threats (False Positives).
  • Provide evidence of enhancing detection of true threats that were previously missed (False Negatives).
  • Provide evidence of optimizing resource consumption and execution time of detection rules (Performance).
  • Provide evidence of specific environment factors influencing customized rule tuning (Contextual Tuning).
  • Provide evidence of improvements made by modifying sensitivity by changing alert triggering thresholds (Threshold Adjustments).
  • Provide evidence of refining rules to better detect deviations from typical behavior (Behavioral Tuning).
  • Provide evidence of improvements of adjusting rules based on time-based patterns (Temporal Tuning).
  • Provide reasoning of adjusting priority or severity levels of alerts (Severity Tuning).
  • Provide evidence of improving quality integrity of our data used by detection rules (Data Quality).
  • Ensure the tuning includes necessary updates to the release documentation and versioning.

Rule Metadata Checks

  • updated_date matches the date of tuning PR merged.
  • min_stack_version should support the widest stack versions.
  • name and description should be descriptive and not include typos.
  • query should be inclusive, not overly exclusive. Review to ensure the original intent of the rule is maintained.

Testing and Validation

  • Validate that the tuned rule's performance is satisfactory and does not negatively impact the stack.
  • Ensure that the tuned rule has a low false positive rate.

If verified as legitimate, document the event under change management and reconcile it against organizational policies for snapshot sharing.
### Additional Information:
### Response and Remediation:
Copy link
Contributor

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.

Copy link
Contributor Author

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"
Copy link
Contributor

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

Copy link
Contributor

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. 🤔

Copy link
Contributor

@terrancedejesus terrancedejesus Oct 17, 2025

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.

Copy link
Contributor Author

@imays11 imays11 Oct 17, 2025

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.

Copy link
Contributor

@terrancedejesus terrancedejesus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice changes!

override event.category to event.provider to account for the use of "any" in EQL query
normalizing IG title capitalization
@imays11
Copy link
Contributor Author

imays11 commented Oct 17, 2025

cc: @terrancedejesus After doing some testing in the stack with @Mikaayenson, I changed the EQL queries to rely on event.provider instead of event.category field. Our OOTB rules do support this change. Below are screenshots of a working query and a created rule with the Event category field changed. This is a work around to improve rule performance since the event.action == "ModifySnapshotAttribute" has not yet been categorized via the AWS Integration to populate event.category field, we would otherwise have to use any in the query.

Screenshot 2025-10-17 at 12 01 33 PM Screenshot 2025-10-17 at 12 02 13 PM

@imays11
Copy link
Contributor Author

imays11 commented Oct 17, 2025

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants