More Info:

This rule examines ECS Task Definitions to ensure that tasks are not configured to run as the root user. Running tasks with a non-root user provides an additional layer of security by minimizing the potential impact of security vulnerabilities within the container.

Risk Level

Medium

Address

Security

Compliance Standards

CBP,RBI_MD_ITF

Triage and Remediation

Remediation

To remediate the misconfiguration of ECS tasks having root as the user in AWS Kubernetes using the AWS console, you can follow these steps:

  1. Access the AWS Management Console:

  2. Navigate to Amazon ECS Service:

    • Click on the “Services” dropdown menu at the top of the page.
    • Select “ECS” under the “Compute” section.
  3. Select the Cluster:

    • From the ECS dashboard, click on the cluster where the ECS tasks with root as the user are running.
  4. Select the Task Definition:

    • In the cluster dashboard, click on the task definition that includes the ECS tasks with root as the user.
  5. Edit the Task Definition:

    • In the task definition details page, click on the “Create new revision” button to create a new revision of the task definition.
    • Click on the container definition that has root as the user.
  6. Update Container Definition:

    • In the container definition settings, scroll down to the “Container Definition” section.
    • Update the “user” field to a non-root user. You can specify a user ID or a username that is not root.
  7. Save Changes:

    • After updating the container definition, click on the “Update” button to save the changes.
  8. Update Service:

    • Go back to the cluster dashboard and click on the service that is using the task definition with the updated container definition.
    • Click on the “Update” button to force a new deployment of the service with the updated task definition.
  9. Verify the Changes:

    • Once the service is updated, verify that the ECS tasks are now running with a non-root user instead of root.

By following these steps, you can remediate the misconfiguration of ECS tasks having root as the user in AWS Kubernetes using the AWS console.