Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

6.6 KB
Raw Blame
{
  "id": "phishing-investigation-v1",
  "name": "Phishing: Email Investigation & Remediation",
  "description": "Triggered by a phishing alert from an email gateway or a user report. Extracts IOCs, blocks the sender domain, and resets credentials that may have been compromised. The retraction step here still requires EMAIL_GATEWAY_URL, which no compose file or .env.example sets, so on a default deployment the message is NOT retracted and the step is skipped. Depth 7.1 added a real mailbox purge, and it is not this step: report the message to POST /phishing/reports and purge the campaign through POST /phishing/campaigns/{id}/purge, which dispatches purge_email once per recipient under the capability contract, verifies each mailbox and can be reversed. That path needs AISOC_FEATURE_MAILBOX_REMEDIATION and a Microsoft 365 or Google Workspace connector; it is not reachable as a playbook step because the engine has no purge_email step type.",
  "version": "1.0.0",
  "author": "Beenu - [email protected]",
  "tags": [
    "phishing",
    "email",
    "identity",
    "mitre.t1566",
    "mitre.t1566.001"
  ],
  "trigger": {
    "on": "alert",
    "severity": [
      "high",
      "critical"
    ],
    "tags": [
      "phishing",
      "email-security"
    ]
  },
  "enabled": true,
  "dry_run_support": true,
  "created_at": "2026-05-10T08:00:00+00:00",
  "updated_at": "2026-05-10T08:00:00+00:00",
  "inputs": {
    "message_id": {
      "description": "Email message ID from the alert",
      "field": "alert.message_id",
      "required": true
    },
    "sender_domain": {
      "description": "Sender domain extracted from the From header",
      "field": "alert.sender_domain",
      "required": true
    },
    "recipient_user": {
      "description": "Primary recipient user identity",
      "field": "alert.recipient_user",
      "required": true
    },
    "attachment_hash": {
      "description": "SHA-256 of any malicious attachment",
      "field": "alert.file_hash",
      "required": false
    }
  },
  "steps": [
    {
      "id": "e1",
      "name": "Enrich sender domain reputation",
      "type": "enrich",
      "params": {
        "indicator_field": "alert.sender_domain",
        "indicator_type": "domain"
      },
      "on_failure": "continue",
      "retry_max": 1,
      "timeout_seconds": 30
    },
    {
      "id": "e2",
      "name": "Enrich attachment hash (if present)",
      "type": "enrich",
      "params": {
        "indicator_field": "alert.file_hash",
        "indicator_type": "hash",
        "skip_if_empty": true
      },
      "on_failure": "continue",
      "retry_max": 1,
      "timeout_seconds": 30
    },
    {
      "id": "retract",
      "name": "Retract the message via the tenant's email gateway (needs EMAIL_GATEWAY_URL; no-op when unset — the real mailbox purge is POST /phishing/campaigns/{id}/purge, not this step)",
      "type": "http",
      "params": {
        "url": "${EMAIL_GATEWAY_URL}/v1/messages/retract",
        "method": "POST",
        "body_template": "{\"message_id\": \"{{inputs.message_id}}\", \"reason\": \"phishing\"}",
        "dry_run": "{{dry_run}}"
      },
      "on_failure": "continue",
      "retry_max": 1,
      "timeout_seconds": 30
    },
    {
      "id": "approval_block_domain",
      "name": "Approval gate \u2014 block sender domain",
      "type": "approval",
      "params": {
        "message": "Block sender domain '{{inputs.sender_domain}}' at email gateway and DNS firewall?",
        "approvers": [
          "soc-lead",
          "security-manager"
        ],
        "timeout_seconds": 900,
        "auto_approve_severity": [
          "critical"
        ]
      },
      "on_failure": "abort",
      "retry_max": 0,
      "timeout_seconds": 920
    },
    {
      "id": "block_domain",
      "name": "Block sender domain",
      "type": "block_ip",
      "params": {
        "ip_field": "alert.sender_domain",
        "block_type": "domain",
        "duration": "72h",
        "dry_run": "{{dry_run}}"
      },
      "condition": "steps.approval_block_domain.outcome == 'approved'",
      "on_failure": "continue",
      "retry_max": 0,
      "timeout_seconds": 20
    },
    {
      "id": "check_clicked",
      "name": "Check if recipient clicked link / opened attachment",
      "type": "http",
      "params": {
        "url": "${SIEM_URL}/search",
        "method": "POST",
        "body_template": "{\"query\": \"email_message_id={{inputs.message_id}} AND (url_click=true OR attachment_open=true)\", \"earliest\": \"-1h\"}"
      },
      "on_failure": "continue",
      "retry_max": 1,
      "timeout_seconds": 30
    },
    {
      "id": "approval_reset",
      "name": "Approval gate \u2014 force password reset (if click detected)",
      "type": "approval",
      "params": {
        "message": "Recipient '{{inputs.recipient_user}}' may have clicked link. Force password reset + MFA?",
        "approvers": [
          "soc-lead"
        ],
        "timeout_seconds": 600,
        "condition_skip": "context.click_detected == false"
      },
      "condition": "context.click_detected == true",
      "on_failure": "continue",
      "retry_max": 0,
      "timeout_seconds": 620
    },
    {
      "id": "reset_pw",
      "name": "Force password reset for recipient",
      "type": "reset_password",
      "params": {
        "user_field": "inputs.recipient_user",
        "dry_run": "{{dry_run}}"
      },
      "condition": "steps.approval_reset.outcome == 'approved'",
      "on_failure": "continue",
      "retry_max": 0,
      "timeout_seconds": 20
    },
    {
      "id": "inv",
      "name": "Phishing investigation",
      "type": "investigate",
      "params": {
        "case_id_field": "alert.case_id",
        "focus": "phishing"
      },
      "on_failure": "continue",
      "retry_max": 0,
      "timeout_seconds": 180
    },
    {
      "id": "n1",
      "name": "Notify security team",
      "type": "notify",
      "params": {
        "channel": "slack",
        "message_template": "Phishing alert: {{inputs.sender_domain}} \u2192 {{inputs.recipient_user}}. Message retracted: {{context.retract_success}}. Domain blocked: {{context.domain_blocked}}.",
        "webhook_env": "SLACK_SOC_WEBHOOK"
      },
      "on_failure": "continue",
      "retry_max": 0,
      "timeout_seconds": 10
    },
    {
      "id": "t1",
      "name": "Open phishing ticket",
      "type": "create_ticket",
      "params": {
        "priority": "P2",
        "title_template": "Phishing: {{inputs.sender_domain}} targeting {{inputs.recipient_user}}",
        "queue": "soc",
        "labels": [
          "phishing",
          "email"
        ]
      },
      "on_failure": "continue",
      "retry_max": 0,
      "timeout_seconds": 20
    }
  ]
}