Containers

Containers exploitation

3 categories:

  • Registry: store and manage container images: ECR (Elastic Container Registry)

  • Orchestration: when and where containers run: ECS (Elastic Container Service) and EKS (Elastic Kubernetes Service)

  • Compute: run containers: Fargate (servless compute engine) and EC2

Enumeration

ECR

Repositories in the container registry

aws ecr describe-repositories

Information about the repo policy

aws ecr get-repository-policy --repository-name [repo-name]

List all images in the specified repository

aws ecr list-images --repository-name [repo-name]

Information about a container image

aws ecr describe-images --repository-name [repo-name] --image-ids imageTag=[imageTag]

Authenticate to ECR

export AWS_ACCESS_KEY_ID="<access_key>"
export AWS_SECRET_ACCESS_KEY=”<secret_key>"
aws ecr get-login-password --profile <profile_name> --region <region> | sudo docker login --username AWS --password-stdin <container_registry> 

Pull Image from ECR

Create New Container

Mount and Enumerate Container File System

ECS

List all ECS clusters

Information about specified cluster

List all services in the specified cluster

Information about a specified service

List all tasks in the specified cluster

List all containers in the specified cluster

EKS

List all EKS clusters

Information about a specified cluster

List of all node groups in a specified cluster

Information about a specified node group in a cluster

List of all fargate in a specified cluster

Information about a specific fargate profile in a cluster

Initial Access

RCE - Command injection

  • List of all secret in EKS vulnerable container

  • Get the secret information from running EKS vulnerable container

Persistence

  • Step By step

Authenticate docker daemon to ECR

Build backdoored docker image

Tag the docker image

Push the docker image to AWS Container Registry

Interesting Book

Interesting Books

Disclaimer: As an Amazon Associate, I earn from qualifying purchases. This helps support this GitBook project at no extra cost to you.

Last updated