with one click
attack-chain-reconstruction-and-defense
// 当用户提供安全事件标题、IOC、实体名或CVE,并希望自动还原攻击链、识别受影响车辆组件、评估风险并生成防御建议时触发此技能。
// 当用户提供安全事件标题、IOC、实体名或CVE,并希望自动还原攻击链、识别受影响车辆组件、评估风险并生成防御建议时触发此技能。
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | attack-chain-reconstruction-and-defense |
| description | 当用户提供安全事件标题、IOC、实体名或CVE,并希望自动还原攻击链、识别受影响车辆组件、评估风险并生成防御建议时触发此技能。 |
当用户表达以下任一意图时触发本技能:
本技能采用严格单 Skill 路由。命中该场景后,Agent 仅执行本 SOP,不跨 Skill 自由拼接未授权流程。
优先从用户输入中提取以下槽位:
entry_type: 入口类型,允许值为 report_title、ioc、entity_name、cve。entry_value: 与入口类型对应的实际查询值。time_range: 可选增强条件。若用户提供则用于缩小查询范围;若缺失且当前结果过宽或冲突,再追问。analysis_goal: 默认值为 reconstruct_attack_chain_and_defense。补槽位规则:
在执行任何查询前,先声明以下约束:
ai4x_query。catalog,再读取目标源 schema;若 sourceId="opencti",只将 schema 作为最小目录,并在需要具体字段时追加 detail,之后再 query。Facts 与 Inferences。必须先调用目录能力确认本场景依赖的数据源可用:
ai4x_query(command="catalog")sourceId 是否存在:
openctivehicle_iobetaraGaps:列出缺失的 sourceId。在构造任何 Cypher 前,必须获取并检查 Schema:
ai4x_query(command="schema", sourceId="opencti")ai4x_query(command="detail", sourceId="opencti", detailKind="object|relationship-type|relationship-schema", typeName="...")ai4x_query(command="schema", sourceId="vehicle_iobe")ai4x_query(command="schema", sourceId="tara")Schema 检查重点:
opencti 中是否可消费 report、attack-pattern、infrastructure、malware、indicator、relationship。vehicle_iobe 中是否可消费 x-vehicle-ecu、x-exposure-surface、x-external-peer、network-traffic、x-message、relationship。tara 中是否可消费 x-vehicle-component、x-vehicle-asset、x-threat-scenario、x-attack-path、x-attack-feasibility、x-tara-risk、relationship。若 Schema 未体现后续查询依赖的对象类型或关键字段,则在 Gaps 中明确列出,并跳过对应链路。
根据入口类型选择查询策略,但必须先从 opencti 起步建立事实锚点。
先查询事件报告与其直接关联对象:
ai4x_query(
command="query",
sourceId="opencti",
cypher="MATCH (r {type: 'report'}) WHERE toLower(r.name) CONTAINS toLower($entry_value) OPTIONAL MATCH (r)-[rel1]-(ap {type: 'attack-pattern'}) OPTIONAL MATCH (r)-[rel2]-(infra {type: 'infrastructure'}) OPTIONAL MATCH (r)-[rel3]-(mw {type: 'malware'}) RETURN r, rel1, ap, rel2, infra, rel3, mw"
)
先尝试匹配 indicator、infrastructure、malware、attack-pattern、report:
ai4x_query(
command="query",
sourceId="opencti",
cypher="MATCH (n) WHERE (n.type IN ['indicator','infrastructure','malware','attack-pattern','report']) AND toLower(coalesce(n.name, '')) CONTAINS toLower($entry_value) OPTIONAL MATCH (n)-[rel]-(m) RETURN n, rel, m"
)
先尝试匹配 vulnerability 及其与 report、attack-pattern 的关系:
ai4x_query(
command="query",
sourceId="opencti",
cypher="MATCH (v {type: 'vulnerability'}) WHERE toLower(coalesce(v.name, '')) CONTAINS toLower($entry_value) OPTIONAL MATCH (v)-[rel]-(m) RETURN v, rel, m"
)
判定规则:
report 命中,则将其作为主事件事实锚点。indicator、infrastructure、malware 或 attack-pattern,则继续向外扩展并寻找相关 report。在已命中的 report 或其近邻对象上,还原最小攻击链。主链优先级固定为:
report -> attack-pattern -> infrastructure若主链不完整,可补充:
report -> malware -> infrastructurereport -> indicator -> infrastructure推荐查询模板:
ai4x_query(
command="query",
sourceId="opencti",
cypher="MATCH (r {type: 'report'}) WHERE toLower(r.name) CONTAINS toLower($entry_value) OPTIONAL MATCH path1=(r)-[*1..2]-(ap {type: 'attack-pattern'}) OPTIONAL MATCH path2=(ap)-[*1..2]-(infra {type: 'infrastructure'}) OPTIONAL MATCH path3=(r)-[*1..2]-(mw {type: 'malware'}) RETURN r, path1, path2, path3, mw, infra, ap"
)
事实抽取要求:
sourceId=opencti。attack-pattern,可以在 Facts 中表述为“命中攻击模式对象”;将其映射为具体攻击阶段时,必须放入 Inferences 并标注待人工确认。目标:把 opencti 侧事件事实与车端暴露面、外部对端、通信对象和 ECU 进行只读映射。
ai4x_query(
command="query",
sourceId="vehicle_iobe",
cypher="MATCH (peer {type: 'x-external-peer'})-[r1]-(traffic {type: 'network-traffic'})-[r2]-(surface {type: 'x-exposure-surface'}) WHERE toLower(coalesce(peer.name, '')) CONTAINS toLower($infra_or_ioc_name) RETURN peer, r1, traffic, r2, surface"
)
ai4x_query(
command="query",
sourceId="vehicle_iobe",
cypher="MATCH (surface {type: 'x-exposure-surface'})-[r1]-(ecu {type: 'x-vehicle-ecu'}) OPTIONAL MATCH (surface)-[r2]-(msg {type: 'x-message'}) WHERE toLower(coalesce(surface.name, '')) CONTAINS toLower($surface_name) RETURN surface, r1, ecu, r2, msg"
)
判定规则:
vehicle_iobe 仅作为受影响面与通信链路事实来源。x-external-peer.name 存在直接命中,可视为一条事实映射线索。Gaps 或 Inferences。目标:只有在 opencti 侧事件事实与 vehicle_iobe 侧通信/暴露事实都存在时,才尝试在 tara 中下沉到组件、资产和风险层。
ai4x_query(
command="query",
sourceId="tara",
cypher="MATCH (component {type: 'x-vehicle-component'}) OPTIONAL MATCH (component)-[r1]-(asset {type: 'x-vehicle-asset'}) WHERE toLower(coalesce(component.name, '')) CONTAINS toLower($candidate_component_name) OR toLower(coalesce(asset.component_name, '')) CONTAINS toLower($candidate_component_name) RETURN component, r1, asset"
)
ai4x_query(
command="query",
sourceId="tara",
cypher="MATCH (component {type: 'x-vehicle-component'})-[*1..3]-(threat {type: 'x-threat-scenario'}) OPTIONAL MATCH (threat)-[r1]-(path {type: 'x-attack-path'}) OPTIONAL MATCH (threat)-[r2]-(feasibility {type: 'x-attack-feasibility'}) OPTIONAL MATCH (threat)-[r3]-(risk {type: 'x-tara-risk'}) WHERE toLower(coalesce(component.name, '')) CONTAINS toLower($candidate_component_name) RETURN component, threat, path, feasibility, risk, r1, r2, r3"
)
判定规则:
opencti 存在与事件相关的攻击事实锚点。vehicle_iobe 存在与基础设施或暴露面相关的通信/暴露事实。tara 存在与候选组件关联的威胁或风险事实。Facts 中写成最终受影响组件,只能在 Inferences 中写为候选,并标记待人工确认。tara 中已有 x-tara-risk、x-attack-feasibility、x-impact-assessment 等事实;若未命中则明确返回“无法判定”。输出时严格分离:
Facts:仅包含查询命中的对象、关系、来源数据源。Inferences:仅包含基于 attack-pattern、基础设施复用、车辆暴露面与 TARA 风险链路做出的推断。攻击链构造规则:
report / attack-pattern / infrastructure / malware / x-external-peer / network-traffic / x-exposure-surface / x-vehicle-ecu / x-vehicle-component / x-tara-risk 顺序组织。attack-pattern 对应到“初始访问、执行、横向移动、影响”等阶段性描述,但必须明确写为推断,并标记“待人工确认”。建议必须证据驱动,不能伪装成已验证事实。
tara 风险命中,建议优先检查对应组件的现有控制措施和适用范围。x-exposure-surface、network-traffic、x-vehicle-ecu、x-vehicle-component 输出针对性建议。x-threat-scenario、x-attack-path、x-tara-risk,引用这些对象作为风险降低建议的证据支撑。tara 风险对象,则明确写明“暂无可验证的 TARA 风险事实”。当前数据源可以支撑事件事实定位、车辆暴露面映射和部分 TARA 风险验证,但无法完美覆盖全部业务目标。建议补充如下:
opencti 可消费对象映射中补充更稳定的 ATT&CK 语义字段,如 tactic、technique external id、kill chain phase,避免仅凭 attack-pattern 名称做阶段推断。vehicle_iobe 中增加更明确的基础设施到暴露面映射字段,例如域名、IP、URL 或协议端点标识,降低外部基础设施到 x-external-peer 的语义匹配歧义。tara 中增加组件与 ECU 或暴露面的标准化关联字段,减少跨数据源拼接时对名称匹配的依赖。最终输出必须使用以下 Markdown 模板:
## Facts
- Event Anchor:
- sourceId: opencti
- objects: [事件报告或入口对象]
- Attack Chain Facts:
- [对象A(type)] --[relationship]--> [对象B(type)] (sourceId=...)
- Vehicle Exposure Facts:
- [外部对端/流量/暴露面/ECU 事实链]
- Component & Risk Facts:
- [组件/资产/威胁场景/风险对象]
## Inferences
- [推断结论 1] (confidence: high|medium|low, review_required: yes/no)
- [推断结论 2] (confidence: high|medium|low, review_required: yes/no)
## Gaps
- Missing Sources:
- [缺失的 sourceId]
- Unresolved Links:
- [未命中的链路或无法验证的映射]
## Recommendations
- Triage Actions:
- [证据驱动的研判动作]
- Mitigations:
- [ECU/组件级缓解建议]
- Detection Templates:
- [EQL/ECS 候选思路,必须标记待人工确认]
## Empty Result Contract
- query_status: empty|partial|complete
- retained_facts:
- [保留的已命中事实,若无则为空数组]
- empty_segments:
- [未命中的查询链路]
- next_questions:
- [建议用户补充的信息]
输出约束:
high、medium、low 的定性分级,依据证据覆盖度给出。sourceId。attack-pattern 到实际攻击阶段的映射、tara 风险继承判断、EQL/ECS 模板、跨源拼接得到的组件归属,必须标记待人工确认。