SuperAPI AI 工具集

triaging-vulnerabilities-with-ssvc-framework

安全与审计

查看项目

更新于 10-17 00:38

技能介绍

概述

SSVC(Stakeholder-Specific Vulnerability Categorization,利益相关方特定漏洞分类)框架由卡内基梅隆大学软件工程研究所(SEI)与CISA合作开发,提供一套结构化的决策树方法用于漏洞优先级排序。与仅依赖CVSS不同,SSVC综合考量利用状态、技术影响、可自动化程度、任务普遍性和公共福祉影响,最终产出四种可执行结果之一:Track、Track*、Attend 或 Act。

前置条件

  • Python 3.9+,并安装 requests、pandas 和 jinja2 库
  • 可访问 CISA KEV 目录 API 和 FIRST 的 EPSS API
  • NVD API 密钥(可选,用于提高速率限制)
  • 来自 OpenVAS、Nessus 或 Qualys 等工具的漏洞扫描结果

SSVC 决策点

1. 利用状态

评估当前利用活动:

  • None — 无活跃利用证据
  • PoC — 存在公开的概念验证
  • Active — 在野观察到活跃利用(检查 CISA KEV)
# Check if a CVE is in CISA Known Exploited Vulnerabilities catalog
curl -s "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json" | \
  python3 -c "import sys,json; data=json.load(sys.stdin); cves=[v['cveID'] for v in data['vulnerabilities']]; print('Active' if 'CVE-2024-3400' in cves else 'Check PoC/None')"

2. 技术影响

确定被利用后失陷的范围:

  • Partial — 仅限系统功能或数据的一部分
  • Total — 完全控制受影响系统,可访问全部数据

3. 可自动化程度

评估利用能否大规模自动化:

  • No — 需要针对每个受害者手动、定向利用
  • Yes — 可脚本化或具备类似蠕虫的传播能力

4. 任务普遍性

受影响产品在你环境中的部署广度:

  • Minimal — 部署有限、非关键系统
  • Support — 间接支撑关键任务功能
  • Essential — 直接支撑核心任务能力

5. 公共福祉影响

对人身安全和公共福利的潜在后果:

  • Minimal — 对安全或公共服务影响可忽略
  • Material — 公共服务出现明显退化
  • Irreversible — 人员伤亡、重大财产损失或关键基础设施故障

SSVC 决策结果

结果 所需行动 SLA
Track 监控,按正常补丁周期修复 90天
Track* 密切监控,在下一个补丁窗口优先处理 60天
Attend 上报高级管理层,加速修复 14天
Act 立即应用缓解措施,高管层知晓 48小时

实施步骤

步骤 1:导入漏洞数据

import requests
import json

# Fetch CISA KEV catalog
kev_url = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json"
kev_data = requests.get(kev_url).json()
kev_cves = {v['cveID'] for v in kev_data['vulnerabilities']}

# Fetch EPSS scores for context
epss_url = "https://api.first.org/data/v1/epss"
epss_response = requests.get(epss_url, params={"cve": "CVE-2024-3400"}).json()

步骤 2:评估每个决策点

def evaluate_exploitation(cve_id, kev_set):
    """Determine exploitation status from CISA KEV and EPSS data."""
    if cve_id in kev_set:
        return "active"
    epss = requests.get(
        "https://api.first.org/data/v1/epss",
        params={"cve": cve_id}
    ).json()
    if epss.get("data"):
        score = float(epss["data"][0].get("epss", 0))
        if score > 0.5:
            return "poc"
    return "none"

def evaluate_technical_impact(cvss_vector):
    """Parse CVSS vector for scope and impact metrics."""
    if "S:C" in cvss_vector or "C:H/I:H/A:H" in cvss_vector:
        return "total"
    return "partial"

def evaluate_automatability(cvss_vector, cve_description):
    """Check if attack vector is network-based with low complexity."""
    if "AV:N" in cvss_vector and "AC:L" in cvss_vector and "UI:N" in cvss_vector:
        return "yes"
    return "no"

步骤 3:应用 SSVC 决策树

def ssvc_decision(exploitation, tech_impact, automatability, mission_prevalence, public_wellbeing):
    """CISA SSVC decision tree implementation."""
    if exploitation == "active":
        if tech_impact == "total" or automatability == "yes":
            return "Act"
        if mission_prevalence in ("essential", "support"):
            return "Act"
        return "Attend"
    if exploitation == "poc":
        if automatability == "yes" and tech_impact == "total":
            return "Attend"
        if mission_prevalence == "essential":
            return "Attend"
        return "Track*"
    # exploitation == "none"
    if tech_impact == "total" and mission_prevalence == "essential":
        return "Track*"
    return "Track"

步骤 4:生成分级报告

# Run the SSVC triage script against scan results
python3 scripts/process.py --input scan_results.csv --output ssvc_triage_report.json

# View summary
cat ssvc_triage_report.json | python3 -m json.tool | head -50

与漏洞扫描器集成

从 Nessus CSV 导入

# Export Nessus scan as CSV, then process
python3 scripts/process.py \
  --input nessus_export.csv \
  --format nessus \
  --output ssvc_results.json

从 OpenVAS 导入

# Export OpenVAS results as XML
python3 scripts/process.py \
  --input openvas_report.xml \
  --format openvas \
  --output ssvc_results.json

验证与测试

# Test SSVC decision logic with known CVEs
python3 -c "
from scripts.process import ssvc_decision
# CVE-2024-3400 - Palo Alto PAN-OS command injection (KEV listed)
assert ssvc_decision('active', 'total', 'yes', 'essential', 'material') == 'Act'
# CVE-2024-21887 - Ivanti Connect Secure (PoC available)
assert ssvc_decision('poc', 'total', 'yes', 'support', 'minimal') == 'Attend'
print('All SSVC decision tests passed')
"

参考