Container Image Scanning: Finding Vulnerabilities Before Deployment

Bottom Line Up Front

Container image scanning identifies known vulnerabilities, misconfigurations, embedded secrets, and license issues in container images before they reach production — and increasingly, before they even reach your registry. If you’re shipping software in containers, this control isn’t optional; it’s the primary mechanism for catching the vulnerable base images, outdated packages, and hardcoded credentials that make up a huge share of real-world container breaches.

From a compliance standpoint, container image scanning maps directly to vulnerability management requirements in SOC 2 (CC7.1), ISO 27001 (Annex A control on technical vulnerability management), PCI DSS (Requirement 6 and 11), and NIST 800-53/800-171 (RA-5 and SI-2). If your workloads touch cardholder data, PHI, or federal contract information, your auditor will ask to see it. If you’re pursuing CMMC, expect this to come up under configuration and vulnerability management practices as well.

The gap between organizations that pass their audit and organizations that actually reduce risk almost always comes down to how scanning is implemented — not whether it exists.

Technical Overview

How it works

Container image scanning tools analyze image layers against databases of known vulnerabilities (CVEs), typically cross-referencing package manifests, OS-level dependencies, and language-specific libraries. Most scanners work by:

  • Unpacking image layers to inspect filesystem contents without running the container
  • Generating or consuming a software bill of materials (SBOM) that inventories every package and version
  • Matching packages against vulnerability feeds (NVD, vendor advisories, distro-specific databases)
  • Scoring findings using CVSS and applying policy rules to determine pass/fail

Modern scanners go beyond CVE matching — they also flag hardcoded secrets, insecure Dockerfile instructions (like running as root), misconfigured permissions, and outdated base images that are approaching end-of-life.

Where it fits in your defense-in-depth model

Container image scanning is one layer in a broader software supply chain security strategy. It sits alongside:

  • Static Application Security Testing (SAST) for your source code
  • software composition analysis (SCA) for open-source dependencies
  • Infrastructure as Code (IaC) scanning for Terraform/CloudFormation misconfigurations
  • Runtime security tools (CWPP/EDR) that catch what scanning misses post-deployment

Think of it as a gate, not a wall. Scanning catches known issues before deployment; runtime protection catches what’s exploited after. You need both — a scanner alone won’t stop a zero-day or a compromised process at runtime.

Cloud vs. on-prem vs. hybrid

Environment Common Tooling Key Consideration
AWS Amazon ECR scanning (basic/enhanced), Inspector Enhanced scanning uses Inspector and continuously rescans images already in ECR
Azure Microsoft Defender for Containers Integrates with Azure Container Registry and AKS admission controls
GCP Artifact Registry vulnerability scanning, Container Analysis API Native integration with GKE binary authorization
On-prem/hybrid Trivy, Grype, Anchore, Clair Requires self-hosted vulnerability feed updates and registry integration

Cloud-native scanners reduce operational overhead but often lag on custom policy enforcement. Open-source and commercial third-party scanners (Trivy, Snyk, Aqua, Prisma Cloud) give you more granular policy control and are frequently preferred when you need consistent scanning across multi-cloud or hybrid registries.

Key components and dependencies

Your scanning architecture typically depends on: a container registry (ECR, ACR, GCR, Harbor, JFrog Artifactory), a CI/CD pipeline where scanning gates are enforced, a vulnerability database (kept current via automatic feed updates), and a policy engine that defines what severity thresholds block a build.

Compliance Requirements Addressed

Framework mapping

Framework Relevant Control What It Requires
SOC 2 CC7.1 (Detection of vulnerabilities) Documented vulnerability scanning process with remediation timelines
ISO 27001 A.8.8 (Management of technical vulnerabilities) Vulnerability identification, risk-based prioritization, and treatment
PCI DSS Req. 6.3, 11.3 Scanning of components in the cardholder data environment before deployment
HIPAA Security Rule §164.308(a)(1) Risk Analysis Vulnerability identification as part of ongoing risk management (not scan-specific but expected)
NIST 800-53 RA-5, SI-2 Vulnerability scanning and flaw remediation
CMMC RM.2.141, SI.1.210 (mapped practices) Vulnerability identification and remediation within defined timeframes

Compliant vs. mature

“Compliant” often means you can produce a scan report showing you ran a tool against your images at some point before an audit. Mature means scanning is automated in your CI/CD pipeline, gates builds based on severity thresholds, has documented remediation SLAs tied to risk levels, and feeds into a risk register that tracks exceptions with compensating controls.

Auditors are getting sharper about spotting the difference. A one-time scan right before your SOC 2 Type II observation period doesn’t demonstrate an operating control — it demonstrates you knew the audit was coming.

Evidence auditors want to see

When your auditor asks for evidence of vulnerability management, expect to produce:

  • Scan configuration showing frequency and scope (every build, scheduled rescans of registry images)
  • Sample scan reports across the audit period, not just one recent report
  • Remediation tickets demonstrating findings were triaged, assigned, and closed within your documented SLA
  • Policy documentation defining severity thresholds and exception handling
  • Evidence of exception approvals where high/critical findings were accepted with compensating controls

Implementation Guide

Step-by-step deployment (CI/CD-integrated)

  • Choose your scanner based on your registry ecosystem and existing tooling budget — Trivy is a strong free/open-source starting point; Snyk or Prisma Cloud suit teams needing deeper policy management and dashboards.
  • Integrate scanning into your CI/CD pipeline so every image build triggers a scan before it’s pushed to your registry.
  • Set severity-based gating policies — commonly, block on Critical/High CVEs with known exploits, warn on Medium, and log Low for tracking.
  • Enable continuous rescanning of images already in your registry, since new CVEs get published against existing packages daily.
  • Configure webhook or API integration so scan results flow into your ticketing system automatically.

Example: GitLab CI with Trivy

“`yaml
container_scan:
stage: test
image: aquasec/trivy:latest
script:
– trivy image –severity HIGH,CRITICAL –exit-code 1 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
allow_failure: false
“`

This configuration fails the pipeline on High/Critical findings — a straightforward way to enforce a hard gate without custom tooling.

Configuration for compliance requirements

At minimum, your configuration should log scan timestamps, image digests, and full findings (not just pass/fail) to satisfy audit evidence requirements. Store scan results somewhere durable — your registry’s native storage often purges history faster than your audit period requires.

Hardening beyond the baseline

  • Scan base images independently before they’re adopted into your build pipeline, not just the final application image
  • Enforce minimal base images (distroless, Alpine) to reduce your attack surface and shrink your CVE exposure
  • Block images running as root via policy, not just flag them
  • Use image signing (Cosign/Notary) alongside scanning so you’re verifying both vulnerability status and image integrity
  • Generate and store an SBOM per image for supply chain traceability — this is increasingly expected even outside formal compliance mandates

Integration with existing tooling

Feed scan results into your SIEM for correlation with runtime alerts, and auto-create tickets in Jira/ServiceNow for anything above your severity threshold. Mature teams route critical findings into their SOAR platform to trigger automated pipeline blocks or Slack/Teams alerts to the owning engineering team.

Operational Management

Monitoring and alerting cadence

Set up daily automated rescans of production registries — new CVEs are published constantly, and an image that was clean last week may not be clean today. Critical findings in production images should trigger same-day alerts to your security team, not wait for the next scheduled review.

Log review

Review scan logs weekly at minimum, focusing on: new critical findings on running images, repeated failures on the same base image (a signal you need a better base image strategy), and exception requests piling up without remediation follow-through.

Change management implications

Any change to your severity gating policy (loosening thresholds, adding exceptions) should go through your standard change management process with documented approval. Auditors specifically look for unauthorized policy changes that would have let a vulnerable image slip through undetected.

Incident response integration

Your IR plan should explicitly reference container scanning as a detection source. If a critical vulnerability is discovered in a production image, your playbook should define who’s notified, remediation timelines, and whether affected containers get isolated or redeployed immediately.

Annual review tasks

At minimum annually, reassess your severity gating thresholds against current threat intelligence, audit your exception list for stale approvals, and validate your scanner’s vulnerability feed is still updating correctly. This is also the right time to reassess whether your scanning tool still fits — vendors update capabilities, and what worked at 20 engineers may not scale at 100.

Common Pitfalls

Scanning only at build time, not in the registry. New CVEs are discovered against packages already deployed. If you’re not rescanning images sitting in your registry, you have a blind spot that grows daily.

Alert fatigue from unfiltered severity thresholds. Teams that gate on every Low/Medium finding quickly train engineers to ignore scan results altogether. Calibrate thresholds to what’s actionable.

Scanning the application layer while ignoring the base image. A hardened application built on a bloated, outdated base image still carries significant risk. Audit your base image supply chain separately.

The checkbox trap. Running a scan once before your audit window, producing a clean report, and calling it done. Auditors are increasingly requesting evidence across the full observation period — a single point-in-time scan won’t hold up under scrutiny, and worse, it doesn’t actually protect you.

No process for exceptions. Every scanner will surface findings you can’t immediately fix (a transitive dependency vulnerability with no available patch, for example). Without a documented exception and compensating control process, these become permanent, invisible risk.

FAQ

Does container image scanning replace the need for a web application firewall or runtime protection?
No. Scanning addresses known vulnerabilities in image contents before deployment; it doesn’t detect runtime exploitation, lateral movement, or zero-days. You need runtime tools (CWPP/EDR) as a complementary layer.

How often should images be rescanned once they’re in production?
Daily automated rescans are the standard for production registries, since new CVEs are published continuously against existing packages. Anything less frequent creates a growing detection gap.

What severity threshold should block a build?
Most mature programs gate builds on Critical and High findings with known exploits, while logging Medium and Low for tracking and periodic remediation. Your exact threshold should reflect your risk appetite and be documented in policy.

Can open-source scanners like Trivy satisfy compliance requirements, or do we need a commercial tool?
Open-source scanners can absolutely satisfy compliance requirements — auditors care about the process and evidence, not the vendor. Commercial tools add value through dashboards, policy management at scale, and support, which matters more as your environment grows.

Do we need to scan third-party images we don’t build ourselves?
Yes. Any image running in your environment — including base images and vendor-provided containers — is part of your attack surface and should be scanned before and during deployment.

Conclusion

Container image scanning isn’t a tool you install once and forget — it’s an operating control that needs to be automated, tuned, and evidenced continuously to hold up under both a real attack and a real audit. The organizations that get this right treat scanning as one layer in a broader supply chain security strategy, not a one-time compliance checkbox.

If you’re staring down a SOC 2 audit, a hipaa risk assessment, or an enterprise security questionnaire and you’re not sure whether your current scanning setup would survive scrutiny, that’s exactly the kind of gap we help close. SecureSystems.com works with startups, SMBs, and scaling teams to build compliance programs that hold up under real audits — without the enterprise price tag or the 20-person security team. Book a free compliance assessment and find out exactly where you stand before your auditor does.

Leave a Comment

icon 4,206 businesses protected this month
J
Jason
just requested a PCI audit