executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
implementing-soar-playbook-with-palo-alto-xsoar在 Cortex XSOAR 中实施自动化事件响应剧本,跨 SOC 工具编排安全工作流并缩短手动响应时间。
Independent GitHub snapshot · Automated classification · Original documentation governs
Cortex XSOAR(原 Demisto)是 Palo Alto Networks 的安全编排(Security Orchestration)、自动化和响应平台。剧本是 XSOAR 的核心自动化引擎,使 SOC 团队能够自动化重复性的事件响应任务。XSOAR 提供 900+ 预建集成包、87 个通用剧本和可视化拖拽编辑器用于构建自定义工作流。使用 SOAR 自动化的组织平均将平均响应时间(MTTR)缩短 80%。
事件类型(如:钓鱼攻击)
|
v
事件布局(UI 显示配置)
|
v
预处理规则(自动分类、去重)
|
v
剧本(自动化逻辑)
|-- 子剧本(模块化可复用工作流)
|-- 任务(单个自动化步骤)
|-- 条件任务(决策分支)
|-- 脚本(自定义 Python/JavaScript)
|-- 集成(外部工具命令)
|
v
作战室(调查时间线)
|
v
结案报告
| 任务类型 | 用途 | 示例 |
|---|---|---|
| 标准 | 执行命令 | !ip ip=8.8.8.8 |
| 条件 | 分支逻辑 | 如果严重性 > 高,则升级 |
| 手动 | 需要分析师输入 | 批准遏制动作 |
| 章节标题 | 组织工作流 | "富化阶段" |
| 数据收集 | 收集外部数据 | 询问用户更多详情 |
| 计时器 | 等待条件/时间 | 等待 5 分钟然后检查 |
incident_type: 钓鱼攻击
playbook: 钓鱼调查 - 完整版
severity_mapping:
- condition: 邮件包含可执行附件
severity: high
- condition: 外部域名邮件含链接
severity: medium
- condition: 用户上报邮件
severity: low
layout: 钓鱼布局
sla: 60 分钟
id: phishing-investigation-full
version: -1
name: 钓鱼调查 - 完整版
description: 自动化钓鱼邮件调查,包含富化、分析和响应
starttaskid: "0"
tasks:
"0":
id: "0"
taskid: start
type: start
nexttasks:
'#none#':
- "1"
"1":
id: "1"
taskid: extract-indicators
type: regular
task:
name: 从邮件提取指标
script: ParseEmailFiles
nexttasks:
'#none#':
- "2"
- "3"
- "4"
"2":
id: "2"
taskid: enrich-urls
type: playbook
task:
name: URL 富化
playbookName: URL Enrichment - Generic v2
"3":
id: "3"
taskid: enrich-files
type: playbook
task:
name: 文件富化
playbookName: File Enrichment - Generic v2
"4":
id: "4"
taskid: enrich-ips
type: playbook
task:
name: IP 富化
playbookName: IP Enrichment - Generic v2
"5":
id: "5"
taskid: determine-verdict
type: condition
task:
name: 邮件是否为恶意?
conditions:
- label: "yes"
condition:
- - operator: isEqualString
left: DBotScore.Score
right: "3"
- label: "no"
nexttasks:
"yes":
- "6"
"no":
- "9"
"6":
id: "6"
taskid: block-sender
type: regular
task:
name: 封锁发件人域名
script: '|||o365-mail-block-sender'
scriptarguments:
sender_address: ${incident.emailfrom}
"7":
id: "7"
taskid: search-mailboxes
type: regular
task:
name: 搜索并从所有邮箱删除
script: '|||o365-mail-purge-compliance-search'
scriptarguments:
query: "from:${incident.emailfrom} subject:${incident.emailsubject}"
"8":
id: "8"
taskid: notify-user
type: regular
task:
name: 通知上报用户
script: '|||send-mail'
scriptarguments:
to: ${incident.reporter}
subject: "钓鱼报告已确认 - 已采取措施"
body: "您上报的邮件已被确认为恶意邮件并已删除。"
"9":
id: "9"
taskid: close-incident
type: regular
task:
name: 关闭事件
script: closeInvestigation
!ParseEmailFiles entryid=${File.EntryID}
!rasterize url=${URL.Data} type=png
!url url=${URL.Data}
!file file=${File.SHA256}
!ip ip=${IP.Address}
!domain domain=${Domain.Name}
!o365-mail-block-sender sender=${incident.emailfrom}
!o365-mail-purge-compliance-search query="from:${incident.emailfrom}"
!pan-os-block-ip ip=${IP.Address} log_forwarding="default"
!cortex-xdr-isolate-endpoint endpoint_id=${Endpoint.ID}
!jira-create-issue summary="钓鱼事件 - ${incident.id}" type="Incident" priority="High"
!servicenow-create-ticket short_description="安全事件" urgency="2"
触发条件:来自 EDR 的恶意软件告警
步骤:
1. 提取文件哈希、进程详情、主机信息
2. 通过 VirusTotal、Hybrid Analysis 富化哈希
3. 检查文件是否在白名单中
4. 如果恶意:
a. 通过 EDR 隔离端点
b. 在所有端点封锁哈希
c. 跨环境搜索该哈希
d. 创建事件工单
5. 如果干净:关闭为误报
触发条件:不可能的旅行或可疑登录告警
步骤:
1. 从 Active Directory 获取用户详情
2. 获取过去 30 天的登录历史
3. 检查不可能的旅行(地理距离与时间比较)
4. 检查是否为已知 VPN/代理 IP
5. 如果已入侵:
a. 禁用 AD 账户
b. 撤销所有 OAuth Token
c. 重置 MFA
d. 通知用户经理
e. 搜索横向移动迹象
6. 如果误报:记录并关闭
触发条件:网络异常告警
步骤:
1. 从网络监控确认流量突增
2. 识别源 IP 和地理位置
3. 检查源 IP 是否为已知僵尸网络
4. 在 WAF 上实施速率限制
5. 如果持续攻击:
a. 启用上游 DDoS 防护
b. 激活 CDN 清洗
c. 如有必要通知 ISP
6. 监控并记录
# XSOAR 自动化脚本:CalculateRiskScore
def calculate_risk_score():
"""为事件计算综合风险分数。"""
severity = demisto.incident().get('severity', 0)
indicator_count = len(demisto.get(demisto.context(), 'DBotScore', []))
malicious_count = len([
i for i in demisto.get(demisto.context(), 'DBotScore', [])
if i.get('Score', 0) == 3
])
base_score = severity * 20
indicator_boost = min(indicator_count * 5, 25)
malicious_boost = malicious_count * 15
risk_score = min(100, base_score + indicator_boost + malicious_boost)
return_results(CommandResults(
outputs_prefix='RiskScore',
outputs={'Score': risk_score, 'Level': '严重' if risk_score > 80 else '高' if risk_score > 60 else '中'},
readable_output=f'风险分数:{risk_score}/100'
))
calculate_risk_score()
| 指标 | SOAR 前 | SOAR 后 | 改善幅度 |
|---|---|---|---|
| 钓鱼 MTTR | 45 分钟 | 5 分钟 | 降低 89% |
| 恶意软件 MTTR | 60 分钟 | 8 分钟 | 降低 87% |
| 账户入侵 MTTR | 30 分钟 | 4 分钟 | 降低 87% |
| 每班处理告警量 | 50 条 | 200+ 条 | 提升 300% |
| 误报处理时间 | 10 分钟 | 30 秒 | 降低 95% |