Skip to content

Commit

Permalink
better deduplication of alerts (#1331)
Browse files Browse the repository at this point in the history
Co-authored-by: ben-githubs <38414634+ben-githubs@users.noreply.github.com>
  • Loading branch information
arielkr256 and ben-githubs authored Aug 19, 2024
1 parent 1e0fbf5 commit 3e6592f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ def title(event):
)


def dedup(event):
return deep_get(
event, "protoPayload", "authenticationInfo", "principalEmail", default="<ACTOR_NOT_FOUND>"
)


def alert_context(event):
context = gcp_alert_context(event)
volume_mount_path = deep_walk(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Reports:
- TA0001 # Initial Access
- TA0002 # Execution
Filename: gcp_k8s_pod_create_or_modify_host_path_vol_mount.py
DedupPeriodMinutes: 360
Tests:
- Name: Pod With Suspicious Volume Mount Created
ExpectedResult: true
Expand Down
6 changes: 6 additions & 0 deletions rules/gcp_k8s_rules/gcp_k8s_privileged_pod_created.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def title(event):
return f"[GCP]: [{actor}] created a privileged pod [{pod_name}] in project [{project_id}]"


def dedup(event):
return deep_get(
event, "protoPayload", "authenticationInfo", "principalEmail", default="<ACTOR_NOT_FOUND>"
)


def alert_context(event):
context = gcp_alert_context(event)
containers_info = deep_walk(event, "protoPayload", "response", "spec", "containers", default=[])
Expand Down
1 change: 1 addition & 0 deletions rules/gcp_k8s_rules/gcp_k8s_privileged_pod_created.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Reference: https://www.golinuxcloud.com/kubernetes-privileged-pod-examples/
Reports:
MITRE ATT&CK:
- TA0004:T1548 # Abuse Elevation Control Mechanism
DedupPeriodMinutes: 360
Tests:
- Name: Privileged Pod Created
ExpectedResult: true
Expand Down

0 comments on commit 3e6592f

Please sign in to comment.