Inspector v2 Finding Troubleshooter
An AWS CloudOps agent skill that diagnoses Amazon Inspector v2 findings
through a finding-type-driven decision tree. The skill walks each finding
to its root cause — vulnerable package, exposed port, Lambda code defect,
stale Lambda layer — with verify commands, emits remediation per type
(patch via SSM, restrict SGs, rebuild ECR images, update Lambda layers,
fix code), and surfaces SBOM export, Lambda layer scanning, ECR image
scanning, and the latest Inspector code scanning for Lambda features.
What this skill does
Classifies an Inspector v2 finding by type (network reachability, package
vulnerability, code vulnerability), severity (Critical/High/Medium/Low),
resource (EC2, ECR, Lambda, ECR repository), walks a type-specific
diagnostic tree to the vulnerable artifact, emits a ROOT_CAUSE_FOUND
verdict with the specific finding type, the vulnerable package / CVE /
port / code location, and the remediation path. Validates SBOM export,
Lambda layer scanning, and Inspector code scanning outputs.
STRICT output contract
When this skill is invoked with an Inspector finding (finding ARN,
finding JSON, CVE id, or a resource ARN flagged by Inspector), the agent
MUST respond with the diagnostic block defined in §"Output format" using
the literal all-caps labels TARGET:, VERDICT:, REASON:, FINDING_TYPE:,
SEVERITY:, EVIDENCE:, REMEDIATION:, and CONFIRM:. Do NOT preface
the block with prose, headings, or disclaimers — emit the block as the
first lines of the response. This contract is what assertion-based evals
and downstream remediation pipelines rely on; deviating from the literal
labels breaks automation silently.
Mindset
One-line takeaway: an Inspector finding is a symptom, not a root
cause. The CVE names the vulnerability; the root cause is why the
vulnerable artifact is present — an unpatched package, an unintended
security group, a stale Lambda layer, an inherited base image. Treat the
finding as the entry point, not the conclusion.
Finding type drives the diagnostic. Reachability → SG/NAU/IGW.
Package → package managers (yum, apt, npm, pip, gem, go), SBOM,
base image. Code → SAST rule, source line. Wrong type → wasted cycle.
Severity drives the SLA, not the root cause. A Critical finding
gets the page; the walk is identical. Do NOT skip evidence because
the severity is Critical — false-positive Criticals are common (the
vulnerable code path may be unreachable). Always verify with a probe.
The resource is not always the right place to fix. A Lambda CVE
is fixed at the layer or deployment package, not the function.
An ECR CVE is fixed by rebuilding the image, not patching the
running container. The skill routes the fix to the right layer.
Philosophy
The finding JSON carries the root-cause signal. The Type,
Title, Resources, PackageVulnerability (CVE, package, version,
fixed-in), NetworkReachability (port, protocol, CIDR), or
CodeVulnerability (file, line, snippet) block is the primary
diagnostic surface. Operators who "see the CVE but don't know what to
do" have often not read the full JSON — batch-get-finding-details
first.
Inspector scans at scan time, not real-time. A finding may be
stale: the package was already patched, the SG already restricted,
the Lambda layer already updated. Verify against current state before
recommending remediation. A finding lastObservedAt > 24h may
already be fixed.
Reachability findings are topology problems, not package problems.
The fix is in the SG/NAU/IGW chain — restrict the SG, remove a public
IP, add a NAT gateway, or isolate. Patching the resource's software
does NOT close a reachability finding.
Lambda code scanning findings need code fixes, not package updates.
Inspector code scanning for Lambda (2024-2025) flags source defects
(injection, hardcoded secrets, path traversal, weak crypto). The fix
is in the application code. The skill reads the CodeSnippet from
batch-get-code-snippets to pinpoint the line.
Quick navigation
| If the symptom is... |
Go to |
First probe |
PackageVulnerability finding on EC2 |
Step 2a |
list-inventory-entries for the CVE'd package |
PackageVulnerability finding on ECR |
Step 2b |
describe-image-scan-findings for the image |
PackageVulnerability finding on Lambda |
Step 2c |
get-function-configuration for layers + runtime |
NetworkReachability finding on EC2 |
Step 3a |
describe-security-groups for the flagged port |
NetworkReachability with IGW path |
Step 3b |
describe-route-tables + describe-network-interfaces |
CodeVulnerability finding on Lambda |
Step 4 |
batch-get-code-snippets for the source line |
| Critical CVE without fixed-in version |
Step 2d |
upstream CVE database, vendor advisory |
| SBOM export shows vulnerable package |
Step 5 |
list-sbom-export + parse CycloneDX/SPDX |
Finding lastObservedAt > 24h ago |
Step 6 |
rescan or check current state |
| Need the finding JSON format and fields |
Reference |
references/finding-types-reference.md |
Pre-flight: finding classification and gather-info gate
Before running type-specific probes, gather the canonical finding JSON,
the resource metadata, and the Inspector coverage status. Misclassifying
the finding type (package vs reachability vs code) produces false root
causes and wrong remediation.
Account-wide pre-flight commands
All pre-flight commands (read-only): see references/diagnostic-commands.md § Pre-flight.
Finding-type short-circuit
Type field |
Effect on diagnosis |
PACKAGE_VULNERABILITY |
Package CVE. Look at PackageVulnerability block: CVE id, package name, vulnerable range, fixed-in version. Resource type (EC2, ECR, Lambda) determines the patch surface. |
NETWORK_REACHABILITY |
Reachability. Look at NetworkReachability block: port, protocol, CIDR, scope (INTERNET / INTERNAL). The SG/NAU/IGW chain is the fix surface, not packages. |
CODE_VULNERABILITY |
Lambda code defect. Look at CodeVulnerability block: rule id, file path, line number, snippet. Source-level fix is required. Lambda-only. |
LAMBDA_CODE_VULNERABILITY |
Lambda code defect (alt label). Same handling as CODE_VULNERABILITY. |
| Mixed / unknown |
Pull batch-get-finding-details and read the full JSON before classifying. |
Severity short-circuit
| Severity |
SLA guidance |
Diagnostic change |
Critical |
Page / hours |
Same root-cause walk; do NOT skip evidence. Verify against current state to rule out false positives. |
High |
Same-day remediation |
Same walk. |
Medium |
Week |
Same walk; batch with other findings. |
Low |
Backlog |
Same walk; may be acceptable risk. |
Informational |
No SLA |
SBOM or coverage metadata — usually not a remediation target. |
If the input is malformed (missing finding ARN, missing resource ARN,
ambiguous finding type, CVE id without a package name), emit VERDICT: NEED_MORE_INFO with FINDING_TYPE: UNKNOWN and list the specific
missing fields. Re-prompt for: (1) the finding ARN or full JSON from
batch-get-finding-details, (2) the resource ARN (EC2/ECR/Lambda), and
(3) the time window of the finding's last observation.
Process — Diagnostic decision tree (apply in finding-type order)
The diagnostic tree is finding-type-driven. Pick the entry point based on
the finding Type, then walk the type-specific probes in order. Each
layer ends with either a positive root-cause confirmation (failing probe
that matches the symptom) or a pass that moves to the next layer. Never
emit ROOT_CAUSE_FOUND without a failing probe that matches the finding.
Step 0: Non-obvious behaviours that change diagnosis
Stale findings, exploitability conditions, layer-trace gotchas,
auto-close behaviour, redacted snippets — see
references/advanced-patterns.md § Step 0.
Step 1: Finding entry — pick the diagnostic branch
Map the finding Type to a branch and jump to that branch's section.
| Type |
Branch |
PACKAGE_VULNERABILITY |
Step 2 |
NETWORK_REACHABILITY |
Step 3 |
CODE_VULNERABILITY / LAMBDA_CODE_VULNERABILITY |
Step 4 |
| Ambiguous / multi-finding |
Step 1b |
Step 1b: Gather the full finding JSON (when the type is ambiguous)
Command: see references/diagnostic-commands.md § Step 1b.
The response includes the full finding JSON. Read Type, Title,
Description, and the type-specific block before classifying.
Step 2: Package vulnerability — diagnose the vulnerable package
2a: Package CVE on EC2 instance
Probes: see references/diagnostic-commands.md § Step 2a.
Verdict signals:
list-inventory-entries shows the package in the CVE's vulnerable
range, AND fixedInVersion is in the patch baseline →
ROOT_CAUSE_FOUND, LAYER: EC2_OS_PACKAGE. Remediation: SSM Run
Command AWS-RunPatchBaseline or AWS-InstallMissingUpdates.
- Instance NOT SSM-managed (no inventory) → NEED_MORE_INFO;
operator must enable SSM agent or patch manually.
- Package version already >=
fixedInVersion → finding is stale.
ROOT_CAUSE_FOUND, LAYER: STALE_FINDING. Will auto-close on
rescan.
2b: Package CVE on ECR image
Probes: see references/diagnostic-commands.md § Step 2b.
Verdict signals:
- CVE present and image is referenced by a running task →
ROOT_CAUSE_FOUND,
LAYER: ECR_BASE_IMAGE. Remediation: rebuild
with a patched base (FROM in Dockerfile), push, redeploy the task.
- Image old and not referenced by any running task →
LAYER: STALE_IMAGE. Remediation: delete (batch-delete-image) or
accept the risk; no running exposure.
- Vulnerable package is an application dependency (not the base image)
→ fix in the lockfile (
package-lock.json, requirements.txt).
2c: Package CVE on Lambda function
Probes: see references/diagnostic-commands.md § Step 2c.
Verdict signals:
- Layer version older than the patched version →
ROOT_CAUSE_FOUND,
LAYER: LAMBDA_LAYER. Remediation: publish a
new layer version with the patched dependency; update the function.
- CVE in the deployment package (not a layer) →
LAYER: LAMBDA_DEPLOYMENT_PACKAGE. Remediation: rebuild the zip
with patched deps, update-function-code.
- CVE in the runtime itself (e.g.,
nodejs20.x) →
LAYER: LAMBDA_RUNTIME. Remediation: update the function runtime;
AWS manages runtime patches.
2d: CVE without a fixed-in version
If PackageVulnerability.fixedInVersion is empty or null, the CVE has
no upstream fix yet. ROOT_CAUSE_FOUND,
FINDING_TYPE: PACKAGE_VULNERABILITY, LAYER: NO_FIX_AVAILABLE.
Remediation options: suppress the finding if not exploitable, isolate
the resource (restrict SGs, move to private subnet), or apply a
vendor mitigation (config change, WAF rule). Escalate to the package
maintainer.
Step 3: Network reachability — diagnose the exposed port
3a: SG rule exposes the flagged port
Probes: see references/diagnostic-commands.md § Step 3a.
Verdict signals:
- SG allows
0.0.0.0/0 on the flagged port →
ROOT_CAUSE_FOUND, LAYER: SG_OVERLY_PERMISSIVE. Remediation:
restrict the SG to a referenced SG or specific CIDR.
- SG allows a broad corporate CIDR (
10.0.0.0/8) →
LAYER: SG_BROAD_CIDR. Remediation: scope to the subnet or SG.
- SG already scoped → finding may be stale or via another path. Step 3b.
3b: IGW route exposes the resource publicly
Probes: see references/diagnostic-commands.md § Step 3b.
Verdict signals:
- Instance has a public IP and the subnet route table has a
0.0.0.0/0
→ an IGW → ROOT_CAUSE_FOUND, LAYER: PUBLIC_IP_VIA_IGW.
Remediation: remove the public IP, move behind NAT/ALB, restrict SG.
- Private subnet but SG allows
0.0.0.0/0 → reachability is INTERNAL
(the finding scope field distinguishes). Scope the SG regardless.
Step 4: Lambda code vulnerability — diagnose the source defect
Probes: see references/diagnostic-commands.md § Step 4.
Verdict signals:
batch-get-code-snippets returns a snippet matching the rule (e.g.,
child_process.exec for command injection, hardcoded AWS key,
fs.readFile(req.query.path) for path traversal) →
ROOT_CAUSE_FOUND, FINDING_TYPE: CODE_VULNERABILITY,
LAYER: LAMBDA_SOURCE_DEFECT. Remediation: fix the source code
(sanitize input, remove hardcoded secret, validate path); redeploy
the function.
- Snippet is
REDACTED but the rule id + filePath identify the issue
(e.g., rule JS-DANGEROUS-SDK-USAGE, file handler.js) → same
verdict; operator must open the file manually.
Step 5: SBOM export integration
Probes: see references/diagnostic-commands.md § Step 5.
Verdict signals:
- SBOM export maps the CVE'd package to multiple resources →
ROOT_CAUSE_FOUND,
LAYER: SBOM_SCOPE. Remediation: patch every
resource in the SBOM that has the vulnerable package version;
prioritize by severity and exposure.
Step 6: Staleness check — finding already fixed
Probes: see references/diagnostic-commands.md § Step 6.
Verdict signals:
- Finding
State: OPEN but current package version >= fixedInVersion
→ finding is stale; will close on next rescan.
ROOT_CAUSE_FOUND, LAYER: STALE_FINDING. Remediation: trigger
rescan or wait for the next cycle; no action needed.
- Finding
State: CLOSED → already resolved; no action.
Step 7: Escalate or NEED_MORE_INFO
If none of the above produced a positive root-cause match, OR the
finding is from a new Inspector detector without a documented
remediation path, emit one of:
- ESCALATE — AWS-side Inspector issue (e.g., a false-positive CVE
that Inspector will not suppress, a code-vulnerability rule that
fires on safe code). Surface the finding ARN, the rule id, and open
a Support case.
- NEED_MORE_INFO — A specific probe requires operator input. List
the missing pieces (SSM agent not enabled, ECR scan not configured,
Lambda layer ARN unknown) and the next probe to run once the info is
available.
Output format
TARGET: <resource-arn>
VERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE
REASON: <1-2 sentences naming the finding type, the vulnerable artifact,
and the failing probe that confirmed the cause>
FINDING_TYPE: <PACKAGE_VULNERABILITY | NETWORK_REACHABILITY |
CODE_VULNERABILITY | UNKNOWN>
SEVERITY: <CRITICAL | HIGH | MEDIUM | LOW | INFORMATIONAL>
LAYER: <EC2_OS_PACKAGE | ECR_BASE_IMAGE | LAMBDA_LAYER |
LAMBDA_DEPLOYMENT_PACKAGE | LAMBDA_RUNTIME |
LAMBDA_SOURCE_DEFECT | SG_OVERLY_PERMISSIVE | SG_BROAD_CIDR |
PUBLIC_IP_VIA_IGW | SBOM_SCOPE | NO_FIX_AVAILABLE |
STALE_FINDING | STALE_IMAGE | UNKNOWN>
EVIDENCE:
- <observed finding — type, CVE, severity, last-observed time>
- <failing probe — command and its output that confirms the cause>
- <passing probes — layers ruled out>
REMEDIATION:
1. <specific action with CLI command — see references/finding-types-reference.md
for copy-pasteable per-layer commands>
2. <verification command after the fix>
CONFIRM: Before executing any state-changing CLI, emit and await operator
approval: "CONFIRM: About to <action> on <resource-arn>. Proceed?
(yes/no)"
Worked example — Critical package CVE on EC2
TARGET: arn:aws:ec2:us-east-1:111:instance/i-0abc123
VERDICT: ROOT_CAUSE_FOUND
REASON: Instance i-0abc123 has openssl-3.0.7 at version 3.0.7-1.amzn2023.1
which is within CVE-2024-XXXX vulnerable range (< 3.0.8); the fixed
version 3.0.8-1.amzn2023.1 is available in the SSM Patch Baseline.
FINDING_TYPE: PACKAGE_VULNERABILITY
SEVERITY: CRITICAL
LAYER: EC2_OS_PACKAGE
EVIDENCE:
- Finding: PACKAGE_VULNERABILITY, CVE-2024-XXXX, severity CRITICAL,
lastObservedAt 2026-08-09T18:00Z.
- Probe: aws ssm list-inventory-entries --instance-id i-0abc123
--type AWS:Application --filters Key=Name,Values=openssl
returns Version: 3.0.7-1.amzn2023.1.
- Probe: aws ssm describe-patches --filters Key=PRODUCT,
Values=AmazonLinux2023 | jq '.[] | select(.CVEIds|
contains("CVE-2024-XXXX"))' returns Version: 3.0.8-1.amzn2023.1.
- Passing: instance is SSM-managed; SSM agent online; patch baseline
assigned.
REMEDIATION:
1. Apply the missing update via SSM Run Command (see references for
full command).
2. After the command completes, wait for the next Inspector scan; the
finding auto-closes when the patched version is detected.
3. Verify: aws ssm list-inventory-entries --instance-id i-0abc123
--type AWS:Application --filters Key=Name,Values=openssl
returns Version: 3.0.8-1.amzn2023.1.
CONFIRM: Before running AWS-RunPatchBaseline, emit and await:
"CONFIRM: About to apply patches on i-0abc123 (openssl 3.0.7 -> 3.0.8).
Proceed? (yes/no)"
Additional worked examples — Lambda hardcoded secret, SG overly
permissive: see references/worked-examples.md.
Finding triage priority matrix (exposure × severity): see references/advanced-patterns.md § Triage priority.
Anti-Patterns — NEVER (top 5)
NEVER declare ROOT_CAUSE_FOUND without a failing probe that matches
the finding. "Must be the package" without SSM inventory or ECR
scan output erodes trust. Every verdict needs a confirming probe.
NEVER confuse package vulnerability and reachability. A
PACKAGE_VULNERABILITY finding is fixed by patching the package;
a NETWORK_REACHABILITY finding is fixed by restricting the SG or
removing the public IP. The finding type tells you the fix surface.
NEVER recommend patching a Lambda function's runtime for a code
vulnerability. Code vulnerabilities are source defects — the fix
is in the application code. Updating the runtime does NOT close a
code finding. Read the CodeSnippet first.
NEVER manually close a finding that should auto-close on rescan.
Inspector sets State: CLOSED when a rescan confirms the issue is
resolved. Manually closing creates audit noise. Use suppression
(update-configuration → filter) ONLY for confirmed false positives.
NEVER assume a Critical CVE is exploitable without checking the
conditions. Many CVEs have conditions: only on specific OS, only
with a specific config, only if a vulnerable code path is called.
A Critical CVSS score does not mean the vulnerability is reachable.
Check the CVE description and upstream advisory first.
Additional critical mistakes: list-findings returns a summary (use
batch-get-finding-details for full JSON); never patch an ECR image in
place (rebuild); a Lambda layer CVE affects every function using the
layer ARN; never suppress without a documented reason; SBOM export is
separate from findings (use SBOM for scope, findings for action).
Pre-flight safety checks (run before any state-changing CLI)
- MANDATORY CONFIRMATION GATE. Before any state-changing operation
(
send-command, update-function-code, revoke-security-group-ingress,
batch-delete-image), emit and await operator approval.
- Read-only first. Every probe (
batch-get-finding-details,
list-inventory-entries, describe-image-scan-findings,
get-function-configuration, describe-security-groups,
list-sbom-export, batch-get-code-snippets) is read-only.
- SSM patches may require a reboot. Verify the instance has a
maintenance window or is in an ASG that handles reboots.
- Lambda updates cause a cold start on the next invocation.
- ECR image deletion is irreversible. Verify no running task uses
the image digest first.
- SG changes affect all attached instances — apply immediately.
- Inspector rescan is throttled. The next scan cycle is usually
sufficient; avoid triggering immediate rescans.
For per-layer copy-pasteable remediation commands, see
references/finding-types-reference.md.
References (load on demand)
- Diagnostic commands — read-only probes per diagnostic step
- Worked examples — full walkthroughs
- Advanced patterns — non-obvious behaviours, triage matrix, 2024-2026 features
- Finding types reference — finding JSON format and per-layer remediation
- Remediation CLI commands — copy-pasteable state-changing commands per LAYER verdict
Domain
AWS CloudOps / Inspector v2 Vulnerability Diagnostics, SBOM Integration,
Lambda Code Scanning, ECR Image Scanning, and SSM Patch Coordination.
Recent AWS features (SBOM export, Lambda code scanning, ECR enhanced scanning, deep inspection): see references/advanced-patterns.md.
AWS documentation
1---2name: inspector2-finding-troubleshooter3description: Diagnoses Amazon Inspector v2 vulnerability findings through a finding-type-driven diagnostic tree covering network reachability (unreachable ports, unintended IGW exposure, SG/NAU cascade), package vulnerability (CVE in OS packages, language ecosystems npm/pip/gem/go, Lambda layers, ECR container images), and code vulnerability (Lambda code scanning for injection, hardcoded secrets, path traversal). Walks severity (Critical/High/Medium/Low) to remediation per type (patch packages via SSM Patch Manager, fix code, restrict security groups, rebuild ECR images, update Lambda layers), integrates SBOM export, Lambda layer scanning, ECR image scanning, and the latest Inspector code scanning for Lambda and SBOM export features. Emits ROOT_CAUSE_FOUND with the specific finding type, vulnerable artifact, and remediation path. Use when an Inspector finding fires, a CVE is reported on EC2/ECR/Lambda, network reachability is flagged, SBOM export shows vulnerable packages, or Lambda code scanning reports a code vuln.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline finding classification works from pasted finding JSON and CVE metadata. Live-account diagnosis uses aws inspector2 list-findings, describe-findings, batch-get-finding-details, list-coverage, list-sbom-export, batch-get-code-snippets, aws ecr describe-images and describe-image-scan-findings, aws lambda get-function-configuration, aws ssm list-inventory-entries, aws ec2 describe-security-groups, and aws...6metadata:7 source: https://skillmd.com/skills/jhkchan/inspector2-finding-troubleshooter8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '2'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Security15 task_type: troubleshoot16 skill_class: capability17 lifecycle_status: active18 verdict_shape: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE19 version: 0.1.020 author: Jacky Chan — AWS Community Builder21 tags: aws, inspector, inspector2, vulnerability, cve, sbom, ecr-scan, lambda-scan, security, troubleshoot22 dependencies: aws-orchestrator23 keywords: aws, inspector, inspector v2, inspector2, vulnerability, CVE, network reachability, package vulnerability, code vulnerability, SBOM, software bill of materials, Lambda layer scanning, ECR image scanning, Lambda code scanning, patch management, SSM Patch Manager, security groups, SCA, SAST, cloudops, troubleshoot, security24 when_to_use: Diagnosing an Amazon Inspector v2 finding — a CVE on an EC2 instance, ECR image, or Lambda function; a network reachability finding flagging an unintended internet-exposed port; a package vulnerability in an OS package, language ecosystem (npm, pip, gem, go, maven), or Lambda layer; a code vulnerability from Inspector code scanning for Lambda (injection, hardcoded secrets, path traversal); an SBOM export showing vulnerable packages; triaging a Critical or High finding; deciding whether to patch, suppress, or restrict; or running a "what does this Inspector finding mean and how do I fix it" page where the root cause may be a stale package, an unintended SG rule, a Lambda layer rebuild, or a code fix — not necessarily the resource itself.25 when_not_to_use: Configuration posture audits (use securityhub-finding-auditor for control findings, AWS Config rule violations), Amazon Macie data classification alerts, Amazon GuardDuty threat detections (runtime threats — use guardduty-finding-troubleshooter), or AWS WAF blocks (use alb-5xx-troubleshooter step 5). This skill diagnoses Inspector scan findings (vulnerability + reachability + code), not detection services.26---2728# Inspector v2 Finding Troubleshooter2930An AWS CloudOps agent skill that diagnoses Amazon Inspector v2 findings31through a finding-type-driven decision tree. The skill walks each finding32to its root cause — vulnerable package, exposed port, Lambda code defect,33stale Lambda layer — with verify commands, emits remediation per type34(patch via SSM, restrict SGs, rebuild ECR images, update Lambda layers,35fix code), and surfaces SBOM export, Lambda layer scanning, ECR image36scanning, and the latest Inspector code scanning for Lambda features.3738## What this skill does3940Classifies an Inspector v2 finding by type (network reachability, package41vulnerability, code vulnerability), severity (Critical/High/Medium/Low),42resource (EC2, ECR, Lambda, ECR repository), walks a type-specific43diagnostic tree to the vulnerable artifact, emits a ROOT_CAUSE_FOUND44verdict with the specific finding type, the vulnerable package / CVE /45port / code location, and the remediation path. Validates SBOM export,46Lambda layer scanning, and Inspector code scanning outputs.4748## STRICT output contract4950When this skill is invoked with an Inspector finding (finding ARN,51finding JSON, CVE id, or a resource ARN flagged by Inspector), the agent52MUST respond with the diagnostic block defined in §"Output format" using53the literal all-caps labels `TARGET:`, `VERDICT:`, `REASON:`, `FINDING_TYPE:`,54`SEVERITY:`, `EVIDENCE:`, `REMEDIATION:`, and `CONFIRM:`. Do NOT preface55the block with prose, headings, or disclaimers — emit the block as the56first lines of the response. This contract is what assertion-based evals57and downstream remediation pipelines rely on; deviating from the literal58labels breaks automation silently.5960## Mindset6162**One-line takeaway:** an Inspector finding is a *symptom*, not a *root63cause*. The CVE names the vulnerability; the root cause is *why the64vulnerable artifact is present* — an unpatched package, an unintended65security group, a stale Lambda layer, an inherited base image. Treat the66finding as the entry point, not the conclusion.6768- **Finding type drives the diagnostic.** Reachability → SG/NAU/IGW.69 Package → package managers (yum, apt, npm, pip, gem, go), SBOM,70 base image. Code → SAST rule, source line. Wrong type → wasted cycle.7172- **Severity drives the SLA, not the root cause.** A Critical finding73 gets the page; the walk is identical. Do NOT skip evidence because74 the severity is Critical — false-positive Criticals are common (the75 vulnerable code path may be unreachable). Always verify with a probe.7677- **The resource is not always the right place to fix.** A Lambda CVE78 is fixed at the *layer* or *deployment package*, not the function.79 An ECR CVE is fixed by *rebuilding the image*, not patching the80 running container. The skill routes the fix to the right layer.8182## Philosophy8384- **The finding JSON carries the root-cause signal.** The `Type`,85 `Title`, `Resources`, `PackageVulnerability` (CVE, package, version,86 fixed-in), `NetworkReachability` (port, protocol, CIDR), or87 `CodeVulnerability` (file, line, snippet) block is the primary88 diagnostic surface. Operators who "see the CVE but don't know what to89 do" have often not read the full JSON — `batch-get-finding-details`90 first.9192- **Inspector scans at scan time, not real-time.** A finding may be93 stale: the package was already patched, the SG already restricted,94 the Lambda layer already updated. Verify against current state before95 recommending remediation. A finding `lastObservedAt` > 24h may96 already be fixed.9798- **Reachability findings are topology problems, not package problems.**99 The fix is in the SG/NAU/IGW chain — restrict the SG, remove a public100 IP, add a NAT gateway, or isolate. Patching the resource's software101 does NOT close a reachability finding.102103- **Lambda code scanning findings need code fixes, not package updates.**104 Inspector code scanning for Lambda (2024-2025) flags source defects105 (injection, hardcoded secrets, path traversal, weak crypto). The fix106 is in the application code. The skill reads the `CodeSnippet` from107 `batch-get-code-snippets` to pinpoint the line.108109## Quick navigation110111| If the symptom is... | Go to | First probe |112|---|---|---|113| `PackageVulnerability` finding on EC2 | Step 2a | `list-inventory-entries` for the CVE'd package |114| `PackageVulnerability` finding on ECR | Step 2b | `describe-image-scan-findings` for the image |115| `PackageVulnerability` finding on Lambda | Step 2c | `get-function-configuration` for layers + runtime |116| `NetworkReachability` finding on EC2 | Step 3a | `describe-security-groups` for the flagged port |117| `NetworkReachability` with IGW path | Step 3b | `describe-route-tables` + `describe-network-interfaces` |118| `CodeVulnerability` finding on Lambda | Step 4 | `batch-get-code-snippets` for the source line |119| Critical CVE without fixed-in version | Step 2d | upstream CVE database, vendor advisory |120| SBOM export shows vulnerable package | Step 5 | `list-sbom-export` + parse CycloneDX/SPDX |121| Finding `lastObservedAt` > 24h ago | Step 6 | rescan or check current state |122| Need the finding JSON format and fields | Reference | `references/finding-types-reference.md` |123124## Pre-flight: finding classification and gather-info gate125126Before running type-specific probes, gather the canonical finding JSON,127the resource metadata, and the Inspector coverage status. Misclassifying128the finding type (package vs reachability vs code) produces false root129causes and wrong remediation.130131### Account-wide pre-flight commands132133All pre-flight commands (read-only): see `references/diagnostic-commands.md` § Pre-flight.134135### Finding-type short-circuit136137| `Type` field | Effect on diagnosis |138|---|---|139| `PACKAGE_VULNERABILITY` | **Package CVE.** Look at `PackageVulnerability` block: CVE id, package name, vulnerable range, fixed-in version. Resource type (EC2, ECR, Lambda) determines the patch surface. |140| `NETWORK_REACHABILITY` | **Reachability.** Look at `NetworkReachability` block: port, protocol, CIDR, scope (INTERNET / INTERNAL). The SG/NAU/IGW chain is the fix surface, not packages. |141| `CODE_VULNERABILITY` | **Lambda code defect.** Look at `CodeVulnerability` block: rule id, file path, line number, snippet. Source-level fix is required. Lambda-only. |142| `LAMBDA_CODE_VULNERABILITY` | **Lambda code defect** (alt label). Same handling as `CODE_VULNERABILITY`. |143| Mixed / unknown | Pull `batch-get-finding-details` and read the full JSON before classifying. |144145### Severity short-circuit146147| Severity | SLA guidance | Diagnostic change |148|---|---|---|149| `Critical` | Page / hours | Same root-cause walk; do NOT skip evidence. Verify against current state to rule out false positives. |150| `High` | Same-day remediation | Same walk. |151| `Medium` | Week | Same walk; batch with other findings. |152| `Low` | Backlog | Same walk; may be acceptable risk. |153| `Informational` | No SLA | SBOM or coverage metadata — usually not a remediation target. |154155If the input is malformed (missing finding ARN, missing resource ARN,156ambiguous finding type, CVE id without a package name), emit `VERDICT:157NEED_MORE_INFO` with `FINDING_TYPE: UNKNOWN` and list the specific158missing fields. Re-prompt for: (1) the finding ARN or full JSON from159`batch-get-finding-details`, (2) the resource ARN (EC2/ECR/Lambda), and160(3) the time window of the finding's last observation.161162## Process — Diagnostic decision tree (apply in finding-type order)163164The diagnostic tree is finding-type-driven. Pick the entry point based on165the finding `Type`, then walk the type-specific probes in order. Each166layer ends with either a positive root-cause confirmation (failing probe167that matches the symptom) or a pass that moves to the next layer. **Never168emit ROOT_CAUSE_FOUND without a failing probe that matches the finding.**169170### Step 0: Non-obvious behaviours that change diagnosis171172Stale findings, exploitability conditions, layer-trace gotchas,173auto-close behaviour, redacted snippets — see174`references/advanced-patterns.md` § Step 0.175176### Step 1: Finding entry — pick the diagnostic branch177178Map the finding `Type` to a branch and jump to that branch's section.179180| Type | Branch |181|---|---|182| `PACKAGE_VULNERABILITY` | Step 2 |183| `NETWORK_REACHABILITY` | Step 3 |184| `CODE_VULNERABILITY` / `LAMBDA_CODE_VULNERABILITY` | Step 4 |185| Ambiguous / multi-finding | Step 1b |186187### Step 1b: Gather the full finding JSON (when the type is ambiguous)188189Command: see `references/diagnostic-commands.md` § Step 1b.190191The response includes the full finding JSON. Read `Type`, `Title`,192`Description`, and the type-specific block before classifying.193194### Step 2: Package vulnerability — diagnose the vulnerable package195196#### 2a: Package CVE on EC2 instance197198Probes: see `references/diagnostic-commands.md` § Step 2a.199200**Verdict signals:**201- `list-inventory-entries` shows the package in the CVE's vulnerable202 range, AND `fixedInVersion` is in the patch baseline →203 **ROOT_CAUSE_FOUND**, `LAYER: EC2_OS_PACKAGE`. Remediation: SSM Run204 Command `AWS-RunPatchBaseline` or `AWS-InstallMissingUpdates`.205- Instance NOT SSM-managed (no inventory) → **NEED_MORE_INFO**;206 operator must enable SSM agent or patch manually.207- Package version already >= `fixedInVersion` → finding is stale.208 **ROOT_CAUSE_FOUND**, `LAYER: STALE_FINDING`. Will auto-close on209 rescan.210211#### 2b: Package CVE on ECR image212213Probes: see `references/diagnostic-commands.md` § Step 2b.214215**Verdict signals:**216- CVE present and image is referenced by a running task →217 **ROOT_CAUSE_FOUND**, `LAYER: ECR_BASE_IMAGE`. Remediation: rebuild218 with a patched base (`FROM` in Dockerfile), push, redeploy the task.219- Image old and not referenced by any running task →220 `LAYER: STALE_IMAGE`. Remediation: delete (`batch-delete-image`) or221 accept the risk; no running exposure.222- Vulnerable package is an application dependency (not the base image)223 → fix in the lockfile (`package-lock.json`, `requirements.txt`).224225#### 2c: Package CVE on Lambda function226227Probes: see `references/diagnostic-commands.md` § Step 2c.228229**Verdict signals:**230- Layer version older than the patched version →231 **ROOT_CAUSE_FOUND**, `LAYER: LAMBDA_LAYER`. Remediation: publish a232 new layer version with the patched dependency; update the function.233- CVE in the deployment package (not a layer) →234 `LAYER: LAMBDA_DEPLOYMENT_PACKAGE`. Remediation: rebuild the zip235 with patched deps, `update-function-code`.236- CVE in the runtime itself (e.g., `nodejs20.x`) →237 `LAYER: LAMBDA_RUNTIME`. Remediation: update the function runtime;238 AWS manages runtime patches.239240#### 2d: CVE without a fixed-in version241242If `PackageVulnerability.fixedInVersion` is empty or null, the CVE has243no upstream fix yet. **ROOT_CAUSE_FOUND**,244`FINDING_TYPE: PACKAGE_VULNERABILITY`, `LAYER: NO_FIX_AVAILABLE`.245Remediation options: suppress the finding if not exploitable, isolate246the resource (restrict SGs, move to private subnet), or apply a247vendor mitigation (config change, WAF rule). Escalate to the package248maintainer.249250### Step 3: Network reachability — diagnose the exposed port251252#### 3a: SG rule exposes the flagged port253254Probes: see `references/diagnostic-commands.md` § Step 3a.255256**Verdict signals:**257- SG allows `0.0.0.0/0` on the flagged port →258 **ROOT_CAUSE_FOUND**, `LAYER: SG_OVERLY_PERMISSIVE`. Remediation:259 restrict the SG to a referenced SG or specific CIDR.260- SG allows a broad corporate CIDR (`10.0.0.0/8`) →261 `LAYER: SG_BROAD_CIDR`. Remediation: scope to the subnet or SG.262- SG already scoped → finding may be stale or via another path. Step 3b.263264#### 3b: IGW route exposes the resource publicly265266Probes: see `references/diagnostic-commands.md` § Step 3b.267268**Verdict signals:**269- Instance has a public IP and the subnet route table has a `0.0.0.0/0`270 → an IGW → **ROOT_CAUSE_FOUND**, `LAYER: PUBLIC_IP_VIA_IGW`.271 Remediation: remove the public IP, move behind NAT/ALB, restrict SG.272- Private subnet but SG allows `0.0.0.0/0` → reachability is INTERNAL273 (the finding `scope` field distinguishes). Scope the SG regardless.274275### Step 4: Lambda code vulnerability — diagnose the source defect276277Probes: see `references/diagnostic-commands.md` § Step 4.278279**Verdict signals:**280- `batch-get-code-snippets` returns a snippet matching the rule (e.g.,281 `child_process.exec` for command injection, hardcoded AWS key,282 `fs.readFile(req.query.path)` for path traversal) →283 **ROOT_CAUSE_FOUND**, `FINDING_TYPE: CODE_VULNERABILITY`,284 `LAYER: LAMBDA_SOURCE_DEFECT`. Remediation: fix the source code285 (sanitize input, remove hardcoded secret, validate path); redeploy286 the function.287- Snippet is `REDACTED` but the rule id + filePath identify the issue288 (e.g., rule `JS-DANGEROUS-SDK-USAGE`, file `handler.js`) → same289 verdict; operator must open the file manually.290291### Step 5: SBOM export integration292293Probes: see `references/diagnostic-commands.md` § Step 5.294295**Verdict signals:**296- SBOM export maps the CVE'd package to multiple resources →297 **ROOT_CAUSE_FOUND**, `LAYER: SBOM_SCOPE`. Remediation: patch every298 resource in the SBOM that has the vulnerable package version;299 prioritize by severity and exposure.300301### Step 6: Staleness check — finding already fixed302303Probes: see `references/diagnostic-commands.md` § Step 6.304305**Verdict signals:**306- Finding `State: OPEN` but current package version >= `fixedInVersion`307 → finding is stale; will close on next rescan.308 **ROOT_CAUSE_FOUND**, `LAYER: STALE_FINDING`. Remediation: trigger309 rescan or wait for the next cycle; no action needed.310- Finding `State: CLOSED` → already resolved; no action.311312### Step 7: Escalate or NEED_MORE_INFO313314If none of the above produced a positive root-cause match, OR the315finding is from a new Inspector detector without a documented316remediation path, emit one of:317318- **ESCALATE** — AWS-side Inspector issue (e.g., a false-positive CVE319 that Inspector will not suppress, a code-vulnerability rule that320 fires on safe code). Surface the finding ARN, the rule id, and open321 a Support case.322- **NEED_MORE_INFO** — A specific probe requires operator input. List323 the missing pieces (SSM agent not enabled, ECR scan not configured,324 Lambda layer ARN unknown) and the next probe to run once the info is325 available.326327## Output format328329```text330TARGET: <resource-arn>331VERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE332REASON: <1-2 sentences naming the finding type, the vulnerable artifact,333 and the failing probe that confirmed the cause>334FINDING_TYPE: <PACKAGE_VULNERABILITY | NETWORK_REACHABILITY |335 CODE_VULNERABILITY | UNKNOWN>336SEVERITY: <CRITICAL | HIGH | MEDIUM | LOW | INFORMATIONAL>337LAYER: <EC2_OS_PACKAGE | ECR_BASE_IMAGE | LAMBDA_LAYER |338 LAMBDA_DEPLOYMENT_PACKAGE | LAMBDA_RUNTIME |339 LAMBDA_SOURCE_DEFECT | SG_OVERLY_PERMISSIVE | SG_BROAD_CIDR |340 PUBLIC_IP_VIA_IGW | SBOM_SCOPE | NO_FIX_AVAILABLE |341 STALE_FINDING | STALE_IMAGE | UNKNOWN>342EVIDENCE:343 - <observed finding — type, CVE, severity, last-observed time>344 - <failing probe — command and its output that confirms the cause>345 - <passing probes — layers ruled out>346REMEDIATION:347 1. <specific action with CLI command — see references/finding-types-reference.md348 for copy-pasteable per-layer commands>349 2. <verification command after the fix>350CONFIRM: Before executing any state-changing CLI, emit and await operator351 approval: "CONFIRM: About to <action> on <resource-arn>. Proceed?352 (yes/no)"353```354355### Worked example — Critical package CVE on EC2356357```text358TARGET: arn:aws:ec2:us-east-1:111:instance/i-0abc123359VERDICT: ROOT_CAUSE_FOUND360REASON: Instance i-0abc123 has openssl-3.0.7 at version 3.0.7-1.amzn2023.1361 which is within CVE-2024-XXXX vulnerable range (< 3.0.8); the fixed362 version 3.0.8-1.amzn2023.1 is available in the SSM Patch Baseline.363FINDING_TYPE: PACKAGE_VULNERABILITY364SEVERITY: CRITICAL365LAYER: EC2_OS_PACKAGE366EVIDENCE:367 - Finding: PACKAGE_VULNERABILITY, CVE-2024-XXXX, severity CRITICAL,368 lastObservedAt 2026-08-09T18:00Z.369 - Probe: aws ssm list-inventory-entries --instance-id i-0abc123370 --type AWS:Application --filters Key=Name,Values=openssl371 returns Version: 3.0.7-1.amzn2023.1.372 - Probe: aws ssm describe-patches --filters Key=PRODUCT,373 Values=AmazonLinux2023 | jq '.[] | select(.CVEIds|374 contains("CVE-2024-XXXX"))' returns Version: 3.0.8-1.amzn2023.1.375 - Passing: instance is SSM-managed; SSM agent online; patch baseline376 assigned.377REMEDIATION:378 1. Apply the missing update via SSM Run Command (see references for379 full command).380 2. After the command completes, wait for the next Inspector scan; the381 finding auto-closes when the patched version is detected.382 3. Verify: aws ssm list-inventory-entries --instance-id i-0abc123383 --type AWS:Application --filters Key=Name,Values=openssl384 returns Version: 3.0.8-1.amzn2023.1.385CONFIRM: Before running AWS-RunPatchBaseline, emit and await:386 "CONFIRM: About to apply patches on i-0abc123 (openssl 3.0.7 -> 3.0.8).387 Proceed? (yes/no)"388```389390Additional worked examples — Lambda hardcoded secret, SG overly391permissive: see `references/worked-examples.md`.392393Finding triage priority matrix (exposure × severity): see `references/advanced-patterns.md` § Triage priority.394395## Anti-Patterns — NEVER (top 5)3963971. **NEVER declare ROOT_CAUSE_FOUND without a failing probe that matches398 the finding.** "Must be the package" without SSM inventory or ECR399 scan output erodes trust. Every verdict needs a confirming probe.4004012. **NEVER confuse package vulnerability and reachability.** A402 `PACKAGE_VULNERABILITY` finding is fixed by patching the package;403 a `NETWORK_REACHABILITY` finding is fixed by restricting the SG or404 removing the public IP. The finding type tells you the fix surface.4054063. **NEVER recommend patching a Lambda function's runtime for a code407 vulnerability.** Code vulnerabilities are source defects — the fix408 is in the application code. Updating the runtime does NOT close a409 code finding. Read the `CodeSnippet` first.4104114. **NEVER manually close a finding that should auto-close on rescan.**412 Inspector sets `State: CLOSED` when a rescan confirms the issue is413 resolved. Manually closing creates audit noise. Use suppression414 (`update-configuration` → filter) ONLY for confirmed false positives.4154165. **NEVER assume a Critical CVE is exploitable without checking the417 conditions.** Many CVEs have conditions: only on specific OS, only418 with a specific config, only if a vulnerable code path is called.419 A Critical CVSS score does not mean the vulnerability is reachable.420 Check the CVE description and upstream advisory first.421422**Additional critical mistakes:** `list-findings` returns a summary (use423`batch-get-finding-details` for full JSON); never patch an ECR image in424place (rebuild); a Lambda layer CVE affects every function using the425layer ARN; never suppress without a documented reason; SBOM export is426separate from findings (use SBOM for scope, findings for action).427428## Pre-flight safety checks (run before any state-changing CLI)429430- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation431 (`send-command`, `update-function-code`, `revoke-security-group-ingress`,432 `batch-delete-image`), emit and await operator approval.433- **Read-only first.** Every probe (`batch-get-finding-details`,434 `list-inventory-entries`, `describe-image-scan-findings`,435 `get-function-configuration`, `describe-security-groups`,436 `list-sbom-export`, `batch-get-code-snippets`) is read-only.437- **SSM patches may require a reboot.** Verify the instance has a438 maintenance window or is in an ASG that handles reboots.439- **Lambda updates cause a cold start** on the next invocation.440- **ECR image deletion is irreversible.** Verify no running task uses441 the image digest first.442- **SG changes affect all attached instances** — apply immediately.443- **Inspector rescan is throttled.** The next scan cycle is usually444 sufficient; avoid triggering immediate rescans.445446For per-layer copy-pasteable remediation commands, see447`references/finding-types-reference.md`.448449## References (load on demand)450451- [Diagnostic commands](references/diagnostic-commands.md) — read-only probes per diagnostic step452- [Worked examples](references/worked-examples.md) — full walkthroughs453- [Advanced patterns](references/advanced-patterns.md) — non-obvious behaviours, triage matrix, 2024-2026 features454- [Finding types reference](references/finding-types-reference.md) — finding JSON format and per-layer remediation455- [Remediation CLI commands](references/remediation-cli-commands.md) — copy-pasteable state-changing commands per LAYER verdict456457## Domain458459AWS CloudOps / Inspector v2 Vulnerability Diagnostics, SBOM Integration,460Lambda Code Scanning, ECR Image Scanning, and SSM Patch Coordination.461462Recent AWS features (SBOM export, Lambda code scanning, ECR enhanced scanning, deep inspection): see `references/advanced-patterns.md`.463464## AWS documentation465466- **Inspector User Guide** — https://docs.aws.amazon.com/inspector/latest/user/inspector_v2.html467- **Inspector finding types** — https://docs.aws.amazon.com/inspector/latest/user/findings.html468- **Inspector SBOM export** — https://docs.aws.amazon.com/inspector/latest/user/sbom-export.html469- **Inspector Lambda code scanning** — https://docs.aws.amazon.com/inspector/latest/user/lambda-code-scanning.html470- **Inspector ECR scanning** — https://docs.aws.amazon.com/inspector/latest/user/ec2-scanning.html471- **Inspector suppression filters** — https://docs.aws.amazon.com/inspector/latest/user/filters.html472- **AWS CLI Inspector v2** — https://docs.aws.amazon.com/cli/latest/reference/inspector2/473- **SSM Patch Manager** — https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-patch.html