[New Rule] AWS Lambda Execution Role Credentials Used Outside Lambda#6292
Open
bryans3c wants to merge 10 commits into
Open
[New Rule] AWS Lambda Execution Role Credentials Used Outside Lambda#6292bryans3c wants to merge 10 commits into
bryans3c wants to merge 10 commits into
Conversation
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 AWS CloudTrail ES|QL detection rule intended to identify potential theft and replay of AWS Lambda execution-role temporary credentials by correlating usage of the same assumed-role access key both inside the Lambda runtime and from an external/non-Lambda context.
Changes:
- Introduces a new ES|QL aggregation rule that groups CloudTrail activity by temporary access key id and flags keys used both with Lambda runtime markers and without them in the same window.
- Adds an investigation guide with triage, false positive, and remediation guidance specific to Lambda credential replay scenarios.
terrancedejesus
approved these changes
Jun 22, 2026
terrancedejesus
left a comment
Contributor
There was a problem hiding this comment.
Couple of considerations. Logic and threat signal! Nice rule!
Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com>
Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com>
imays11
reviewed
Jun 26, 2026
|
|
||
| | eval is_lambda_call = case( | ||
| user_agent.original LIKE "*exec-env/AWS_Lambda*" | ||
| or aws.cloudtrail.user_identity.invoked_by == "lambda.amazonaws.com", |
Contributor
There was a problem hiding this comment.
The only time I see this invoked_by value is when aws.cloudtrail.user_identity.type == AWSService, how are you comparing these AssumedRole lambda calls to the original service Lambda calls?
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
Add detection of a single AWS Lambda execution-role credential (a temporary assumed-role access key) that is used both from inside the Lambda execution environment and from outside it within the same window. When a function runs, its temporary credentials are presented with the Lambda runtime user agent (containing "exec-env/AWS_Lambda") or with a request invoked by "lambda.amazonaws.com". An adversary who exfiltrates those credentials, typically through a server-side request forgery or remote code execution flaw in the function, can replay them from their own host, where the same
access key appears without the Lambda runtime markers and from an unrelated source. Observing the same temporary key
both inside and outside the runtime is a strong indicator of stolen Lambda credentials being abused.
How To Test
Query & data can be assessed 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