Skip to main content

More Info:

Grant the EKS worker node IAM role only read-only ECR permissions so nodes can pull images but cannot modify the registry.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS EKS

Triage and Remediation

Remediation

Manual Steps

  1. Identify the worker node IAM role (NodeInstanceRole)
    • From any machine with AWS CLI configured for the EKS account:
    • Record the IAM role ARN returned (this is the worker node role).
  2. List IAM policies currently attached to the worker node role
    • From any machine with AWS CLI:
    • Note any customer-managed or inline policies that mention ecr: actions.
  3. Review current ECR permissions for the worker node role
    • For each attached managed policy ARN from step 2:
    • For each inline policy name from step 2:
    • Inspect for any ECR actions beyond:
      • ecr:BatchCheckLayerAvailability
      • ecr:BatchGetImage
      • ecr:GetDownloadUrlForLayer
      • ecr:GetAuthorizationToken
  4. Decide and adjust: restrict ECR access to read-only if appropriate
    • If the role has broader ECR permissions (for example ecr:*, ecr:PutImage, ecr:DeleteRepository, ecr:BatchDeleteImage):
      • Confirm no operational dependency requires these write/administrative ECR actions from worker nodes.
      • Create or update a dedicated IAM policy for worker nodes that contains only the benchmark-recommended ECR statement:
      • Attach this policy to the worker node role:
      • Detach or edit any existing policies that grant broader ECR access, ensuring other non-ECR permissions still required by nodes are preserved.
  5. (Optional) Use separate role for ECR admin/write tasks
    • If cluster components or automation need to push/manage images, create a separate IAM role or user with the required ecr:* write/admin permissions, and configure CI/CD or admin tools to use that identity rather than the worker node role.
  6. Verify resulting permissions match the benchmark intent
    • From any machine with AWS CLI:
    • Re-fetch each policy as in step 3 and confirm:
      • The worker node role has only the four ECR actions listed in the remediation (and no additional ECR write/admin actions), and
      • Other non-ECR permissions required for node operation (e.g., CloudWatch logs, SSM, autoscaling) remain as approved.
kubectl cannot modify IAM roles or Amazon ECR permissions; this finding is fixed in AWS IAM and/or your IaC, not via Kubernetes API objects. See the Manual Steps section for how to update the EKS worker node IAM role (NodeInstanceRole) with the required read‑only ECR policy.
What output indicates a problem
  • Under ECR-related permissions for role ...:
    • If any of the four required actions are missing, nodes may not be able to pull images.
  • Under EXTRA/WIDER ECR permissions (POTENTIAL PROBLEM):
    • Any listed actions (e.g., Allow ecr:*, Allow ecr:PutImage, Allow ecr:DeleteRepository*) indicate the node role is not read-only and needs manual review and likely tightening in IAM.