implementing-soar-automation-with-phantom
使用 Splunk SOAR(原 Phantom)实施安全编排、自动化和响应(SOAR)工作流, 自动化告警分诊、IOC 富化、遏制动作和事件响应剧本。 适用于 SOC 团队需要减少分析师手工工作、标准化响应流程, 或将多种安全工具集成到自动化工作流中时。
Best use case
implementing-soar-automation-with-phantom is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
使用 Splunk SOAR(原 Phantom)实施安全编排、自动化和响应(SOAR)工作流, 自动化告警分诊、IOC 富化、遏制动作和事件响应剧本。 适用于 SOC 团队需要减少分析师手工工作、标准化响应流程, 或将多种安全工具集成到自动化工作流中时。
Teams using implementing-soar-automation-with-phantom should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/implementing-soar-automation-with-phantom/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How implementing-soar-automation-with-phantom Compares
| Feature / Agent | implementing-soar-automation-with-phantom | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
使用 Splunk SOAR(原 Phantom)实施安全编排、自动化和响应(SOAR)工作流, 自动化告警分诊、IOC 富化、遏制动作和事件响应剧本。 适用于 SOC 团队需要减少分析师手工工作、标准化响应流程, 或将多种安全工具集成到自动化工作流中时。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 使用 Phantom 实施 SOAR 自动化
## 适用场景
以下情况使用本技能:
- SOC 团队需要自动化高频告警的重复性分诊和富化任务
- 手动响应时间超出 SLA 要求,自动化可降低 MTTR
- 多个安全工具(SIEM、EDR、防火墙、TIP)需要编排的响应动作
- 需要剧本标准化以确保跨班次分析师响应的一致性
**不适用于**无人类审批门控的全自动遏制——高影响操作(如禁用账户或主机隔离)必须包含分析师决策点。
## 前置条件
- 已部署 Splunk SOAR(Phantom)6.x+ 并可访问 Web 界面
- 已配置应用连接器:VirusTotal、CrowdStrike、ServiceNow、Active Directory、Splunk ES
- Splunk ES 集成用于将 notable 事件作为 SOAR 事件摄取
- 每个集成工具的 API 凭据已存储在 SOAR 资产配置中
- 了解 Python 用于自定义剧本动作
## 工作流程
### 步骤 1:配置资产连接
通过 SOAR 应用设置与安全工具的集成:
**VirusTotal 资产配置:**
```json
{
"app": "VirusTotal v3",
"asset_name": "virustotal_prod",
"configuration": {
"api_key": "YOUR_VT_API_KEY",
"rate_limit": true,
"max_requests_per_minute": 4
},
"product_vendor": "VirusTotal",
"product_name": "VirusTotal"
}
```
**CrowdStrike Falcon 资产:**
```json
{
"app": "CrowdStrike Falcon",
"asset_name": "crowdstrike_prod",
"configuration": {
"client_id": "CS_CLIENT_ID",
"client_secret": "CS_CLIENT_SECRET",
"base_url": "https://api.crowdstrike.com"
}
}
```
**Active Directory 资产:**
```json
{
"app": "Active Directory",
"asset_name": "ad_prod",
"configuration": {
"server": "dc01.company.com",
"username": "soar_service@company.com",
"password": "SERVICE_ACCOUNT_PASSWORD",
"ssl": true
}
}
```
### 步骤 2:构建网络钓鱼分诊剧本
用 Python(Phantom 剧本格式)创建自动化钓鱼响应剧本:
```python
"""
钓鱼邮件分诊自动化剧本
触发条件:通过 Splunk ES notable 或邮件摄取报告的新钓鱼邮件
"""
import phantom.rules as phantom
import json
def on_start(container):
# 从容器中提取构件(URL、文件哈希、发件人)
artifacts = phantom.get_artifacts(container_id=container["id"])
for artifact in artifacts:
artifact_type = artifact.get("cef", {}).get("type", "")
if artifact_type == "url":
phantom.act("url reputation", targets=artifact,
assets=["virustotal_prod"],
callback=url_reputation_callback,
name="url_reputation")
elif artifact_type == "hash":
phantom.act("file reputation", targets=artifact,
assets=["virustotal_prod"],
callback=hash_reputation_callback,
name="file_reputation")
elif artifact_type == "ip":
phantom.act("ip reputation", targets=artifact,
assets=["virustotal_prod"],
callback=ip_reputation_callback,
name="ip_reputation")
def url_reputation_callback(action, success, container, results, handle):
if not success:
phantom.comment(container, "URL 信誉检查失败")
return
for result in results:
data = result.get("data", [{}])[0]
malicious_count = data.get("summary", {}).get("malicious", 0)
total_engines = data.get("summary", {}).get("total_engines", 0)
if malicious_count > 5:
# 高置信度恶意 — 自动封锁并升级
phantom.act("block url", targets=result,
assets=["palo_alto_prod"],
name="block_malicious_url")
phantom.set_severity(container, "high")
phantom.set_status(container, "open")
phantom.comment(container,
f"URL 被 {malicious_count}/{total_engines} 个引擎标记为恶意。"
f"已在防火墙封锁。正在升级到二级。")
# 创建 ServiceNow 工单
phantom.act("create ticket", targets=container,
assets=["servicenow_prod"],
parameters=[{
"short_description": f"钓鱼攻击 - 检测到恶意 URL",
"urgency": "2",
"impact": "2"
}],
name="create_incident_ticket")
elif malicious_count > 0:
# 中等置信度 — 请求分析师审查
phantom.promote(container, template="钓鱼调查")
phantom.comment(container,
f"URL 被 {malicious_count}/{total_engines} 个引擎标记。"
f"需要分析师审查。")
else:
# 干净 — 关闭并添加注释
phantom.set_status(container, "closed")
phantom.comment(container,
f"URL 无威胁:0/{total_engines} 个引擎标记。已自动关闭。")
def hash_reputation_callback(action, success, container, results, handle):
if not success:
return
for result in results:
data = result.get("data", [{}])[0]
positives = data.get("summary", {}).get("positives", 0)
if positives > 10:
# 已知恶意软件 — 隔离并封锁
phantom.act("quarantine device", targets=result,
assets=["crowdstrike_prod"],
name="isolate_endpoint")
phantom.set_severity(container, "high")
def ip_reputation_callback(action, success, container, results, handle):
if not success:
return
for result in results:
data = result.get("data", [{}])[0]
malicious = data.get("summary", {}).get("malicious", 0)
if malicious > 3:
phantom.act("block ip", targets=result,
assets=["palo_alto_prod"],
name="block_malicious_ip")
```
### 步骤 3:构建告警富化剧本
自动化所有传入 SIEM 告警的富化:
```python
"""
通用告警富化剧本
对每个新事件运行,在分析师审查前添加上下文
"""
import phantom.rules as phantom
def on_start(container):
# 获取所有构件
success, message, artifacts = phantom.get_artifacts(
container_id=container["id"], full_data=True
)
ip_artifacts = [a for a in artifacts if a.get("cef", {}).get("sourceAddress")]
domain_artifacts = [a for a in artifacts if a.get("cef", {}).get("destinationDnsDomain")]
# 并行富化 IP
for artifact in ip_artifacts:
ip = artifact["cef"]["sourceAddress"]
# VirusTotal 查询
phantom.act("ip reputation",
parameters=[{"ip": ip}],
assets=["virustotal_prod"],
callback=enrich_ip_callback,
name=f"vt_ip_{ip}")
# GeoIP 查询
phantom.act("geolocate ip",
parameters=[{"ip": ip}],
assets=["maxmind_prod"],
callback=geoip_callback,
name=f"geo_{ip}")
# Whois 查询
phantom.act("whois ip",
parameters=[{"ip": ip}],
assets=["whois_prod"],
name=f"whois_{ip}")
# 富化域名
for artifact in domain_artifacts:
domain = artifact["cef"]["destinationDnsDomain"]
phantom.act("domain reputation",
parameters=[{"domain": domain}],
assets=["virustotal_prod"],
name=f"vt_domain_{domain}")
def enrich_ip_callback(action, success, container, results, handle):
"""使用富化数据更新容器"""
if success:
for result in results:
summary = result.get("summary", {})
phantom.add_artifact(container, {
"cef": {
"vt_malicious": summary.get("malicious", 0),
"vt_suspicious": summary.get("suspicious", 0),
"enrichment_source": "VirusTotal"
},
"label": "enrichment",
"name": "VT IP 富化"
})
```
### 步骤 4:为高影响操作实施审批门控
为关键操作添加人工参与环节:
```python
def containment_decision(action, success, container, results, handle):
"""向分析师展示遏制选项"""
phantom.prompt(
container=container,
user="soc_tier2",
message=(
"已确认恶意活动。\n"
f"主机:{container['artifacts'][0]['cef'].get('sourceAddress')}\n"
f"威胁:{results[0]['summary'].get('threat_name')}\n\n"
"选择遏制动作:"
),
respond_in_mins=15,
options=["隔离主机", "禁用账户", "两者都执行", "仅监控"],
callback=execute_containment
)
def execute_containment(action, success, container, results, handle):
response = results.get("response", "仅监控")
if response in ["隔离主机", "两者都执行"]:
phantom.act("quarantine device",
parameters=[{"hostname": container["artifacts"][0]["cef"]["sourceHostName"]}],
assets=["crowdstrike_prod"],
name="isolate_host")
if response in ["禁用账户", "两者都执行"]:
phantom.act("disable user",
parameters=[{"username": container["artifacts"][0]["cef"]["sourceUserName"]}],
assets=["ad_prod"],
name="disable_account")
phantom.comment(container, f"分析师已批准:{response}")
```
### 步骤 5:配置剧本调度和触发器
在 SOAR 中设置事件触发器:
```json
{
"playbook_name": "phishing_triage_automation",
"trigger": {
"type": "event_created",
"conditions": {
"label": ["phishing", "notable"],
"severity": ["high", "medium"]
}
},
"active": true,
"run_as": "automation_user"
}
```
### 步骤 6:监控剧本性能
使用 SOAR 指标追踪自动化效果:
```python
# 查询 SOAR API 获取剧本执行统计
import requests
headers = {"ph-auth-token": "YOUR_SOAR_TOKEN"}
response = requests.get(
"https://soar.company.com/rest/playbook_run",
headers=headers,
params={
"page_size": 100,
"filter": '{"status":"success"}',
"sort": "create_time",
"order": "desc"
}
)
runs = response.json()["data"]
# 计算自动化指标
total_runs = len(runs)
avg_duration = sum(r["end_time"] - r["start_time"] for r in runs) / total_runs
auto_closed = sum(1 for r in runs if r.get("auto_resolved"))
print(f"总执行次数:{total_runs}")
print(f"平均时长:{avg_duration:.1f}s")
print(f"自动解决:{auto_closed}/{total_runs} ({auto_closed/total_runs*100:.0f}%)")
```
## 核心概念
| 术语 | 定义 |
|------|------|
| **SOAR** | 安全编排、自动化和响应(Security Orchestration, Automation, and Response)——整合安全工具与自动化剧本的平台 |
| **剧本(Playbook)** | 定义由安全事件触发的顺序和并行动作的自动化工作流 |
| **资产(Asset)** | SOAR 中已连接安全工具的配置(API 端点、凭据、连接参数) |
| **容器(Container)** | 包含来自已摄取告警或事件的构件(IOC)的 SOAR 事件对象 |
| **构件(Artifact)** | 容器内的单个 IOC 或数据点(IP、哈希、URL、域名、电子邮件) |
| **审批门控(Approval Gate)** | 在执行高影响自动化操作前需要分析师决策的人工参与步骤 |
## 工具与系统
- **Splunk SOAR(Phantom)**:具有 300+ 应用集成和可视化剧本编辑器的企业级 SOAR 平台
- **Splunk ES**:将 notable 事件作为容器输送给 SOAR 进行自动分诊的 SIEM 平台
- **CrowdStrike Falcon**:通过 SOAR 集成实现自动化主机隔离和威胁狩猎的 EDR 平台
- **ServiceNow**:通过集成实现自动化事件工单创建和跟踪的 ITSM 平台
- **Palo Alto NGFW**:通过 SOAR 剧本实现自动化 IP/URL 封锁的防火墙
## 常见场景
- **钓鱼分诊**:自动提取 URL/附件,在沙箱引爆,封锁恶意内容,创建工单
- **恶意软件告警富化**:跨 VT/MalwareBazaar 自动富化文件哈希,确认恶意后隔离
- **暴力破解响应**:自动检查攻击是否成功,被攻陷则禁用账户,封锁源 IP
- **威胁情报 IOC 处理**:自动摄取 TI 情报源 IOC,与内部日志比对,为匹配项创建封锁
- **漏洞告警响应**:自动查询资产数据库获取受影响系统,按优先级创建补丁工单
## 输出格式
```
SOAR 剧本执行报告
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
剧本: 钓鱼分诊自动化 v2.3
容器: SOAR-2024-08921
触发条件: 来自 Splunk ES 的 notable 事件(钓鱼)
已执行动作:
[1] URL 信誉(VirusTotal) — 14/90 个引擎标记为恶意 [2.1s]
[2] IP 信誉(AbuseIPDB) — 置信度:85% [1.3s]
[3] 封锁 URL(Palo Alto) — 在 PA-5260 上封锁 [0.8s]
[4] 封锁 IP(Palo Alto) — 在 PA-5260 上封锁 [0.7s]
[5] 创建工单(ServiceNow) — INC0012345 已创建 [1.5s]
[6] 提示分析师(二级) — 响应:"隔离主机" [4m 12s]
[7] 隔离设备(CrowdStrike) — WORKSTATION-042 已隔离 [3.2s]
总时长: 4m 22s(对比手动分诊平均 35 分钟)
节省时间: 约 31 分钟
处置结果: 真阳性 — 已升级至事件响应
```Related Skills
performing-ioc-enrichment-automation
通过编排 VirusTotal、AbuseIPDB、Shodan、MISP 和其他情报源的查询, 自动化入侵指标(IOC)丰富化,提供上下文评分和处置建议。 适用于 SOC 分析师在告警分诊或事件调查期间需要对 IP、域名、URL 和文件哈希 进行快速多源丰富化时。
implementing-zero-trust-with-hashicorp-boundary
使用 HashiCorp Boundary 实现具备动态凭据代理、会话录制和 Vault 集成的身份感知零信任基础设施访问管理。
implementing-zero-trust-with-beyondcorp
使用身份感知代理(IAP,Identity-Aware Proxy)、上下文感知访问策略、设备信任验证和 Access Context Manager,部署 Google BeyondCorp Enterprise 零信任访问控制,对 GCP 资源和内部应用强制执行基于身份和安全态势的访问。
implementing-zero-trust-network-access
通过配置身份感知代理、微分段、基于条件访问策略的持续验证,以及在 AWS、Azure 和 GCP 环境中以 BeyondCorp 风格的架构替代传统 VPN 访问,在云环境中实施零信任网络访问(ZTNA)。
implementing-zero-trust-network-access-with-zscaler
使用 Zscaler 实施零信任网络访问(Zero Trust Network Access,ZTNA),通过 Zscaler Private Access(ZPA)配置应用分段、访问策略和连接器,替代传统 VPN 架构
implementing-zero-trust-in-cloud
本技能指导组织按照 NIST SP 800-207 和 Google BeyondCorp 原则在云环境中实施零信任(Zero Trust)架构,涵盖以身份为中心的访问控制、微分段(Micro-Segmentation)、持续验证、设备信任评估,以及部署身份感知代理(Identity-Aware Proxy)以消除 AWS、Azure 和 GCP 环境中的隐式网络信任。
implementing-zero-trust-for-saas-applications
使用 CASB、SSPM、条件访问策略、OAuth 应用治理和会话控制,为 SaaS 应用实施零信任访问控制, 对云托管服务强制执行身份验证、设备合规性检查和数据保护。
implementing-zero-trust-dns-with-nextdns
将 NextDNS 实施为零信任 DNS 过滤层,提供加密解析、威胁情报阻断、隐私保护,以及跨所有端点的组织策略执行。
implementing-zero-standing-privilege-with-cyberark
部署 CyberArk Secure Cloud Access,通过基于时间、权限和审批控制的即时访问,在混合云和多云环境中消除常设权限。
implementing-zero-knowledge-proof-for-authentication
零知识证明(ZKP)允许证明者在不泄露秘密本身的情况下证明对某个秘密(如密码或私钥)的了解。本技能实现 Schnorr 身份识别协议和使用离散对数问题的简化 ZKPP,使服务器永远不需要获取用户密码即可完成认证。
implementing-web-application-logging-with-modsecurity
配置带有 OWASP 核心规则集(CRS)的 ModSecurity WAF,实现 Web 应用程序日志记录, 调整规则以减少误报,分析审计日志进行攻击检测,并为应用程序特定威胁实现自定义 SecRules。 分析师配置 SecRuleEngine、SecAuditEngine 和 CRS 偏执级别,以在安全覆盖范围和运营稳定性之间取得平衡。 适用于涉及 WAF 配置、ModSecurity 规则调整、Web 应用审计日志或 CRS 部署的场景。
implementing-vulnerability-sla-breach-alerting
为漏洞修复 SLA 违规构建自动化告警,包含基于严重程度的时间线、升级工作流和合规性报告仪表板。