VulnParse-Pin Threat Model.md
View source on GitHub ↗
Threat Model
This threat model defines the v2.1.0 (Apache-2.0) attack surfaces, trust boundaries, mitigations, and residual risks for VulnParse-Pin (vpp) deployments.
Scope
In scope:
- Local workstation, container, Kubernetes/systemd, and CI/CD execution across all 13 subcommands (
scan,demo,diff,ui,gui,export,verify,defer,intel,ml,mcp,assets,simulate) - Streaming ingestion of untrusted scanner files (XML, SARIF 2.1.0, JSONL, CSV, JSON) and offline CMDB/cloud inventory exports (
netbox-json,netbox-csv,aws-ec2,gcp-compute,azure-vm,csv,nmap-xml) - Persistent DuckDB
.vpp.dbworkspace and.wal/.tmpsidecars - Threat-intelligence feed retrieval (
FeedCacheManager) and 5 SQLite indexes (nvd,epss,kev,ghsa,osv) - Signed offline ML model artifacts (
aci_v3_core,pre_kev_v1_core, optional.onnxcompanions) - Workspace context configs (
assets.yaml,decisions.yaml) and custom Jinja2--template-dir - Localhost HTTP and stdio interfaces (
vpp mcp,vpp gui) and unified workbench HTML (mcp/ui_app.py) - Output artifacts (HTML/Markdown Dossiers & Roadmaps, Remediation plans, standalone
simulator-html, CSV, JSON,RunManifest, signed webhooks)
Out of scope:
- Host OS kernel hardening and physical/hypervisor isolation
- Upstream scanner accuracy or compromise of authoritative NVD/CISA/FIRST/GitHub publishers before download
- Consumer browser or spreadsheet security outside VPP’s exported artifacts
Trust Boundaries
- Untrusted: Scanner exports (XML, SARIF, JSONL, CSV), CMDB/cloud inventory exports (
vpp assets compile), inline findings text/titles/locations, OSV offline.zipbundles, external advisory descriptions, unauthenticated HTTP requests/headers (Host,Origin,Transfer-Encoding), and SEP-1865postMessageframes prior tohostOriginverification. - Semi-trusted: Remote HTTPS intelligence mirrors (KEV, EPSS, NVD, Exploit-DB, GHSA API), local cached files/SQLite DBs on shared filesystems, and custom ML model artifacts before
.sig.json/ HMAC verification. - Configuration / Policy Boundary:
config.yaml,scoring.json,tn_triage.json,assets.yaml,decisions.yaml, and custom--template-dir. - Trusted Runtime: Local Python process,
PermFileHandler(0o600/0o700), DuckDB.vpp.dbworkspace, per-processX-VPP-CSRFtoken, and HMAC keys (VP_FEED_CACHE_HMAC_KEY,VP_SQLITE_HMAC_KEY,VP_WEBHOOK_HMAC_KEY,VP_MODEL_HMAC_KEY). - Output Sinks: Analyst browsers (HTML Dossiers/Roadmaps,
vpp gui, standalonesimulator-html), SEP-1865 MCP host iframes (ui://vpp/workbench.html), Markdown renderers (GitHub/GitLab PR comments), spreadsheet tools (CSV), and HTTPS webhook receivers.
Primary Threat Scenarios & v2.1 Mitigations
- XXE, DTD Expansion, & Malformed XML / Encoding Smuggling
- Mitigation:
defusedxmlis absent;_xml_security.pyrunsinspect_xml_prolog()(up to 1 MiB, including BOM-less UTF-16LE/BE & UTF-32) rejecting<!ENTITY/SYSTEM/PUBLIC/internal subsets, andsafe_iterparse()runslxml.etree.iterparse(resolve_entities=False,no_network=True,load_dtd=False,huge_tree=False) with full-subtreeassert_no_entity_nodes().
- Mitigation:
- Symlink Escapes, Path Traversal, & File Mode Races
- Mitigation: PFH defaults to
forbid_symlinks_read=True,forbid_symlinks_write=True,enforce_roots_on_write=True,file_mode=0o600,dir_mode=0o700.VppDatabasevalidates.vpp.db,.wal,.tmp, and all ancestors via_validate_duckdb_paths(), runningumask(0o177)andopen_for_write_non_pfhunder_UMASK_LOCK._validate_mcp_config_path()checks--assets,--decisions, and--workspace-rootagainst symlinks/loops.
- Mitigation: PFH defaults to
- Untrusted CMDB / Cloud Inventory Exports (
vpp assets)- Threat: Malicious or corrupted inventory exports could attempt symlink traversal, oversized memory exhaustion, XXE via Nmap XML, terminal/ANSI escape injection in asset tags/hostnames, race conditions on rule promotion, or silent mislabeling of private-only cloud assets as
internet_facing: false. - Mitigation:
core/inventory_compiler.pyenforces_MAX_INVENTORY_BYTES = 64 MiB, rejects NUL paths, symlinks, symlink loops, and non-regular files viaO_NOFOLLOW, parses Nmap XML viainspect_xml_prolog()+safe_iterparse(), strips ANSI CSI/OSC/DCS/APC and C0/C1 control sequences (_strip_ansi_and_control), validates Draft 2020-12assets.schema.json, locks rule promotion viafcntl.flock+ atomic writes, and preservesinternet_facing: nullon ambiguous private-only cloud/CMDB assets unless explicitly tagged or overridden via--default-private-exposure.
- Threat: Malicious or corrupted inventory exports could attempt symlink traversal, oversized memory exhaustion, XXE via Nmap XML, terminal/ANSI escape injection in asset tags/hostnames, race conditions on rule promotion, or silent mislabeling of private-only cloud assets as
- Localhost HTTP GUI & MCP Server Attacks (
vpp gui/vpp mcp)- Threat: Malicious browser tabs or LAN peers targeting
127.0.0.1:8787/8765via DNS rebinding, CSRF / simple-CORS requests, iframe clickjacking, HTTP request smuggling / duplicate headers, connection/batch/nesting DoS, unauthorized writes without--allow-write, or overwriting.vpp.db/decisions.yamlvia export paths. - Mitigation: Both servers bind loopback (
127.0.0.1) by default and refuse non-loopback--hostwithout>=16-char--auth-token-envverified viahmac.compare_digest.HttpSecurityPolicyvalidates singleHostandOriginheaders; duplicate security/framing headers return400,Transfer-Encodingreturns501, non-application/jsonPOSTreturns415, missingContent-Lengthreturns411, and payloads> 4 MiB(MAX_MESSAGE_BYTES) return413.BoundedSemaphore(32)caps concurrency (503), socket timeout is15.0s, JSON serialization setsallow_nan=False, andvpp mcpbounds batches (MAX_BATCH_ITEMS = 64), nesting (MAX_JSON_DEPTH = 64), and internal errors (-32603).vpp guiadditionally enforces a per-process 256-bitX-VPP-CSRFheader (hmac.compare_digest),X-Frame-Options: DENY,X-Content-Type-Options: nosniff,Referrer-Policy: no-referrer,Cache-Control: no-store, and strict HTTP CSP (frame-ancestors 'none'). Both surfaces default to read-only (blocking mutating tools/modals without--allow-write),vpp_export_dossierblocks protected DB/YAML/config paths (_assert_export_target_not_protected), andvpp_diff_and_drift(re_enrich=True)copies DB/WAL into0o600O_NOFOLLOW | O_EXCLtemp files.
- Threat: Malicious browser tabs or LAN peers targeting
- Browser Workbench & SEP-1865 Iframe Attacks (
mcp/ui_app.py)- Threat: Untrusted scan strings, host themes, or malicious postMessage frames attempting DOM XSS, wildcard
postMessageorigin spoofing,__proto__prototype pollution, CSSurl()/@importexfiltration, or<script>break-out in embeddedsimulator-htmlsnapshots. - Mitigation:
ui_app.pyrenders exclusively viadocument.createElementandtextContent(zeroinnerHTML, zero external CDNs orhttp:///https://URLs), stores maps inObject.create(null), validates numeric bars withNumber.isFinite, strips/rejects CSSurl(/expression/@importtokens, latcheshostOriginexclusively on the matchinginitRpcIdresponse (blockingtools/callotherwise), bounds RPC calls withRPC_TIMEOUT_MS = 30000, escapes<script type="application/json">data via_escape_json_for_script_tag()(\u0026/\u003c/\u003e/\u2028/\u2029), and sets strict<meta>CSP (connect-src 'none'inmcpandstatic-simulator).
- Threat: Untrusted scan strings, host themes, or malicious postMessage frames attempting DOM XSS, wildcard
- Cache & ML Model Weight Tampering / Downgrade Attacks
- Mitigation: When
VP_FEED_CACHE_HMAC_KEYorVP_SQLITE_HMAC_KEYis set, plainsha256sidecars and unsigned SQLite DBs fail closed with zero auto-resign; tampered SQLite caches are quarantined to.tampered.<UTCSTAMP>.vpp intel statusverifies read-only (?mode=ro). Similarly,ml/registry.pyenforces< 2 MiB(MAX_MODEL_ARTIFACT_BYTES), rejects symlinks/non-regular/world-writable artifacts viaO_NOFOLLOW, and verifies.sig.jsonSHA-256 orVP_MODEL_HMAC_KEY(hmac-sha256) fail-closed while defaulting to non-mutatingml.mode: shadow.
- Mitigation: When
- HTTP Redirect Downgrade & Decompression / Zip-Bomb DoS
- Mitigation:
_open_https_stream()disables auto-redirects (allow_redirects=False) and enforces HTTPS per hop (MAX_NVD_META_BYTES = 1 MiB,MAX_REMOTE_FEED_BYTES = 200 MiB,MAX_DECOMPRESSED_FEED_BYTES = 2 GiB).OSVEnrichmentSource._validate_zip_member()blocks.., symlinks, drive prefixes, and zip-bombs.
- Mitigation:
- HTML XSS, Markdown Table/Link Injection, & CSV Formula Injection
- Mitigation:
renderer.pyenables Jinja2autoescapefor HTML templates (zero external CDNs) andmd_escapefor Markdown templates/reports.csv_exporter.pyneutralizes formula prefixes (=,+,-,@,\t,\r) unless both--no-csv-sanitizeand--confirm-unsafe-csvare passed.
- Mitigation:
- SQL Injection in DuckDB Queries / Textual TUI
- Mitigation:
storage/repositories.py,diff_engine.py,renderer.py,mcp/tools.py,ui/gui_server.py, andui/app.pyuse parameterized DuckDB queries and validated column/table allowlists (_ALLOWED_SQLITE_TABLESinvpp intel status).
- Mitigation:
- Evidence & Manifest Tampering / Waiver Staleness
- Mitigation:
RunManifestv2 hashes inputs, configs, outputs, and SHA-256 hash-chainedledger_events(includingMCP_DEFERRAL_PROPOSED,GUI_DEFERRAL_RECORDED, andGUI_ASSET_RULE_PROMOTED).vpp verifyvalidates manifests read-only (verifying listed output artifacts + symlinks) without writing to$HOME/XDG_*.DecisionsRegistry+vpp diff --fail-on stale-assumptioncatches expired or assumption-violated deferrals.
- Mitigation:
Security Assumptions
- Execution user account and local secret store (
VP_FEED_CACHE_HMAC_KEY,VP_SQLITE_HMAC_KEY,VP_WEBHOOK_HMAC_KEY,VP_MODEL_HMAC_KEY, and any--auth-token-envvariable) are protected by host permissions. --template-dircustom Jinja2 templates andassets.yaml/decisions.yamlare operator-controlled inputs.- POSIX
0o600/0o700mode enforcement applies on Linux/macOS; Windows relies on NTFS ACLs.
Residual Risks
- Upstream intelligence compromise: If an authoritative feed publisher (NVD, CISA, FIRST, GitHub, OSV) serves poisoned content over valid TLS before VPP caches it, VPP will faithfully sign and snapshot that content.
- Operator opt-out flags: Passing
--allow-symlinks-read,--no-csv-sanitize --confirm-unsafe-csv,--allow-regen, or--allow-write(onvpp mcp/vpp gui) intentionally relaxes fail-closed or read-only protections. - Unrestricted read roots by default:
--enforce-root-readis opt-in (Falseby default) so CLI users can pass scan files from arbitrary paths; high-security enclaves should pass--enforce-root-read(and--workspace-rootforvpp mcp/vpp gui). - Untrusted custom
--template-dir: Supplying untrusted Jinja2 templates can alter rendered HTML/Markdown output.
Recommended Controls by Environment
- Developer workstation: Keep defaults enabled (
read_onlyMCP/GUI,ml.mode: shadow); install optional[ui]in an isolatedpipx/uv toolor virtualenv; avoid--no-csv-sanitize. - CI/CD pipeline: Set
VP_FEED_CACHE_HMAC_KEY,VP_SQLITE_HMAC_KEY,VP_MODEL_HMAC_KEY, andVP_WEBHOOK_HMAC_KEY; pass--offlineagainst pre-verified caches or runvpp intel status; gate PRs withvpp diff --fail-on stale-assumption(orkev/p1); audit inventory drift withvpp assets audit --fail-on shadow; verify artifacts withvpp verify. - Restricted / air-gapped enclave: Run as non-root with
readOnlyRootFilesystem,--portableon a dedicated0o700volume,--enforce-root-read,vpp mcpoverstdio(or loopbackvpp gui), andvpp verifyfor read-only audit verification.