> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/compute/appsec-aws-336.md).

# AWS ECS task definition is not configured with read-only access to container root filesystems miscon

## Rule Details

|                        |                                       |
| ---------------------- | ------------------------------------- |
| Cortex AppSec Rule ID  | APPSEC\_AWS\_336                      |
| Category - Subcategory | Compute - Default Credentials Or Auth |
| Provider               | AWS                                   |
| Severity               | LOW                                   |
| Framework              | Terraform, Terraform Plan             |
| Mapped CSPM/KSPM Rule  | 3215813a-f857-45b9-b6bc-f2ae2cce8b41  |

## Impact

This rule is checking to ensure that Elastic Container Service (ECS) containers are restricted to read-only access to root file systems. The rule's monitoring is primarily concerned with maintaining a high level of security for the system.

Allowing write access to the root file system can pose a high security risk. If a containerized application is compromised, it could enable an attacker to alter the root file system of the host machine, thus compromising the entire system or application. This could lead to significant data loss, system crashes, or a broader security breach. Therefore, it's essential to limit all ECS containers to read-only access to restrict the potential actions of a compromised container.

## How to Fix

*Resource:* aws\_ecs\_task\_definition

* *Arguments:* container\_definitions.readonlyRootFilesystem

To fix the issue, you need to specify the `read_only` parameter for each one of your ECS containers in your terraform files. By setting this parameter to `true`, you guarantee that the ECS container will have read-only access to the root file system.

## The `readonlyRootFilesystem` attribute is set to true which restricts the writable access to the root file system. This is secure because it prevents the ECS containers from making changes to the root filesystem. This can be essential in preventing or minimizing damage caused by compromised containers. \[source,go]

resource "aws\_ecs\_task\_definition" "task\_definition" { family = "service" cpu = "256" memory = "512" network\_mode = "awsvpc" requires\_compatibilities = \["FARGATE"] execution\_role\_arn = aws\_iam\_role.ecs\_execution\_iam\_role.arn

## container\_definitions = <\<DEFINITION \[ { "name": "container", "image": "<http://dockr.io/example:latest>", "cpu": 256, "memory": 512, "essential": true, "networkMode": "awsvpc", "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "awslogs-example", "awslogs-region": "us-west-2", "awslogs-stream-prefix": "awslogs-example" } }, "mountPoints": \[ { "sourceVolume": "my\_volume", "containerPath": "/mnt/my\_volume", "readOnly": true } ], "readonlyRootFilesystem": true } ] DEFINITION }


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/compute/appsec-aws-336.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
