# Policy Engine Data Pipeline ## Overview This document provides a comprehensive view of how StellaOps feeds data to the Policy Engine for vulnerability risk decisions. The pipeline spans multiple subsystems: SBOM generation with 20+ analyzers, runtime observation via eBPF agents, static/dynamic call graph analysis, binary fingerprinting, and confidence-weighted scoring. **Design Principle:** Every policy decision links back to concrete, verifiable evidence. The system aggregates evidence from multiple sources without silently merging conflicts (aggregation-not-merge). --- ## Master Data Flow Diagram ``` ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ POLICY ENGINE DATA PIPELINE - COMPLETE VIEW │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ┌──────────────────────┐ │ CONTAINER IMAGE │ │ (OCI/Docker/tar) │ └──────────┬───────────┘ │ ┌──────────────────────────┼──────────────────────────┐ │ │ │ ▼ ▼ ▼ ┌───────────────────────┐ ┌───────────────────────┐ ┌───────────────────────┐ │ LAYER EXTRACTION │ │ BINARY EXTRACTION │ │ RUNTIME DEPLOYMENT │ │ (FS + Metadata) │ │ (ELF/PE/Mach-O) │ │ (K8s/Docker/Podman) │ └───────────┬───────────┘ └───────────┬───────────┘ └───────────┬───────────┘ │ │ │ ┌───────────┴───────────┐ ┌───────────┴───────────┐ ┌───────────┴───────────┐ │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ ▼ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │LANGUAGE │ │ OS │ │ BINARY │ │ eBPF │ │ANALYZERS│ │ANALYZERS│ │ INDEX │ │ AGENTS │ │ (11) │ │ (9) │ │ │ │ │ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │ │ │ │ │ ┌────────────────┘ │ │ │ │ ┌─────────────────────────────────────┘ │ │ │ │ │ ▼ ▼ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────────────────┐ │ SBOM │ │ SYMBOL MANIFEST │ │ RUNTIME SIGNALS │ │ (CycloneDX/SPDX) │ │ (Function Hashes) │ │ (Function Calls + Syscalls) │ └──────────┬──────────┘ └──────────┬──────────┘ └───────────────┬─────────────────┘ │ │ │ │ ┌────────────────────┘ │ │ │ │ ▼ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ │ CALL GRAPH │ │ HOT SYMBOL INDEX │ │ CONSTRUCTION │◄──────────────────────────────│ (Invocation Freq) │ │ (Static + Dynamic) │ └─────────────────────┘ └──────────┬──────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────────────────┐ │ REACHABILITY ANALYSIS │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │ │ Entry Point │ │ Path BFS │ │ K4 Lattice │ │ 8-State │ │ │ │ Detection │ │ Traversal │ │ Resolution │ │ Classification│ │ │ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘ │ └──────────────────────────────────┬──────────────────────────────────────────┘ │ ┌──────────────────────────────────┼──────────────────────────────────────────┐ │ │ │ ▼ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────────────┐ │ ADVISORY MATCHING │ │ VEX STATEMENTS │ │ EXCEPTION REGISTRY │ │ (CVE/GHSA/OSV) │ │ (OpenVEX) │ │ (Approved Waivers) │ │ │ │ │ │ │ │ ┌───────────────┐ │ │ ┌───────────────┐ │ │ ┌───────────────────────┐ │ │ │ Concelier │ │ │ │ VexLens │ │ │ │ Exception Store │ │ │ │ (NVD,GHSA,OSV)│ │ │ │ (Consensus) │ │ │ │ (Time-bounded) │ │ │ └───────────────┘ │ │ └───────────────┘ │ │ └───────────────────────┘ │ └──────────┬──────────┘ └──────────┬──────────┘ └─────────────┬───────────────┘ │ │ │ └───────────────────────────┼───────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────┐ │ CONFIDENCE SCORING │ │ ┌─────────────────────────────────┐ │ │ │ Reachability │ 0.30 weight │ │ │ │ Runtime │ 0.25 weight │ │ │ │ VEX │ 0.20 weight │ │ │ │ Provenance │ 0.15 weight │ │ │ │ Policy │ 0.10 weight │ │ │ └─────────────────────────────────┘ │ └───────────────────┬─────────────────────┘ │ ▼ ┌─────────────────────────────────────────┐ │ POLICY ENGINE │ │ ┌─────────────────────────────────┐ │ │ │ K4 Lattice Evaluation │ │ │ │ (Unknown, True, False, Both) │ │ │ ├─────────────────────────────────┤ │ │ │ Gates: │ │ │ │ • MinimumConfidenceGate │ │ │ │ • ReachabilityRequirementGate │ │ │ │ • UnknownsBudgetGate │ │ │ └─────────────────────────────────┘ │ └───────────────────┬─────────────────────┘ │ ▼ ┌─────────────────────────────────────────┐ │ VERDICT │ │ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ │ │ │PASS │ │WARN │ │FAIL │ │SKIP │ │ │ └─────┘ └─────┘ └─────┘ └─────┘ │ │ │ │ + Explain Trace (evidence chain) │ │ + DSSE Attestation │ └─────────────────────────────────────────┘ ``` --- ## 1. SBOM Generation Layer ### 1.1 Language Analyzers (11 Total) The Scanner module implements specialized analyzers for each language ecosystem. Each analyzer extracts package manifests, lockfiles, and dependency trees. ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ LANGUAGE ANALYZERS INVENTORY │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌─────────────────────────────────────────────────────────────────────────────┐ │ │ │ .NET ECOSYSTEM │ │ │ │ ┌──────────────────┐ │ │ │ │ │ DotNetAnalyzer │ Files: *.csproj, *.fsproj, *.vbproj, packages.config │ │ │ │ │ │ *.deps.json, *.nuspec, paket.lock │ │ │ │ │ PackageRef → │ Output: pkg:nuget/Package@Version │ │ │ │ │ TransitiveDeps │ Features: Framework targeting, runtime deps │ │ │ │ └──────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────────────┐ │ │ │ JVM ECOSYSTEM │ │ │ │ ┌──────────────────┐ │ │ │ │ │ JavaAnalyzer │ Files: pom.xml, build.gradle, build.gradle.kts │ │ │ │ │ │ *.jar (META-INF/MANIFEST.MF), ivy.xml │ │ │ │ │ Maven/Gradle → │ Output: pkg:maven/groupId/artifactId@version │ │ │ │ │ JAR Inspection │ Features: Shaded JARs, BOM imports, classifiers │ │ │ │ └──────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────────────┐ │ │ │ JAVASCRIPT ECOSYSTEM │ │ │ │ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ │ │ │ │ NodeAnalyzer │ │ DenoAnalyzer │ │ BunAnalyzer │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ package.json │ │ deno.json │ │ bun.lockb │ │ │ │ │ │ package-lock │ │ deno.lock │ │ package.json │ │ │ │ │ │ yarn.lock │ │ import_map.json │ │ │ │ │ │ │ │ pnpm-lock.yaml │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ pkg:npm/... │ │ pkg:deno/... │ │ pkg:npm/... │ │ │ │ │ └──────────────────┘ └──────────────────┘ └──────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────────────┐ │ │ │ PYTHON ECOSYSTEM │ │ │ │ ┌──────────────────┐ │ │ │ │ │ PythonAnalyzer │ Files: requirements.txt, Pipfile.lock, poetry.lock │ │ │ │ │ │ setup.py, setup.cfg, pyproject.toml │ │ │ │ │ Pip/Poetry → │ *.egg-info/PKG-INFO, METADATA │ │ │ │ │ Wheel Metadata │ Output: pkg:pypi/package@version │ │ │ │ └──────────────────┘ Features: Extras, environment markers │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────────────┐ │ │ │ GO ECOSYSTEM │ │ │ │ ┌──────────────────┐ │ │ │ │ │ GoAnalyzer │ Files: go.mod, go.sum, vendor/modules.txt │ │ │ │ │ │ Binary: __go_buildinfo section │ │ │ │ │ Module Graph → │ Output: pkg:golang/module@version │ │ │ │ │ Binary Embed │ Features: Replace directives, pseudo-versions │ │ │ │ └──────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────────────┐ │ │ │ RUST ECOSYSTEM │ │ │ │ ┌──────────────────┐ │ │ │ │ │ RustAnalyzer │ Files: Cargo.toml, Cargo.lock │ │ │ │ │ │ Binary: .comment section (rustc version) │ │ │ │ │ Cargo.lock → │ Output: pkg:cargo/crate@version │ │ │ │ │ Feature Flags │ Features: Features, target-specific deps │ │ │ │ └──────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────────────┐ │ │ │ SCRIPTING ECOSYSTEMS │ │ │ │ ┌──────────────────┐ ┌──────────────────┐ │ │ │ │ │ PhpAnalyzer │ │ RubyAnalyzer │ │ │ │ │ │ │ │ │ │ │ │ │ │ composer.json │ │ Gemfile │ │ │ │ │ │ composer.lock │ │ Gemfile.lock │ │ │ │ │ │ │ │ *.gemspec │ │ │ │ │ │ pkg:composer/... │ │ pkg:gem/... │ │ │ │ │ └──────────────────┘ └──────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────────────┐ │ │ │ NATIVE BINARIES │ │ │ │ ┌──────────────────┐ │ │ │ │ │ NativeAnalyzer │ Formats: ELF (Linux), PE (Windows), Mach-O (macOS) │ │ │ │ │ │ Extracts: Build-ID, linked libraries, symbols │ │ │ │ │ ELF Parsing → │ Output: pkg:generic/binary@build-id │ │ │ │ │ Symbol Tables │ Features: DWARF debug info, .note.gnu.build-id │ │ │ │ └──────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 1.2 OS/Distribution Analyzers (9 Total) OS-level package analyzers extract installed system packages with version information using distribution-specific formats. ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ OS/DISTRIBUTION ANALYZERS │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌────────────────────────────────────────────────────────────────────────────┐ │ │ │ LINUX DISTRIBUTIONS │ │ │ │ │ │ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ │ │ APK │ │ DPKG │ │ RPM │ │ │ │ │ │ (Alpine) │ │ (Debian) │ │ (RHEL) │ │ │ │ │ ├─────────────┤ ├─────────────┤ ├─────────────┤ │ │ │ │ │/lib/apk/db/ │ │/var/lib/dpkg│ │/var/lib/rpm │ │ │ │ │ │ installed │ │ status │ │ Packages │ │ │ │ │ │ │ │ available │ │ rpmdb.sqlite│ │ │ │ │ ├─────────────┤ ├─────────────┤ ├─────────────┤ │ │ │ │ │pkg:apk/ │ │pkg:deb/ │ │pkg:rpm/ │ │ │ │ │ │alpine/pkg │ │debian/pkg │ │rhel/pkg │ │ │ │ │ │@version │ │@version │ │@evr │ │ │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ │ │ │ │ │ Version Semantics: │ │ │ │ • APK: semver-like with -r suffix (1.2.3-r4) │ │ │ │ • DPKG: epoch:upstream-debian (1:2.3.4-5ubuntu6) │ │ │ │ • RPM: NEVRA (name-epoch:version-release.arch) │ │ │ │ │ │ │ └────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌────────────────────────────────────────────────────────────────────────────┐ │ │ │ macOS │ │ │ │ │ │ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ │ │ Homebrew │ │ Pkgutil │ │ MacOsBundle │ │ │ │ │ │ │ │ (System) │ │ (.app) │ │ │ │ │ ├─────────────┤ ├─────────────┤ ├─────────────┤ │ │ │ │ │/opt/homebrew│ │pkgutil │ │Info.plist │ │ │ │ │ │/Cellar/ │ │--pkgs │ │Contents/ │ │ │ │ │ │INSTALL_RCPT │ │ │ │ │ │ │ │ │ ├─────────────┤ ├─────────────┤ ├─────────────┤ │ │ │ │ │pkg:brew/ │ │pkg:macos/ │ │pkg:swift/ │ │ │ │ │ │formula@ver │ │pkg@version │ │bundle@ver │ │ │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ │ │ │ │ └────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌────────────────────────────────────────────────────────────────────────────┐ │ │ │ WINDOWS │ │ │ │ │ │ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ │ │ Chocolatey │ │ MSI │ │ WinSxS │ │ │ │ │ │ │ │ (Installer) │ │ (Side-by- │ │ │ │ │ │ │ │ │ │ Side) │ │ │ │ │ ├─────────────┤ ├─────────────┤ ├─────────────┤ │ │ │ │ │C:\Programdata│ │Registry │ │C:\Windows\ │ │ │ │ │ │\chocolatey\ │ │HKLM\SOFTWARE│ │WinSxS\ │ │ │ │ │ │lib\ │ │\Microsoft\ │ │Manifests\ │ │ │ │ │ │ │ │Windows\ │ │ │ │ │ │ │ ├─────────────┤ ├─────────────┤ ├─────────────┤ │ │ │ │ │pkg:choco/ │ │pkg:msi/ │ │pkg:winsxs/ │ │ │ │ │ │package@ver │ │product@ver │ │assembly@ver │ │ │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ │ │ │ │ └────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 1.3 Surface Analyzers Surface analyzers extract metadata beyond packages: secrets, environment, filesystem attributes. ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ SURFACE ANALYZERS │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌────────────────────┐ ┌────────────────────┐ ┌────────────────────┐ │ │ │ FileSystemAnalyzer │ │ EnvironmentAnalyzer│ │ SecretsAnalyzer │ │ │ ├────────────────────┤ ├────────────────────┤ ├────────────────────┤ │ │ │ │ │ │ │ │ │ │ │ • File permissions │ │ • ENV variables │ │ • API keys │ │ │ │ • SUID/SGID bits │ │ • PATH entries │ │ • Private keys │ │ │ │ • Capabilities │ │ • User context │ │ • Passwords │ │ │ │ • Symlink targets │ │ • Shell config │ │ • Tokens │ │ │ │ • World-writable │ │ • Locale settings │ │ • Connection strs │ │ │ │ │ │ │ │ │ │ │ │ Output: │ │ Output: │ │ Output: │ │ │ │ property:fs/... │ │ property:env/... │ │ finding:secret/... │ │ │ └────────────────────┘ └────────────────────┘ └────────────────────┘ │ │ │ │ ┌────────────────────┐ ┌────────────────────┐ │ │ │ ValidationAnalyzer │ │ CapabilityAnalyzer │ │ │ ├────────────────────┤ ├────────────────────┤ │ │ │ │ │ │ │ │ │ • SBOM completeness│ │ Detects usage of: │ │ │ │ • Hash verification│ │ • Exec (shell out) │ │ │ │ • Signature checks │ │ • Network (sockets)│ │ │ │ • Format compliance│ │ • Filesystem I/O │ │ │ │ │ │ • Crypto operations│ │ │ │ │ │ • Database access │ │ │ │ │ │ • Dynamic code │ │ │ │ │ │ • Reflection │ │ │ │ │ │ • Native interop │ │ │ └────────────────────┘ └────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 1.4 SBOM Composition Layer All analyzer outputs are composed into standardized SBOM formats with DSSE attestation. ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ SBOM COMPOSITION LAYER │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌─────────────────────────────────────────────────────────────────────────┐ │ │ │ ANALYZER OUTPUTS │ │ │ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │ │ │ │ Lang │ │ OS │ │ Binary │ │ Surface │ │ Secrets │ │ │ │ │ │ Deps │ │ Pkgs │ │ IDs │ │ Props │ │ Findings│ │ │ │ │ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │ │ │ │ │ │ │ │ │ │ │ │ │ └───────────┴───────────┴───────────┴───────────┘ │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────┐ │ │ │ │ │ SBOM Composer │ │ │ │ │ │ (Deduplication + │ │ │ │ │ │ Relationship │ │ │ │ │ │ Inference) │ │ │ │ │ └──────────┬──────────┘ │ │ │ │ │ │ │ │ └───────────────────────────────┼─────────────────────────────────────────┘ │ │ │ │ │ ┌──────────────────────────┼──────────────────────────┐ │ │ │ │ │ │ │ ▼ ▼ ▼ │ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │ │ CycloneDX │ │ SPDX │ │ CBOM │ │ │ │ 1.4 / 1.5 / │ │ 2.3 / 3.0.1 │ │ (Cryptographic) │ │ │ │ 1.6 │ │ │ │ │ │ │ ├─────────────────┤ ├─────────────────┤ ├─────────────────┤ │ │ │ • components[] │ │ • packages[] │ │ • algorithms[] │ │ │ │ • dependencies[]│ │ • relationships │ │ • certificates[]│ │ │ │ • vulnerabilities│ │ • files[] │ │ • keys[] │ │ │ │ • services[] │ │ • snippets[] │ │ • protocols[] │ │ │ │ • formulation │ │ • annotations │ │ │ │ │ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘ │ │ │ │ │ │ │ └─────────────────────────┼─────────────────────────┘ │ │ │ │ │ ▼ │ │ ┌─────────────────────┐ │ │ │ DSSE Envelope │ │ │ │ (in-toto) │ │ │ ├─────────────────────┤ │ │ │ payloadType: │ │ │ │ application/vnd. │ │ │ │ cyclonedx+json │ │ │ │ │ │ │ │ payload: │ │ │ │ │ │ │ │ signatures: [ │ │ │ │ { keyid, sig } │ │ │ │ ] │ │ │ └─────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` --- ## 2. Runtime Observation Layer ### 2.1 eBPF Agent Architecture The Signals module provides kernel-level observability through eBPF probes. ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ eBPF RUNTIME OBSERVATION │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ KERNEL SPACE │ │ │ │ │ │ │ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │ │ │ │ kprobe/kretprobe│ │ tracepoint │ │ uprobe │ │ │ │ │ │ (syscalls) │ │ (scheduler, │ │ (userspace │ │ │ │ │ │ │ │ network, fs) │ │ functions) │ │ │ │ │ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘ │ │ │ │ │ │ │ │ │ │ │ └────────────────────┼────────────────────┘ │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────────┐ │ │ │ │ │ eBPF Ring Buffer │ │ │ │ │ │ (per-CPU) │ │ │ │ │ └────────────┬────────────┘ │ │ │ │ │ │ │ │ └─────────────────────────────────┼─────────────────────────────────────────────┘ │ │ │ │ │ ┌─────────────────────────────────┼─────────────────────────────────────────────┐ │ │ │ USER SPACE │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────────────────┐ │ │ │ │ │ RuntimeSignalCollector │ │ │ │ │ │ (StellaOps.Signals) │ │ │ │ │ ├─────────────────────────────────┤ │ │ │ │ │ • Perf event polling │ │ │ │ │ │ • Symbol resolution │ │ │ │ │ │ • Stack trace unwinding │ │ │ │ │ │ • Container ID correlation │ │ │ │ │ └──────────────┬──────────────────┘ │ │ │ │ │ │ │ │ │ ┌──────────────┴──────────────┐ │ │ │ │ │ │ │ │ │ │ ▼ ▼ │ │ │ │ ┌─────────────────────┐ ┌─────────────────────┐ │ │ │ │ │ Function Call Event │ │ Syscall Event │ │ │ │ │ ├─────────────────────┤ ├─────────────────────┤ │ │ │ │ │ timestamp: i64 │ │ timestamp: i64 │ │ │ │ │ │ container_id: str │ │ container_id: str │ │ │ │ │ │ pid/tid: u32 │ │ syscall_nr: u32 │ │ │ │ │ │ function_name: str │ │ args: [u64; 6] │ │ │ │ │ │ module: str │ │ retval: i64 │ │ │ │ │ │ stack_trace: [addr] │ │ stack_trace: [addr] │ │ │ │ │ │ latency_ns: u64 │ │ latency_ns: u64 │ │ │ │ │ └─────────────────────┘ └─────────────────────┘ │ │ │ │ │ │ │ └───────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 2.2 Container Observation (Zastava) Zastava observes container lifecycle events and runtime posture. ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ ZASTAVA CONTAINER OBSERVER │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ CONTAINER RUNTIME │ │ │ │ │ │ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ │ │ Docker │ │ containerd │ │ CRI-O │ │ │ │ │ │ Engine │ │ │ │ │ │ │ │ │ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │ │ │ │ │ │ │ │ │ │ │ └──────────────────┼──────────────────┘ │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────┐ │ │ │ │ │ Container Events │ │ │ │ │ │ (via API socket) │ │ │ │ │ └──────────┬──────────┘ │ │ │ │ │ │ │ │ └─────────────────────────────┼─────────────────────────────────────────────────┘ │ │ │ │ │ ▼ │ │ ┌─────────────────────────────┐ │ │ │ ZastavaObserver │ │ │ ├─────────────────────────────┤ │ │ │ • Image digest extraction │ │ │ │ • Container ID tracking │ │ │ │ • Lifecycle events │ │ │ │ • Runtime posture eval │ │ │ └──────────────┬──────────────┘ │ │ │ │ │ ┌───────────────────────┼───────────────────────┐ │ │ │ │ │ │ │ ▼ ▼ ▼ │ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │ │ CREATE │ │ START │ │ STOP │ │ │ ├─────────────┤ ├─────────────┤ ├─────────────┤ │ │ │ image_ref │ │ container_id│ │ exit_code │ │ │ │ image_digest│ │ pid │ │ duration │ │ │ │ labels │ │ started_at │ │ stopped_at │ │ │ │ env_vars │ │ cgroups │ │ oom_killed │ │ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ RUNTIME POSTURES │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ Posture │ Description │ Evidence Level │ │ │ │ │ ├───────────────────┼───────────────────────────────┼─────────────────┤ │ │ │ │ │ None │ No runtime observation │ Static only │ │ │ │ │ │ Passive │ Container events only │ Low │ │ │ │ │ │ ActiveTracing │ Syscall + network monitoring │ Medium │ │ │ │ │ │ EbpfDeep │ Full eBPF instrumentation │ High │ │ │ │ │ │ FullInstrumentation│ eBPF + userspace probes │ Maximum │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 2.3 Hot Symbol Index Runtime observations are aggregated into the Hot Symbol Index for reachability correlation. ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ HOT SYMBOL INDEX │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ PostgreSQL Storage │ │ │ │ │ │ │ │ Table: signals.hot_symbols │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ Column │ Type │ Description │ │ │ │ │ ├─────────────────────┼─────────────┼─────────────────────────────────┤ │ │ │ │ │ image_digest │ text │ Container image SHA256 │ │ │ │ │ │ function_name │ text │ Fully qualified function name │ │ │ │ │ │ module │ text │ Package/library containing func │ │ │ │ │ │ purl │ text │ Package URL for module │ │ │ │ │ │ invocation_count │ bigint │ Total observed calls │ │ │ │ │ │ first_observed │ timestamptz │ First invocation timestamp │ │ │ │ │ │ last_observed │ timestamptz │ Most recent invocation │ │ │ │ │ │ unique_callers │ int │ Distinct call sites │ │ │ │ │ │ sample_stack │ jsonb │ Representative stack trace │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ │ Indexes: │ │ │ │ • (image_digest, function_name) - PRIMARY │ │ │ │ • (purl, function_name) - lookup by package │ │ │ │ • (invocation_count DESC) - hot path ranking │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ Query Patterns │ │ │ │ │ │ │ │ -- Is function in vulnerable package ever called? │ │ │ │ SELECT invocation_count > 0 │ │ │ │ FROM signals.hot_symbols │ │ │ │ WHERE image_digest = $1 │ │ │ │ AND purl = $2 │ │ │ │ AND function_name = $3; │ │ │ │ │ │ │ │ -- Get all observed functions for a package │ │ │ │ SELECT function_name, invocation_count, sample_stack │ │ │ │ FROM signals.hot_symbols │ │ │ │ WHERE image_digest = $1 AND purl = $2 │ │ │ │ ORDER BY invocation_count DESC; │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` --- ## 3. Call Graph Analysis Layer ### 3.1 ReachGraph Architecture The ReachGraph module constructs and analyzes call graphs for reachability determination. ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ REACHGRAPH ARCHITECTURE │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌─────────────────────┐ │ │ │ SBOM + Binaries │ │ │ └──────────┬──────────┘ │ │ │ │ │ ▼ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ GRAPH INDEXER │ │ │ │ │ │ │ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │ │ │ │ SBOM Ingestion │ │ Binary Symbol │ │ Advisory Overlay│ │ │ │ │ │ │ │ Extraction │ │ │ │ │ │ │ ├─────────────────┤ ├─────────────────┤ ├─────────────────┤ │ │ │ │ │ • Package nodes │ │ • Function nodes│ │ • CVE → Package │ │ │ │ │ │ • Dependency │ │ • Call edges │ │ • Affected func │ │ │ │ │ │ edges │ │ • Import edges │ │ (if known) │ │ │ │ │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ │ │ │ │ │ │ └───────────────────────────────────┬───────────────────────────────────────────┘ │ │ │ │ │ ▼ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ GRAPH DATA MODEL │ │ │ │ │ │ │ │ Node Types: Edge Types: │ │ │ │ ┌─────────────┐ ┌─────────────────────┐ │ │ │ │ │ Package │ │ DEPENDS_ON │ │ │ │ │ │ Function │ │ CALLS │ │ │ │ │ │ File │ │ IMPORTS │ │ │ │ │ │ EntryPoint │ │ CONTAINS │ │ │ │ │ │ CVE │ │ AFFECTS │ │ │ │ │ └─────────────┘ │ ENTRY_FOR │ │ │ │ │ └─────────────────────┘ │ │ │ │ │ │ │ │ Example Graph Fragment: │ │ │ │ │ │ │ │ [EntryPoint:main.js] ──CALLS──► [Function:lodash.template] │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ──ENTRY_FOR──► [Package:myapp@1.0] ◄──DEPENDS_ON── [Package:lodash@4.17]│ │ │ │ ▲ │ │ │ │ │ │ │ │ │ [CVE-2021-23337] ─┘ AFFECTS │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ ▼ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ GRAPH ANALYTICS ENGINE │ │ │ │ │ │ │ │ ┌───────────────────────┐ ┌───────────────────────┐ │ │ │ │ │ Label Propagation │ │ Centrality Scoring │ │ │ │ │ │ Clustering │ │ │ │ │ │ │ ├───────────────────────┤ ├───────────────────────┤ │ │ │ │ │ Groups related │ │ Identifies critical │ │ │ │ │ │ components into │ │ nodes (high impact │ │ │ │ │ │ clusters for impact │ │ if compromised) │ │ │ │ │ │ analysis │ │ │ │ │ │ │ └───────────────────────┘ └───────────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 3.2 Reachability Slice Service BFS-based path finding for reachability queries. ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ REACHGRAPH SLICE SERVICE │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ SLICE OPERATIONS │ │ │ │ │ │ │ │ Query: "Is CVE-2021-23337 reachable from any entry point?" │ │ │ │ │ │ │ │ ┌────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ BFS TRAVERSAL │ │ │ │ │ │ │ │ │ │ │ │ [EntryPoint:main.js] │ │ │ │ │ │ │ │ │ │ │ │ │ │ depth=0 │ │ │ │ │ │ ▼ │ │ │ │ │ │ [Function:app.renderTemplate] │ │ │ │ │ │ │ │ │ │ │ │ │ │ depth=1 │ │ │ │ │ │ ▼ │ │ │ │ │ │ [Function:lodash.template] ◄── CVE-2021-23337 │ │ │ │ │ │ │ │ │ │ │ │ │ │ depth=2 │ │ │ │ │ │ ▼ │ │ │ │ │ │ REACHABLE! Path length: 2 │ │ │ │ │ │ │ │ │ │ │ └────────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ SLICE TYPES │ │ │ │ │ │ │ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │ │ │ │ Package Slice │ │ CVE Slice │ │ File Slice │ │ │ │ │ ├─────────────────┤ ├─────────────────┤ ├─────────────────┤ │ │ │ │ │ All paths to │ │ All paths to │ │ All functions │ │ │ │ │ │ functions in │ │ affected │ │ in a specific │ │ │ │ │ │ a package │ │ function │ │ source file │ │ │ │ │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ │ │ │ │ │ │ │ ┌─────────────────┐ │ │ │ │ │ EntryPoint Slice│ │ │ │ │ ├─────────────────┤ │ │ │ │ │ All reachable │ │ │ │ │ │ code from a │ │ │ │ │ │ given entry │ │ │ │ │ └─────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 3.3 Eight-State Reachability Classification ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ 8-STATE REACHABILITY LATTICE │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌───────────────────┐ │ │ │ LiveExploitPath │ Confirmed exploit path │ │ │ (Highest) │ exists with runtime proof │ │ └─────────┬─────────┘ │ │ │ │ │ ┌─────────▼─────────┐ │ │ │ DynamicReachable │ Runtime observed │ │ │ │ (eBPF evidence) │ │ └─────────┬─────────┘ │ │ │ │ │ ┌─────────▼─────────┐ │ │ │ StaticReachable │ Static analysis found │ │ │ │ call path exists │ │ └─────────┬─────────┘ │ │ │ │ │ ┌─────────▼─────────┐ │ │ │PotentiallyReachable│ Import exists but │ │ │ │ no direct call found │ │ └─────────┬─────────┘ │ │ │ │ │ ┌─────────▼─────────┐ │ │ │ Unknown │ Insufficient data │ │ │ (Default) │ to determine │ │ └─────────┬─────────┘ │ │ │ │ │ ┌───────────────────────┼───────────────────────┐ │ │ │ │ │ │ │ ┌────────▼────────┐ ┌─────────▼─────────┐ ┌────────▼────────┐ │ │ │ NotReachable │ │ GateBlocked │ │ NotApplicable │ │ │ │ │ │ │ │ │ │ │ │ Static analysis │ │ Dead code path │ │ Language/OS │ │ │ │ proves no path │ │ behind feature │ │ mismatch │ │ │ │ │ │ flag or ifdef │ │ │ │ │ └─────────────────┘ └───────────────────┘ └─────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ STATE TRANSITION RULES │ │ │ │ │ │ │ │ Unknown + RuntimeEvidence → DynamicReachable │ │ │ │ Unknown + StaticPathFound → StaticReachable │ │ │ │ StaticReachable + RuntimeEvidence → DynamicReachable │ │ │ │ DynamicReachable + ExploitProof → LiveExploitPath │ │ │ │ Unknown + NoPath → NotReachable │ │ │ │ Any + DeadCodeFlag → GateBlocked │ │ │ │ Any + PlatformMismatch → NotApplicable │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` --- ## 4. Binary Analysis Layer ### 4.1 Binary Identity Extraction ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ BINARY IDENTITY EXTRACTION │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ SUPPORTED FORMATS │ │ │ │ │ │ │ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │ │ │ │ ELF │ │ PE │ │ Mach-O │ │ │ │ │ │ (Linux) │ │ (Windows) │ │ (macOS) │ │ │ │ │ ├─────────────────┤ ├─────────────────┤ ├─────────────────┤ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ .note.gnu. │ │ CodeView GUID │ │ LC_UUID │ │ │ │ │ │ build-id │ │ (PDB link) │ │ load command │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ Build-ID: │ │ GUID: │ │ UUID: │ │ │ │ │ │ SHA1 or SHA256 │ │ 16-byte + age │ │ 16-byte │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ IDENTITY EXTRACTION FLOW │ │ │ │ │ │ │ │ Binary File │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────────────────────┐ │ │ │ │ │ Format Detection │ │ │ │ │ │ (Magic bytes: 0x7F ELF, MZ, etc) │ │ │ │ │ └──────────────────┬──────────────────┘ │ │ │ │ │ │ │ │ │ ┌──────────────┼──────────────┐ │ │ │ │ ▼ ▼ ▼ │ │ │ │ ┌───────┐ ┌───────┐ ┌───────┐ │ │ │ │ │ ELF │ │ PE │ │Mach-O │ │ │ │ │ │Parser │ │Parser │ │Parser │ │ │ │ │ └───┬───┘ └───┬───┘ └───┬───┘ │ │ │ │ │ │ │ │ │ │ │ └──────────────┼──────────────┘ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────────────────────┐ │ │ │ │ │ BinaryIdentity │ │ │ │ │ ├─────────────────────────────────────┤ │ │ │ │ │ build_id: string │ │ │ │ │ │ format: ELF | PE | MachO │ │ │ │ │ │ arch: x86_64 | arm64 | ... │ │ │ │ │ │ linked_libraries: [string] │ │ │ │ │ │ exported_symbols: [Symbol] │ │ │ │ │ │ imported_symbols: [Symbol] │ │ │ │ │ │ sections: [Section] │ │ │ │ │ └─────────────────────────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 4.2 Function Fingerprinting ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ FUNCTION FINGERPRINTING │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ FINGERPRINT COMPONENTS │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ BasicBlockHash │ │ │ │ │ │ │ │ │ │ │ │ • Hash of normalized instruction sequence per basic block │ │ │ │ │ │ • Ignores register names (normalized to r0, r1, etc.) │ │ │ │ │ │ • Ignores immediate addresses (normalized to ) │ │ │ │ │ │ • Preserves instruction opcodes and operand types │ │ │ │ │ │ │ │ │ │ │ │ Example: │ │ │ │ │ │ mov rax, [rbp-8] → mov r0, [r1-] │ │ │ │ │ │ call 0x401000 → call │ │ │ │ │ │ ret → ret │ │ │ │ │ │ │ │ │ │ │ │ Hash: SHA256(normalized_bytes) → 32-byte fingerprint │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ CfgHash │ │ │ │ │ │ │ │ │ │ │ │ • Hash of control flow graph structure │ │ │ │ │ │ • Encodes: (basic_block_count, edge_count, edge_types) │ │ │ │ │ │ • Captures function complexity and branching pattern │ │ │ │ │ │ │ │ │ │ │ │ CFG: ┌─────┐ │ │ │ │ │ │ │ BB0 │──────┐ │ │ │ │ │ │ └──┬──┘ │ (conditional) │ │ │ │ │ │ │ ▼ │ │ │ │ │ │ ┌──▼──┐ ┌─────┐ │ │ │ │ │ │ │ BB1 │ │ BB2 │ │ │ │ │ │ │ └──┬──┘ └──┬──┘ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └────┬────┘ │ │ │ │ │ │ ┌──▼──┐ │ │ │ │ │ │ │ BB3 │ (exit) │ │ │ │ │ │ └─────┘ │ │ │ │ │ │ │ │ │ │ │ │ CfgHash = hash(4 blocks, 4 edges, [fall,cond,fall,fall]) │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ StringRefsHash │ │ │ │ │ │ │ │ │ │ │ │ • Hash of string literals referenced by function │ │ │ │ │ │ • Useful for identifying specific error handlers, log messages │ │ │ │ │ │ • Sorted before hashing for determinism │ │ │ │ │ │ │ │ │ │ │ │ References: ["error: invalid input", "debug: %s", "OK"] │ │ │ │ │ │ Sorted: ["OK", "debug: %s", "error: invalid input"] │ │ │ │ │ │ StringRefsHash = SHA256(sorted_refs) │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ COMPOSITE FINGERPRINT │ │ │ │ │ │ │ │ FunctionFingerprint { │ │ │ │ name: "vulnerable_func", │ │ │ │ basic_block_hash: "a1b2c3...", │ │ │ │ cfg_hash: "d4e5f6...", │ │ │ │ string_refs_hash: "789abc...", │ │ │ │ instruction_count: 47, │ │ │ │ cyclomatic_complexity: 5, │ │ │ │ composite_hash: SHA256(bb_hash || cfg_hash || str_hash) │ │ │ │ } │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 4.3 Patch Detection Engine ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ PATCH DETECTION ENGINE │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ DETECTION WORKFLOW │ │ │ │ │ │ │ │ ┌─────────────────┐ ┌─────────────────┐ │ │ │ │ │ Target Binary │ │ Known Patched │ │ │ │ │ │ (from scan) │ │ Reference │ │ │ │ │ └────────┬────────┘ └────────┬────────┘ │ │ │ │ │ │ │ │ │ │ ▼ ▼ │ │ │ │ ┌─────────────────┐ ┌─────────────────┐ │ │ │ │ │ Extract │ │ Extract │ │ │ │ │ │ Fingerprints │ │ Fingerprints │ │ │ │ │ └────────┬────────┘ └────────┬────────┘ │ │ │ │ │ │ │ │ │ │ └───────────┬───────────┘ │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────────┐ │ │ │ │ │ PatchDiffEngine │ │ │ │ │ ├─────────────────────────┤ │ │ │ │ │ │ │ │ │ │ │ For each CVE function: │ │ │ │ │ │ 1. Find in target │ │ │ │ │ │ 2. Compare fingerprint │ │ │ │ │ │ 3. Compute similarity │ │ │ │ │ │ │ │ │ │ │ └────────────┬────────────┘ │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────────────────────────────┐ │ │ │ │ │ SIMILARITY SCORING │ │ │ │ │ │ │ │ │ │ │ │ CFG Similarity: │ │ │ │ │ │ cfg_sim = 1 - (edit_distance / max_size) │ │ │ │ │ │ │ │ │ │ │ │ Block Similarity: │ │ │ │ │ │ block_sim = matching_blocks / total │ │ │ │ │ │ │ │ │ │ │ │ Composite: │ │ │ │ │ │ score = 0.6*cfg_sim + 0.4*block_sim │ │ │ │ │ │ │ │ │ │ │ │ Thresholds: │ │ │ │ │ │ > 0.95 : Exact match (patched) │ │ │ │ │ │ 0.80-0.95: Likely patched │ │ │ │ │ │ 0.50-0.80: Uncertain │ │ │ │ │ │ < 0.50 : Likely vulnerable │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ BACKPORT DETECTION │ │ │ │ │ │ │ │ Scenario: Package reports version 1.2.3 but has backported patch │ │ │ │ │ │ │ │ Version Mismatch: │ │ │ │ Declared: lodash@4.17.15 (vulnerable per NVD) │ │ │ │ Binary Analysis: patch_similarity = 0.97 (matches 4.17.21 fix) │ │ │ │ │ │ │ │ Result: │ │ │ │ evidence_type: BACKPORTED_PATCH │ │ │ │ confidence: 0.97 │ │ │ │ recommendation: Consider NOT_AFFECTED despite version │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` --- ## 5. Confidence Scoring System ### 5.1 Evidence-Weighted Score Formula ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ CONFIDENCE SCORING SYSTEM │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ SCORING FORMULA │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ │ │ │ │ │ │ FinalScore = Σ (Weight_i × NormalizedScore_i) × 100 │ │ │ │ │ │ │ │ │ │ │ │ Where: │ │ │ │ │ │ i ∈ {Reachability, Runtime, VEX, Provenance, Policy} │ │ │ │ │ │ Σ Weight_i = 1.0 │ │ │ │ │ │ NormalizedScore_i ∈ [0.0, 1.0] │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ FACTOR BREAKDOWN │ │ │ │ │ │ │ │ ┌───────────────────────────────────────────────────────────────────┐ │ │ │ │ │ FACTOR │ WEIGHT │ DESCRIPTION │ │ │ │ │ ├─────────────────┼────────┼────────────────────────────────────────┤ │ │ │ │ │ Reachability │ 0.30 │ Can code path reach vulnerable func? │ │ │ │ │ │ (RCH) │ │ │ │ │ │ │ │ │ │ 1.0 = LiveExploitPath │ │ │ │ │ │ │ │ 0.9 = DynamicReachable │ │ │ │ │ │ │ │ 0.7 = StaticReachable │ │ │ │ │ │ │ │ 0.5 = PotentiallyReachable │ │ │ │ │ │ │ │ 0.3 = Unknown │ │ │ │ │ │ │ │ 0.1 = NotReachable │ │ │ │ │ ├─────────────────┼────────┼────────────────────────────────────────┤ │ │ │ │ │ Runtime │ 0.25 │ Is function observed at runtime? │ │ │ │ │ │ (RTS) │ │ │ │ │ │ │ │ │ │ 1.0 = Observed with high frequency │ │ │ │ │ │ │ │ 0.8 = Observed at least once │ │ │ │ │ │ │ │ 0.5 = No observation (neutral) │ │ │ │ │ │ │ │ 0.2 = Never observed (long window) │ │ │ │ │ ├─────────────────┼────────┼────────────────────────────────────────┤ │ │ │ │ │ VEX │ 0.20 │ Vendor VEX statement consensus │ │ │ │ │ │ (VEX) │ │ │ │ │ │ │ │ │ │ 1.0 = Exploitable (high trust vendor) │ │ │ │ │ │ │ │ 0.7 = Under investigation │ │ │ │ │ │ │ │ 0.5 = No VEX (neutral) │ │ │ │ │ │ │ │ 0.2 = Not affected (high trust) │ │ │ │ │ ├─────────────────┼────────┼────────────────────────────────────────┤ │ │ │ │ │ Provenance │ 0.15 │ Build/supply chain evidence │ │ │ │ │ │ (PRV) │ │ │ │ │ │ │ │ │ │ 1.0 = Untrusted/unknown source │ │ │ │ │ │ │ │ 0.7 = Partial attestation │ │ │ │ │ │ │ │ 0.3 = Full SLSA L3+ attestation │ │ │ │ │ │ │ │ 0.1 = Verified reproducible build │ │ │ │ │ ├─────────────────┼────────┼────────────────────────────────────────┤ │ │ │ │ │ Policy │ 0.10 │ Exception/override status │ │ │ │ │ │ (POL) │ │ │ │ │ │ │ │ │ │ 1.0 = No exception │ │ │ │ │ │ │ │ 0.5 = Time-bounded exception │ │ │ │ │ │ │ │ 0.1 = Permanent waiver │ │ │ │ │ └───────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ EXAMPLE CALCULATION │ │ │ │ │ │ │ │ CVE-2021-23337 in lodash@4.17.15: │ │ │ │ │ │ │ │ ┌────────────────────────────────────────────────────────────────┐ │ │ │ │ │ Factor │ Value │ Norm │ Weight │ Weighted │ │ │ │ │ ├──────────────┼──────────────────┼───────┼────────┼────────────┤ │ │ │ │ │ Reachability │ StaticReachable │ 0.70 │ 0.30 │ 0.210 │ │ │ │ │ │ Runtime │ Not observed │ 0.50 │ 0.25 │ 0.125 │ │ │ │ │ │ VEX │ No VEX │ 0.50 │ 0.20 │ 0.100 │ │ │ │ │ │ Provenance │ Partial attest │ 0.70 │ 0.15 │ 0.105 │ │ │ │ │ │ Policy │ No exception │ 1.00 │ 0.10 │ 0.100 │ │ │ │ │ ├──────────────┼──────────────────┼───────┼────────┼────────────┤ │ │ │ │ │ TOTAL │ │ │ │ 0.640 │ │ │ │ │ └────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ │ Final Confidence Score: 0.640 × 100 = 64 │ │ │ │ Interpretation: Medium-High confidence this is exploitable │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 5.2 Confidence Factor Visualization ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ CONFIDENCE FACTOR DIAGRAM │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌─────────────────────┐ │ │ │ FINDING │ │ │ │ CVE-2021-23337 │ │ │ │ lodash@4.17.15 │ │ │ └──────────┬──────────┘ │ │ │ │ │ ┌──────────────────────────────────┼──────────────────────────────────┐ │ │ │ │ │ │ │ │ ┌──────────────────────────────┼──────────────────────────────┐ │ │ │ │ │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ │ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ │ │ │REACHABILITY│ │ RUNTIME │ │ VEX │ │PROVENANCE │ │ POLICY │ │ │ │ (0.30) │ │ (0.25) │ │ (0.20) │ │ (0.15) │ │ (0.10) │ │ │ ├───────────┤ ├───────────┤ ├───────────┤ ├───────────┤ ├───────────┤ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ReachGraph│ │ Signals │ │ VexLens │ │ Attestor │ │ Exception │ │ │ │ call path │ │ eBPF │ │ Consensus│ │ SLSA │ │ Store │ │ │ │ analysis │ │ Hot Syms │ │ OpenVEX │ │ DSSE │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─────┬─────┘ └─────┬─────┘ └─────┬─────┘ └─────┬─────┘ └─────┬─────┘ │ │ │ │ │ │ │ │ │ │ ┌──────────┘ │ │ │ │ │ │ │ ┌───────────────────────┘ │ │ │ │ │ │ │ ┌────────────────────────────────────┘ │ │ │ │ │ │ │ ┌───────────────────────────────────────────────┘ │ │ │ │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ CONFIDENCE AGGREGATOR │ │ │ │ │ │ │ │ score = Σ(weight_i × factor_score_i) │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ │ │ │ │ │ │ │ │ ████████████████████████████████████████░░░░░░░░░░░░░░░░ │ │ │ │ │ │ |-------- 64% confidence this is exploitable ---------| │ │ │ │ │ │ │ │ │ │ │ │ Components: │ │ │ │ │ │ [RCH: 21%] [RTS: 12.5%] [VEX: 10%] [PRV: 10.5%] [POL: 10%]│ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` --- ## 6. Policy Engine Decision Layer ### 6.1 K4 Belnap Four-Valued Logic ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ K4 BELNAP FOUR-VALUED LOGIC │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ TRUTH VALUES │ │ │ │ │ │ │ │ ┌───────┐ │ │ │ │ │ ⊤ │ BOTH (Conflict) │ │ │ │ │ Both │ Evidence says both true AND false │ │ │ │ └───┬───┘ │ │ │ │ ╱ ╲ │ │ │ │ ╱ ╲ │ │ │ │ ╱ ╲ │ │ │ │ ┌─────┴─────┐ ┌─────┴─────┐ │ │ │ │ │ T │ │ F │ │ │ │ │ │ True │ │ False │ │ │ │ │ │ │ │ │ │ │ │ │ └─────┬─────┘ └─────┬─────┘ │ │ │ │ ╲ ╱ │ │ │ │ ╲ ╱ │ │ │ │ ╲ ╱ │ │ │ │ └───┬───┘ │ │ │ │ │ ⊥ │ UNKNOWN (Neither) │ │ │ │ │Neither│ No evidence either way │ │ │ │ └───────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ LATTICE OPERATIONS │ │ │ │ │ │ │ │ JOIN (∨) - combines evidence, prefers "more information" │ │ │ │ ┌─────────┬─────────┬─────────┬─────────┬─────────┐ │ │ │ │ │ ∨ │ ⊥ │ T │ F │ ⊤ │ │ │ │ │ ├─────────┼─────────┼─────────┼─────────┼─────────┤ │ │ │ │ │ ⊥ │ ⊥ │ T │ F │ ⊤ │ │ │ │ │ │ T │ T │ T │ ⊤ │ ⊤ │ │ │ │ │ │ F │ F │ ⊤ │ F │ ⊤ │ │ │ │ │ │ ⊤ │ ⊤ │ ⊤ │ ⊤ │ ⊤ │ │ │ │ │ └─────────┴─────────┴─────────┴─────────┴─────────┘ │ │ │ │ │ │ │ │ MEET (∧) - requires agreement, prefers "less information" │ │ │ │ ┌─────────┬─────────┬─────────┬─────────┬─────────┐ │ │ │ │ │ ∧ │ ⊥ │ T │ F │ ⊤ │ │ │ │ │ ├─────────┼─────────┼─────────┼─────────┼─────────┤ │ │ │ │ │ ⊥ │ ⊥ │ ⊥ │ ⊥ │ ⊥ │ │ │ │ │ │ T │ ⊥ │ T │ ⊥ │ T │ │ │ │ │ │ F │ ⊥ │ ⊥ │ F │ F │ │ │ │ │ │ ⊤ │ ⊥ │ T │ F │ ⊤ │ │ │ │ │ └─────────┴─────────┴─────────┴─────────┴─────────┘ │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ APPLICATION IN POLICY │ │ │ │ │ │ │ │ Rule: "Block if vulnerability is reachable" │ │ │ │ │ │ │ │ ┌────────────────────────────────────────────────────────────────┐ │ │ │ │ │ Evidence Sources │ Individual │ Combined (∨) │ Decision │ │ │ │ │ ├───────────────────────┼────────────┼──────────────┼───────────┤ │ │ │ │ │ Static analysis │ T │ │ │ │ │ │ │ │ Runtime observation │ ⊥ │ T ∨ ⊥ │ │ │ │ │ │ │ VEX says not affected │ F │ = T ∨ F │ │ │ │ │ │ │ │ │ = ⊤ (Both) │ CONFLICT │ │ │ │ │ └────────────────────────────────────────────────────────────────┘ │ │ │ │ │ │ │ │ Conflict resolution: escalate for human review, default to cautious │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 6.2 Policy Gates ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ POLICY GATES │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │ │ GATE EVALUATION ORDER │ │ │ │ │ │ │ │ Finding │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ GATE 1: MinimumConfidenceGate │ │ │ │ │ │ │ │ │ │ │ │ Purpose: Skip low-confidence findings that would cause noise │ │ │ │ │ │ │ │ │ │ │ │ Config: │ │ │ │ │ │ min_confidence_to_evaluate: 0.3 │ │ │ │ │ │ min_confidence_to_fail: 0.5 │ │ │ │ │ │ │ │ │ │ │ │ Logic: │ │ │ │ │ │ if confidence < 0.3 → SKIP (don't evaluate) │ │ │ │ │ │ if confidence < 0.5 → WARN (evaluate but don't fail) │ │ │ │ │ │ else → continue to next gate │ │ │ │ │ │ │ │ │ │ │ └──────────────────────────────┬──────────────────────────────────────┘ │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ GATE 2: ReachabilityRequirementGate │ │ │ │ │ │ │ │ │ │ │ │ Purpose: Only fail on findings with sufficient reachability proof │ │ │ │ │ │ │ │ │ │ │ │ Config: │ │ │ │ │ │ require_reachability_for: [critical, high] │ │ │ │ │ │ minimum_state: StaticReachable │ │ │ │ │ │ │ │ │ │ │ │ Logic: │ │ │ │ │ │ if severity in [critical,high]: │ │ │ │ │ │ if reachability < StaticReachable → WARN (downgrade) │ │ │ │ │ │ else → continue │ │ │ │ │ │ else → continue (reachability not required for medium/low) │ │ │ │ │ │ │ │ │ │ │ └──────────────────────────────┬──────────────────────────────────────┘ │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ GATE 3: UnknownsBudgetGate │ │ │ │ │ │ │ │ │ │ │ │ Purpose: Allow some unknown components, fail if too many │ │ │ │ │ │ │ │ │ │ │ │ Config: │ │ │ │ │ │ max_unknown_packages: 10 │ │ │ │ │ │ max_unknown_percentage: 5% │ │ │ │ │ │ │ │ │ │ │ │ Logic: │ │ │ │ │ │ unknown_count = count(packages where purl is unparseable) │ │ │ │ │ │ if unknown_count > 10 OR unknown_count/total > 5% → FAIL │ │ │ │ │ │ else → continue │ │ │ │ │ │ │ │ │ │ │ └──────────────────────────────┬──────────────────────────────────────┘ │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ │ │ GATE 4: SeverityThresholdGate │ │ │ │ │ │ │ │ │ │ │ │ Config: │ │ │ │ │ │ fail_on: [critical] │ │ │ │ │ │ warn_on: [high, medium] │ │ │ │ │ │ allow: [low, none] │ │ │ │ │ │ │ │ │ │ │ └──────────────────────────────┬──────────────────────────────────────┘ │ │ │ │ │ │ │ │ │ ▼ │ │ │ │ FINAL VERDICT │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` ### 6.3 Complete Decision Flow ``` ┌─────────────────────────────────────────────────────────────────────────────────────┐ │ COMPLETE POLICY DECISION FLOW │ ├─────────────────────────────────────────────────────────────────────────────────────┤ │ │ │ INPUTS PROCESSING OUTPUT │ │ ────── ────────── ────── │ │ │ │ ┌─────────────┐ │ │ │ SBOM │──┐ │ │ │ (packages) │ │ │ │ └─────────────┘ │ │ │ │ ┌─────────────────────────────────────┐ │ │ ┌─────────────┐ │ │ │ │ │ │ Advisories │──┼────►│ FINDING MATCHER │ │ │ │ (CVE/GHSA) │ │ │ │ │ │ └─────────────┘ │ │ package × advisory → findings │ │ │ │ │ │ │ │ ┌─────────────┐ │ └──────────────────┬──────────────────┘ │ │ │ VEX │──┘ │ │ │ │ (OpenVEX) │ │ │ │ └─────────────┘ │ │ │ ▼ │ │ ┌─────────────┐ ┌─────────────────────────────────────┐ │ │ │ Reachability│─────────────►│ │ │ │ │ (K4/8st) │ │ EVIDENCE AGGREGATOR │ │ │ └─────────────┘ │ │ │ │ │ For each finding: │ │ │ ┌─────────────┐ │ • Collect all evidence sources │ │ │ │ Runtime │─────────────►│ • Resolve conflicts (K4 logic) │ │ │ │ (Hot Syms) │ │ • Compute confidence score │ │ │ └─────────────┘ │ │ │ │ └──────────────────┬──────────────────┘ │ │ ┌─────────────┐ │ │ │ │ Exceptions │──┐ │ │ │ │ (waivers) │ │ ▼ │ │ └─────────────┘ │ ┌─────────────────────────────────────┐ │ │ │ │ │ │ │ ┌─────────────┐ │ │ GATE EVALUATOR │ │ │ │ Unknowns │──┼──────────►│ │ │ │ │ (budget) │ │ │ Gate 1: MinimumConfidence │ │ │ └─────────────┘ │ │ Gate 2: ReachabilityRequirement │ │ │ │ │ Gate 3: UnknownsBudget │ │ │ ┌─────────────┐ │ │ Gate 4: SeverityThreshold │ │ │ │ Policy │──┘ │ │ │ │ │ (rules) │ └──────────────────┬──────────────────┘ │ │ └─────────────┘ │ │ │ │ │ │ ▼ │ │ ┌─────────────────────────────────────┐ │ │ │ │ │ │ │ VERDICT BUILDER │ │ │ │ │ ┌────────┐ │ │ │ Aggregate gate results: │ │ │ │ │ │ • Any FAIL → FAIL │──►│ VERDICT│ │ │ │ • Any WARN → WARN │ │ │ │ │ │ • All PASS → PASS │ │ (DSSE) │ │ │ │ │ │ │ │ │ │ Generate explain trace │ └────────┘ │ │ │ │ │ │ └─────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────┘ ``` --- ## 7. Data Contracts Summary ### 7.1 Input Data Structures ```typescript // SBOM Input interface SbomInput { format: 'cyclonedx' | 'spdx'; version: string; components: Component[]; dependencies: Dependency[]; metadata: SbomMetadata; } // Advisory Input interface AdvisoryInput { source: 'nvd' | 'ghsa' | 'osv' | 'oval'; id: string; // CVE-2021-23337 severity: Severity; affected_packages: AffectedRange[]; fixed_versions?: string[]; references: Reference[]; } // VEX Input interface VexInput { format: 'openvex' | 'csaf' | 'cyclonedx-vex'; issuer: string; trust_level: number; // 0.0-1.0 statements: VexStatement[]; } // Reachability Input interface ReachabilityInput { state: ReachabilityState; // 8-state enum evidence: { static_paths?: CallPath[]; runtime_observations?: RuntimeObservation[]; binary_match?: BinaryMatchResult; }; confidence: number; } // Runtime Input interface RuntimeInput { image_digest: string; hot_symbols: HotSymbol[]; runtime_posture: RuntimePosture; observation_window: TimeRange; } ``` ### 7.2 Output Data Structures ```typescript // Policy Verdict interface PolicyVerdict { scan_id: string; verdict: 'PASS' | 'WARN' | 'FAIL' | 'SKIP'; timestamp: string; // ISO-8601 UTC findings: EvaluatedFinding[]; summary: { total_findings: number; by_verdict: Record; by_severity: Record; confidence_distribution: Distribution; }; explain_trace: ExplainTrace; attestation: DsseEnvelope; } // Evaluated Finding interface EvaluatedFinding { finding_id: string; cve: string; package: string; // PURL verdict: 'PASS' | 'WARN' | 'FAIL' | 'SKIP'; evidence: { severity: SeverityEvidence; reachability: ReachabilityEvidence; vex: VexEvidence; runtime: RuntimeEvidence; exception: ExceptionEvidence; }; confidence: { score: number; // 0-100 factors: ConfidenceFactors; }; gate_results: GateResult[]; k4_value: K4Value; // Unknown, True, False, Both } ``` --- ## 8. Related Documentation - [Policy Evaluation Flow](../../flows/04-policy-evaluation-flow.md) - Policy evaluation sequence - [SBOM Generation Flow](../../flows/03-sbom-generation-flow.md) - SBOM creation process - [Reachability Drift Alert Flow](../../flows/19-reachability-drift-alert-flow.md) - Runtime drift detection - [Risk Score Dashboard Flow](../../flows/18-risk-score-dashboard-flow.md) - Risk aggregation - [Module Matrix](module-matrix.md) - Complete module inventory - [Scanner Architecture](../../modules/scanner/architecture.md) - Scanner module dossier - [Policy Architecture](../../modules/policy/architecture.md) - Policy engine dossier - [Signals Architecture](../../modules/signals/architecture.md) - Runtime observation