feat(feed): add CISA KEV feed connector (known exploited vulnerabilities)
This commit is contained in:
@@ -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: {} }
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user