Docker && Kubernetes

Docker

Concepts

  • Docker Image

    • Read only file with OS, libraries and apps

    • Anyone can create a docker image

    • Images can be stored in Docker hub (default public registry) or private registry

  • Docker Container

    • Stateful instance of an image with a writable layer

    • Contains everything needed to run your application

    • Based on one or more images

  • Docker Registry

    • Repository of images

  • Docker Hub

    • Public docker registry

  • Dockerfile

    • Configuration file that contains instructions for building a Docker image

  • Docker-compose file

    • Configuration file for docker-compose

  • Docker Swarm

    • Group of machines that are running Docker and joined into a cluster.

    • When you run docker commands, they are executed by a swarm manager.

  • Portainer

    • Management solution for Docker hosts and Docker Swarm clusters

    • Via web interface

  • Docker capabilities

    • Turn the binary "root/non-root" into a fine-grained access control system.

    • Processes that just need to bind on a port below 1024 do not have to run as root, they can just be granted the net_bind_service capability instead.

  • Docker Control Groups

    • Used to allocate cpu, memory, network bandwith of host to container groups.

Commands

Docker security basics

Detect inside a docker or running containers

Escape NET_ADMIN docker container

Attack insecure volume mounts

Attack docker misconfiguration

Audit Docker Runtime and Registries

Attack container capabilities

Tools

Kubernetes

Concepts

  • Kubernetes is a security orchestrator

  • Kubernetes master provides an API to interact with nodes

  • Each Kubernetes node run kubelet to interact with API and kube-proxy to refect Kubernetes networking services on each node.

  • Kubernetes objects are abstractions of states of your system.

    • Pods: collection of container share a network and namespace in the same node.

    • Services: Group of pods running in the cluster.

    • Volumes: directory accesible to all containers in a pod. Solves the problem of loose info when container crash and restart.

    • Namespaces: scope of Kubernetes objects, like a workspace (dev-space).

Commands

External Recon

Common open ports

Common endpoints

Quick attacks

Attack Private Registry misconfiguration

Attack Cluster Metadata with SSRF

Attack escaping pod volume mounts to access node and host

Tools

Last updated

Was this helpful?