πŸ”’ Security

SOAR

Security Orchestration, Automation and Response

A platform that automates everything from security threat detection to response. Integrates with SIEM to reduce alert fatigue and improves SOC team efficiency through playbook-based automated incident response.

πŸ“– Detailed Explanation

SOAR is a platform that automates and streamlines the work of a Security Operations Center (SOC). In a traditional SOC, analysts had to review thousands of alerts generated by the SIEM one by one. SOAR automates these repetitive tasks with playbooks, allowing analysts to focus on real threats. Since Gartner first defined it in 2017, it has become established as a major security solution.

SOAR has three core functions. Orchestration connects various security tools, such as SIEM, EDR, firewalls, and threat intelligence, into a single workflow. Automation automatically executes repetitive response tasks according to predefined playbooks. Response supports incident case management, collaboration, and documentation.

Representative SOAR solutions include Palo Alto's Cortex XSOAR (formerly Demisto), Splunk SOAR (formerly Phantom), IBM Security SOAR (formerly Resilient), and Microsoft Sentinel (integrated SIEM+SOAR). Open-source options such as TheHive and Shuffle also allow small and medium-sized businesses to adopt it.

Recently, AI/ML has been integrated into SOAR. Features are being added that automatically classify the severity of alerts, recommend past response histories for similar incidents, and generate playbooks in natural language. Through this, the workload of Tier 1 analysts can be greatly reduced, and the Mean Time To Respond (MTTR) can be shortened.

πŸ’» Code Example

# SOAR ν”Œλ ˆμ΄λΆ μžλ™ν™” 예제 (Python)

import json
import requests
from datetime import datetime
from typing import Dict, List, Optional
from dataclasses import dataclass, asdict
from enum import Enum

class Severity(Enum):
    LOW = "low"
    MEDIUM = "medium"
    HIGH = "high"
    CRITICAL = "critical"

class IncidentStatus(Enum):
    NEW = "new"
    IN_PROGRESS = "in_progress"
    RESOLVED = "resolved"
    FALSE_POSITIVE = "false_positive"

@dataclass
class SecurityIncident:
    """λ³΄μ•ˆ μΈμ‹œλ˜νŠΈ 데이터 λͺ¨λΈ"""
    id: str
    title: str
    description: str
    severity: Severity
    source: str  # SIEM, EDR, Firewall λ“±
    source_ip: Optional[str]
    dest_ip: Optional[str]
    indicators: List[str]  # IOCs
    status: IncidentStatus
    created_at: datetime
    playbook_results: Dict = None

class SOARPlaybook:
    """SOAR ν”Œλ ˆμ΄λΆ κΈ°λ³Έ 클래슀"""

    def __init__(self, name: str):
        self.name = name
        self.steps_executed = []
        self.results = {}

    def enrich_with_threat_intel(self, indicator: str) -> Dict:
        """μœ„ν˜‘ μΈν…”λ¦¬μ „μŠ€λ‘œ IOC 쑰회"""
        # VirusTotal, AbuseIPDB, OTX λ“± 쑰회
        enrichment = {
            "indicator": indicator,
            "virustotal_detections": 0,
            "abuseipdb_score": 0,
            "known_malicious": False,
            "related_campaigns": []
        }

        # VirusTotal API 호좜 μ˜ˆμ‹œ
        # vt_response = requests.get(
        #     f"https://www.virustotal.com/api/v3/ip_addresses/{indicator}",
        #     headers={"x-apikey": VT_API_KEY}
        # )

        self.steps_executed.append(f"Enriched {indicator}")
        return enrichment

    def block_ip_on_firewall(self, ip: str, duration_hours: int = 24) -> bool:
        """λ°©ν™”λ²½μ—μ„œ IP 차단"""
        # μ‹€μ œλ‘œλŠ” λ°©ν™”λ²½ API 호좜
        print(f"[FIREWALL] Blocking IP {ip} for {duration_hours} hours")
        self.steps_executed.append(f"Blocked IP {ip}")
        return True

    def isolate_endpoint(self, hostname: str) -> bool:
        """EDR을 톡해 μ—”λ“œν¬μΈνŠΈ 격리"""
        # CrowdStrike, SentinelOne λ“± API 호좜
        print(f"[EDR] Isolating endpoint {hostname}")
        self.steps_executed.append(f"Isolated {hostname}")
        return True

    def create_ticket(self, incident: SecurityIncident) -> str:
        """ITSM μ‹œμŠ€ν…œμ— ν‹°μΌ“ 생성"""
        ticket_id = f"INC-{datetime.now().strftime('%Y%m%d%H%M%S')}"
        print(f"[ITSM] Created ticket {ticket_id}")
        self.steps_executed.append(f"Created ticket {ticket_id}")
        return ticket_id

    def notify_team(self, channel: str, message: str) -> bool:
        """Slack/Teams둜 μ•Œλ¦Ό 전솑"""
        # Slack Webhook μ˜ˆμ‹œ
        # requests.post(SLACK_WEBHOOK, json={"text": message})
        print(f"[NOTIFY] Sent to {channel}: {message}")
        self.steps_executed.append(f"Notified {channel}")
        return True


class PhishingPlaybook(SOARPlaybook):
    """ν”Όμ‹± 이메일 λŒ€μ‘ ν”Œλ ˆμ΄λΆ"""

    def execute(self, incident: SecurityIncident) -> Dict:
        """ν”Œλ ˆμ΄λΆ μ‹€ν–‰"""
        results = {"incident_id": incident.id, "actions": []}

        # Step 1: λ°œμ‹ μž 도메인/IP 쑰회
        for indicator in incident.indicators:
            enrichment = self.enrich_with_threat_intel(indicator)
            results["actions"].append({
                "step": "enrich",
                "indicator": indicator,
                "result": enrichment
            })

            # Step 2: μ•…μ„±μœΌλ‘œ ν™•μΈλ˜λ©΄ μžλ™ 차단
            if enrichment.get("known_malicious"):
                self.block_ip_on_firewall(indicator)
                results["actions"].append({
                    "step": "block_ip",
                    "ip": indicator,
                    "result": "blocked"
                })

        # Step 3: 심각도 λ†’μœΌλ©΄ κ΄€λ ¨ μ‚¬μš©μž 계정 μΌμ‹œ 잠금
        if incident.severity in [Severity.HIGH, Severity.CRITICAL]:
            # μ‹€μ œλ‘œλŠ” AD/IAM API 호좜
            results["actions"].append({
                "step": "account_lockout",
                "result": "pending_approval"  # μˆ˜λ™ 승인 ν•„μš”
            })

        # Step 4: ν‹°μΌ“ 생성 및 νŒ€ μ•Œλ¦Ό
        ticket_id = self.create_ticket(incident)
        self.notify_team(
            "security-alerts",
            f"🚨 Phishing incident detected: {incident.title}\n"
            f"Ticket: {ticket_id}\nSeverity: {incident.severity.value}"
        )

        results["ticket_id"] = ticket_id
        results["playbook_completed"] = True
        return results


class MalwarePlaybook(SOARPlaybook):
    """멀웨어 탐지 λŒ€μ‘ ν”Œλ ˆμ΄λΆ"""

    def execute(self, incident: SecurityIncident) -> Dict:
        results = {"incident_id": incident.id, "actions": []}

        # Step 1: 감염 μ—”λ“œν¬μΈνŠΈ μ¦‰μ‹œ 격리
        if incident.dest_ip:
            hostname = self._resolve_hostname(incident.dest_ip)
            self.isolate_endpoint(hostname)
            results["actions"].append({
                "step": "isolate_endpoint",
                "hostname": hostname,
                "result": "isolated"
            })

        # Step 2: 파일 ν•΄μ‹œ 쑰회
        for indicator in incident.indicators:
            if self._is_file_hash(indicator):
                enrichment = self.enrich_with_threat_intel(indicator)
                results["actions"].append({
                    "step": "hash_lookup",
                    "hash": indicator,
                    "result": enrichment
                })

        # Step 3: C2 μ„œλ²„ 차단
        if incident.source_ip:
            self.block_ip_on_firewall(incident.source_ip, duration_hours=168)  # 7일

        # Step 4: ν¬λ Œμ‹ 데이터 μˆ˜μ§‘ 트리거
        results["actions"].append({
            "step": "forensics",
            "result": "memory_dump_triggered"
        })

        ticket_id = self.create_ticket(incident)
        self.notify_team(
            "security-critical",
            f"πŸ”΄ MALWARE ALERT: {incident.title}\n"
            f"Affected: {incident.dest_ip}\nTicket: {ticket_id}"
        )

        return results

    def _resolve_hostname(self, ip: str) -> str:
        # DNS μ—­λ°©ν–₯ 쑰회 λ˜λŠ” CMDB 쑰회
        return f"host-{ip.replace('.', '-')}"

    def _is_file_hash(self, indicator: str) -> bool:
        return len(indicator) in [32, 40, 64]  # MD5, SHA1, SHA256


# μ‚¬μš© μ˜ˆμ‹œ: SIEM μ•Œλ¦Ό 처리
def handle_siem_alert(alert_data: Dict):
    """SIEMμ—μ„œ 전달받은 μ•Œλ¦Ό 처리"""

    # μΈμ‹œλ˜νŠΈ 객체 생성
    incident = SecurityIncident(
        id=alert_data["alert_id"],
        title=alert_data["rule_name"],
        description=alert_data["description"],
        severity=Severity(alert_data["severity"]),
        source="Splunk",
        source_ip=alert_data.get("src_ip"),
        dest_ip=alert_data.get("dest_ip"),
        indicators=alert_data.get("iocs", []),
        status=IncidentStatus.NEW,
        created_at=datetime.now()
    )

    # μ•Œλ¦Ό μœ ν˜•μ— λ”°λ₯Έ ν”Œλ ˆμ΄λΆ 선택
    playbook_map = {
        "phishing": PhishingPlaybook("Phishing Response"),
        "malware": MalwarePlaybook("Malware Response"),
    }

    alert_type = alert_data.get("category", "generic")
    playbook = playbook_map.get(alert_type)

    if playbook:
        results = playbook.execute(incident)
        incident.playbook_results = results
        incident.status = IncidentStatus.IN_PROGRESS
        print(json.dumps(results, indent=2, default=str))

    return incident

# ν…ŒμŠ€νŠΈ
sample_alert = {
    "alert_id": "SIEM-2024-001234",
    "rule_name": "Suspicious Outbound Connection to Known C2",
    "description": "Endpoint communicated with known malware C2 server",
    "severity": "critical",
    "category": "malware",
    "src_ip": "192.168.1.100",
    "dest_ip": "10.0.0.50",
    "iocs": ["185.220.101.1", "abc123def456789..."]
}

handle_siem_alert(sample_alert)

πŸ—£οΈ How It's Said in Practice

SOC Manager: "We get more than 5,000 SIEM alerts a day. The Tier 1 analysts can't handle them all."

Security Engineer: "If we adopt SOAR, we can automate 80% of it. Repetitive patterns like phishing and brute-force attacks can be handled automatically with playbooks, and analysts only need to focus on advanced threats."

SOC Manager: "How much will MTTR improve?"

Security Engineer: "Judging by industry averages, there are many cases where response time dropped from 4 hours with manual response to 15 minutes after applying SOAR."

Interviewer: "Please explain the difference between SIEM and SOAR."

Candidate: "SIEM collects and analyzes logs to detect anomalies, and SOAR automates the response to detected alerts. When SIEM tells you 'what happened,' SOAR executes 'how to respond.' Recently, there are also many platforms that integrate the two, such as Microsoft Sentinel."

Take a mock interview on this topic β†’ WIA SOOM AI Interview Β· Start for free

Reviewer: "This playbook automatically blocks IPs, but with a false positive, legitimate traffic could also be blocked. We need to add a Human-in-the-loop step."

Author: "We'll automatically block only for Critical alerts, and add an approval-pending step for Medium and below. We'll make it possible to approve or reject with a Slack button."

⚠️ Cautions

πŸ“š Learn More