Detection content has been deleted from Panther


Description

Detection content has been removed from Panther.

Query · python

PANTHER_DETECTION_DELETE_ACTIONS = [
    "DELETE_DATA_MODEL",
    "DELETE_DETECTION",
    "DELETE_DETECTION_PACK_SOURCE",
    "DELETE_GLOBAL_HELPER",
    "DELETE_LOOKUP_TABLE",
    "DELETE_SAVED_DATA_LAKE_QUERY",
]


def rule(event):
    return (
        event.get("actionName") in PANTHER_DETECTION_DELETE_ACTIONS
        and event.get("actionResult") == "SUCCEEDED"
    )


def title(event):
    return f"Detection Content has been deleted by {event.udm('actor_user')}"


def alert_context(event):
    detections_list = event.deep_get("actionParams", "dynamic", "input", "detections")
    if detections_list is None:
        detections_list = event.deep_get("actionParams", "input", "detections", default=[])
    return {
        "deleted_detections_list": [x.get("id") for x in detections_list],
        "user": event.udm("actor_user"),
        "ip": event.udm("source_ip"),
    }

Analyst notes

Ensure this change was approved and appropriate.

Raw source Detection content has been deleted from Panther · Panther Python
Esc
Published by panther-labs/panther-analysis ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
AnalysisType: rule
Filename: panther_detection_deleted.py
RuleID: "Panther.Detection.Deleted"
DisplayName: "Detection content has been deleted from Panther"
Enabled: true
LogTypes:
  - Panther.Audit
Severity: Info
Tags:
  - DataModel
  - Defense Evasion:Impair Defenses
Reports:
  MITRE ATT&CK:
    - TA0005:T1562
Description: Detection content has been removed from Panther.
Runbook: Ensure this change was approved and appropriate.
Reference: https://docs.panther.com/system-configuration/panther-audit-logs/querying-and-writing-detections-for-panther-audit-logs
SummaryAttributes:
  - p_any_ip_addresses
Tests:
  - Name: Delete 1 Detection
    ExpectedResult: true
    Log:
      {
        "actionName": "DELETE_DETECTION",
        "actionParams":
          {
            "dynamic":
              { "input": { "detections": [{ "id": "GitHub.Team.Modified" }] } },
          },
        "actionResult": "SUCCEEDED",
        "actor":
          {
            "attributes":
              {
                "email": "homer@springfield.gov",
                "emailVerified": true,
                "roleId": "11111111",
              },
            "id": "1111111",
            "name": "Homer Simpson",
            "type": "USER",
          },
        "errors": null,
        "p_log_type": "Panther.Audit",
        "sourceIP": "1.2.3.4",
        "timestamp": "2022-04-28 15:30:22.42",
      }
  - Name: Delete Many Detections
    ExpectedResult: true
    Log:
      {
        "actionName": "DELETE_DETECTION",
        "actionParams":
          {
            "dynamic":
              {
                "input":
                  {
                    "detections":
                      [
                        { "id": "Github.Repo.Created" },
                        { "id": "Okta.Global.MFA.Disabled" },
                        { "id": "Okta.AdminRoleAssigned" },
                        { "id": "Okta.BruteForceLogins" },
                      ],
                  },
              },
          },
        "actionResult": "SUCCEEDED",
        "actor":
          {
            "attributes":
              {
                "email": "homer@springfield.gov",
                "emailVerified": true,
                "roleId": "111111",
              },
            "id": "1111111",
            "name": "Homer Simpson",
            "type": "USER",
          },
        "errors": null,
        "p_log_type": "Panther.Audit",
        "sourceIP": "1.2.3.4.",
        "timestamp": "2022-04-28 15:34:43.067",
      }
  - Name: Non-Delete event
    ExpectedResult: false
    Log:
      {
        "actionName": "GET_GENERAL_SETTINGS",
        "actionParams": {},
        "actionResult": "SUCCEEDED",
        "actor":
          {
            "attributes":
              {
                "email": "homer@springfield.gov",
                "emailVerified": true,
                "roleId": "111111",
              },
            "id": "111111",
            "name": "Homer Simpson",
            "type": "USER",
          },
        "errors": null,
        "p_log_type": "Panther.Audit",
      }


# ------ paired body: panther_detection_deleted.py ------

PANTHER_DETECTION_DELETE_ACTIONS = [
    "DELETE_DATA_MODEL",
    "DELETE_DETECTION",
    "DELETE_DETECTION_PACK_SOURCE",
    "DELETE_GLOBAL_HELPER",
    "DELETE_LOOKUP_TABLE",
    "DELETE_SAVED_DATA_LAKE_QUERY",
]


def rule(event):
    return (
        event.get("actionName") in PANTHER_DETECTION_DELETE_ACTIONS
        and event.get("actionResult") == "SUCCEEDED"
    )


def title(event):
    return f"Detection Content has been deleted by {event.udm('actor_user')}"


def alert_context(event):
    detections_list = event.deep_get("actionParams", "dynamic", "input", "detections")
    if detections_list is None:
        detections_list = event.deep_get("actionParams", "input", "detections", default=[])
    return {
        "deleted_detections_list": [x.get("id") for x in detections_list],
        "user": event.udm("actor_user"),
        "ip": event.udm("source_ip"),
    }

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.