Finding Your Way in Container Security

K
Ksenia PegueroSr. Research Lead em Synopsys
Ksenia Peguero
September 19, 2023
Finding You Way in Container Security
© 2023 Synopsys, Inc. 2
Synopsys Confidential Information
whoami
• Current: Sr. Manager of Softwre Engineering
at Synopsys Software Integrity Group
• Prior: Principal Consultant at Cigital/Synopsys
• PhD in Computer Science
• Mother
• Ballroom dancing & diving
• @KseniaDmitrieva
© 2023 Synopsys, Inc. 3
Synopsys Confidential Information
Agenda
• Introduction to container technologies
• Challenges for DevSecOps engineers
• Common container threats and real-world attacks
• How to secure components of container infrastructure
• Standards and resources for container security
• Best practices to secure containers
© 2023 Synopsys, Inc. 4
Synopsys Confidential Information
What is a container?
• Containerization is not new. The first ones
appeared in 1999 as FreeBSD Jails
• Modern containers took off in 2013 (Docker)
Containers are executable units of software in
which application code is packaged, along with its
libraries and dependencies, in common ways so
that it can be run anywhere, whether it be on
desktop, traditional IT, or the cloud. (IBM)
• Containers use operating system virtualization
– Using namespaces and cgroups to isolate
processes, CPU, memory, disk
© 2023 Synopsys, Inc. 5
Synopsys Confidential Information
Containers vs Virtual Machines
Hypervisor
Hardware
• Isolation of machines
• Hardware virtualization
Host OS
Kernel
Hardware
• Process isolation
• Operating system virtualization >
Application virtualization
C 1 C 2 C 3 C 4
Containers Virtual Machines
VM1
OS
VM2
OS
VM3
OS
VM4
OS
© 2023 Synopsys, Inc. 6
Synopsys Confidential Information
Components of container infrastructure
Container
image
image creation
Image registry
image storage and retrieval
Orchestrator
automating deployment,
management, scaling,
security management
Container runtime
>_
loading container images,
spinning up containers,
managing network, local
resources
Host OS
running the container runtime
© 2023 Synopsys, Inc. 7
© 2019 Synopsys, Inc. 7
Synopsys Confidential Information
Main benefits:
• Lightweight
• Portable and platform independent
• Support modern development and architecture
• Improve utilization of CPU and memory
According to the IBM report, “containers are delivering real-world
business benefits”:
• Improved application quality
• Faster time to market
• Improved employee productivity
• Higher customer satisfaction
• Reduced application downtime
https://www.ibm.com/downloads/cas/VG8KRPRM
Benefits of using containers
This Photo by Unknown Author is licensed under CC BY
© 2023 Synopsys, Inc. 8
Synopsys Confidential Information
https://www.ibm.com/downloads/cas/VG8KRPRM
Challenges of using containers (in 2020)
Talent and
knowledge
Insufficient internal expertise
Complexity of learning containerization strategies and technologies
Challenges in redesigning existing on-premises enterprise application for containers
Costs
Uncertainty regarding the time and costs involved in container projects
No clear way to assess ROI or track benefits concretely
Difficulty predicting container performance, undermining confidence in meeting SLAs
Management
Difficulty cataloging, curating and managing containers as they proliferate across our environment
Difficulty managing, sharing and securing data across containers
Tooling
Immaturity of internal, homegrown tools for container development and management
Lack of enterprise-grade security capabilities
© 2023 Synopsys, Inc. 9
Synopsys Confidential Information
Examples of Container Vulnerabilities
• CVE-2014-9357
• CVE-2019-5021
• CVE-2019-15752
• CVE-2019-11246
Container
image
Image registry
Orchestrator
Container runtime
>_
Host OS
© 2023 Synopsys, Inc. 10
Synopsys Confidential Information
• Docker 1.3.2
– Used chroot sandboxing to extract archives
– Victim calls docker pull to automatically unpack a malicious image or build
• Attacker includes malicious xz binaries in the image or build
• Victim creates a container using the malicious image or build
• Privilege escalation => Attacker runs as root on the host OS
• CVE severity – Critical
• Vulnerability was fixed in Docker 1.3.3
CVE-2014-9357
Arbitrary code execution with root privileges
© 2023 Synopsys, Inc. 11
Synopsys Confidential Information
Blank root password
• Affects containers built with the Alpine Linux
Docker image versions 3, 4, 5.
• System credentials are typically stored in
etc/shadow
• Authentication mechanisms can be
customized with different packages
– Alpine Linux + shadow/PAM packages
• Empty password for root user
• Attacker hacks into container => easily
switches to root
• CVE Severity - Critical
CVE-2019-5021
Root users on Alpine Linux containers have blank passwords.
© 2023 Synopsys, Inc. 12
Synopsys Confidential Information
Trojan horse
• Not the virus trojan horse
• Docker Desktop Community Edition versions
prior to 2.1.0.1
• Docker startup or authenticate invokes
docker-credential-wincred.exe
• Access controls of containing folder
%PROGRAMDATA%DockerDesktopversi
on-bin
• Exploit: Replace the executable, keep the
name
• When Docker starts, the executable runs with
user’s privilege (what if it was admin?)
• CVE Severity - High
CVE-2019-15752
Docker folder uses the default windows access control.
© 2023 Synopsys, Inc. 13
Synopsys Confidential Information
• Affects Kubernetes versions older than 1.12.9,
1.13.6, and 1.14.2
• Command kubectl cp – copy files between
host and containers
– Packs into archive using tar
– Transfers over network
– Unpacks on the host
• Compromised tar binary on the container =>
access to the host file system:
– Adding malicious files
– Overwriting existing files
• CVE Severity - High
CVE-2019-11246
Kubernetes File Manipulation
© 2023 Synopsys, Inc. 14
Synopsys Confidential Information
Securing Containers: Risks and Mitigations
• Container image
• Image registry
• Container runtime
• Host OS
• Orchestrator
Container
image
Image registry
Orchestrator
Container runtime
>_
Host OS
© 2023 Synopsys, Inc. 15
Synopsys Confidential Information
Securing container images
Mitigations
• Use a minimalistic base OS, like Alpine Linux and
Windows Nano Server
• Keep the software in container images up-to-date
• Periodically scan the containers for:
– Known vulnerabilities / CVEs in the container layers
– Misconfigurations of containers
(Containerfiles/Dockerfiles) with a scanner (port
misconfigurations, protocols, certificates, running as non-
privileged users, etc.)
– Malware
– Hard-coded secrets
• An organization should have a set of vetted images
that are used across all teams
• Maintain application security requirements for the
code deployed on the container:
– Maintain the frameworks/libraries/components up-to-date
– Scan the internally-developed applications
• Base OS functionality and components
• Components missing critical security
updates (component become outdated over
time)
• Configuration defects
• Embedded malware
• Leaking clear text secrets
Risks
© 2023 Synopsys, Inc. 16
Synopsys Confidential Information
Securing image registries
Mitigations
• Use private registry
• Use secure connections to the registry
• Harden the registry host
• Use authentication and access control
– E.g. developers can only write to the
specific repository
• Regularly monitor
• Prune stale images
• Only publish trusted images (that
passed security requirements)
• Ensure that only containers from your
private registry can be used within the
organization
• Insecure connection
• Leaking IP from the
registry
• Stale images
Risks
© 2023 Synopsys, Inc. 17
Synopsys Confidential Information
Securing container runtime
Mitigations
• Monitor container runtime for vulnerabilities (CVEs)
and update it often
• Control egress network traffic sent by containers
– Traffic in the virtual network is encrypted.
Therefore, traditional network controls (firewalls)
may not work.
– Dynamic IP assigned automatically. Therefore, IP-
based controls won’t work.
– Use app-aware tools
• Use mandatory access control (MAC) technologies
(file system, processes, network sockets, etc.)
• CIS Benchmark for Docker
• Use OS kernel level controls
• Network risks between containers in the
same runtime
• Runtime misconfigurations:
• Containers running in privileged mode
• Containers mounting volumes in sensitive
directories on the host OS
Risks
© 2023 Synopsys, Inc. 18
Synopsys Confidential Information
Securing host OS
Mitigations
• Use slim OS with kernel protections (e.g.
SELinux)
• Keep the OS up-to-date, monitor for
vulnerabilities
• Limit logins to the host OS, audit
authentication
• Monitoring for any unexpected behavior on
the host (network, file system, processes,
etc.)
• Running “busted” containers
• Malicious containers
• Rogue containers
• Containers with vulnerable layers
• Containers with application security
defects
• Large attack surface
• Shared kernel
• Host OS components
• Shared file system (mounting volumes)
• Additional users of the OS
Risks
© 2023 Synopsys, Inc. 19
Synopsys Confidential Information
Host OS
Can we forget about application security?
Scenario: vulnerable application in a container
Secure/vetted
Container
Container
Marketing
web app
Public
Internet
DB Engine
SQL injection
Payload: SQLi to RCE
Container Container Container
Mitigations:
• Limit egress: to an internal
subnet or (better) application
protocols
• No internet access
• Only needed internal
network access
• Restrict DB user: deny running
OS commands
Service managing bounties
for Bug Bounty program
RCE: network scan
© 2023 Synopsys, Inc. 20
Synopsys Confidential Information
Securing orchestration platforms
Risks
• Unnecessary administrative access
• Unauthorized access (to containers and data storage
volumes)
• Compliance risk – encrypting data at rest
• Network risks – traffic from different applications sharing
the same virtual network
• Orchestrator node trust
Mitigations
• Limit the number of privileged users
• Access control linked to the company user directory
• Encrypting data storage volumes
• Segmentation, segmentation, segmentation:
– Virtual networks by sensitivity level (if by app is not
possible)
– Host “pinning” by sensitivity levels (individually
managed clusters)
Aerial view of the Forbidden City, Beijing (© Google Earth 2021)
Defense in depth
© 2023 Synopsys, Inc. 21
Synopsys Confidential Information
Container Security Resources
© 2023 Synopsys, Inc. 22
Synopsys Confidential Information
OWASP Docker Top 10
Draft in progress.
Not a list of top 10 vulnerabilities or risks, but a
list of top 10 controls.
Document: https://github.com/OWASP/Docker-
Security/blob/main/dist/owasp-docker-
security.pdf
• Use it as guidance during the design phase,
for auditing an existing environment, or
procuring a new one
• Focuses on Docker, but could be applied to
containers in general
• Orchestrator security risks are out of scope
for this list, but container networking is in
scope
D01 - Secure User Mapping
D02 - Patch Management Strategy
D03 - Network Segmentation and Firewalling
D04 - Secure Defaults and Hardening
D05 - Maintain Security Contexts
D06 - Protect Secrets
D07 - Resource Protection
D08 - Container Image Integrity and Origin
D09 - Follow Immutable Paradigm
D10 - Logging
https://owasp.org/www-project-docker-top-10/
© 2023 Synopsys, Inc. 23
Synopsys Confidential Information
OWASP Container Security Verification Standard (CSVS)
• The structure is based on the OWASP Application
Security Verification Standard (ASVS)
• Has overlap with Docker Top 10, but covers broader
categories:
– V1: Organizational (processes & people)
– V2: Infrastructure
– V3: Containers (Docker Top 10)
– V4: Orchestration Management
– V5: Image Distribution
– V6: Secrets and Keys
– V7: Network
– V8: Storage
– V9: Logging & Monitoring
– V10: Integration
– V11: Disaster Recovery
– V12: Testing
• This is a shorter standard, compared to CIS
Benchmarks and NIST Application Container Security
Guide
https://owasp.org/www-project-container-security-verification-standard/migrated_content
• Provides 3 security verification levels
1. For all containers
2. Containers with sensitive data or business logic
3. Critical containers (high value transactions, PII,
medical data)
© 2023 Synopsys, Inc. 24
Synopsys Confidential Information
NIST Special Publication 800-190
Application Container Security Guide
https://doi.org/10.6028/NIST.SP.800-190
• Overview of Container Technology
• Explains basic concepts of container
and orchestrations
• Discusses risks to the core components
of container technologies
• Contains a section on countermeasures
for the listed risks
• Provides threat scenario examples and
considerations for the container
technology life cycle
NIST Application Container Security Guide
Container Technology Architecture and Lifecycle Phases
NIST SP 800-190
© 2023 Synopsys, Inc. 25
Synopsys Confidential Information
Center for Internet Security (CIS) developed "more than 100 configuration guidelines across 25+
vendor product families to safeguard systems against today’s evolving cyber threats."
• CIS Benchmarks include hardening guidelines for manual and automated steps
CIS Docker Benchmark provides detailed guidelines in the following categories:
• Host
• Docker daemon and its config files
• Container images and build files
• Container runtime
• Docker security operations
• Docker Swarm
CIS Docker Benchmark
https://www.cisecurity.org/benchmark/docker
© 2023 Synopsys, Inc. 26
Synopsys Confidential Information
• Harden all the systems
• Use segmentation at all levels (clusters, hosts, networks)
• Monitor all the components
• Use vetted base images
• Generate a Software Bill of Materials (SBOM) for every container image
– Gotchas – only if the installer is used and not a custom script
• Use an ASOC tool (Application Security Orchestration and Correlation)
– Collects data from various AppSec sources
– Consolidates and correlates the findings, prioritizing remediation efforts
Best Practices of Securing Containers
© 2023 Synopsys, Inc. 27
Synopsys Confidential Information
Ksenia Peguero
ksenia@synopsys.com
Twitter: @KseniaDmitrieva
https://www.synopsys.com/software
Thank You
1 de 28

Recomendados

Finding Your Way in Container Security por
Finding Your Way in Container SecurityFinding Your Way in Container Security
Finding Your Way in Container SecurityKsenia Peguero
122 visualizações28 slides
Applied Security for Containers, OW2con'18, June 7-8, 2018, Paris por
Applied Security for Containers, OW2con'18, June 7-8, 2018, ParisApplied Security for Containers, OW2con'18, June 7-8, 2018, Paris
Applied Security for Containers, OW2con'18, June 7-8, 2018, ParisOW2
131 visualizações21 slides
Understanding docker ecosystem and vulnerabilities points por
Understanding docker ecosystem and vulnerabilities pointsUnderstanding docker ecosystem and vulnerabilities points
Understanding docker ecosystem and vulnerabilities pointsAbdul Khan
17 visualizações23 slides
Docker Containers Security por
Docker Containers SecurityDocker Containers Security
Docker Containers SecurityStephane Woillez
285 visualizações23 slides
Docker Enterprise Deployment Planning por
Docker Enterprise Deployment PlanningDocker Enterprise Deployment Planning
Docker Enterprise Deployment PlanningStephane Woillez
255 visualizações26 slides
Strategy, planning and governance for enterprise deployments of containers - ... por
Strategy, planning and governance for enterprise deployments of containers - ...Strategy, planning and governance for enterprise deployments of containers - ...
Strategy, planning and governance for enterprise deployments of containers - ...The Incredible Automation Day
2.6K visualizações26 slides

Mais conteúdo relacionado

Similar a Finding Your Way in Container Security

Containerization por
ContainerizationContainerization
ContainerizationGowtham Ventrapati
2.3K visualizações16 slides
AWS re:Invent 2016: Securing Container-Based Applications (CON402) por
AWS re:Invent 2016: Securing Container-Based Applications (CON402)AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)Amazon Web Services
2.3K visualizações56 slides
AWS re:Invent 2016: Securing Container-Based Applications (CON402) por
AWS re:Invent 2016: Securing Container-Based Applications (CON402)AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)Amazon Web Services
2.1K visualizações56 slides
Dockers and kubernetes por
Dockers and kubernetesDockers and kubernetes
Dockers and kubernetesDr Ganesh Iyer
3.1K visualizações133 slides
Securing the Infrastructure and the Workloads of Linux Containers por
Securing the Infrastructure and the Workloads of Linux ContainersSecuring the Infrastructure and the Workloads of Linux Containers
Securing the Infrastructure and the Workloads of Linux ContainersMassimiliano Mattetti
530 visualizações24 slides
Containers and Security for DevOps por
Containers and Security for DevOpsContainers and Security for DevOps
Containers and Security for DevOpsSalesforce Engineering
337 visualizações37 slides

Similar a Finding Your Way in Container Security(20)

Containerization por Gowtham Ventrapati
ContainerizationContainerization
Containerization
Gowtham Ventrapati2.3K visualizações
AWS re:Invent 2016: Securing Container-Based Applications (CON402) por Amazon Web Services
AWS re:Invent 2016: Securing Container-Based Applications (CON402)AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)
Amazon Web Services2.3K visualizações
AWS re:Invent 2016: Securing Container-Based Applications (CON402) por Amazon Web Services
AWS re:Invent 2016: Securing Container-Based Applications (CON402)AWS re:Invent 2016: Securing Container-Based Applications (CON402)
AWS re:Invent 2016: Securing Container-Based Applications (CON402)
Amazon Web Services2.1K visualizações
Dockers and kubernetes por Dr Ganesh Iyer
Dockers and kubernetesDockers and kubernetes
Dockers and kubernetes
Dr Ganesh Iyer3.1K visualizações
Securing the Infrastructure and the Workloads of Linux Containers por Massimiliano Mattetti
Securing the Infrastructure and the Workloads of Linux ContainersSecuring the Infrastructure and the Workloads of Linux Containers
Securing the Infrastructure and the Workloads of Linux Containers
Massimiliano Mattetti530 visualizações
Containers and Security for DevOps por Salesforce Engineering
Containers and Security for DevOpsContainers and Security for DevOps
Containers and Security for DevOps
Salesforce Engineering337 visualizações
Container Security por Salman Baset
Container SecurityContainer Security
Container Security
Salman Baset470 visualizações
Replace your Docker based Containers with Cri-o Kata Containers for better se... por NETWAYS
Replace your Docker based Containers with Cri-o Kata Containers for better se...Replace your Docker based Containers with Cri-o Kata Containers for better se...
Replace your Docker based Containers with Cri-o Kata Containers for better se...
NETWAYS221 visualizações
Demystifying Containerization Principles for Data Scientists por Dr Ganesh Iyer
Demystifying Containerization Principles for Data ScientistsDemystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data Scientists
Dr Ganesh Iyer198 visualizações
Container Security Essentials por DNIF
Container Security EssentialsContainer Security Essentials
Container Security Essentials
DNIF318 visualizações
Are Your Containers as Secure as You Think? por DevOps.com
Are Your Containers as Secure as You Think?Are Your Containers as Secure as You Think?
Are Your Containers as Secure as You Think?
DevOps.com128 visualizações
Understanding container security por John Kinsella
Understanding container securityUnderstanding container security
Understanding container security
John Kinsella2.6K visualizações
State of the Container Ecosystem por Vinay Rao
State of the Container EcosystemState of the Container Ecosystem
State of the Container Ecosystem
Vinay Rao601 visualizações
The Kubernetes WebLogic revival (part 1) por Simon Haslam
The Kubernetes WebLogic revival (part 1)The Kubernetes WebLogic revival (part 1)
The Kubernetes WebLogic revival (part 1)
Simon Haslam305 visualizações
Immutable Infrastructure Security por Ricky Sanders
Immutable Infrastructure SecurityImmutable Infrastructure Security
Immutable Infrastructure Security
Ricky Sanders1.2K visualizações
DCSF19 Container Security: Theory & Practice at Netflix por Docker, Inc.
DCSF19 Container Security: Theory & Practice at NetflixDCSF19 Container Security: Theory & Practice at Netflix
DCSF19 Container Security: Theory & Practice at Netflix
Docker, Inc.3.6K visualizações
UKC - Feb 2013 - Analyzing the security of Windows 7 and Linux for cloud comp... por Vincent Giersch
UKC - Feb 2013 - Analyzing the security of Windows 7 and Linux for cloud comp...UKC - Feb 2013 - Analyzing the security of Windows 7 and Linux for cloud comp...
UKC - Feb 2013 - Analyzing the security of Windows 7 and Linux for cloud comp...
Vincent Giersch815 visualizações
Why kubernetes matters por Platform9
Why kubernetes mattersWhy kubernetes matters
Why kubernetes matters
Platform93K visualizações

Último

START Newsletter 3 por
START Newsletter 3START Newsletter 3
START Newsletter 3Start Project
5 visualizações25 slides
802.11 Computer Networks por
802.11 Computer Networks802.11 Computer Networks
802.11 Computer NetworksTusharChoudhary72015
9 visualizações33 slides
Control Systems Feedback.pdf por
Control Systems Feedback.pdfControl Systems Feedback.pdf
Control Systems Feedback.pdfLGGaming5
5 visualizações39 slides
NEW SUPPLIERS SUPPLIES (copie).pdf por
NEW SUPPLIERS SUPPLIES (copie).pdfNEW SUPPLIERS SUPPLIES (copie).pdf
NEW SUPPLIERS SUPPLIES (copie).pdfgeorgesradjou
15 visualizações30 slides
MSA Website Slideshow (16).pdf por
MSA Website Slideshow (16).pdfMSA Website Slideshow (16).pdf
MSA Website Slideshow (16).pdfmsaucla
64 visualizações8 slides
Advances in micro milling: From tool fabrication to process outcomes por
Advances in micro milling: From tool fabrication to process outcomesAdvances in micro milling: From tool fabrication to process outcomes
Advances in micro milling: From tool fabrication to process outcomesShivendra Nandan
5 visualizações18 slides

Último(20)

START Newsletter 3 por Start Project
START Newsletter 3START Newsletter 3
START Newsletter 3
Start Project5 visualizações
Control Systems Feedback.pdf por LGGaming5
Control Systems Feedback.pdfControl Systems Feedback.pdf
Control Systems Feedback.pdf
LGGaming55 visualizações
NEW SUPPLIERS SUPPLIES (copie).pdf por georgesradjou
NEW SUPPLIERS SUPPLIES (copie).pdfNEW SUPPLIERS SUPPLIES (copie).pdf
NEW SUPPLIERS SUPPLIES (copie).pdf
georgesradjou15 visualizações
MSA Website Slideshow (16).pdf por msaucla
MSA Website Slideshow (16).pdfMSA Website Slideshow (16).pdf
MSA Website Slideshow (16).pdf
msaucla64 visualizações
Advances in micro milling: From tool fabrication to process outcomes por Shivendra Nandan
Advances in micro milling: From tool fabrication to process outcomesAdvances in micro milling: From tool fabrication to process outcomes
Advances in micro milling: From tool fabrication to process outcomes
Shivendra Nandan5 visualizações
Digital Watermarking Of Audio Signals.pptx por AyushJaiswal781174
Digital Watermarking Of Audio Signals.pptxDigital Watermarking Of Audio Signals.pptx
Digital Watermarking Of Audio Signals.pptx
AyushJaiswal78117411 visualizações
An approach of ontology and knowledge base for railway maintenance por IJECEIAES
An approach of ontology and knowledge base for railway maintenanceAn approach of ontology and knowledge base for railway maintenance
An approach of ontology and knowledge base for railway maintenance
IJECEIAES12 visualizações
Thermal aware task assignment for multicore processors using genetic algorithm por IJECEIAES
Thermal aware task assignment for multicore processors using genetic algorithm Thermal aware task assignment for multicore processors using genetic algorithm
Thermal aware task assignment for multicore processors using genetic algorithm
IJECEIAES31 visualizações
SUMIT SQL PROJECT SUPERSTORE 1.pptx por Sumit Jadhav
SUMIT SQL PROJECT SUPERSTORE 1.pptxSUMIT SQL PROJECT SUPERSTORE 1.pptx
SUMIT SQL PROJECT SUPERSTORE 1.pptx
Sumit Jadhav 12 visualizações
DESIGN OF SPRINGS-UNIT4.pptx por gopinathcreddy
DESIGN OF SPRINGS-UNIT4.pptxDESIGN OF SPRINGS-UNIT4.pptx
DESIGN OF SPRINGS-UNIT4.pptx
gopinathcreddy19 visualizações
Searching in Data Structure por raghavbirla63
Searching in Data StructureSearching in Data Structure
Searching in Data Structure
raghavbirla635 visualizações
What is Whirling Hygrometer.pdf por IIT KHARAGPUR
What is Whirling Hygrometer.pdfWhat is Whirling Hygrometer.pdf
What is Whirling Hygrometer.pdf
IIT KHARAGPUR 11 visualizações
Activated sludge process .pdf por 8832RafiyaAltaf
Activated sludge process .pdfActivated sludge process .pdf
Activated sludge process .pdf
8832RafiyaAltaf9 visualizações
Design of machine elements-UNIT 3.pptx por gopinathcreddy
Design of machine elements-UNIT 3.pptxDesign of machine elements-UNIT 3.pptx
Design of machine elements-UNIT 3.pptx
gopinathcreddy32 visualizações
DevOps-ITverse-2023-IIT-DU.pptx por Anowar Hossain
DevOps-ITverse-2023-IIT-DU.pptxDevOps-ITverse-2023-IIT-DU.pptx
DevOps-ITverse-2023-IIT-DU.pptx
Anowar Hossain9 visualizações
Taking out the Trash (And the Recyclables]: RFID and the Handling of Municipa... por ijseajournal
Taking out the Trash (And the Recyclables]: RFID and the Handling of Municipa...Taking out the Trash (And the Recyclables]: RFID and the Handling of Municipa...
Taking out the Trash (And the Recyclables]: RFID and the Handling of Municipa...
ijseajournal5 visualizações
K8S Roadmap.pdf por MaryamTavakkoli2
K8S Roadmap.pdfK8S Roadmap.pdf
K8S Roadmap.pdf
MaryamTavakkoli26 visualizações
Saikat Chakraborty Java Oracle Certificate.pdf por SaikatChakraborty787148
Saikat Chakraborty Java Oracle Certificate.pdfSaikat Chakraborty Java Oracle Certificate.pdf
Saikat Chakraborty Java Oracle Certificate.pdf
SaikatChakraborty78714815 visualizações

Finding Your Way in Container Security

  • 1. Ksenia Peguero September 19, 2023 Finding You Way in Container Security
  • 2. © 2023 Synopsys, Inc. 2 Synopsys Confidential Information whoami • Current: Sr. Manager of Softwre Engineering at Synopsys Software Integrity Group • Prior: Principal Consultant at Cigital/Synopsys • PhD in Computer Science • Mother • Ballroom dancing & diving • @KseniaDmitrieva
  • 3. © 2023 Synopsys, Inc. 3 Synopsys Confidential Information Agenda • Introduction to container technologies • Challenges for DevSecOps engineers • Common container threats and real-world attacks • How to secure components of container infrastructure • Standards and resources for container security • Best practices to secure containers
  • 4. © 2023 Synopsys, Inc. 4 Synopsys Confidential Information What is a container? • Containerization is not new. The first ones appeared in 1999 as FreeBSD Jails • Modern containers took off in 2013 (Docker) Containers are executable units of software in which application code is packaged, along with its libraries and dependencies, in common ways so that it can be run anywhere, whether it be on desktop, traditional IT, or the cloud. (IBM) • Containers use operating system virtualization – Using namespaces and cgroups to isolate processes, CPU, memory, disk
  • 5. © 2023 Synopsys, Inc. 5 Synopsys Confidential Information Containers vs Virtual Machines Hypervisor Hardware • Isolation of machines • Hardware virtualization Host OS Kernel Hardware • Process isolation • Operating system virtualization > Application virtualization C 1 C 2 C 3 C 4 Containers Virtual Machines VM1 OS VM2 OS VM3 OS VM4 OS
  • 6. © 2023 Synopsys, Inc. 6 Synopsys Confidential Information Components of container infrastructure Container image image creation Image registry image storage and retrieval Orchestrator automating deployment, management, scaling, security management Container runtime >_ loading container images, spinning up containers, managing network, local resources Host OS running the container runtime
  • 7. © 2023 Synopsys, Inc. 7 © 2019 Synopsys, Inc. 7 Synopsys Confidential Information Main benefits: • Lightweight • Portable and platform independent • Support modern development and architecture • Improve utilization of CPU and memory According to the IBM report, “containers are delivering real-world business benefits”: • Improved application quality • Faster time to market • Improved employee productivity • Higher customer satisfaction • Reduced application downtime https://www.ibm.com/downloads/cas/VG8KRPRM Benefits of using containers This Photo by Unknown Author is licensed under CC BY
  • 8. © 2023 Synopsys, Inc. 8 Synopsys Confidential Information https://www.ibm.com/downloads/cas/VG8KRPRM Challenges of using containers (in 2020) Talent and knowledge Insufficient internal expertise Complexity of learning containerization strategies and technologies Challenges in redesigning existing on-premises enterprise application for containers Costs Uncertainty regarding the time and costs involved in container projects No clear way to assess ROI or track benefits concretely Difficulty predicting container performance, undermining confidence in meeting SLAs Management Difficulty cataloging, curating and managing containers as they proliferate across our environment Difficulty managing, sharing and securing data across containers Tooling Immaturity of internal, homegrown tools for container development and management Lack of enterprise-grade security capabilities
  • 9. © 2023 Synopsys, Inc. 9 Synopsys Confidential Information Examples of Container Vulnerabilities • CVE-2014-9357 • CVE-2019-5021 • CVE-2019-15752 • CVE-2019-11246 Container image Image registry Orchestrator Container runtime >_ Host OS
  • 10. © 2023 Synopsys, Inc. 10 Synopsys Confidential Information • Docker 1.3.2 – Used chroot sandboxing to extract archives – Victim calls docker pull to automatically unpack a malicious image or build • Attacker includes malicious xz binaries in the image or build • Victim creates a container using the malicious image or build • Privilege escalation => Attacker runs as root on the host OS • CVE severity – Critical • Vulnerability was fixed in Docker 1.3.3 CVE-2014-9357 Arbitrary code execution with root privileges
  • 11. © 2023 Synopsys, Inc. 11 Synopsys Confidential Information Blank root password • Affects containers built with the Alpine Linux Docker image versions 3, 4, 5. • System credentials are typically stored in etc/shadow • Authentication mechanisms can be customized with different packages – Alpine Linux + shadow/PAM packages • Empty password for root user • Attacker hacks into container => easily switches to root • CVE Severity - Critical CVE-2019-5021 Root users on Alpine Linux containers have blank passwords.
  • 12. © 2023 Synopsys, Inc. 12 Synopsys Confidential Information Trojan horse • Not the virus trojan horse • Docker Desktop Community Edition versions prior to 2.1.0.1 • Docker startup or authenticate invokes docker-credential-wincred.exe • Access controls of containing folder %PROGRAMDATA%DockerDesktopversi on-bin • Exploit: Replace the executable, keep the name • When Docker starts, the executable runs with user’s privilege (what if it was admin?) • CVE Severity - High CVE-2019-15752 Docker folder uses the default windows access control.
  • 13. © 2023 Synopsys, Inc. 13 Synopsys Confidential Information • Affects Kubernetes versions older than 1.12.9, 1.13.6, and 1.14.2 • Command kubectl cp – copy files between host and containers – Packs into archive using tar – Transfers over network – Unpacks on the host • Compromised tar binary on the container => access to the host file system: – Adding malicious files – Overwriting existing files • CVE Severity - High CVE-2019-11246 Kubernetes File Manipulation
  • 14. © 2023 Synopsys, Inc. 14 Synopsys Confidential Information Securing Containers: Risks and Mitigations • Container image • Image registry • Container runtime • Host OS • Orchestrator Container image Image registry Orchestrator Container runtime >_ Host OS
  • 15. © 2023 Synopsys, Inc. 15 Synopsys Confidential Information Securing container images Mitigations • Use a minimalistic base OS, like Alpine Linux and Windows Nano Server • Keep the software in container images up-to-date • Periodically scan the containers for: – Known vulnerabilities / CVEs in the container layers – Misconfigurations of containers (Containerfiles/Dockerfiles) with a scanner (port misconfigurations, protocols, certificates, running as non- privileged users, etc.) – Malware – Hard-coded secrets • An organization should have a set of vetted images that are used across all teams • Maintain application security requirements for the code deployed on the container: – Maintain the frameworks/libraries/components up-to-date – Scan the internally-developed applications • Base OS functionality and components • Components missing critical security updates (component become outdated over time) • Configuration defects • Embedded malware • Leaking clear text secrets Risks
  • 16. © 2023 Synopsys, Inc. 16 Synopsys Confidential Information Securing image registries Mitigations • Use private registry • Use secure connections to the registry • Harden the registry host • Use authentication and access control – E.g. developers can only write to the specific repository • Regularly monitor • Prune stale images • Only publish trusted images (that passed security requirements) • Ensure that only containers from your private registry can be used within the organization • Insecure connection • Leaking IP from the registry • Stale images Risks
  • 17. © 2023 Synopsys, Inc. 17 Synopsys Confidential Information Securing container runtime Mitigations • Monitor container runtime for vulnerabilities (CVEs) and update it often • Control egress network traffic sent by containers – Traffic in the virtual network is encrypted. Therefore, traditional network controls (firewalls) may not work. – Dynamic IP assigned automatically. Therefore, IP- based controls won’t work. – Use app-aware tools • Use mandatory access control (MAC) technologies (file system, processes, network sockets, etc.) • CIS Benchmark for Docker • Use OS kernel level controls • Network risks between containers in the same runtime • Runtime misconfigurations: • Containers running in privileged mode • Containers mounting volumes in sensitive directories on the host OS Risks
  • 18. © 2023 Synopsys, Inc. 18 Synopsys Confidential Information Securing host OS Mitigations • Use slim OS with kernel protections (e.g. SELinux) • Keep the OS up-to-date, monitor for vulnerabilities • Limit logins to the host OS, audit authentication • Monitoring for any unexpected behavior on the host (network, file system, processes, etc.) • Running “busted” containers • Malicious containers • Rogue containers • Containers with vulnerable layers • Containers with application security defects • Large attack surface • Shared kernel • Host OS components • Shared file system (mounting volumes) • Additional users of the OS Risks
  • 19. © 2023 Synopsys, Inc. 19 Synopsys Confidential Information Host OS Can we forget about application security? Scenario: vulnerable application in a container Secure/vetted Container Container Marketing web app Public Internet DB Engine SQL injection Payload: SQLi to RCE Container Container Container Mitigations: • Limit egress: to an internal subnet or (better) application protocols • No internet access • Only needed internal network access • Restrict DB user: deny running OS commands Service managing bounties for Bug Bounty program RCE: network scan
  • 20. © 2023 Synopsys, Inc. 20 Synopsys Confidential Information Securing orchestration platforms Risks • Unnecessary administrative access • Unauthorized access (to containers and data storage volumes) • Compliance risk – encrypting data at rest • Network risks – traffic from different applications sharing the same virtual network • Orchestrator node trust Mitigations • Limit the number of privileged users • Access control linked to the company user directory • Encrypting data storage volumes • Segmentation, segmentation, segmentation: – Virtual networks by sensitivity level (if by app is not possible) – Host “pinning” by sensitivity levels (individually managed clusters) Aerial view of the Forbidden City, Beijing (© Google Earth 2021) Defense in depth
  • 21. © 2023 Synopsys, Inc. 21 Synopsys Confidential Information Container Security Resources
  • 22. © 2023 Synopsys, Inc. 22 Synopsys Confidential Information OWASP Docker Top 10 Draft in progress. Not a list of top 10 vulnerabilities or risks, but a list of top 10 controls. Document: https://github.com/OWASP/Docker- Security/blob/main/dist/owasp-docker- security.pdf • Use it as guidance during the design phase, for auditing an existing environment, or procuring a new one • Focuses on Docker, but could be applied to containers in general • Orchestrator security risks are out of scope for this list, but container networking is in scope D01 - Secure User Mapping D02 - Patch Management Strategy D03 - Network Segmentation and Firewalling D04 - Secure Defaults and Hardening D05 - Maintain Security Contexts D06 - Protect Secrets D07 - Resource Protection D08 - Container Image Integrity and Origin D09 - Follow Immutable Paradigm D10 - Logging https://owasp.org/www-project-docker-top-10/
  • 23. © 2023 Synopsys, Inc. 23 Synopsys Confidential Information OWASP Container Security Verification Standard (CSVS) • The structure is based on the OWASP Application Security Verification Standard (ASVS) • Has overlap with Docker Top 10, but covers broader categories: – V1: Organizational (processes & people) – V2: Infrastructure – V3: Containers (Docker Top 10) – V4: Orchestration Management – V5: Image Distribution – V6: Secrets and Keys – V7: Network – V8: Storage – V9: Logging & Monitoring – V10: Integration – V11: Disaster Recovery – V12: Testing • This is a shorter standard, compared to CIS Benchmarks and NIST Application Container Security Guide https://owasp.org/www-project-container-security-verification-standard/migrated_content • Provides 3 security verification levels 1. For all containers 2. Containers with sensitive data or business logic 3. Critical containers (high value transactions, PII, medical data)
  • 24. © 2023 Synopsys, Inc. 24 Synopsys Confidential Information NIST Special Publication 800-190 Application Container Security Guide https://doi.org/10.6028/NIST.SP.800-190 • Overview of Container Technology • Explains basic concepts of container and orchestrations • Discusses risks to the core components of container technologies • Contains a section on countermeasures for the listed risks • Provides threat scenario examples and considerations for the container technology life cycle NIST Application Container Security Guide Container Technology Architecture and Lifecycle Phases NIST SP 800-190
  • 25. © 2023 Synopsys, Inc. 25 Synopsys Confidential Information Center for Internet Security (CIS) developed "more than 100 configuration guidelines across 25+ vendor product families to safeguard systems against today’s evolving cyber threats." • CIS Benchmarks include hardening guidelines for manual and automated steps CIS Docker Benchmark provides detailed guidelines in the following categories: • Host • Docker daemon and its config files • Container images and build files • Container runtime • Docker security operations • Docker Swarm CIS Docker Benchmark https://www.cisecurity.org/benchmark/docker
  • 26. © 2023 Synopsys, Inc. 26 Synopsys Confidential Information • Harden all the systems • Use segmentation at all levels (clusters, hosts, networks) • Monitor all the components • Use vetted base images • Generate a Software Bill of Materials (SBOM) for every container image – Gotchas – only if the installer is used and not a custom script • Use an ASOC tool (Application Security Orchestration and Correlation) – Collects data from various AppSec sources – Consolidates and correlates the findings, prioritizing remediation efforts Best Practices of Securing Containers
  • 27. © 2023 Synopsys, Inc. 27 Synopsys Confidential Information Ksenia Peguero ksenia@synopsys.com Twitter: @KseniaDmitrieva https://www.synopsys.com/software