# Performing Cve Prioritization With Kev Catalog

> 结合 CISA 已知被利用漏洞（KEV）目录、EPSS 和 CVSS，基于真实世界的漏洞利用证据对 CVE 修复工作进行优先级排序。

- Skill: `killvxk/performing-cve-prioritization-with-kev-catalog` (Agent Skill, multi-file: 8 files)
- Install (CLI): `npx skillmds@latest add killvxk/performing-cve-prioritization-with-kev-catalog`
- Raw SKILL.md: https://api.skillmd.com/api/skills/killvxk/performing-cve-prioritization-with-kev-catalog/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: Apache-2.0
- Author: killvxk (https://skillmd.com/u/killvxk)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/killvxk/performing-cve-prioritization-with-kev-catalog

---

# 使用 KEV 目录执行 CVE 优先级排序

## 概述
CISA 已知被利用漏洞（KEV，Known Exploited Vulnerabilities）目录由约束性操作指令（BOD，Binding Operational Directive）22-01 建立，是一份持续更新的 CVE 列表，记录了已在现实环境中被主动利用、具有重大风险的漏洞。截至 2026 年初，该目录已包含超过 1,484 条记录，仅 2025 年就新增了 245 条，增长约 20%。本技能涵盖将 KEV 目录与 EPSS（漏洞利用预测评分系统，Exploit Prediction Scoring System）和 CVSS 整合到漏洞优先级工作流中，创建基于风险的方法，将已确认利用活动的漏洞优先级置于单纯理论严重性之上。

## 前置条件
- 访问漏洞扫描结果（Qualys、Nessus、Rapid7 等）
- 熟悉 CVE 标识符和 NVD
- 了解 CVSS 评分（v3.1 和 v4.0）
- 可访问 CISA KEV、EPSS 和 NVD API 端点
- Python 3.8+ 及 requests 和 pandas 库

## 核心概念

### CISA KEV 目录结构
每个 KEV 条目包含：
- **CVE ID**：CVE 标识符（如 CVE-2024-3094）
- **供应商/项目**：受影响的供应商和产品名称
- **漏洞名称**：漏洞简短描述
- **添加日期**：CISA 将其添加到目录的日期
- **简短描述**：简要技术说明
- **必要措施**：推荐的修复行动
- **截止日期**：联邦民事行政机构（FCEB）的修复截止时间
- **勒索软件利用情况**：是否有勒索软件组织利用该漏洞

### BOD 22-01 修复时间线
| CVE 发布日期 | 修复截止时间 |
|----------------------|---------------------|
| 2021 年或之后 | 列入 KEV 后 2 周 |
| 2021 年之前 | 列入 KEV 后 6 个月 |

### 多因素优先级排序模型

| 因素 | 权重 | 数据来源 | 理由 |
|--------|--------|-------------|-----------|
| CISA KEV 收录 | 30% | CISA KEV JSON 数据源 | 已确认主动利用 |
| EPSS 评分 | 25% | FIRST EPSS API | 预测漏洞利用概率 |
| CVSS 基础分 | 20% | NVD API v2.0 | 漏洞固有严重性 |
| 资产关键性 | 15% | CMDB/资产清单 | 业务影响背景 |
| 网络暴露程度 | 10% | 网络架构 | 攻击面可访问性 |

### KEV + EPSS 决策矩阵

| KEV 收录 | EPSS > 0.5 | CVSS >= 9.0 | 优先级 | SLA |
|------------|-----------|-------------|----------|-----|
| 是 | 任意 | 任意 | P1-紧急 | 48 小时 |
| 否 | 是 | 是 | P1-紧急 | 48 小时 |
| 否 | 是 | 否 | P2-严重 | 7 天 |
| 否 | 否 | 是 | P2-严重 | 7 天 |
| 否 | 否 | 否（>= 7.0） | P3-高危 | 14 天 |
| 否 | 否 | 否（>= 4.0） | P4-中危 | 30 天 |
| 否 | 否 | 否（< 4.0） | P5-低危 | 90 天 |

## 实施步骤

### 步骤 1：获取并解析 KEV 目录

```python
import requests
import json
from datetime import datetime

KEV_URL = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json"

def fetch_kev_catalog():
    """下载并解析 CISA KEV 目录。"""
    response = requests.get(KEV_URL, timeout=30)
    response.raise_for_status()
    data = response.json()

    catalog = {}
    for vuln in data.get("vulnerabilities", []):
        cve_id = vuln["cveID"]
        catalog[cve_id] = {
            "vendor": vuln.get("vendorProject", ""),
            "product": vuln.get("product", ""),
            "name": vuln.get("vulnerabilityName", ""),
            "date_added": vuln.get("dateAdded", ""),
            "description": vuln.get("shortDescription", ""),
            "action": vuln.get("requiredAction", ""),
            "due_date": vuln.get("dueDate", ""),
            "ransomware_use": vuln.get("knownRansomwareCampaignUse", "Unknown"),
        }

    print(f"[+] 已从 CISA KEV 目录加载 {len(catalog)} 个 CVE")
    print(f"    目录版本：{data.get('catalogVersion', 'N/A')}")
    print(f"    最后更新：{data.get('dateReleased', 'N/A')}")
    return catalog

kev = fetch_kev_catalog()
```

### 步骤 2：使用 EPSS 评分丰富数据

```python
EPSS_API = "https://api.first.org/data/v1/epss"

def get_epss_scores(cve_list):
    """批量获取一组 CVE 的 EPSS 评分。"""
    scores = {}
    batch_size = 100
    for i in range(0, len(cve_list), batch_size):
        batch = cve_list[i:i + batch_size]
        cve_param = ",".join(batch)
        response = requests.get(EPSS_API, params={"cve": cve_param}, timeout=30)
        if response.status_code == 200:
            for entry in response.json().get("data", []):
                scores[entry["cve"]] = {
                    "epss": float(entry.get("epss", 0)),
                    "percentile": float(entry.get("percentile", 0)),
                }
    return scores
```

### 步骤 3：构建优先级排序引擎

```python
import pandas as pd

def prioritize_vulnerabilities(scan_results, kev_catalog, epss_scores):
    """对扫描结果应用多因素优先级排序。"""
    prioritized = []

    for vuln in scan_results:
        cve_id = vuln.get("cve_id", "")
        cvss_score = float(vuln.get("cvss_score", 0))
        asset_criticality = float(vuln.get("asset_criticality", 3))
        exposure = float(vuln.get("network_exposure", 3))

        in_kev = cve_id in kev_catalog
        kev_data = kev_catalog.get(cve_id, {})
        epss_data = epss_scores.get(cve_id, {"epss": 0, "percentile": 0})
        epss_score = epss_data["epss"]

        # 综合风险分计算
        risk_score = (
            (1.0 if in_kev else 0.0) * 10 * 0.30 +
            epss_score * 10 * 0.25 +
            cvss_score * 0.20 +
            (asset_criticality / 5.0) * 10 * 0.15 +
            (exposure / 5.0) * 10 * 0.10
        )

        # 分配优先级
        if in_kev or (epss_score > 0.5 and cvss_score >= 9.0):
            priority = "P1-紧急"
            sla_days = 2
        elif epss_score > 0.5 or cvss_score >= 9.0:
            priority = "P2-严重"
            sla_days = 7
        elif cvss_score >= 7.0:
            priority = "P3-高危"
            sla_days = 14
        elif cvss_score >= 4.0:
            priority = "P4-中危"
            sla_days = 30
        else:
            priority = "P5-低危"
            sla_days = 90

        prioritized.append({
            "cve_id": cve_id,
            "cvss_score": cvss_score,
            "epss_score": round(epss_score, 4),
            "epss_percentile": round(epss_data["percentile"], 4),
            "in_cisa_kev": in_kev,
            "ransomware_use": kev_data.get("ransomware_use", "N/A"),
            "kev_due_date": kev_data.get("due_date", "N/A"),
            "risk_score": round(risk_score, 2),
            "priority": priority,
            "sla_days": sla_days,
            "asset": vuln.get("asset", ""),
            "asset_criticality": asset_criticality,
        })

    df = pd.DataFrame(prioritized)
    df = df.sort_values("risk_score", ascending=False)
    return df
```

### 步骤 4：生成优先级排序报告

```python
def generate_report(df, output_file="kev_prioritized_report.csv"):
    """从优先级排序的漏洞数据生成摘要报告。"""
    print("\n" + "=" * 70)
    print("漏洞优先级排序报告 — KEV + EPSS + CVSS")
    print("=" * 70)

    print(f"\n已分析漏洞总数：{len(df)}")
    print(f"KEV 收录的漏洞：{df['in_cisa_kev'].sum()}")
    print(f"与勒索软件关联：{(df['ransomware_use'] == 'Known').sum()}")

    print("\n优先级分布：")
    print(df["priority"].value_counts().to_string())

    print("\n前 15 个高风险漏洞：")
    top = df.head(15)[["cve_id", "cvss_score", "epss_score", "in_cisa_kev",
                        "risk_score", "priority"]]
    print(top.to_string(index=False))

    df.to_csv(output_file, index=False)
    print(f"\n[+] 完整报告已保存到：{output_file}")
```

## 最佳实践
1. 每日更新 KEV 目录，因为 CISA 每周多次添加新条目
2. 始终将 KEV 与 EPSS 交叉比对；某个 CVE 可能 EPSS 高但尚未列入 KEV
3. 无论 CVSS 分数高低，将所有 KEV 收录的 CVE 视为 P1-紧急处理
4. 特别关注标记为"已知勒索软件利用"的 KEV 条目
5. 在 CI/CD 流水线中自动化 KEV 与漏洞扫描结果的比对
6. 单独追踪 KEV 截止日期以满足 FCEB 合规要求
7. 将 KEV 用作威胁猎人的领先指标；一旦 CVE 被添加，立即检查环境中的历史利用情况

## 常见陷阱
- 仅依赖 CVSS 分数而不检查 KEV 或 EPSS 数据
- KEV 目录更新频率不足（CISA 每周更新多次）
- 将非 KEV 的 CVE 视为安全的；它们可能已被利用但尚未被收录
- 忽视"勒索软件利用"字段，该字段标识最紧迫的威胁
- 仅将 KEV 用于合规，而不整合到整体风险管理中

## 相关技能
- prioritizing-vulnerabilities-with-cvss-scoring
- building-vulnerability-data-pipeline-with-api
- implementing-threat-intelligence-scoring
- implementing-vulnerability-remediation-sla

