Skip to main content

More Info:

Enable image vulnerability scanning on Amazon ECR (scan-on-push) or a third-party provider so that container images are checked for known vulnerabilities before deployment.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS EKS

Triage and Remediation

Remediation

Manual Steps

  1. Identify all image sources used by the cluster
    • On any machine with kubectl access, list all images currently referenced in workloads:
    • From this list, determine which images are pulled from Amazon ECR (*.dkr.ecr.*.amazonaws.com) and which come from other registries (for potential third‑party scanning).
  2. Check ECR repositories for scan-on-push configuration (AWS CLI)
    • On any machine with AWS CLI access and appropriate IAM permissions, for each AWS account/region that hosts ECR images, run:
    • For each repository listed, check its scanning configuration:
    • Record which repositories have "scanOnPush": true and which do not.
  3. Enable or correct ECR scan-on-push settings where missing
    • For any ECR repository that does not have scan-on-push enabled, set it:
    • For new repositories you manage via IaC (CloudFormation/Terraform), ensure the repository definition includes the equivalent of scanOnPush=true so future repos are compliant by default.
  4. Run ad‑hoc scans for existing images that may predate scan-on-push
    • In the AWS console, go to https://console.aws.amazon.com/ecr/repositories, select the correct Region, then open each repository that contains images used by your EKS cluster.
    • On the Images tab of a repository, select important/tagged images (e.g., latest, release tags) and choose Scan to perform manual scans, prioritizing images currently deployed in the cluster.
  5. Evaluate and document third‑party scanning (if using non‑ECR registries)
    • For any non‑ECR registry discovered in step 1, confirm whether a vulnerability scanning solution is in place (e.g., native registry scanning, CI pipeline scanner, or external scanning service).
    • Collect evidence such as:
      • Registry or scanner configuration showing automatic scans on push or on schedule.
      • Sample scan reports for images actually deployed in the cluster.
    • If no scanning exists for a given registry, plan and implement a scanning solution comparable in coverage to ECR’s image scanning.
  6. Verify effective coverage for all deployed images
    • Cross‑check: every image from step 1 should either reside in an ECR repository with scanOnPush=true or in a non‑ECR registry with documented, active vulnerability scanning.
    • Optionally, spot‑check a few images by pulling their latest scan results in ECR (via console or CLI) or your third‑party tool, to confirm scans are actually running and producing findings.
This control is configured in AWS ECR and/or your chosen image scanning provider, not in Kubernetes objects, so it cannot be fixed with kubectl. Make the changes in the AWS console, AWS CLI, or your IaC definitions for ECR repositories, and then follow the guidance in the Manual Steps section.
Explanation of problematic output:
  • scanOnPush=DISABLED for any registry/repo used by running pods indicates that Amazon ECR image scanning on push is not enabled for that repository and should be reviewed and remediated.
  • SKIPPED entries (public ECR or different regions) mean the script could not automatically confirm scanning; you must verify that either ECR scanning or a third-party vulnerability scanner is in place for those images.