# Automating attack path reduction after Bitdefender GravityZone launch
Bitdefender recently announced the launch of GravityZone Exposure Management [1]. This solution maps attack paths by correlating vulnerabilities, misconfigurations, account risks, and internet exposure [2]. Practitioners are moving from simple vulnerability management to exposure management because only 26% of CISA KEV vulnerabilities were fully fixed in 2025 [3].
An exposed service, an unpatched workstation, and an account with excessive privileges often appear as separate tickets in a queue [4]. In reality, they form a single route to a critical asset [4]. Security teams must automate the detection and remediation of these chains to handle them at scale.
Mapping the exposure chain
Exposure management requires a graph of dependencies instead of a list of CVEs. Bitdefender GravityZone Attack Path Analysis identifies which single fix breaks the most routes [2]. Practitioners can replicate this logic with open tools by building a custom pipeline to correlate data. A good first input is the CISA Known Exploited Vulnerabilities catalog, which lists flaws with confirmed real world exploitation and is published as a JSON feed [8].
Actual data ingestion pipeline with n8n
The workflow below runs every six hours. Three HTTP Request nodes [9] run one after another: the KEV feed, a Shodan host search limited to your own address range [10], and the members of the Entra ID Global Administrator role, addressed by its built-in role template ID [11]. A Code node then reads all three results by node name and keeps the exposed hosts whose Shodan vulns list includes a KEV CVE. Shodan only returns the vulns field on paid plans.
Before import, create three n8n credentials: a Query Auth credential whose parameter name is key and whose value is your Shodan key, a Microsoft OAuth2 API credential for an app granted RoleManagement.Read.Directory [11], and a Jira Software Cloud credential. Replace the angle bracket placeholders.
{
"name": "Attack Path Data Ingestion",
"settings": { "timezone": "America/New_York" },
"nodes": [
{
"parameters": {
"rule": { "interval": [{ "field": "cronExpression", "expression": "0 */6 * * *" }] }
},
"id": "1",
"name": "Every 6 Hours",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [250, 300]
},
{
"parameters": {
"method": "GET",
"url": "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json"
},
"id": "2",
"name": "Fetch CISA KEV",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [450, 300]
},
{
"parameters": {
"method": "GET",
"url": "https://api.shodan.io/shodan/host/search",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{ "name": "query", "value": "net:<your_public_CIDR>" },
{ "name": "facets", "value": "port,product" }
]
}
},
"id": "3",
"name": "Fetch Shodan Exposure",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [650, 300]
},
{
"parameters": {
"method": "GET",
"url": "https://graph.microsoft.com/v1.0/directoryRoles(roleTemplateId='62e90394-69f5-4237-9190-012177145e10')/members",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOAuth2Api"
},
"id": "4",
"name": "Fetch Global Admins",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [850, 300]
},
{
"parameters": {
"mode": "runOnceForAllItems",
"jsCode": "const kev = $('Fetch CISA KEV').first().json.vulnerabilities;\nconst hosts = $('Fetch Shodan Exposure').first().json.matches || [];\nconst admins = $('Fetch Global Admins').first().json.value || [];\n\nconst kevCves = new Set(kev.map(v => v.cveID));\nconst exposedAssets = hosts.map(h => ({\n ip: h.ip_str,\n port: h.port,\n product: h.product,\n vulns: Object.keys(h.vulns || {})\n}));\nconst kevExposed = exposedAssets.filter(a => a.vulns.some(c => kevCves.has(c)));\nconst highPrivAccounts = admins.map(a => a.userPrincipalName || a.id);\n\nreturn [{ json: {\n kevCves: [...kevCves],\n exposedAssets,\n kevExposed,\n highPrivAccounts,\n timestamp: new Date().toISOString()\n} }];"
},
"id": "5",
"name": "Correlate Attack Paths",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [1050, 300]
},
{
"parameters": {
"method": "POST",
"url": "https://<your-site>.atlassian.net/rest/api/2/issue",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "jiraSoftwareCloudApi",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ fields: { project: { key: 'SEC' }, issuetype: { name: 'Task' }, summary: 'Attack path correlation ' + $json.timestamp.slice(0, 10), description: 'KEV CVEs on exposed hosts: ' + $json.kevExposed.length + '\\nGlobal admins: ' + $json.highPrivAccounts.join(', '), labels: ['attack-path', 'automation', 'exposure-management'] } }) }}"
},
"id": "6",
"name": "Create Jira Ticket",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [1250, 300]
}
],
"connections": {
"Every 6 Hours": { "main": [[{ "node": "Fetch CISA KEV", "type": "main", "index": 0 }]] },
"Fetch CISA KEV": { "main": [[{ "node": "Fetch Shodan Exposure", "type": "main", "index": 0 }]] },
"Fetch Shodan Exposure": { "main": [[{ "node": "Fetch Global Admins", "type": "main", "index": 0 }]] },
"Fetch Global Admins": { "main": [[{ "node": "Correlate Attack Paths", "type": "main", "index": 0 }]] },
"Correlate Attack Paths": { "main": [[{ "node": "Create Jira Ticket", "type": "main", "index": 0 }]] }
}
}Python script for attack path graph building
The script reads the Code node's output (saved to a file) and builds a directed graph. The asset to account edges are an assumption you should replace with real reachability data, such as which hosts those accounts sign in to. They stand for lateral movement through remote services, MITRE ATT&CK T1021 [17].
#!/usr/bin/env python3
"""
Build attack path graph from vulnerability, exposure, and privilege data
Outputs GraphML for visualization in yEd/Gephi
"""
import json
import networkx as nx
from datetime import datetime
def build_attack_graph(kev_cves, exposed_assets, high_priv_accounts):
G = nx.DiGraph()
kev = set(kev_cves)
for asset in exposed_assets:
node_id = f"ASSET:{asset['ip']}:{asset['port']}"
G.add_node(node_id, type="asset", ip=asset['ip'], product=asset.get('product') or "")
# Connect each KEV CVE the asset carries to the asset
for cve in kev.intersection(asset.get('vulns', [])):
G.add_node(f"CVE:{cve}", type="vulnerability")
G.add_edge(f"CVE:{cve}", node_id, relation="exploits")
for acct in high_priv_accounts:
G.add_node(f"ACCT:{acct}", type="account", privilege="high")
# Assumed lateral movement edges: replace with real sign-in or admin rights data
for asset in exposed_assets:
for acct in high_priv_accounts:
G.add_edge(f"ASSET:{asset['ip']}:{asset['port']}", f"ACCT:{acct}",
relation="lateral_movement", technique="T1021")
return G
def find_choke_points(G):
"""Count how many vulnerability-to-account paths pass through each asset or account"""
sources = [n for n, d in G.nodes(data=True) if d.get('type') == 'vulnerability']
targets = [n for n, d in G.nodes(data=True) if d.get('type') == 'account']
counts = {n: 0 for n, d in G.nodes(data=True) if d.get('type') in ('asset', 'account')}
for s in sources:
for t in targets:
for path in nx.all_simple_paths(G, s, t):
for node in path:
if node in counts:
counts[node] += 1
return sorted(counts.items(), key=lambda x: x[1], reverse=True)
if __name__ == '__main__':
# Load data saved from the n8n Code node output
with open('attack_path_data.json') as f:
data = json.load(f)
G = build_attack_graph(data['kevCves'], data['exposedAssets'], data['highPrivAccounts'])
print("Top 5 choke points (fix these first):")
for node, count in find_choke_points(G)[:5]:
print(f" {node}: on {count} attack paths")
nx.write_graphml(G, f"attack_graph_{datetime.now().strftime('%Y%m%d')}.graphml")Automating detection with static and dynamic analysis
The goal is to harden the environment autonomously once an attack path is identified [5]. Practitioners can use Semgrep to automate the detection of specific coding patterns or misconfigured APIs across the entire codebase. Semgrep runs as a step in most CI systems, so every pull request gets the same check [6]. CodeQL adds data flow analysis, which can trace untrusted input to a dangerous call across several files [7].
Semgrep rules for attack path vulnerabilities
Semgrep parses every pattern in a rule for each language the rule lists, so browser-only code such as window.location gets its own JavaScript rule, and a metavariable-regex has to sit inside a patterns block.
# .semgrep-rules/attack-path-patterns.yaml
rules:
# Excessive privileges assigned in code
- id: excessive-permissions-assignment
pattern-either:
- pattern: $USER.permissions = "admin"
- pattern: $USER.role = "superuser"
- pattern: grant_role($USER, "admin")
- pattern: add_permission($USER, "write:*")
message: "Code assigns excessive privileges - potential privilege escalation path"
languages: [python, javascript]
severity: ERROR
metadata:
cwe: "CWE-269"
attack_path: "privilege_escalation"
# Open redirect from a Flask request parameter
- id: open-redirect-flask
pattern-either:
- pattern: redirect(request.args.get(...))
- pattern: flask.redirect(flask.request.args.get(...))
message: "Open redirect with user-controlled input"
languages: [python]
severity: WARNING
metadata:
cwe: "CWE-601"
attack_path: "initial_access"
# Open redirect in browser JavaScript
- id: open-redirect-dom
patterns:
- pattern-either:
- pattern: window.location = $URL
- pattern: location.href = $URL
- metavariable-regex:
metavariable: $URL
regex: (?i).*(location\.search|location\.hash|params|query).*
message: "Open redirect with user-controlled input"
languages: [javascript]
severity: WARNING
metadata:
cwe: "CWE-601"
attack_path: "initial_access"
# Insecure deserialization (RCE path), one rule per language
- id: insecure-deserialization-python
pattern-either:
- pattern: pickle.loads($DATA)
- pattern: yaml.load($DATA, Loader=yaml.Loader)
message: "Insecure deserialization - potential RCE in attack chain"
languages: [python]
severity: ERROR
metadata:
cwe: "CWE-502"
attack_path: "code_execution"
- id: insecure-deserialization-java
pattern: (ObjectInputStream $IN).readObject()
message: "Java deserialization of a stream - potential RCE in attack chain"
languages: [java]
severity: ERROR
metadata:
cwe: "CWE-502"
attack_path: "code_execution"
# Missing authentication on sensitive endpoints
- id: missing-auth-sensitive-endpoint
patterns:
- pattern-either:
- pattern: |
@$APP.route("=~/^\/api\/admin\/.*/")
def $F(...): ...
- pattern: |
@$ROUTER.post("=~/^\/api\/config\/.*/")
def $F(...): ...
- pattern-not: |
@login_required
def $F(...): ...
- pattern-not: |
@auth_required
def $F(...): ...
message: "Sensitive endpoint missing authentication decorator"
languages: [python]
severity: ERROR
metadata:
cwe: "CWE-306"
attack_path: "privilege_escalation"# Validate the rules, then scan all repos, writing JSON and SARIF copies [18]
semgrep scan --validate --config=.semgrep-rules/attack-path-patterns.yaml
semgrep scan --config=.semgrep-rules/attack-path-patterns.yaml \
--config=auto \
--json-output=semgrep_attack_paths.json \
--sarif-output=semgrep_attack_paths.sarif \
/path/to/all/repos/
# GitHub Actions job using the official Semgrep container image
# jobs:
# semgrep:
# runs-on: ubuntu-latest
# container:
# image: semgrep/semgrep
# steps:
# - uses: actions/checkout@v4
# - run: semgrep scan --config .semgrep-rules/attack-path-patterns.yaml --error --sarif-output=results.sarifCodeQL queries for data flow in attack paths
Current CodeQL writes data flow queries with a configuration module that implements DataFlow::ConfigSig, passed to TaintTracking::Global [7]. RemoteFlowSource covers HTTP parameters, headers and other remote input. The sink method names below are examples; swap in the role, permission and configuration setters your code base uses. The standard CodeQL query suites already cover command injection and SQL injection, so this query only adds the application specific sinks.
/**
* @name Attack path: untrusted input reaches a privilege or configuration change
* @kind path-problem
* @id local/attack-path-dataflow
*/
import java
import semmle.code.java.dataflow.FlowSources
import semmle.code.java.dataflow.TaintTracking
module AttackPathConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
predicate isSink(DataFlow::Node sink) {
exists(MethodCall mc |
mc.getMethod().hasName(["setRole", "grantPermission", "setConfig"]) and
sink.asExpr() = mc.getAnArgument()
)
}
// Treat the result of your own validation helper as clean (rename to match your code)
predicate isBarrier(DataFlow::Node node) {
exists(MethodCall mc | mc.getMethod().hasName("validateRole") and node.asExpr() = mc)
}
}
module AttackPathFlow = TaintTracking::Global<AttackPathConfig>;
import AttackPathFlow::PathGraph
from AttackPathFlow::PathNode source, AttackPathFlow::PathNode sink
where AttackPathFlow::flowPath(source, sink)
select sink.getNode(), source, sink, "Attack path: untrusted input reaches sensitive operation without validation"# The .ql file needs a qlpack.yml beside it that depends on codeql/java-all, then:
codeql pack install
# Run CodeQL for attack path analysis
codeql database create ap-db --language=java --build-mode=none --source-root=/path/to/code
codeql database analyze ap-db attack-path-dataflow.ql \
--format=sarif-latest --output=attack-paths.sarif \
--ram=8192 --threads=4
# Upload to GitHub code scanning
# codeql github upload-results --repository=OWNER/REPO --ref=refs/heads/main \
# --commit="$(git rev-parse HEAD)" --sarif=attack-paths.sarifImplementing a response workflow
Response in exposure management means breaking the path instead of just patching software [2]. This might involve changing a firewall rule, stripping a privilege, or updating a configuration file.
Automated response n8n workflow
The webhook receives a choke point. A Code node checks the input strictly, because the asset branch hands the target to a shell. An If node then sends assets to an Execute Command node and accounts to a Microsoft Graph call that removes the account from a directory role [12]. Both branches end in a Jira ticket [14].
Three things to know before you use it. The Execute Command node is disabled by default from n8n 2.0, has a single command field, and runs on the n8n host or inside the n8n container [13]; to use it you remove it from the NODES_EXCLUDE setting. The contain-host.sh script is yours to write for your firewall; n8n does not provide one. The Graph call needs an app granted RoleManagement.ReadWrite.Directory, and the target must be the account's object ID.
{
"name": "Attack Path Auto-Response",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "attack-path-response",
"responseMode": "onReceived"
},
"id": "1",
"name": "Webhook Trigger",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [250, 300]
},
{
"parameters": {
"mode": "runOnceForAllItems",
"jsCode": "const cp = $input.first().json.body.attack_path.choke_point;\nconst ipv4 = /^(\\d{1,3})(\\.\\d{1,3}){3}$/;\nconst guid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nif (cp.type === 'asset' && ipv4.test(cp.ip)) {\n return [{ json: { action: 'isolate_asset', target: cp.ip } }];\n}\nif (cp.type === 'account' && guid.test(cp.account_id)) {\n return [{ json: { action: 'revoke_privilege', target: cp.account_id, roleTemplateId: '62e90394-69f5-4237-9190-012177145e10' } }];\n}\nthrow new Error('Choke point rejected: unknown type or malformed target');"
},
"id": "2",
"name": "Determine Response Action",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [450, 300]
},
{
"parameters": {
"conditions": {
"options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" },
"conditions": [
{
"id": "is-asset",
"leftValue": "={{ $json.action }}",
"rightValue": "isolate_asset",
"operator": { "type": "string", "operation": "equals" }
}
],
"combinator": "and"
}
},
"id": "3",
"name": "Asset or Account",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [650, 300]
},
{
"parameters": {
"command": "=sudo /usr/local/sbin/contain-host.sh {{ $json.target }}"
},
"id": "4",
"name": "Execute Firewall Rule",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [850, 200]
},
{
"parameters": {
"method": "DELETE",
"url": "=https://graph.microsoft.com/v1.0/directoryRoles(roleTemplateId='{{ $json.roleTemplateId }}')/members/{{ $json.target }}/$ref",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "microsoftOAuth2Api"
},
"id": "5",
"name": "Remove Directory Role",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [850, 400]
},
{
"parameters": {
"method": "POST",
"url": "https://<your-site>.atlassian.net/rest/api/2/issue",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "jiraSoftwareCloudApi",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ fields: { project: { key: 'SEC' }, issuetype: { name: 'Task' }, summary: 'AUTO-RESPONSE: ' + $('Determine Response Action').first().json.action + ' on ' + $('Determine Response Action').first().json.target, description: 'Automated response for an attack path choke point at ' + new Date().toISOString(), labels: ['auto-response', 'attack-path'] } }) }}"
},
"id": "6",
"name": "Create Incident Ticket",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [1050, 300]
}
],
"connections": {
"Webhook Trigger": { "main": [[{ "node": "Determine Response Action", "type": "main", "index": 0 }]] },
"Determine Response Action": { "main": [[{ "node": "Asset or Account", "type": "main", "index": 0 }]] },
"Asset or Account": {
"main": [
[{ "node": "Execute Firewall Rule", "type": "main", "index": 0 }],
[{ "node": "Remove Directory Role", "type": "main", "index": 0 }]
]
},
"Execute Firewall Rule": { "main": [[{ "node": "Create Incident Ticket", "type": "main", "index": 0 }]] },
"Remove Directory Role": { "main": [[{ "node": "Create Incident Ticket", "type": "main", "index": 0 }]] }
}
}PowerShell script for immediate containment
The script runs with the ActiveDirectory and NetSecurity modules. The firewall rules it adds apply to the Windows host where it runs, so run it on the server that must stop talking to the target. Active Directory has no cmdlet that ends a user's existing sessions: Kerberos tickets already issued stay valid until they expire (10 hours by default), so disable the account if containment has to be immediate. For accounts synced to Entra ID, Revoke-MgUserSignInSession invalidates cloud refresh tokens [16].
# Contain-AttackPath.ps1 - run with rights to change the groups and the account
param(
[string]$TargetIP,
[string]$TargetAccount,
[string]$TargetUpn,
[switch]$IsolateNetwork,
[switch]$RevokePrivileges,
[switch]$SnapshotMemory
)
# Block traffic to and from the target on this host
if ($IsolateNetwork) {
$stamp = Get-Date -Format 'yyyyMMddHHmmss'
foreach ($dir in "Inbound", "Outbound") {
New-NetFirewallRule -Name "ATTACK-PATH-CONTAIN-$dir-$stamp" `
-DisplayName "Auto-contain $dir for attack path: $TargetIP" `
-Description "Automated containment of $TargetIP" `
-Direction $dir -Action Block -RemoteAddress $TargetIP `
-Enabled True -Profile Domain,Private,Public
}
Write-Host "Created inbound and outbound block rules for $TargetIP"
}
# Revoke excessive privileges
if ($RevokePrivileges) {
foreach ($group in "Domain Admins", "Enterprise Admins", "Schema Admins") {
try {
Remove-ADGroupMember -Identity $group -Members $TargetAccount -Confirm:$false -ErrorAction Stop
Write-Host "Removed $TargetAccount from $group"
} catch {
Write-Warning "Could not remove from ${group}: $_"
}
}
# Reset the credential and stop new logons
$newPass = -join ((48..57) + (65..90) + (97..122) | Get-Random -Count 32 | ForEach-Object { [char]$_ })
Set-ADAccountPassword -Identity $TargetAccount -Reset -NewPassword (ConvertTo-SecureString $newPass -AsPlainText -Force)
Disable-ADAccount -Identity $TargetAccount
# Synced accounts: also revoke Entra ID refresh tokens (Microsoft Graph PowerShell SDK)
if ($TargetUpn) {
Connect-MgGraph -Scopes "User.RevokeSessions.All"
Revoke-MgUserSignInSession -UserId $TargetUpn
}
Write-Host "Reset password, disabled $TargetAccount and revoked cloud sessions where possible"
}
# Snapshot memory for forensics (WinPmem must already be on the target)
if ($SnapshotMemory) {
$session = New-PSSession -ComputerName $TargetIP -ErrorAction SilentlyContinue
if ($session) {
Invoke-Command -Session $session -ScriptBlock {
$dumpDir = Join-Path $env:SystemDrive "Forensics"
New-Item -ItemType Directory -Path $dumpDir -Force | Out-Null
$dumpPath = Join-Path $dumpDir "memory_$(Get-Date -Format 'yyyyMMdd_HHmmss').raw"
$winpmem = Join-Path $env:SystemDrive "Tools\WinPMEM\winpmem_mini_x64_rc2.exe"
& $winpmem $dumpPath
return $dumpPath
}
Write-Host "Memory snapshot taken on $TargetIP"
}
}
# Log everything
$logEntry = @{
Timestamp = Get-Date -Format 'o'
Action = "Attack Path Containment"
TargetIP = $TargetIP
TargetAccount = $TargetAccount
ActionsTaken = @(
if ($IsolateNetwork) { "Network isolation via firewall" }
if ($RevokePrivileges) { "Privilege revocation, password reset, account disabled" }
if ($SnapshotMemory) { "Memory snapshot for forensics" }
)
} | ConvertTo-Json -Depth 3
$logDir = Join-Path $env:SystemDrive "Logs"
New-Item -ItemType Directory -Path $logDir -Force | Out-Null
Add-Content -Path (Join-Path $logDir "attack_path_containment.log") -Value $logEntryNew-PSSession by IP address needs WinRM over HTTPS or a TrustedHosts entry; a computer name works with default Kerberos authentication.
Actions for exposure reduction
The launch of GravityZone Exposure Management shows that vulnerabilities should not be treated as isolated events [4]. Practitioners should take these actions to address the risks:
First, audit all accounts with excessive privileges on the same network segment as internet facing services. Removing these privileges breaks the route even if the software remains unpatched because these are key components of attack paths [4]. Get-LocalGroupMember reports a domain account's PrincipalSource as ActiveDirectory [15].
# Find domain accounts with local admin rights on servers in your internet-facing range
$prefix = "<first octets of your internet-facing range>"
Get-ADComputer -Filter 'OperatingSystem -like "*Server*"' -Properties IPv4Address |
Where-Object { $_.IPv4Address -like "$prefix*" } |
ForEach-Object {
Invoke-Command -ComputerName $_.DNSHostName -ScriptBlock {
Get-LocalGroupMember -Group "Administrators" |
Where-Object { $_.PrincipalSource -eq "ActiveDirectory" } |
Select-Object @{N='Server';E={$env:COMPUTERNAME}}, Name, PrincipalSource
}
}Second, prioritize the remediation of CISA KEV vulnerabilities on assets with multiple network connections. Median fixes for these vulnerabilities took 43 days in 2025 [3]. Reducing the time to fix gateway assets is the most effective way to reduce risk.
#!/bin/bash
# kev_priority_patch.sh: match the KEV feed against your asset inventory export
KEV_URL="https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json"
ASSET_DB="/opt/assets/cmdb.json" # expected shape: {"assets":[{"hostname","ip","network_zone","vendor","product"}]}
N8N_WEBHOOK="https://<your-n8n-host>/webhook/kev-patch"
curl -s "$KEV_URL" | jq -r '.vulnerabilities[] | [.cveID, .vendor, .product, .dateAdded, .requiredAction] | @tsv' > kev.tsv
while IFS=$'\t' read -r cve vendor product date action; do
jq -r --arg v "$vendor" --arg p "$product" \
'.assets[] | select(.vendor==$v and .product==$p) | [.hostname, .ip, .network_zone] | @tsv' \
"$ASSET_DB" | while IFS=$'\t' read -r host ip zone; do
echo "PRIORITY PATCH: $cve on $host ($ip) in $zone - $action"
# Build the JSON with jq so quotes in the KEV text cannot break it
jq -n --arg cve "$cve" --arg host "$host" --arg ip "$ip" --arg zone "$zone" --arg action "$action" \
'{cve:$cve, host:$host, ip:$ip, zone:$zone, action:$action}' |
curl -s -X POST "$N8N_WEBHOOK" -H "Content-Type: application/json" --data-binary @-
done
done < kev.tsvThird, implement a correlation layer using n8n or a similar orchestrator to link external attack surface data with an internal privilege map. This allows you to identify the single fix that breaks the most routes [2] before an AI enabled attack can exploit the chain [5].
# Deploy the n8n workflows above:
# 1. Import Attack Path Data Ingestion workflow
# 2. Import Attack Path Auto-Response workflow
# 3. Create the credentials (Shodan query auth, Microsoft OAuth2 API, Jira Software Cloud)
# 4. Activate both workflows
# 5. Test against a lab host first:
curl -X POST "https://<your-n8n-host>/webhook/attack-path-response" \
-H 'Content-Type: application/json' \
-d '{"attack_path":{"choke_point":{"type":"asset","ip":"<test-host-address>"}}}'Try it yourself: BitLocker Recovery Key: Find It or Fix a Lost One, a free tool from CyberAutomations.