Description:

Amazon Elastic Container Registry (Amazon ECR) is an AWS-managed container image registry service that is secure, scalable, and reliable. Amazon ECR is an extension to Amazon Elastic Container Service (Amazon ECS) or Amazon Elastic Kubernetes Service (Amazon EKS). You can manually scan container images stored in Amazon ECR. Or, alternatively, you can configure your repositories to scan images when you push them to a repository.


Rationale:

Amazon ECR image scanning helps in identifying software vulnerabilities in your container images. We will be notified about the vulnerabilities once the scanning finishes.


Impact:

Each container image may be scanned once per 24 hours. If scan on push is disabled on a repository, then you must manually start each image scan to get the scan results. When a new repository is configured to scan on push, all new images pushed to the repository will be scanned.


Default Value:

You can manually scan container images stored in Amazon ECR. Or you can configure your repositories to scan images when you push them to a repository.


Audit:

  1. Sign in to the Amazon Management Console

  2. Go to the Amazon ECR Console at  https://console.aws.amazon.com/ecr

  3. In the left menu, select Repositories in Amazon ECR

  4. Select the repository that you want to check whether scan on push is enabled or not from the scan on push column

    If it is disabled follow the implementation steps to enable it


Remediation:

Pre-requisites:

  • Private/Public Repository
    An Amazon ECR image repository contains your Docker images, Open Container Initiative (OCI) images, and OCI compatible artifacts. A public repository is open to publicly pull images from and is visible on the Amazon ECR Public Gallery.


Implementation steps:

  1. Sign in to the Amazon Management Console

  2. Go to the Amazon ECR Console at  https://console.aws.amazon.com/ecr

  3. In the left menu, select Repositories in Amazon ECR

  4. Select the Repository you want to modify and click on Edit 

  5. Now select the Enable option to enable scan on push.

  6. Click on save


Backout plan:

  1. Sign in to the Amazon Management Console

  2. Go to the Amazon ECR Console at  https://console.aws.amazon.com/ecr

  3. In the left menu, select Repositories in Amazon ECR

  4. Select the Repository you want to modify and click on Edit

  5. Now select the Disable option to disable scan on push.


Note:

If you are unable to find the status of the scan on push column, select the setting button on the right side and enable the status.


References:

Image scanning - Amazon ECR