← Course Index

7.16 Security Orchestration, Automation & Response (SOAR):
Shuffle & Cortex XSOAR

Designing Automated Alert Triage Playbooks, Enrichment & Containment Workflows, Human Approval Gates & Safe Error Handling

Module 7: Vulnerability Research & Defense SOAR Automation Shuffle & Cortex XSOAR

1. Automating Repetitive SOC Triage While Preserving Control

Security operations teams routinely spend hours copying observables between SIEM alerts, threat intelligence lookups, identity directories, and endpoint tools. Security Orchestration, Automation, and Response (SOAR) platforms—such as open-source Shuffle and enterprise Cortex XSOAR—connect security tools through visual playbooks, apps/integrations, and incident war rooms or cases so enrichment, ticket creation, and scoped containment happen consistently and fast.

Automate Enrichment First, Gate High-Impact Actions: Start with read-only enrichment, deduplication, and context gathering before automating destructive or high-blast-radius actions—and require explicit human approval before disabling accounts, isolating critical servers, or blocking broad network ranges.
1. TRIGGER & INGEST SIEM / EDR Webhook Alert Parse IPs, Domains & Users Deduplicate & Link Case Route by Severity & Type 2. PLAYBOOK EXECUTION Context & Reputation Lookup CTI, asset owner & auth status Decision & Approval Gate Branch on risk; pause for analyst sign-off 3. CONTAIN, NOTIFY & LOG Isolate host/token or update ticket Handle API errors & record audit trail 4. SOC OUTCOME • Faster Mean Time to Triage • Consistent Enrichment Notes • Controlled, Auditable Actions
Figure 7.16: SOAR Playbook Flow from Alert Ingestion and Enrichment to Approval Gates, Scoped Action, and Audit Logging.

2. Comparing Shuffle & Cortex XSOAR in SOC Operations

Aspect Shuffle Cortex XSOAR
Platform Style Open-source / self-hosted workflow automation platform with visual workflows, webhooks, and open app integrations. Enterprise SOAR platform featuring structured incident layouts, playbooks, War Room collaboration, and engine/integration packs.
Key Strengths Flexible self-hosting, webhook-driven automation, and lightweight custom app/API building. Mature enterprise case/incident management, role-based access controls, and broad out-of-the-box security integrations.
Operational Focus Protect worker/API secrets, validate incoming webhooks, and handle retries/timeouts cleanly. Standardize incident fields, tune playbook branches, and govern engine/integration permissions and approvals.
Guard Against Loops & Unintended Blast Radius: A misconfigured playbook can trigger a storm of API calls, lock out critical accounts, or block legitimate infrastructure if inputs are not validated. Build idempotency checks, error branches, and allowlists into every active playbook.

3. Practical SOAR Playbook, Webhook & Triage Examples (10 Scenarios)

Example 1: Sending a Structured Alert Payload to a SOAR Webhook (Bash / curl)

Bash (curl) — Posting a JSON Alert Event to a Webhook Endpoint
curl -s -X POST "https://soar.example.internal/api/v1/hooks/alert-triage" \
  -H "Content-Type: application/json" \
  -d '{"alert_id":"ALT-9042","severity":"high","src_ip":"198.51.100.77","user":"j.doe"}'
SAMPLE OUTPUT
{"status":"accepted","workflow_execution_id":"exec-7741a9c2"}

Example 2: Evaluating Decision & Approval Logic for a Playbook Step (Python)

Python — Routing an Alert to Auto-Enrich, Analyst Approval, or Close
def decide_next_step(severity, reputation_score, is_critical_asset):
    if severity == "low" and reputation_score < 50:
        return "enrich_and_close_benign"
    if reputation_score >= 80 and not is_critical_asset:
        return "require_human_approval_for_isolation"
    return "enrich_and_assign_to_analyst"

print(decide_next_step("high", 88, False))
print(decide_next_step("low", 20, False))
SAMPLE OUTPUT
require_human_approval_for_isolation
enrich_and_close_benign

Example 3: Normalizing Extracted Observables in a Playbook Script (Python)

Python — Deduplicating IPs, Domains & Users Before Enrichment
raw_iocs = {
    "ips": ["198.51.100.77", "198.51.100.77", "10.20.4.18"],
    "users": ["J.DOE", "j.doe"]
}

clean_ips = sorted({ip for ip in raw_iocs["ips"] if not ip.startswith("10.")})
clean_users = sorted({u.lower() for u in raw_iocs["users"]})

print("External IPs:", clean_ips)
print("Normalized users:", clean_users)
SAMPLE OUTPUT
External IPs: ['198.51.100.77']
Normalized users: ['j.doe']

Example 4: Recording a Playbook Execution & Approval Decision (JSON)

JSON — Capturing Audit Trail Fields for a SOAR Run
{
  "execution_id": "exec-7741a9c2",
  "playbook": "phishing-and-ip-triage-v2",
  "alert_id": "ALT-9042",
  "approval_required": true,
  "approved_by": "soc-lead-01",
  "outcome": "ticket_updated_and_queued"
}
SAMPLE OUTPUT
[PLAYBOOK COMPLETE] exec-7741a9c2 | Alert: ALT-9042 | Outcome: ticket_updated_and_queued

Example 5: Handling Transient API Errors with Bounded Retry Logic (Python)

Python — Safe Retry Pattern for External Enrichment Calls
def call_enrichment_with_retry(attempts, max_retries=3):
    for attempt in range(1, max_retries + 1):
        ok = attempts.pop(0) if attempts else False
        if ok:
            return {"status": "ok", "attempt": attempt}
    return {"status": "fallback_error_branch", "attempts_used": max_retries}

print(call_enrichment_with_retry([False, False, True]))
print(call_enrichment_with_retry([False, False, False]))
SAMPLE OUTPUT
{'status': 'ok', 'attempt': 3}
{'status': 'fallback_error_branch', 'attempts_used': 3}

Example 6: Hunting Automated / Service Account Activity in Sentinel (KQL)

KQL (Microsoft Sentinel) — Reviewing Sign-In or API Activity for SOAR Service Accounts
SigninLogs
| where TimeGenerated > ago(24h)
| where UserPrincipalName has "soar"
| summarize
    Events = count(),
    SourceIPs = make_set(IPAddress, 5),
    Failures = countif(ResultType != "0")
  by UserPrincipalName, AppDisplayName
| order by Events desc
SAMPLE OUTPUT
UserPrincipalName       AppDisplayName       Events SourceIPs         Failures
-----------------       --------------       ------ ---------         --------
svc-soar@example.com    SOAR Automation App  312    ["10.20.3.40"]    0

Example 7: Checking Container or Service Health on a SOAR Host (Bash)

Bash — Checking Running Automation Containers or Services
docker ps --format "table {{.Names}}\t{{.Status}}" 2>/dev/null | head -n 6 || echo "shuffle-backend    Up 5 days (healthy)"
SAMPLE OUTPUT
shuffle-backend    Up 5 days (healthy)

Example 8: Velociraptor VQL — Checking Recent Execution After Containment Action

VQL (Velociraptor) — Verifying Active Processes on a Triaged Endpoint
SELECT
  Pid,
  Name,
  Exe
FROM pslist()
LIMIT 15
SAMPLE OUTPUT
Pid  Name        Exe
---  ----        ---
1044 explorer.exe C:\Windows\explorer.exe

Example 9: Wazuh Rule — Alerting on SOAR / Automation Configuration Changes

XML (Wazuh Rule) — Monitoring Playbook or Automation Config Files

  
    550
    /opt/soar/|/etc/shuffle/
    SOAR configuration or workflow file modified on $(agent.name)
  
SAMPLE OUTPUT
** Alert 1795743510.66219: - local,soar,automation_governance
2026 Nov 26 19:02:14 (soar-worker-01) 10.20.3.40->/var/ossec/logs/alerts/alerts.log
Rule: 102810 (level 9) -> 'SOAR configuration or workflow file modified on soar-worker-01'

Example 10: Summarizing Playbook Run Outcomes in Python

Python — Counting Playbook Executions by Final Status
from collections import Counter

runs = [
    {"id": "exec-1", "status": "completed"},
    {"id": "exec-2", "status": "completed"},
    {"id": "exec-3", "status": "awaiting_approval"},
    {"id": "exec-4", "status": "failed_api_timeout"},
]

for status, total in Counter(r["status"] for r in runs).items():
    print(f"{status}: {total}")
SAMPLE OUTPUT
completed: 2
awaiting_approval: 1
failed_api_timeout: 1

4. Interactive SOAR Playbook & Automation Simulator

Select a SOAR workflow scenario below to review design and operational best practices:

← Previous: 7.15 Infrastructure Tracking with Maltego & Shodan 7.17 Enterprise Key Management (HSM & KMS) →