Inferensys

Prompt

Container Image Vulnerability Triage Prompt

A practical prompt playbook for platform security teams using LLMs to triage container image scan results by assessing runtime reachability and prioritizing findings based on actual exposure rather than raw CVSS scores.
Operations team reviewing AI vendor onboarding platform on laptop, forms and contracts visible, casual office workspace.
PROMPT PLAYBOOK

When to Use This Prompt

Define the triage job, the ideal user, required inputs, and the boundaries where this prompt should not be applied.

This prompt is designed for platform security engineers and DevSecOps teams who receive a high volume of container image vulnerability scan results and need to separate signal from noise. The core job-to-be-done is to move beyond raw CVSS scores by assessing whether a vulnerable package is actually reachable in the running container's execution path. Use this prompt when you have a container image scan output (from tools like Trivy, Grype, or Snyk) and need a structured, runtime-informed prioritization list that accounts for entrypoint processes, network exposure, and loaded libraries. The ideal user has access to both the scan JSON and runtime context—such as a running process list, open port mapping, or filesystem mount details—to feed into the analysis.

Do not use this prompt when you lack runtime context and are working solely from a static image scan. Without process lists, network bindings, or filesystem usage data, the model cannot reliably assess reachability and will default to raw CVSS ranking, which defeats the purpose. Similarly, avoid this prompt for images that are not yet deployed or for which you cannot obtain a docker inspect or equivalent runtime snapshot. This prompt is also inappropriate for compliance-only workflows where every CVE must be patched regardless of exploitability; it is a prioritization tool, not a compliance checklist generator. For regulated environments, always route the final triage output through a human reviewer before closing findings.

Before using this prompt, gather the following inputs: (1) the raw vulnerability scan report in JSON format, (2) the output of ps aux or equivalent from a running container instance, (3) a list of listening ports and their associated processes, and (4) any known constraints such as network policies or seccomp profiles that limit exploitability. The prompt template expects these as structured inputs and will produce a ranked table with exploitability assessments. Next step: copy the prompt template from the following section, populate the placeholders with your scan and runtime data, and run it against a model that supports structured JSON output. Validate the results against a small set of manually triaged findings before scaling to your full image fleet.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Container Image Vulnerability Triage Prompt works, where it fails, and the operational prerequisites for production use.

01

Good Fit: Runtime Reachability Analysis

Use when: You have a container image scan (e.g., Trivy, Grype, Snyk) and can pair it with runtime evidence such as a Software Bill of Materials (SBOM) or a running process tree. Guardrail: The prompt is designed to downgrade vulnerabilities in packages that are never loaded or executed. Without runtime context, it will default to a conservative, raw CVSS-based assessment.

02

Bad Fit: Zero Runtime Context

Avoid when: The only input is a raw vulnerability list with no data on installed packages, running processes, or entrypoint configuration. Guardrail: In this scenario, the model cannot perform reachability analysis and will likely hallucinate a runtime profile. The workflow should branch to a standard CVSS prioritization prompt instead.

03

Required Inputs: Scan Data + SBOM + Process Tree

What to watch: Missing or stale inputs are the primary cause of incorrect triage. Guardrail: The prompt template requires three explicit placeholders: [SCAN_RESULTS], [SBOM], and [RUNTIME_PROCESSES]. Implement a pre-flight check in your harness that validates all three are non-empty before calling the model.

04

Operational Risk: False Negatives on Dormant Code

Risk: A package is not currently running but could be triggered by a specific request or configuration change, leading to a downgraded vulnerability that is actually exploitable. Guardrail: The prompt instructs the model to flag any downgraded finding with a 'conditional risk' tag. Your pipeline must route these to a human review queue rather than auto-closing them.

05

Operational Risk: Base Image Drift

Risk: The SBOM was generated at build time, but the running container has since had packages updated or added via an entrypoint script. Guardrail: The prompt includes a [IMAGE_AGE_HOURS] variable. If the image age exceeds your threshold, the model is instructed to increase uncertainty and recommend a fresh scan before finalizing the triage.

06

Integration Pattern: CI/CD Gating vs. Continuous Monitoring

Use when: You need a pre-deployment gate (block critical reachable vulns) or a continuous monitoring ticket (ranked backlog). Guardrail: The prompt's [OUTPUT_SCHEMA] includes a deployment_decision field (BLOCK, WARN, ALLOW). Your harness must enforce this decision programmatically; never rely on a human to read the JSON in a log.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for triaging container image scan results by assessing runtime reachability and prioritizing findings based on actual exposure.

This template is designed to be wired directly into a CI/CD or security pipeline. It takes the raw output from a container image scanner (like Trivy, Grype, or Snyk) and combines it with a runtime reachability analysis to move beyond raw CVSS scores. The goal is to reduce alert fatigue by focusing remediation efforts on vulnerabilities in packages that are actually loaded and executed, not just present in the image manifest. The prompt instructs the model to act as a security analyst, cross-referencing a vulnerability list with a runtime profile to produce a prioritized, evidence-backed triage report.

markdown
You are a senior platform security engineer triaging container image vulnerabilities. Your task is to analyze a list of vulnerabilities found in a container image and determine which ones pose a genuine runtime risk.

You will be provided with two pieces of data:
1.  **VULNERABILITY_LIST:** A JSON array of objects from a container scanner. Each object contains `VulnerabilityID`, `PkgName`, `InstalledVersion`, `FixedVersion`, `Severity` (from the scanner, e.g., CRITICAL, HIGH), `CVSS` score, and a `Description`.
2.  **RUNTIME_PROFILE:** A JSON object detailing the packages and binaries that are actually loaded or executed in a running instance of this container. It includes a list of `LoadedPackages` and `ExecutedBinaries`.

**Your Task:**
For each vulnerability in the VULNERABILITY_LIST, determine if the vulnerable package is reachable based on the RUNTIME_PROFILE. A package is reachable if it appears in `LoadedPackages` or if any of its binaries are in `ExecutedBinaries`.

**Output Instructions:**
Produce a JSON object with the following structure. Do not include any text outside the JSON object.

[OUTPUT_SCHEMA]
{
  "triage_report": [
    {
      "vulnerability_id": "string",
      "package_name": "string",
      "cvss_score": number,
      "scanner_severity": "string",
      "runtime_reachable": boolean,
      "reachability_evidence": "string", // Explain why it is or is not reachable, referencing the RUNTIME_PROFILE.
      "effective_severity": "string", // One of: CRITICAL, HIGH, MEDIUM, LOW, INFO. Downgrade non-reachable CRITICAL/HIGH vulns to LOW.
      "remediation_priority": number // 1 (highest) to 5 (lowest). Priority 1 is for reachable CRITICAL vulns. Priority 5 is for non-reachable INFO vulns.
    }
  ],
  "summary": {
    "total_vulnerabilities": number,
    "reachable_critical_count": number,
    "reachable_high_count": number,
    "requires_immediate_action": boolean // True if any reachable CRITICAL vulnerability exists.
  }
}

[CONSTRAINTS]
- Base your analysis strictly on the provided VULNERABILITY_LIST and RUNTIME_PROFILE. Do not infer or assume other information.
- If the RUNTIME_PROFILE is empty or missing, set `runtime_reachable` to false for all vulnerabilities and add a warning to the `summary`.
- If a vulnerability is not reachable, its `effective_severity` must be downgraded to LOW, regardless of the CVSS score.
- Sort the `triage_report` array by `remediation_priority` in ascending order (most critical first).

---

[VULNERABILITY_LIST]
{{VULNERABILITY_LIST_JSON}}

[RUNTIME_PROFILE]
{{RUNTIME_PROFILE_JSON}}

To adapt this template, replace the {{VULNERABILITY_LIST_JSON}} and {{RUNTIME_PROFILE_JSON}} placeholders with your actual data. The VULNERABILITY_LIST should be the direct JSON output from your scanning tool, and the RUNTIME_PROFILE can be generated by tools like syft packages, a custom eBPF-based agent, or a dynamic analysis step in your CI pipeline. If you lack a runtime profile, you must modify the prompt's logic to avoid downgrading all findings; instead, you might instruct the model to prioritize based on known exploitability or network exposure. Always validate the model's JSON output against the provided schema before allowing it to pass to the next stage of your workflow, as a malformed JSON response could break automated ticket creation.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional inputs for the Container Image Vulnerability Triage Prompt. Validate these before calling the model to prevent runtime errors and ensure the model has enough context to assess reachability.

PlaceholderPurposeExampleValidation Notes

[SCAN_RESULTS_JSON]

Raw vulnerability scan output in machine-readable format

{"Results":[{"Vulnerabilities":[{"VulnerabilityID":"CVE-2023-44487","PkgName":"libnghttp2","InstalledVersion":"1.52.0","FixedVersion":"1.55.1","Severity":"HIGH","Status":"fixed"}]}]}

Must be valid JSON. If empty or null, abort and request scan data. Validate against expected scanner schema (Trivy, Grype, Snyk).

[IMAGE_MANIFEST]

Container image metadata including base image, layers, and entrypoint

{"BaseImage":"alpine:3.18","Entrypoint":["/usr/local/bin/myapp"],"ExposedPorts":["8080"],"EnvVars":["PATH=/usr/local/bin"]}

Must include entrypoint or CMD. If missing, set reachability assessment confidence to LOW. Validate that manifest matches the image digest in scan results.

[RUNTIME_BEHAVIOR]

Observed or intended runtime behavior: network listeners, file access patterns, executed binaries

{"ListeningPorts":["8080"],"ExecutedBinaries":["/usr/local/bin/myapp","/bin/sh"],"FileAccess":["/etc/myapp/config.yaml"],"NetworkEgress":["api.internal:443"]}

Optional but strongly recommended. If null, the model must assume worst-case reachability. Validate that executed binaries match packages in scan results.

[DEPLOYMENT_CONTEXT]

Environment where the container runs: cluster type, network policy, privilege level

{"Orchestrator":"Kubernetes","Privileged":false,"ReadOnlyRootFilesystem":true,"NetworkPolicy":"deny-all-egress-except-approved","ExposedToInternet":false}

Optional. If null, model must assume public internet exposure and privileged execution. Validate boolean fields are true/false, not strings.

[PRIORITY_THRESHOLDS]

Organization-specific severity and exposure thresholds for escalation

{"AutoEscalateCVSS":8.0,"AutoEscalateExposure":["internet-facing","privileged"],"IgnorePackages":["curl","vim"],"IgnoreSeveritiesBelow":"MEDIUM"}

Optional. If null, use default thresholds (CVSS >= 7.0, internet-facing, privileged). Validate that IgnorePackages list does not suppress critical infrastructure packages.

[PREVIOUS_TRIAGE_STATE]

Prior triage decisions for this image to detect regressions and suppress known false positives

{"PreviouslyAcceptedRisks":["CVE-2023-44487"],"PreviouslyMitigated":["CVE-2023-38545"],"LastScanDigest":"sha256:abc123"}

Optional. If provided, validate that LastScanDigest differs from current scan digest, otherwise skip duplicate triage. Cross-reference accepted risks against current findings to suppress re-alerting.

[OUTPUT_SCHEMA]

Expected output structure for downstream vulnerability management system

{"format":"json","requiredFields":["finding_id","cve_id","package","reachable","exploitability_rating","escalate","remediation","confidence"],"confidenceEnum":["HIGH","MEDIUM","LOW"]}

Required. Validate that requiredFields match downstream system contract. If format is json, enforce strict schema compliance in eval. If csv, validate column ordering.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Container Image Vulnerability Triage Prompt into a secure, auditable CI/CD pipeline.

This prompt is designed to be integrated into a DevSecOps pipeline, not used as a one-off chat. The core workflow ingests a container image scan report (typically from tools like Trivy, Grype, or Snyk) and a runtime reachability analysis (from tools like Slim, Syft/Grype's cataloger, or a custom eBPF agent). The application layer must orchestrate these two data fetches, assemble the prompt, and parse the structured JSON output to update a vulnerability management system (e.g., DefectDojo, Jira, or a custom security dashboard). The model's primary job is to correlate static findings with runtime evidence and downgrade or escalate severity based on actual exposure, not just theoretical CVSS scores.

The implementation harness must enforce a strict contract. Before calling the LLM, validate that the [SCAN_REPORT] contains the required fields (VulnerabilityID, PkgName, InstalledVersion, FixedVersion, Severity) and that the [RUNTIME_EVIDENCE] provides a boolean or probabilistic assessment of package reachability. After the LLM call, validate the output JSON against a defined schema. If the model fails to produce valid JSON or omits required fields like effective_severity or rationale, implement a retry loop (maximum 2 retries) with a repair prompt that includes the validation error. If retries are exhausted, log the raw output and flag the image for manual triage. For high-risk deployments, route all CRITICAL effective severities to a human approval queue before allowing the pipeline to proceed.

Model choice matters here. This task requires strong instruction-following and structured output capabilities. A capable model like Claude 3.5 Sonnet or GPT-4o is recommended. Set the temperature low (0.0-0.1) to maximize deterministic, fact-based reasoning. Do not enable web browsing or other tools; the model must reason strictly from the provided [SCAN_REPORT] and [RUNTIME_EVIDENCE]. Log every prompt and response pair, including the model version, for auditability. This log becomes critical evidence for compliance reviews (e.g., SOC 2, FedRAMP) to demonstrate that vulnerability triage follows a consistent, documented process. Finally, avoid the anti-pattern of sending raw, unredacted scan reports that may contain internal image names or registry URLs to an external model endpoint without a data loss prevention (DLP) review.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when triaging container image vulnerabilities with LLMs and how to guard against it.

01

Reachability Hallucination

What to watch: The model asserts a vulnerable package is unreachable without evidence, or invents a call path that doesn't exist. This is the most dangerous failure mode because it downgrades exploitable vulnerabilities. Guardrail: Require the model to cite specific file paths and function names from the image manifest or runtime analysis tool output. If no evidence exists, the default must be 'potentially reachable' and escalated for human review.

02

CVSS Score Anchoring

What to watch: The model overweights the raw CVSS base score and ignores runtime context, exploitability conditions, and environmental factors. A 9.8 in a non-routable internal library gets the same urgency as an exposed service. Guardrail: Explicitly instruct the model to produce a separate 'runtime exposure score' that considers network accessibility, running process context, and configuration. Validate that high CVSS findings with low exposure are correctly downgraded in priority.

03

Stale Scan Data Misinterpretation

What to watch: The model treats all findings in a scan report as current, failing to recognize that a fix was already applied in a newer base image layer or that the vulnerable package was removed in a subsequent build. This creates noise and wastes engineering cycles. Guardrail: Always provide the image digest, layer history, and build timestamp alongside the scan results. Instruct the model to cross-reference the finding's package version against the final layer manifest before assigning priority.

04

Vendor Advisory Over-Trust

What to watch: The model parrots the vendor's severity rating or remediation advice without questioning whether it applies to the specific container's stripped-down OS. A 'critical' fix for a desktop component may be irrelevant. Guardrail: Ground the prompt with a policy that vendor advisories are advisory only. Require the model to map the advisory's affected component list to the actual installed packages in the image and flag mismatches.

05

Output Format Drift Under Load

What to watch: When processing large scan reports with hundreds of findings, the model drops fields, truncates JSON, or reverts to prose instead of the required structured output schema. This breaks downstream automation. Guardrail: Implement a strict JSON schema validator in the application layer. If validation fails, retry with a smaller batch of findings. Use a separate classification step to split findings into 'requires deep analysis' and 'bulk triage' batches to control context size.

06

Exploitability Assumption Without Exploit Maturity

What to watch: The model assumes a vulnerability is exploitable simply because a CVE exists, ignoring whether public exploit code is available, the attack vector is remote, or user interaction is required. This inflates urgency. Guardrail: Include exploit maturity data (e.g., EPSS score, CISA KEV status, exploit-db references) in the input context. Instruct the model to produce a separate 'exploitability confidence' rating that is low unless confirmed exploit code or active exploitation evidence is present.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for testing the Container Image Vulnerability Triage Prompt before deployment. Each row defines a pass standard, a failure signal, and a concrete test method. Use this rubric to calibrate the prompt against a golden dataset of scanner findings with known runtime reachability outcomes.

CriterionPass StandardFailure SignalTest Method

Runtime Reachability Classification

Correctly labels a vulnerable package as reachable or unreachable in >= 90% of test cases where ground truth is known from runtime analysis tools

Misclassifies an unreachable package as reachable (false positive) or a reachable package as unreachable (false negative) in > 10% of cases

Compare prompt output labels against a golden dataset of 50 scanner findings with verified runtime reachability determined by eBPF or process tracing

Severity Re-ranking Accuracy

Re-assigns severity based on runtime exposure such that no Critical/High finding is downgraded without an explicit, verifiable reachability justification

Downgrades a Critical or High CVE to Medium or Low without citing specific evidence that the vulnerable code path is unreachable at runtime

Audit 20 downgraded findings for the presence of a reachability rationale that references a specific code path, library load, or network exposure fact

False Positive Suppression

Correctly identifies and recommends suppression for >= 85% of scanner findings that are known false positives in the test environment

Fails to flag a known false positive for suppression, or recommends suppression for a true positive with runtime reachability

Run the prompt against a set of 30 findings pre-labeled as true positive or false positive by a security engineer; measure precision and recall of suppression recommendations

Evidence Grounding

Every reachability determination includes a specific, verifiable evidence snippet from the provided scan context or runtime manifest

Output contains a reachability claim with no supporting evidence, or cites evidence not present in the input context

Parse the output for each finding and confirm that the evidence field maps to a string present in the [SCAN_RESULTS] or [RUNTIME_MANIFEST] input

Output Schema Compliance

Output is valid JSON matching the [OUTPUT_SCHEMA] on the first generation attempt for >= 95% of test runs

Output is missing required fields, contains extra fields not in the schema, or uses incorrect types for fields like severity or confidence

Validate output with a JSON Schema validator programmatically; run 100 test cases and measure first-pass validity rate

Confidence Calibration

Confidence scores correlate with correctness: high-confidence outputs are correct >= 90% of the time; low-confidence outputs are correct <= 70% of the time

High-confidence outputs are frequently wrong, or low-confidence outputs are nearly always correct, indicating miscalibration

Bucket outputs by confidence score (0.0-0.3, 0.4-0.7, 0.8-1.0) and compute accuracy within each bucket against ground truth labels

Abstention on Missing Data

Prompt returns a confidence score below 0.5 and sets needs_human_review to true when runtime manifest data is absent or insufficient for a reachability determination

Prompt assigns high confidence and a definitive reachability label when the [RUNTIME_MANIFEST] field is empty or contains no process or network data

Run the prompt with the [RUNTIME_MANIFEST] field set to null or an empty object and verify that all findings have confidence < 0.5 and needs_human_review set to true

Latency and Token Efficiency

Prompt processes a batch of 20 findings within 30 seconds and uses fewer than 4000 output tokens on average

Prompt exceeds 60 seconds for a 20-finding batch or produces verbose output exceeding 8000 tokens with redundant text

Measure end-to-end latency and token usage over 10 runs with a fixed batch of 20 findings; compute mean and p95

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Add strict JSON output schema validation, retry logic for malformed outputs, and structured logging of every triage decision. Wire the prompt into a pipeline that feeds [RUNTIME_PROFILE] (from tools like Syft/Grype with reachability data or a running container's /proc/*/maps) alongside [SCANNER_OUTPUT]. Include a confidence score per finding and require the model to cite the specific evidence (e.g., "binary at /app/bin not in running process maps").

Watch for

  • Silent format drift when scanner output changes shape
  • Missing human review gate for escalated findings
  • Model conflating "package installed" with "package reachable"
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.