[New Rule] AWS SageMaker Execution Role Passed by Unusual Principal#6435
Open
bryans3c wants to merge 4 commits into
Open
[New Rule] AWS SageMaker Execution Role Passed by Unusual Principal#6435bryans3c wants to merge 4 commits into
bryans3c wants to merge 4 commits into
Conversation
bryans3c
requested review from
Aegrah,
Mikaayenson,
Samirbous,
django-88,
eric-forte-elastic,
imays11,
terrancedejesus and
w0rk3r
July 13, 2026 12:02
Contributor
Rule: New - GuidelinesThese guidelines serve as a reminder set of considerations when proposing a new rule. Documentation and Context
Rule Metadata Checks
New BBR Rules
Testing and Validation
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new production ES|QL detection rule to identify “first seen in 7 days” usage of an Amazon SageMaker execution role (roleArn) passed via iam:PassRole, which can indicate privilege escalation risk when unusual principals begin using new or more-privileged roles.
Changes:
- Introduces a new ES|QL rule that extracts
roleArnfromaws.cloudtrail.request_parametersviaGROK. - Implements first-occurrence logic by aggregating over a 7-day window and alerting only when the earliest observation of a (principal, roleArn) pair is within the last 10 minutes.
- Adds investigation guide content, tags, and ATT&CK mapping for triage context.
| Esql.user_agent_original_values = VALUES(user_agent.original), | ||
| Esql.cloud_account_id_values = VALUES(cloud.account.id), | ||
| Esql.cloud_region_values = VALUES(cloud.region) | ||
| BY aws.cloudtrail.user_identity.arn, Esql.aws_cloudtrail_request_parameters_role_arn |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
terrancedejesus
approved these changes
Jul 15, 2026
| AND event.action IN ("CreateNotebookInstance", "CreateTrainingJob", "CreateProcessingJob", "CreateAutoMLJob", "CreatePipeline") | ||
| AND event.outcome == "success" | ||
| AND aws.cloudtrail.user_identity.type != "AWSService" | ||
| | GROK aws.cloudtrail.request_parameters """.*roleArn=(?<Esql.aws_cloudtrail_request_parameters_role_arn>arn:aws:iam::[0-9]{12}:role/[^,}]+).*""" |
Contributor
There was a problem hiding this comment.
Suggested change
| | GROK aws.cloudtrail.request_parameters """.*roleArn=(?<Esql.aws_cloudtrail_request_parameters_role_arn>arn:aws:iam::[0-9]{12}:role/[^,}]+).*""" | |
| | GROK aws.cloudtrail.request_parameters """.*roleArn=(?<Esql.aws_cloudtrail_request_parameters_role_arn>arn:aws[a-z-]*:iam::[0-9]{12}:role/[^,}]+).*""" |
May want to do to support govcloud, other non-commercial regions, etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Issue link(s):
Summary - What I changed
Added ES|QL rule that fires the first time an IAM principal passes a specific execution role (
roleArn) to a SageMaker resource-creation call (CreateNotebookInstance,CreateTrainingJob,CreateProcessingJob,CreateAutoMLJob,CreatePipeline) it hasn't used in the last 7 days.Why it matters
These actions require
iam:PassRoleand attach a role the created resource then runs as, a known cloud privilege-escalation path when combined with a broadPassRolegrant.roleArnonly exists inside the Go-map-formattedrequest_parametersstring, and Elasticsearch doesn't exposeflattenedsub-keys as independently aggregatable fields, so a nativenew_termsrule can't key on it. The query extractsroleArnwithGROKand hand-rolls the first-occurrence comparison (7-day scan, alert only when the earliest occurrence of a given principal+role pair falls in the last 10 minutes).Live-fire verified: created a real SageMaker notebook with a role never used before by that identity and confirmed it was correctly flagged.
How To Test
Query can be used in TRADE stack and other telemetry stacks.
Checklist
bug,enhancement,schema,maintenance,Rule: New,Rule: Deprecation,Rule: Tuning,Hunt: New, orHunt: Tuningso guidelines can be generatedmeta:rapid-mergelabel if planning to merge within 24 hoursContributor checklist