From 4206b44e78bf3b1f8e1496db79bd67ef5af60e69 Mon Sep 17 00:00:00 2001 From: Guillaume BOURGEOIS Date: Mon, 13 Jul 2026 12:12:34 +0200 Subject: [PATCH] feat(feed): add CISA KEV feed connector (known exploited vulnerabilities) --- integrations/feed-cisa-kev/manifest.yaml | 36 +++++++++ .../feed-cisa-kev/scripts/fetch_indicators.py | 80 +++++++++++++++++++ .../feed-cisa-kev/scripts/test_connection.py | 49 ++++++++++++ 3 files changed, 165 insertions(+) create mode 100644 integrations/feed-cisa-kev/manifest.yaml create mode 100644 integrations/feed-cisa-kev/scripts/fetch_indicators.py create mode 100644 integrations/feed-cisa-kev/scripts/test_connection.py diff --git a/integrations/feed-cisa-kev/manifest.yaml b/integrations/feed-cisa-kev/manifest.yaml new file mode 100644 index 0000000..af5d36c --- /dev/null +++ b/integrations/feed-cisa-kev/manifest.yaml @@ -0,0 +1,36 @@ +id: feed_cisa_kev +name: CISA KEV Feed +version: 1.0.0 +description: "CISA Known Exploited Vulnerabilities (KEV) feed connector — pull the authoritative catalog of CVEs known to be actively exploited in the wild and emit normalized IOCs (CVE + type, with vendor/product/due-date/ransomware flag) for import into the Threat Indicator Manager. Free, no authentication required; stdlib-only, no extra Python dependencies." +changelog: "1.0.0 — Initial release: fetch the CISA KEV catalog." +category: feed + +# The CISA KEV catalog is a free JSON file served over HTTPS. No key required. +config_schema: + properties: + insecure: + type: boolean + description: "Trust any TLS certificate (not secure)" + default: false + required: [] + +commands: + - id: fetch_indicators + name: feed-cisa-kev-fetch-indicators + description: "Fetch the CISA KEV catalog and return normalized CVE indicators." + risk: read + inputs_schema: + properties: + ransomware_only: { type: boolean, description: "Only return CVEs linked to known ransomware campaigns (default false)" } + max_indicators: { type: number, description: "Max indicators to return (0 = no limit, default 0)" } + required: [] + outputs_schema: { properties: {} } + + - id: test_connection + name: feed-cisa-kev-test-connection + description: "Verify the CISA KEV feed is reachable (used by the Test button)." + risk: read + inputs_schema: + properties: {} + required: [] + outputs_schema: { properties: {} } diff --git a/integrations/feed-cisa-kev/scripts/fetch_indicators.py b/integrations/feed-cisa-kev/scripts/fetch_indicators.py new file mode 100644 index 0000000..68b9548 --- /dev/null +++ b/integrations/feed-cisa-kev/scripts/fetch_indicators.py @@ -0,0 +1,80 @@ +import json, os, sys, ssl, urllib.request, urllib.error + +URL = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json" + + +def _cfg(): + return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}")) + + +def _inputs(): + return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}")) + + +def _ctx(cfg): + if cfg.get("insecure"): + c = ssl.create_default_context() + c.check_hostname = False + c.verify_mode = ssl.CERT_NONE + return c + return None + + +def _get(url, cfg): + req = urllib.request.Request( + url, headers={"User-Agent": "Riposte-SOAR", "Accept": "application/json"} + ) + with urllib.request.urlopen(req, timeout=120, context=_ctx(cfg)) as r: + return r.read() + + +def _run(fn): + try: + print(json.dumps(fn(_cfg(), _inputs()))) + except urllib.error.HTTPError as e: + print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")})) + sys.exit(1) + except Exception as e: + print(json.dumps({"error": str(e)})) + sys.exit(1) + + +def main(cfg, inputs): + ransomware_only = bool(inputs.get("ransomware_only")) + raw = _get(URL, cfg) + data = json.loads(raw) if raw else {} + + maxn = int(inputs.get("max_indicators") or 0) + out = [] + for v in data.get("vulnerabilities", []): + if not isinstance(v, dict): + continue + cid = v.get("cveID") + if not cid: + continue + ransom = v.get("knownRansomwareCampaignUse") + if ransomware_only and str(ransom).lower() != "known": + continue + out.append({ + "value": cid, + "type": "cve", + "vendor": v.get("vendorProject"), + "product": v.get("product"), + "name": v.get("vulnerabilityName"), + "date_added": v.get("dateAdded"), + "due_date": v.get("dueDate"), + "ransomware": ransom, + "tags": ["cisa-kev", "exploited"], + }) + if maxn and len(out) >= maxn: + break + + return { + "source": "cisa:kev", + "count": len(out), + "indicators": out, + "catalog_version": data.get("catalogVersion"), + } + + +_run(main) diff --git a/integrations/feed-cisa-kev/scripts/test_connection.py b/integrations/feed-cisa-kev/scripts/test_connection.py new file mode 100644 index 0000000..2aef63c --- /dev/null +++ b/integrations/feed-cisa-kev/scripts/test_connection.py @@ -0,0 +1,49 @@ +import json, os, sys, ssl, urllib.request, urllib.error + +URL = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json" + + +def _cfg(): + return json.loads(os.environ.get("INTEGRATION_SECRETS", "{}")) + + +def _inputs(): + return json.loads(os.environ.get("INTEGRATION_INPUTS", "{}")) + + +def _ctx(cfg): + if cfg.get("insecure"): + c = ssl.create_default_context() + c.check_hostname = False + c.verify_mode = ssl.CERT_NONE + return c + return None + + +def _get(url, cfg): + req = urllib.request.Request( + url, headers={"User-Agent": "Riposte-SOAR", "Accept": "application/json"} + ) + with urllib.request.urlopen(req, timeout=60, context=_ctx(cfg)) as r: + return r.read() + + +def _run(fn): + try: + print(json.dumps(fn(_cfg(), _inputs()))) + except urllib.error.HTTPError as e: + print(json.dumps({"error": "HTTP " + str(e.code), "detail": e.read().decode("utf-8", "replace")})) + sys.exit(1) + except Exception as e: + print(json.dumps({"error": str(e)})) + sys.exit(1) + + +def main(cfg, inputs): + raw = _get(URL, cfg) + data = json.loads(raw) if raw else {} + n = data.get("count") or len(data.get("vulnerabilities", [])) + return {"ok": True, "sample_count": n, "catalog_version": data.get("catalogVersion")} + + +_run(main)