π‘οΈ AWS ECS Task Definition runs as privilegedπ’
- Contextual name: π‘οΈ Task Definition runs as privilegedπ’
- ID:
/ce/ca/aws/ecs/task-definition-privileged - Tags:
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logicβ
- π§ prod.logic.yamlπ’
Similar Policiesβ
- AWS Security Hub: [ECS.4] ECS containers should run as non-privileged
Descriptionβ
Descriptionβ
This policy identifies AWS ECS Task Definitions that contain one or more containers configured with the
privilegedparameter set to true.When a container is run in privileged mode, it is granted access to all host devices and bypasses most isolation mechanisms provided by the container runtime. In effect, a privileged container can perform nearly any operation that the underlying host can.
Rationaleβ
Running containers in privileged mode significantly weakens the security boundaries that normally protect the host system.
Key risks include:
- Device Access: Privileged containers gain unrestricted access to all host devices (
/dev).- Expanded Kernel Capabilities: They inherit all Linux kernel capabilities, enabling actions such as modifying kernel modules, altering system time, or manipulating network configurations.
- Host Escalation Risk: If an attacker compromises a privileged container, they can often break out of the container environment and obtain root-level access to the EC2 host.
... see more
Remediationβ
Remediationβ
Update the ECS Task Definition to Update Privileged Parameterβ
Using the AWS CLIβ
Retrieve the existing task definition JSON
aws ecs describe-task-definition \
--task-definition {{family-or-full-arn}} \
--query 'taskDefinition' > task-def.jsonEdit
task-def.jsonFor every container in the
containerDefinitionslist, changeprivilegedto false or remove the key (default is false)."containerDefinitions": [
{
"name": "{{app}}",
"image": "{{image}}",
"privileged": false,
...
}
]Register the updated task definition
aws ecs register-task-definition --cli-input-json file://task-def.jsonUpdate your ECS service to use the new task definition revision