SlideShare a Scribd company logo
@laceworklabs
Batten Down the
Hatches: A Practical
Guide to
Securing Kubernetes
James Condon
CSA
June 18th, 2019
@laceworklabs
whoami
• James Condon, Director of Research @ Lacework
• Former USAF OSI, Mandiant, and ProtectWise
• Network Forensics, Incident Response, Threat Intelligence, Cloud Security
Twitter: @laceworklabs, @jameswcondon
Email: james@lacework.com
Blog: www.lacework.com/blog/
@laceworklabs
AGENDA
Kubernetes Overview
Risks and Threats
Securing Kubernetes
@laceworklabs
KUBERNETES
OVERVIEW
@laceworklabs
Networking
Provisioning
Security
Storage
Redundancy
Auto-Scaling
@laceworklabs
@laceworklabs
Master
API Server
etcd
Scheduler
Control Manger
Proxy
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
UI
Dashboard
CLI
BASIC ARCHITECTURE
@laceworklabs
RISKS & THREATS TO KUBERNETES
@laceworklabs
MAJOR THRE AT VECTORS
Exposed K8s Components Pod Compromise
• UI Dashboard
• API Service
• etcd
• Kubelet
• Application Attacks
• Supply Chain Attacks
• Orchestrator and container CVEs
@laceworklabs
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
UI
Dashboard
CLI
EXPOSED DASHBOARDS
Master
API Server
etcd
Scheduler
Control Manger
Proxy
@laceworklabs
EXPOSED DASHBOARDS
• Web-based cluster management UI
• Risks & Threats:
• Default service accounts needs RBAC
• Can expose CSP keys
• Cryptojacking attacks
• Information & data leaks
@laceworklabs
DISCOVERING DASHBOARDS DEMO
@laceworklabs
DASHBOARD FINDINGS
500+
75% AWS
10% GCP +
Azure
Ports 80, 443,
8080
@laceworklabs
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
UI
Dashboard
CLI
KUBE-APISERVER
Master
API Server
etcd
Scheduler
Control Manger
Proxy
@laceworklabs
EXPOSED API SERVER
• Handles all client interactions to the K8s API
• REST API
• Handles authentication and authorization
• Secure & insecure port by default
• Risks & Threats
• Access to insecure port allows complete
access of cluster
• CVE-2018-1002105
• Information leaks
@laceworklabs
DISCOVERING API SERVERS
@laceworklabs
API SERVER FINDINGS
21K+
92% AWS, ~3% GCP + Azure
’18: 21K+ for K8s, Meso,
OpenShift, & Swarm
Cert CNs: kubernetes-master
88%, system:apiserver 4%,
apiserver 2%
@laceworklabs
API SERVER FINDINGS (INSECURE PORT)
800+
@laceworklabs
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
UI
Dashboard
CLI
KUBELET
Master
API Server
etcd
Scheduler
Control Manger
Proxy
@laceworklabs
EXPOSED KUBELET
• Daemon on nodes to bridge compute resources, facilitate communicates, and aide
in pod health
• Risks & Threats
• Allows anonymous requests by default
• “AlwaysAllow” is the default for authenticated requests rest by default
• Contains credentials that can be used to access other components in the
cluster
@laceworklabs
EXEC ON RUNNING CONTAINER THROUGH KUBELET
• PoC by Security Engineer @ Handy (K8 v1.9)
• Issue POST request to targeted Pod
• Follow with GET request via SPDY or websocket client
@laceworklabs
REPLAYING KUBELET CREDENTIALS
• SSRF in vulnerable service used by Shopify
• Kubelet credentials leaks via vulnerability
• Credentials replayed to gain root access in any container
@laceworklabs
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
UI
Dashboard
CLI
etcd
Master
API Server
etcd
Scheduler
Control Manger
Proxy
@laceworklabs
ETCD
• Distributed key value datastore
• REST & gRPC APIs
• Responsible for storing objects, state, etc.
• Risks & Threats
• No authentication or encryption at rest by
default
• Maintains cluster secrets
• The Luke Hemsworth of unsecured DBs
@laceworklabs
DISCOVERING ETCD CLUSTERS
@laceworklabs
ETCD FINDINGS
2.4K+
kube-master-1
kubemaster-etcd
kubeadm-master2
k8s_node2
K8s-cluster-etcd
@laceworklabs
POD COMPROMISE & LATERAL
MOVEMENT
Pod
Compromise
Application
Vulnerabilities
Supply Chain
Attacks
Known &
Unknown
CVEs
@laceworklabs
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
Node
Proxy
Kubelet
Container
Runtime
Pod 1...n
UI
Dashboard
CLI
PODS
Master
API Server
etcd
Scheduler
Control Manger
Proxy
@laceworklabs
APPLICATION VULNERABILITIES
@laceworklabs
SUPPLY CHAIN ATTACKS
@laceworklabs
• allows containers using subPath volume mounts to access files or
directories outside of the volume, including the host’s filesystemCVE-2017-1002101
• Flaw in runc, allows potential container escapeCVE-2019-5736
• Options for accessing host systemPrivileged Containers
• Default service accounts are overprivileged and have too much
access that an attacker could leverageService Accounts
• Authenticated users with permission to exec/attach/portforward
could escalated to run additional commands against Kubelet APICVE-2018-1002105
LATERAL MOVEMENT
@laceworklabs
securing kubernetes
@laceworklabs
10
ESSENTIALS
SECURING
K8S
Upgrade
Network
Security
POD Security
PoliciesNode Security
Hardening
Audit Logging
Security
Boundaries
RT Compliance
/ Auditing
Image Security
RBAC
Host Logging /
HIDS
@laceworklabs
NETWORK SECURITY
Restrict Open Internet Access
TLS, VPN, Bastion
Network Policy for pods
Host Firewalls
@laceworklabs
IMAGE SECURITY
Container vulnerability scans
Scan for poor configurations in containers
Scan for keys in containers
Combine pre-deploy with runtime
@laceworklabs
ROLE BASED ACCESS CONTROL
Critical for division on access
Segregates roles and permissions
Decreases attack surface
Reduce default permissions of service
accounts
@laceworklabs
SECURITY BOUNDARIES
Utilize multiple namespaces
Separate sensitive workloads
Utilize node pools to separate
Ex: kube-public
@laceworklabs
UPGRADE!
CVE-2018-1002105 DEMO
Upgrading should be seamless
No runtime patching
Patch = redeploy
Vulnerabilities != vulnerable often
@laceworklabs
POD SECURITY POLICIES
Huge win in securing K8s
Allow centralized cluster level
security controls / configuration
Controls growing frequently
Common Examples:
privileged
volumes
network
@laceworklabs
NODE SECURITY HARDENNING
Minimal OS footprint
Restricted file system access
Upgrades and Patches
Disabled root login
Kernel Protection
Security Defaults
@laceworklabs
AUDIT LOGGING
Audit Logging for ALL API requests
API is largest attack surface
Log as much as you can afford
Store, glacier, have them avail/query
Audit logs big forensics firehouse
@laceworklabs
RT COMPLIANCE / CONFIG
CIS Benchmarks
Realtime / runtime auditing critical
Infrastructure as code = wider paper cuts
Security vulnerabilities often config’s
Identify, alert, fix, measure (repeat)
@laceworklabs
HOST LOGGING / HIDS / EDR
Ephemeral workloads make logging more
important
Understand process, applications, network
Building net “sensors” hard / blind
Correlate IOC’s + events (ML+)
Opensource + SaaS options
Build / buy centralized warehouse
Auditd, /proc, pcap,etc..
@laceworklabs
FINAL THOUGHTS
• K8s is complex “5 minutes to deploy, 5 years
to learn”
• Reported attacks are primarily
cryptojacking, pivoting to CSP, and data leak
• Misconfiguration and pod compromise are
the major vectors
• Use traditional security, DevSecOps, and K8s
features to harden your cluster
@laceworklabs
resources
1. Tesla Exposed Dashboard https://redlock.io/blog/cryptojacking-tesla
2. Weight Watchers Exposed Dashboard https://kromtech.com/blog/security-center/weightwatchers-exposure-a-
simple-yet-powerful-lesson-in-cloud-security
3. Lacework Containers at Risk Report https://info.lacework.com/hubfs/Containers%20At-
Risk_%20A%20Review%20of%2021,000%20Cloud%20Environments.pdf
4. CVE-2018-1002105 Github Page https://github.com/kubernetes/kubernetes/issues/71411
5. Kubelet Reference Page https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet-
authentication-authorization/
6. Compromising Kubernetes Through Kubelet Blog https://medium.com/handy-tech/analysis-of-a-kubernetes-
hack-backdooring-through-kubelet-823be5c3d67c
7. Shopify Hack https://hackerone.com/reports/341876
8. Exposed etcd Clusters Blog https://elweb.co/the-security-footgun-in-etcd/
9. Lacework exposed etcd Clusters Blog https://www.lacework.com/etcd-thousands-of-clusters-open/
10. Backdoored Docker Images https://arstechnica.com/information-technology/2018/06/backdoored-images-
downloaded-5-million-times-finally-removed-from-docker-hub/
11. Twistlock Blog on CVE-2017-1002101https://www.twistlock.com/labs-blog/deep-dive-severe-kubernetes-
vulnerability-date-cve-2017-1002101/
12. Attacking and Defending a Kubernetes Cluster Webinar https://vimeo.com/277901517
13. Kubernetes Illustrated Children's Guide: https://youtu.be/4ht22ReBjno
@laceworklabs
QUESTIONS
Twitter: @laceworklabs, @jameswcondon
Email: james@lacework.com
Blog: www.lacework.com/blog/

More Related Content

PDF
BSides Denver 2019 - Cloud Wars Episode V: The Cryptojacker Strikes Back
PDF
DerbyCon 2019: Prepare to be Boarded! A Tale of Kubernetes, Plunder, and Cryp...
PDF
All Your Containers Are Belong To Us
PPTX
Lacework | Top 10 Cloud Security Threats
PPTX
AWS Security Week | Getting to Continuous Security and Compliance Monitoring ...
PDF
Kubernetes security
PDF
Kubernetes - security you need to know about it
PDF
Top 10 Threats to Cloud Security
BSides Denver 2019 - Cloud Wars Episode V: The Cryptojacker Strikes Back
DerbyCon 2019: Prepare to be Boarded! A Tale of Kubernetes, Plunder, and Cryp...
All Your Containers Are Belong To Us
Lacework | Top 10 Cloud Security Threats
AWS Security Week | Getting to Continuous Security and Compliance Monitoring ...
Kubernetes security
Kubernetes - security you need to know about it
Top 10 Threats to Cloud Security

What's hot (20)

PDF
Automated Infrastructure Security: Monitoring using FOSS
PDF
Security in Serverless world
PPTX
Native cloud security monitoring
PDF
Build to Hack, Hack to Build
PDF
Prepare to defend thyself with Blue/Green
PPTX
Your Blacklist is Dead: Why the Future of Command and Control is the Cloud
PDF
Securing your AWS Deployments with Spinnaker and Armory Enterprise
PDF
Docker & IoT: protecting the Datacenter
PDF
Node.js Security Done Right - Tips and Tricks They Won't Teach You In School
PPTX
Crypto Miners in the Cloud
PDF
What is Google Cloud Good For at DevFestInspire 2021
PDF
Serverless security - how to protect what you don't see?
PDF
The elements of kubernetes
PPTX
Red Team vs Blue Team on AWS - RSA 2018
PPTX
DevSecCon Tel Aviv 2018 - Serverless Security
PDF
Abusing bleeding edge web standards for appsec glory
PDF
AWS temporary credentials challenges in prevention detection mitigation
PDF
Microservices reativos usando a stack do Netflix na AWS
PDF
Policy as code what helm developers need to know about security
PDF
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Automated Infrastructure Security: Monitoring using FOSS
Security in Serverless world
Native cloud security monitoring
Build to Hack, Hack to Build
Prepare to defend thyself with Blue/Green
Your Blacklist is Dead: Why the Future of Command and Control is the Cloud
Securing your AWS Deployments with Spinnaker and Armory Enterprise
Docker & IoT: protecting the Datacenter
Node.js Security Done Right - Tips and Tricks They Won't Teach You In School
Crypto Miners in the Cloud
What is Google Cloud Good For at DevFestInspire 2021
Serverless security - how to protect what you don't see?
The elements of kubernetes
Red Team vs Blue Team on AWS - RSA 2018
DevSecCon Tel Aviv 2018 - Serverless Security
Abusing bleeding edge web standards for appsec glory
AWS temporary credentials challenges in prevention detection mitigation
Microservices reativos usando a stack do Netflix na AWS
Policy as code what helm developers need to know about security
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Ad

Similar to Batten Down the Hatches: A Practical Guide to Securing Kubernetes - RMISC 2019 (20)

PDF
Practical Guide to Securing Kubernetes
PDF
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
PDF
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
PDF
Patterns and Pains of Migrating Legacy Applications to Kubernetes
PDF
Patterns and Pains of Migrating Legacy Applications to Kubernetes
PPTX
Application portability with kubernetes
PDF
GDG Cloud Southlake 29 Jimmy Mesta OWASP Top 10 for Kubernetes
PDF
Exploit K8S via Misconfiguration .YAML in CSP environments
PDF
IBM Think Session 8598 Domino and JavaScript Development MasterClass
PDF
DCEU 18: Docker Container Networking
PDF
The Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
PDF
Secrets in Kubernetes
PDF
Secrets in Kubernetes
PDF
Kubernetes in 15 minutes
PPT
Shmoocon 2013 - OpenStack Security Brief
PDF
Cloud-native .NET Microservices mit Kubernetes
PDF
DCSF19 Container Security: Theory & Practice at Netflix
PPTX
Kubernetes Security
PPTX
StorageOS, Storage for Containers Shouldn't Be Annoying at Container Camp UK
PDF
Cloud orchestration risks
Practical Guide to Securing Kubernetes
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
Migrating Hundreds of Legacy Applications to Kubernetes - The Good, the Bad, ...
Patterns and Pains of Migrating Legacy Applications to Kubernetes
Patterns and Pains of Migrating Legacy Applications to Kubernetes
Application portability with kubernetes
GDG Cloud Southlake 29 Jimmy Mesta OWASP Top 10 for Kubernetes
Exploit K8S via Misconfiguration .YAML in CSP environments
IBM Think Session 8598 Domino and JavaScript Development MasterClass
DCEU 18: Docker Container Networking
The Golden Ticket: Docker and High Security Microservices by Aaron Grattafiori
Secrets in Kubernetes
Secrets in Kubernetes
Kubernetes in 15 minutes
Shmoocon 2013 - OpenStack Security Brief
Cloud-native .NET Microservices mit Kubernetes
DCSF19 Container Security: Theory & Practice at Netflix
Kubernetes Security
StorageOS, Storage for Containers Shouldn't Be Annoying at Container Camp UK
Cloud orchestration risks
Ad

More from Lacework (10)

PPTX
Lacework Kubernetes Meetup | August 28, 2018
PPTX
Lacework AWS Security Week Presentation
PPTX
Lacework Overview: Security Redefined for Cloud Scale
PPTX
Containers At-Risk: A Review of 21,000 Cloud Environments
PDF
Lacework Protection for AWS S3 Buckets
PDF
Guidebook Case Study
PDF
Container Security Research
PDF
Security for AWS: Journey to Least Privilege
PDF
Containers At-Risk A Review of 21,000 Cloud Environments
PPTX
Lacework for AWS Security Overview
Lacework Kubernetes Meetup | August 28, 2018
Lacework AWS Security Week Presentation
Lacework Overview: Security Redefined for Cloud Scale
Containers At-Risk: A Review of 21,000 Cloud Environments
Lacework Protection for AWS S3 Buckets
Guidebook Case Study
Container Security Research
Security for AWS: Journey to Least Privilege
Containers At-Risk A Review of 21,000 Cloud Environments
Lacework for AWS Security Overview

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Cloud computing and distributed systems.
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
sap open course for s4hana steps from ECC to s4
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Cloud computing and distributed systems.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Reach Out and Touch Someone: Haptics and Empathic Computing
Machine learning based COVID-19 study performance prediction
Understanding_Digital_Forensics_Presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Network Security Unit 5.pdf for BCA BBA.
sap open course for s4hana steps from ECC to s4
NewMind AI Weekly Chronicles - August'25 Week I
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation_ Review paper, used for researhc scholars
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Review of recent advances in non-invasive hemoglobin estimation
Digital-Transformation-Roadmap-for-Companies.pptx

Batten Down the Hatches: A Practical Guide to Securing Kubernetes - RMISC 2019