Lightspin, a cloud security company, reported that the Amazon Elastic Container Registry (ECR) Public Gallery contained a critical security flaw that could have been exploited to launch a wide variety of attacks.
According to Gafnit Amiga, Lightspin’s director of security research, in a report provided to The Hacker News, “by exploiting this vulnerability, a malicious actor could delete all images in the Amazon ECR Public Gallery or update the image contents to inject malicious code.”
Any machine that pulls and runs the image, be it a user’s local machine, a Kubernetes cluster, or the cloud, will execute the malicious code.
AWS ECR is a container image registry service that lets developers distribute their code in the form of Docker images and deploy those images at scale. The ECR Public Gallery is where all of the accessible public repositories hosted on ECR are displayed.
When you create a public registry on Amazon, “by default, your account has read and write access to the repositories in your public registry,” as stated in the official documentation. However, to access the Amazon ECR APIs and upload images to your repositories, the IAM user must have the appropriate permissions.
However, Lightspin discovered that the vulnerability could be exploited by external actors to delete, update, and create poisoned versions of legitimate images in registries and repositories belonging to other AWS accounts using exploiting undocumented internal ECR Public APIs.
To delete images using the “DeleteImageForConvergentReplicationInternal” action, or to push a new image using the “PutImageForConvergentReplicationInternal” action, temporary credentials are acquired using Amazon Cognito to authorize requests to the internal APIs.
A “deep software supply chain attack,” as described by Lightspin.
The urgency with which Amazon deployed a fix to address the vulnerability on November 16, 2022, less than 24 hours after it was reported, is indicative of the gravity of the situation. There is nothing the customer needs to do.
Depending on the attacker’s motivations and techniques, this flaw “may lead to denial-of-service, data exfiltration, lateral movement, privilege escalation, data destruction, and other multivariate attack paths,” Amiga said.
The ECR Public supply chain could be compromised if “a malicious actor poisoned popular images while abusing the trust model of ECR Public.”