For the complete documentation index, see llms.txt. This page is also available as Markdown.
Cortex CloudApplication Security

AWS ECS services have automatic public IP address assignment enabled misconfiguration detected in co

Rule Details

Cortex AppSec Rule ID

APPSEC_AWS_333

Category - Subcategory

Logging - Public Exposure

Provider

AWS

Severity

LOW

Framework

Terraform, Terraform Plan

Mapped CSPM/KSPM Rule

2e58c953-9a4e-4e59-bf3a-3ac93f4cd27b

Impact

This rule verifies that Elastic Container Service (ECS) services do not automatically assign public IP addresses. The main risk of non-compliance with this rule is increased vulnerability. If ECS services are automatically assigned public IP addresses, it opens the possibility for unauthorized entities to interact with and potentially exploit these services. This can lead to data breaches, service interruptions, and other security incidents. Therefore, it's critical to ensure IP addresses aren't automatically publicly exposed to limit potential attack vectors and maintain the security of the services.

How to Fix

Resource: aws_ecs_service

  • Arguments: network_configuration.assign_public_ip

In order to fix this issue, you need to ensure that the ECS services do not have public IP addresses assigned to them automatically. This can be done by setting the assign_public_ip attribute to false in the aws_ecs_service resource block.

By setting the assign_public_ip attribute to false, the ECS services will not have public IP addresses automatically assigned to them. This makes the ECS services more secure as they can't be reached directly from the internet. They can only be accessed via the load balancer, providing an additional layer of security. [source,go]

resource "aws_ecs_service" "example" { name = "example" cluster = aws_ecs_cluster.example.id task_definition = aws_ecs_task_definition.example.arn

network_configuration { subnets = [aws_subnet.example.id] assign_public_ip = false }

load_balancer { target_group_arn = aws_lb_target_group.example.arn container_name = "example" container_port = 8080 } }

Last updated

Was this helpful?