Implementing SOAR Playbook for Phishing
Overview
This skill implements a phishing incident response workflow using the Splunk SOAR (formerly Phantom) REST API. When a suspected phishing email is reported, the agent parses email headers and body, creates a SOAR container representing the incident, attaches artifacts containing indicators of compromise (sender address, URLs, IP addresses, file hashes), triggers an automated investigation playbook, and polls for action results.
Splunk SOAR orchestrates and automates security operations through playbooks that chain together investigative and response actions. The REST API at /rest/container, /rest/artifact, and /rest/playbook_run enables programmatic incident creation and automation triggering from external tools, email gateways, and SIEM alerts.
When to Use
- When deploying or configuring implementing soar playbook for phishing capabilities in your environment
- When establishing security controls aligned to compliance requirements
- When building or improving security architecture for this domain
- When conducting security assessments that require this implementation
Prerequisites
- Python 3.9 or later with
requests and email modules
- Splunk SOAR instance (Cloud or On-Premises) with REST API access
- SOAR API token with permissions to create containers and trigger playbooks
- Network connectivity to SOAR instance on port 443
- A configured phishing investigation playbook in SOAR
Steps
Parse the phishing email: Read the email file (.eml format) and extract headers including From, To, Subject, Reply-To, Return-Path, Received, Message-ID, X-Mailer, and authentication results (SPF, DKIM, DMARC). Extract URLs and IP addresses from the email body.
Authenticate to SOAR REST API: Use the API token in the ph-auth-token header to authenticate all REST API requests to the SOAR instance.
Create a container: POST to /rest/container with the incident label, name, description, severity, and status. The container represents the phishing incident and receives a container ID in the response.
Add email header artifacts: POST to /rest/artifact with container_id and CEF (Common Event Format) fields containing sender address (fromAddress), recipient (toAddress), subject, originating IP (sourceAddress), and Message-ID. Set run_automation to False for all but the last artifact.
Add URL artifacts: For each URL extracted from the email body, create an artifact with CEF field requestURL and type url. These artifacts feed into URL reputation checks in the playbook.
Trigger the playbook: POST to /rest/playbook_run with the playbook ID or name and the container ID. This initiates the automated investigation workflow.
Poll action results: GET /rest/action_run filtered by container ID to monitor playbook progress. Poll until all actions reach a terminal state (success, failed, or cancelled).
Compile response report: Aggregate playbook action results into a summary report with verdicts from URL reputation, domain reputation, IP geolocation, and email header analysis.
Expected Output
{
"incident": {
"container_id": 1542,
"status": "new",
"severity": "high",
"artifacts_created": 5
},
"playbook": {
"name": "phishing_investigate",
"run_id": 892,
"status": "success",
"actions_completed": 8
},
"verdict": "malicious",
"indicators": {
"sender_domain_reputation": "malicious",
"urls_flagged": 2,
"spf_result": "fail",
"dkim_result": "fail"
}
}
1---2name: implementing-soar-playbook-for-phishing3description: Automates phishing incident response by calling the Splunk SOAR (Phantom)4 REST API to create containers, attach artifacts (emails, URLs, attachments), and5 trigger response playbooks. Use when building or wiring up a Splunk SOAR phishing6 playbook, ingesting a suspected phishing report into SOAR, or automating containment7 and triage for phishing incidents.8domain: cybersecurity9subdomain: security-operations10tags:11- soar12- splunk-phantom13- phishing14- incident-response15version: '1.0'16author: mahipal17license: Apache-2.018nist_csf:19- DE.CM-0120- RS.MA-0121- GV.OV-0122- DE.AE-0223mitre_attack:24- T107825- T119026- T105927- T156628- T159829mitre_f3:30 version: '1.1'31 tactics:32 - reconnaissance33 - resource-development34 - initial-access35 - stealth36 techniques:37 - id: T159838 name: Phishing for Information39 tactic: reconnaissance40 source: attack41 - id: T166042 name: Phishing43 tactic: initial-access44 source: attack45 - id: T167246 name: Email Spoofing47 tactic: stealth48 source: attack49 - id: F1020.00250 name: 'Create Fake Materials: Fake Website'51 tactic: resource-development52 source: f353 - id: F103254 name: Impersonate Official55 tactic: initial-access56 source: f357metadata:58 source: https://skillmd.com/skills/26zl/implementing-soar-playbook-for-phishing59---606162# Implementing SOAR Playbook for Phishing6364## Overview6566This skill implements a phishing incident response workflow using the Splunk SOAR (formerly Phantom) REST API. When a suspected phishing email is reported, the agent parses email headers and body, creates a SOAR container representing the incident, attaches artifacts containing indicators of compromise (sender address, URLs, IP addresses, file hashes), triggers an automated investigation playbook, and polls for action results.6768Splunk SOAR orchestrates and automates security operations through playbooks that chain together investigative and response actions. The REST API at `/rest/container`, `/rest/artifact`, and `/rest/playbook_run` enables programmatic incident creation and automation triggering from external tools, email gateways, and SIEM alerts.697071## When to Use7273- When deploying or configuring implementing soar playbook for phishing capabilities in your environment74- When establishing security controls aligned to compliance requirements75- When building or improving security architecture for this domain76- When conducting security assessments that require this implementation7778## Prerequisites7980- Python 3.9 or later with `requests` and `email` modules81- Splunk SOAR instance (Cloud or On-Premises) with REST API access82- SOAR API token with permissions to create containers and trigger playbooks83- Network connectivity to SOAR instance on port 44384- A configured phishing investigation playbook in SOAR8586## Steps87881. **Parse the phishing email**: Read the email file (.eml format) and extract headers including From, To, Subject, Reply-To, Return-Path, Received, Message-ID, X-Mailer, and authentication results (SPF, DKIM, DMARC). Extract URLs and IP addresses from the email body.89902. **Authenticate to SOAR REST API**: Use the API token in the `ph-auth-token` header to authenticate all REST API requests to the SOAR instance.91923. **Create a container**: POST to `/rest/container` with the incident label, name, description, severity, and status. The container represents the phishing incident and receives a container ID in the response.93944. **Add email header artifacts**: POST to `/rest/artifact` with `container_id` and CEF (Common Event Format) fields containing sender address (`fromAddress`), recipient (`toAddress`), subject, originating IP (`sourceAddress`), and Message-ID. Set `run_automation` to False for all but the last artifact.95965. **Add URL artifacts**: For each URL extracted from the email body, create an artifact with CEF field `requestURL` and type `url`. These artifacts feed into URL reputation checks in the playbook.97986. **Trigger the playbook**: POST to `/rest/playbook_run` with the playbook ID or name and the container ID. This initiates the automated investigation workflow.991007. **Poll action results**: GET `/rest/action_run` filtered by container ID to monitor playbook progress. Poll until all actions reach a terminal state (success, failed, or cancelled).1011028. **Compile response report**: Aggregate playbook action results into a summary report with verdicts from URL reputation, domain reputation, IP geolocation, and email header analysis.103104## Expected Output105106```json107{108 "incident": {109 "container_id": 1542,110 "status": "new",111 "severity": "high",112 "artifacts_created": 5113 },114 "playbook": {115 "name": "phishing_investigate",116 "run_id": 892,117 "status": "success",118 "actions_completed": 8119 },120 "verdict": "malicious",121 "indicators": {122 "sender_domain_reputation": "malicious",123 "urls_flagged": 2,124 "spf_result": "fail",125 "dkim_result": "fail"126 }127}128```