Slide 1

Slide 1 text

TRACK: DEVSECOPS NOVEMBER 12, 2020 - Madhu Akula Defender’s Guide to Cloud Native Infrastructure Security @madhuakula

Slide 2

Slide 2 text

TRACK: DEVSECOPS About Me! ● Security Engineering @ Miro ● Creator of Kubernetes Goat, Hacker Container, tools.tldr.run, many other ● Security (Cloud Native, Containers, Kubernetes & Automation) ● Speaker & Trainer @ BlackHat, DEF CON, USENIX, OWASP, All Day DevOps, null, etc. ● Co-Author of Security Automation with Ansible 2 ● Never Ending Learner! https://madhuakula.com Madhu Akula @madhuakula

Slide 3

Slide 3 text

TRACK: DEVSECOPS ● Why Cloud Native Infrastructure? ● What is the current attack surface? ● Introducing Cloud Native Security Defense ● Layers of security defence (defense in depth) ● Demonstrations focusing on specific scenarios ● Key takeaways ● References & Resources ● Next steps to learn more and more… What you will learn today? @madhuakula

Slide 4

Slide 4 text

TRACK: DEVSECOPS Cloud Native is used to describe containerised application to dynamically schedule, orchestrate and manage through continuous delivery workflows. Which allows to optimize resource utilization, and microservices-oriented to increase the overall agility and maintainability and support the life cycle of applications. - Cloud Native Computing Foundation What is Cloud Native? @madhuakula

Slide 5

Slide 5 text

TRACK: DEVSECOPS What is Cloud Native? https://landscape.cncf.io @madhuakula @madhuakula

Slide 6

Slide 6 text

TRACK: DEVSECOPS Why Cloud Native? Cloud native technologies empower organizations to build and run scalable applications in modern, dynamic environments such as public, private, and hybrid clouds. Containers, service meshes, microservices, immutable infrastructure, and declarative APIs exemplify this approach. These techniques enable loosely coupled systems that are resilient, manageable, and observable. Combined with robust automation, they allow engineers to make high-impact changes frequently and predictably with minimal toil. https://github.com/cncf/toc/blob/master/DEFINITION.md @madhuakula

Slide 7

Slide 7 text

TRACK: DEVSECOPS Why Cloud Native Defense? https://kromtech.com/blog/security-center/cryptojacking-invades-cloud-how-modern-containeri zation-trend-is-exploited-by-attackers https://www.youtube.com/watch?v=4CTK2aUXTHo https://github.com/Frichetten/CVE-2019-5736-PoC https://engineering.bitnami.com/articles/helm-security.html @madhuakula

Slide 8

Slide 8 text

TRACK: DEVSECOPS ● Application Code ● Container Image ● Orchestration Platform ● Runtime ● Microservices & Communication ● API Gateway & Proxies ● Network & Load Balancers ● AuthN & AuthZ ● Storage ● Management Current Attack Surface ● Namespaces ● Control Groups ● Daemon ● Configuration ● Capabilities ● Content Trust ● Container Registry ● Volumes ● Networks ● Many other... @madhuakula

Slide 9

Slide 9 text

TRACK: DEVSECOPS Current Attack Surface (contd.) https://www.microsoft.com/security/blog/2020/04/02/attack-matrix-kubernetes/ @madhuakula

Slide 10

Slide 10 text

TRACK: DEVSECOPS Layers of Defense Defense-in-Depth @madhuakula

Slide 11

Slide 11 text

TRACK: DEVSECOPS ● Code Quality Analysis (Ex: SonarQube) ● Security Linters (Ex: Findsecbugs) ● Sensitive Info/Secrets Analysis ● Dependency Security Analysis Checks ● Static Code Security Analysis ● Dynamic Security Analysis ● Semantic Code Analysis (Ex: CodeQL) ● Many more... Application Security @madhuakula

Slide 12

Slide 12 text

TRACK: DEVSECOPS Demo Time https://youtu.be/ayo6d0xHqyc @madhuakula

Slide 13

Slide 13 text

TRACK: DEVSECOPS Centralised Logging & Monitoring @madhuakula

Slide 14

Slide 14 text

TRACK: DEVSECOPS ● Immutable artifact ● Artifact store ● Artifact metadata ● Artifact auditors ● Artifact validations ● Deployment policy Supply Chain Security https://cloud.google.com/solutions/secure-software-supply-chains-on-google-kubernetes-engine @madhuakula

Slide 15

Slide 15 text

TRACK: DEVSECOPS Security Profiles https://github.com/genuinetools/bane @madhuakula

Slide 16

Slide 16 text

TRACK: DEVSECOPS Network Security Policies https://github.com/ahmetb/kubernetes-network-policy-recipes Provides isolation between Kubernetes resources (pods, namespaces, svc, etc.) using labels and selectors across the cluster. @madhuakula

Slide 17

Slide 17 text

TRACK: DEVSECOPS Risk Analysis https://github.com/goodwithtech/dockle https://github.com/aquasecurity/trivy https://kubesec.io @madhuakula

Slide 18

Slide 18 text

TRACK: DEVSECOPS ● Most of the cloud providers has fix for this in some way ● GKE: Workload Identity, Metadata Concealment for Nodes https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity ● AWS: IMDSv2 for SSRF https://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-re verse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service/ ● Metadata Concealment / Proxies @madhuakula

Slide 19

Slide 19 text

TRACK: DEVSECOPS Role-based access control (RBAC) is a method of regulating access to computer or network resources based on the roles of individual users within your organization. Role Based Access Control - RBAC https://kubernetes.io/docs/reference/access-authn-authz/rbac/ @madhuakula

Slide 20

Slide 20 text

TRACK: DEVSECOPS Secrets Management https://www.hashicorp.com/blog/injecting-vault-secrets-into-kubernetes-pods-via-a-sidecar/ @madhuakula

Slide 21

Slide 21 text

TRACK: DEVSECOPS TLS with cert-manager Automate certificate management in cloud native environments. cert-manager builds on top of Kubernetes, introducing certificate authorities and certificates as first-class resource types in the Kubernetes API. This makes it possible to provide 'certificates as a service' to developers working within your Kubernetes cluster. @madhuakula

Slide 22

Slide 22 text

TRACK: DEVSECOPS Pod Security Policies (PSP) https://kubernetes.io/docs/concepts/policy/pod-security-policy A Pod Security Policy is a cluster-level resource that controls security sensitive aspects of the pod specification. The PodSecurityPolicy objects define a set of conditions that a pod must run with in order to be accepted into the system, as well as defaults for the related fields. Good utility to check out is https://github.com/sysdiglabs/kube -psp-advisor WATCH OUT @madhuakula

Slide 23

Slide 23 text

TRACK: DEVSECOPS Open Policy Agent (OPA) Policy-based control for cloud native environments Flexible, fine-grained control for administrators across the stack https://www.openpolicyagent.or g @madhuakula

Slide 24

Slide 24 text

TRACK: DEVSECOPS Container Runtime Security ● gVisor is a user-space kernel, written in Go, that implements a substantial portion of the Linux system call interface. It provides an additional layer of isolation between running applications and the host operating system ● Firecracker is an open source virtualization technology that is purpose-built for creating and managing secure, multi-tenant container and function-based services ● Many other... @madhuakula

Slide 25

Slide 25 text

TRACK: DEVSECOPS Runtime Security Detection https://falco.org/ Falco, the open-source cloud-native runtime security project, is the de facto Kubernetes threat detection engine @madhuakula

Slide 26

Slide 26 text

TRACK: DEVSECOPS Docker CIS Benchmarks https://github.com/docker/docker-bench-security A script that checks for dozens of common best-practices around deploying Docker containers in production ● Host configuration ● Docker daemon configuration and files ● Docker container images ● Docker runtime ● Docker security operations ● Docker swarm configuration @madhuakula

Slide 27

Slide 27 text

TRACK: DEVSECOPS Kubernetes CIS Benchmarks https://github.com/aquasecurity/kube-bench ● Master Node Security Configuration ○ API Server ○ Scheduler ○ Controller Manager ○ Configuration Files ○ Etcd ○ General Security Primitives ○ PodSecurityPolicices ● Worker Node Security Configuration ○ Kubelet ○ Configuration Files @madhuakula

Slide 28

Slide 28 text

TRACK: DEVSECOPS Audit your Clusters https://github.com/Shopify/kubeaudit @madhuakula

Slide 29

Slide 29 text

TRACK: DEVSECOPS Best Practices ● Application Code ○ Code Linters ○ Dependency Scanning ○ Code Analysis (static, dynamic, variant and manual analysis) ● Infrastructure Code ○ Dockerfile (cis benchmarks, security best practices) ○ Kubernetes manifests/Helm charts (cis benchmarks, least privilege) ○ Host images, Host infrastructure (terraform, cloud infra security configs) ○ Container Registry, Config Management ● Sensitive information checks (secrets, api keys, etc.) ● Version Control System (Config, PRs, MRs, etc.) ● Manual Review/Approval/Verification @madhuakula

Slide 30

Slide 30 text

TRACK: DEVSECOPS Best Practices (Contd.) ● Secure Defaults ● Least privilege principle ● Network Security Policies ● RBAC reviews ● Service Mesh ● Open Security Policy Agent (Multiple levels applying policy engine checks) ● Proactive Logging & Monitoring for detection ● Falco - Syscall monitoring & Threat detection engine ● RASP - Runtime application security protection ● Logging & Monitoring with Centralized Monitoring ● Proactive Security Monitoring & Detection ● Many other... @madhuakula

Slide 31

Slide 31 text

TRACK: DEVSECOPS More Hands-On Labs coming here... https://github.com/madhuakula/kubernetes-goat @madhuakula

Slide 32

Slide 32 text

TRACK: DEVSECOPS Cloud Native Security Tools https://tools.tldr.run @madhuakula

Slide 33

Slide 33 text

TRACK: DEVSECOPS Key Takeaways ● Security is everyone’s responsibility (Dev, Ops and Security, etc.) ● Threat model your architecture and identify risks/threats ● Follow and apply secure defaults ● Know what you have (Inventory of assets) ● Adopt zero trust model and trust nothing (Zoning, Containment & Segmentation) ● Apply security at each layer (Defense in depth strategy) ● Follow least privilege principle ● AuthN & AuthZ ● Encryption at REST & TRANSIT ● Proactive monitoring & Active defense ● Continuously analyse and apply feedback loops ● Crawl, Walk, Run @madhuakula

Slide 34

Slide 34 text

TRACK: DEVSECOPS ● Docker Security Docs ● Kubernetes Security Docs ● Attack matrix for Kubernetes ● Breaking & Pwning Docker Containers & Kubernetes Clusters ● Advanced Persistence Threats: The Future of Kubernetes Attacks ● 11 Ways (Not) to Get Hacked ● Attacking & Auditing Docker Containers using Open Source @ DEFCON 26 ● Attacking and Auditing Docker Containers and Kubernetes Clusters @ DEFCON 27 ● contained.af ● CIS Benchmarks Docker ● Understanding and Hardening Linux Containers ● Abusing Privileged and Unprivileged Linux Containers ● Container Security Notes ● Linux Container Security ● Docker Runtime Privileges and Capabilities ● Apparmor Security Profiles on Docker ● Seccomp Security Profiles on Docker ● Docker Labs Capabilities ● Practical SELinux and Containers ● Containers and Operating systems morning paper gist ● Kubernetes Webinar series References & Resources @madhuakula

Slide 35

Slide 35 text

TRACK: DEVSECOPS ● Google SRE - 3 books ● Cloud Native Infrastructure Book ● Cloud Native Transformation Book ● Kubernetes-Security.info ● DevOps Security Checklist ● Kubernetes Attack Audit Reports ● CNCF Landscape ● Known CVE’s and Vulnerability Research ● K8S Slack Channels/Working Groups ● Katacoda Playgrounds & Play with Docker & Play with Kubernetes ● Many other... More Reading & Learning :) @madhuakula

Slide 36

Slide 36 text

TRACK: DEVSECOPS THANK YOU TO OUR SPONSORS @madhuakula

Slide 37

Slide 37 text

TRACK: DEVSECOPS Thank You Madhu Akula https://madhuakula.com @madhuakula