-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into THREAT-311/cs_eventstreams_passthrough
- Loading branch information
Showing
22 changed files
with
1,385 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
35 changes: 35 additions & 0 deletions
35
rules/aws_cloudtrail_rules/aws_cloudtrail_event_selectors_disabled.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from panther_aws_helpers import aws_cloudtrail_success, aws_rule_context, lookup_aws_account_name | ||
|
||
# API calls that are indicative of CloudTrail changes | ||
CLOUDTRAIL_EDIT_SELECTORS = {"PutEventSelectors"} | ||
|
||
|
||
def rule(event): | ||
if not (aws_cloudtrail_success(event) and event.get("eventName") in CLOUDTRAIL_EDIT_SELECTORS): | ||
return False | ||
|
||
# Check if management events are included for each selector. | ||
# deep_walk only returns a list if there's more than 1 entry in the nested array, so we must | ||
# enforce it to be a list. | ||
includes = event.deep_walk("requestParameters", "eventSelectors", "includeManagementEvents") | ||
if not isinstance(includes, list): | ||
includes = [includes] | ||
|
||
# Return False all the management events are included, else return True and raise alert | ||
return not all(includes) | ||
|
||
|
||
def dedup(event): | ||
# Merge on the CloudTrail ARN | ||
return event.deep_get("requestParameters", "trailName", default="<UNKNOWN_NAME>") | ||
|
||
|
||
def title(event): | ||
return ( | ||
f"Management events have been exluded from CloudTrail [{dedup(event)}] in account " | ||
f"[{lookup_aws_account_name(event.get('recipientAccountId'))}]" | ||
) | ||
|
||
|
||
def alert_context(event): | ||
return aws_rule_context(event) |
Oops, something went wrong.