SlideShare a Scribd company logo
1 of 40
$whoami
MIHIR SHAH | SHAHENSHAH
github.com/shahenshah99
Previous talks and content
Hack ElasticSearch
This particular exploit took advantage of the Elasticsearch
search capabilities. In order for the attack to work, it
requires data
INSERT DATA
Use cURL to add a record. ElasticSearch can take a
minute to launch, so you may find it's not listening yet.
EXPLOIT
This particular version of Elasticsearch (1.4.2) allowed
Java code to be used as part of the search. While
whitelisting existed, there are other ways to gain access to
the Java API required to potentially case damage.
Let’s get a shell
CGroups
CGroups control how much resources a process can use.
It is possible to ensure system protection from malicious
users or applications against DoS attacks
CPU-Shares
While memory limits defined a set maximum, CPU limits
are based on shares. These shares are a weight
between how much processing time one process should
get compared to another. If a CPU is idle, then the
process will use all the available resources. If a second
process requires the CPU then the available CPU time
will be shared based on the weighting.
Network Namespace
Namespaces control what a process and see and
access.
Pid Namespace
As with networks, the processes a container can see
depends on which namespace it belongs too. By changing
the Pid namespace allows a container to interact with
processes beyond its normal scope.
Shared Namespaces
Providing containers access to the host namespace is
sometimes required, such as for debugging tooling, but is
regarded as bad practice.
Understanding the
installation of Clair/CoreOS
Copy the docker image to
the registry
Creating a SecComp Profile
SecComp defines which system calls should and should
not be allowed to be executed by a container. They're
defined in a JSON file that is applied when a container
starts.
Lets launch a container
IT DIDN’T WORK
Because our container attempted to execute chmod, the
call failed with Operation not permitted. This is because
our seccomp profile blocked it.
Trying strace on Ubuntu and Alpine
and observing the results
New-Privilege Flags
User Namespace
By default, the Docker Daemon runs as root user on the host
ps aux | grep docker
As a result of the Daemon running as root, any containers started will
have the same security context as the host's root user.
This has the side-effect that if files owned by the root user are accessible
from the container, then can be modified by the running container.
docker run --rm alpine id
Case Scenario
Let’s create a copy of the touch binary
sudo cp /bin/touch /bin/touch.bak && ls -lha
/bin/touch.bak
Because the container is both root inside the container and on the host, the file
can be removed.
docker run -it -v /bin/:/host/ alpine rm -f /host/touch.bak
As a result, the command no longer exists.
In this case, the container is capable of deleting the touch binary from the host.
Mitigation Technique
docker run --user=1000:1000 alpine
id
LETS TRY THIS ON PREVIOUS SCENARIO
(DEMO)
What if we required root
level access inside the
container?
Enter User Namespaces
User Namespaces are a Linux Kernel security
feature. The feature allows a root user inside a
namespace, or container, to a unprivileged user
id on the Host.
Docker Ignore
Lets create an Image with a potentially sensitive file
and see how it goes around
But what if you want to use
the passwords.txt in your
image?
Accessing .ssh files
Create some data to use in the build within the .ssh mounted directory.
Start a build secrets server. This server will be used by
other containers are they're building built to access the .ssh
mounted directory.
Lets understand the
dockerfile for OnVault and
build the image
docker build -f Dockerfile-onvault -t onvault-test .
Time for the truth!!
docker run -it onvault-test ls /root/.ssh
Reading Vault secrets from
docker containers
To access the stored secrets, the container is configured
to use a Volume Driver called LibSecret. The Volume
Driver communicates with Vault meaning the applications
don't require any additional configuration to access the
secrets.
Lets set up the environment
first
1. The first script launches the Consul and Vault
containers
1. The Vault starts sealed meaning you can't read/write
data. Use the helper script to unseal the vault
1. The final stage is to obtain the access token; this is
outputted when we initialised and unsealed the vault.
1. By logging in we can now start storing and persisting
data
Vault will encrypt the data before storing it in Consul. The
name of the key is db-password which we're storing under
the collection app-1. By grouping secrets around
applications makes them easier to manage. It also allows
you to add restrictions to only allow certain users to access
certain groups.
Configure Docker Volume Driver
With the data saved, we now need our Docker
Container to be able to read and access the
secret, in this case, our password. We'll do this
by using a 3rd party Docker Volume Driver called
LibSecret. Volume drivers are plugins that extend
Docker. Docker will communicate with the plugin
when accessing the file-system.
Launch LibSecret
Let’s Start the container
Our container never has access to Vault or access token.
Everything is managed via the Volume Driver.
Now let’s try reading the secrets
Each key within our collection is accessed as a
file. For example, to read decrypted value of db-
password we'd just read the file.
Try out these things -
1.Reading secrets with the
password
2.Adding new content to the Vault
3.Reading other files stored in the
vault
That should be all!!!
(Or is it?)
ANY QUESTIONS?
THANK YOU

More Related Content

What's hot

Container Monitoring with Sysdig
Container Monitoring with SysdigContainer Monitoring with Sysdig
Container Monitoring with SysdigSreenivas Makam
 
Container Security
Container SecurityContainer Security
Container SecuritySalman Baset
 
A Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container PlatformsA Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container PlatformsSalman Baset
 
Container security
Container securityContainer security
Container securityAnthony Chow
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsCarlos Sanchez
 
Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015Leonid Mirsky
 
Orchestration? You Don't Need Orchestration. What You Want Is Choreography by...
Orchestration? You Don't Need Orchestration. What You Want Is Choreography by...Orchestration? You Don't Need Orchestration. What You Want Is Choreography by...
Orchestration? You Don't Need Orchestration. What You Want Is Choreography by...Docker, Inc.
 
Enhancing OpenShift Security for Business Critical Deployments
Enhancing OpenShift Security for Business Critical DeploymentsEnhancing OpenShift Security for Business Critical Deployments
Enhancing OpenShift Security for Business Critical DeploymentsDevOps.com
 
Docker 101 2015-05-28
Docker 101 2015-05-28Docker 101 2015-05-28
Docker 101 2015-05-28Adrian Otto
 
Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker, Inc.
 
Linux Administration Tutorial | Configuring A DNS Server In 10 Simple Steps |...
Linux Administration Tutorial | Configuring A DNS Server In 10 Simple Steps |...Linux Administration Tutorial | Configuring A DNS Server In 10 Simple Steps |...
Linux Administration Tutorial | Configuring A DNS Server In 10 Simple Steps |...Edureka!
 
Container security
Container securityContainer security
Container securityAnthony Chow
 
Introduction to Docker & CoreOS - Symfony User Group Cologne
Introduction to Docker & CoreOS - Symfony User Group CologneIntroduction to Docker & CoreOS - Symfony User Group Cologne
Introduction to Docker & CoreOS - Symfony User Group CologneD
 
Docker Security - Continuous Container Security
Docker Security - Continuous Container SecurityDocker Security - Continuous Container Security
Docker Security - Continuous Container SecurityDieter Reuter
 
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...Codemotion
 

What's hot (20)

Docker Swarm scheduling in 1.12
Docker Swarm scheduling in 1.12Docker Swarm scheduling in 1.12
Docker Swarm scheduling in 1.12
 
Container Monitoring with Sysdig
Container Monitoring with SysdigContainer Monitoring with Sysdig
Container Monitoring with Sysdig
 
Container Security
Container SecurityContainer Security
Container Security
 
A Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container PlatformsA Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container Platforms
 
Docker toolbox
Docker toolboxDocker toolbox
Docker toolbox
 
Container security
Container securityContainer security
Container security
 
Docker
DockerDocker
Docker
 
From Monolith to Docker Distributed Applications
From Monolith to Docker Distributed ApplicationsFrom Monolith to Docker Distributed Applications
From Monolith to Docker Distributed Applications
 
Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015Docker orchestration using core os and ansible - Ansible IL 2015
Docker orchestration using core os and ansible - Ansible IL 2015
 
Orchestration? You Don't Need Orchestration. What You Want Is Choreography by...
Orchestration? You Don't Need Orchestration. What You Want Is Choreography by...Orchestration? You Don't Need Orchestration. What You Want Is Choreography by...
Orchestration? You Don't Need Orchestration. What You Want Is Choreography by...
 
Enhancing OpenShift Security for Business Critical Deployments
Enhancing OpenShift Security for Business Critical DeploymentsEnhancing OpenShift Security for Business Critical Deployments
Enhancing OpenShift Security for Business Critical Deployments
 
CoreOS intro
CoreOS introCoreOS intro
CoreOS intro
 
Hadoop on ec2
Hadoop on ec2Hadoop on ec2
Hadoop on ec2
 
Docker 101 2015-05-28
Docker 101 2015-05-28Docker 101 2015-05-28
Docker 101 2015-05-28
 
Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker Swarm 0.2.0
Docker Swarm 0.2.0
 
Linux Administration Tutorial | Configuring A DNS Server In 10 Simple Steps |...
Linux Administration Tutorial | Configuring A DNS Server In 10 Simple Steps |...Linux Administration Tutorial | Configuring A DNS Server In 10 Simple Steps |...
Linux Administration Tutorial | Configuring A DNS Server In 10 Simple Steps |...
 
Container security
Container securityContainer security
Container security
 
Introduction to Docker & CoreOS - Symfony User Group Cologne
Introduction to Docker & CoreOS - Symfony User Group CologneIntroduction to Docker & CoreOS - Symfony User Group Cologne
Introduction to Docker & CoreOS - Symfony User Group Cologne
 
Docker Security - Continuous Container Security
Docker Security - Continuous Container SecurityDocker Security - Continuous Container Security
Docker Security - Continuous Container Security
 
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...
Gianluca Arbezzano Wordpress: gestione delle installazioni e scalabilità con ...
 

Similar to Explore container security techniques and best practices

Docker security: Rolling out Trust in your container
Docker security: Rolling out Trust in your containerDocker security: Rolling out Trust in your container
Docker security: Rolling out Trust in your containerRonak Kogta
 
Hands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesHands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesYigal Elefant
 
Docker Security
Docker SecurityDocker Security
Docker SecurityBladE0341
 
How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016Phil Estes
 
Dockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to GeekDockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to GeekwiTTyMinds1
 
Docker London: Container Security
Docker London: Container SecurityDocker London: Container Security
Docker London: Container SecurityPhil Estes
 
Practical Container Security by Mrunal Patel and Thomas Cameron, Red Hat
Practical Container Security by Mrunal Patel and Thomas Cameron, Red HatPractical Container Security by Mrunal Patel and Thomas Cameron, Red Hat
Practical Container Security by Mrunal Patel and Thomas Cameron, Red HatDocker, Inc.
 
Docker Security Overview
Docker Security OverviewDocker Security Overview
Docker Security OverviewSreenivas Makam
 
Introduction to docker security
Introduction to docker securityIntroduction to docker security
Introduction to docker securityWalid Ashraf
 
Thotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail WhaleThotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail WhaleErin Willingham
 
Intro to containerization
Intro to containerizationIntro to containerization
Intro to containerizationBalint Pato
 
Unraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production CloudUnraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production CloudSalman Baset
 
Tokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker SecurityTokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker SecurityPhil Estes
 
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
"Docker best practice", Станислав Коленкин (senior devops, DataArt)"Docker best practice", Станислав Коленкин (senior devops, DataArt)
"Docker best practice", Станислав Коленкин (senior devops, DataArt)DataArt
 
Docker navjot kaur
Docker navjot kaurDocker navjot kaur
Docker navjot kaurNavjot Kaur
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014Carlo Bonamico
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...Codemotion
 

Similar to Explore container security techniques and best practices (20)

Docker security: Rolling out Trust in your container
Docker security: Rolling out Trust in your containerDocker security: Rolling out Trust in your container
Docker security: Rolling out Trust in your container
 
Hands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbiesHands on introduction to docker security for docker newbies
Hands on introduction to docker security for docker newbies
 
Hack the whale
Hack the whaleHack the whale
Hack the whale
 
Docker Security
Docker SecurityDocker Security
Docker Security
 
How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016
 
Dockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to GeekDockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to Geek
 
Docker London: Container Security
Docker London: Container SecurityDocker London: Container Security
Docker London: Container Security
 
Practical Container Security by Mrunal Patel and Thomas Cameron, Red Hat
Practical Container Security by Mrunal Patel and Thomas Cameron, Red HatPractical Container Security by Mrunal Patel and Thomas Cameron, Red Hat
Practical Container Security by Mrunal Patel and Thomas Cameron, Red Hat
 
Docker Security Overview
Docker Security OverviewDocker Security Overview
Docker Security Overview
 
Introduction to docker security
Introduction to docker securityIntroduction to docker security
Introduction to docker security
 
Thotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail WhaleThotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail Whale
 
Intro to containerization
Intro to containerizationIntro to containerization
Intro to containerization
 
Unraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production CloudUnraveling Docker Security: Lessons From a Production Cloud
Unraveling Docker Security: Lessons From a Production Cloud
 
Tokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker SecurityTokyo OpenStack Summit 2015: Unraveling Docker Security
Tokyo OpenStack Summit 2015: Unraveling Docker Security
 
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
"Docker best practice", Станислав Коленкин (senior devops, DataArt)"Docker best practice", Станислав Коленкин (senior devops, DataArt)
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
 
Docker navjot kaur
Docker navjot kaurDocker navjot kaur
Docker navjot kaur
 
SW Docker Security
SW Docker SecuritySW Docker Security
SW Docker Security
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
Docker dDessi november 2015
Docker dDessi november 2015Docker dDessi november 2015
Docker dDessi november 2015
 

More from Mihir Shah

Windows custom shellcoding
Windows custom shellcodingWindows custom shellcoding
Windows custom shellcodingMihir Shah
 
Seh based attack
Seh based attackSeh based attack
Seh based attackMihir Shah
 
Post exploitation using powershell
Post exploitation using powershellPost exploitation using powershell
Post exploitation using powershellMihir Shah
 
Buffer overflow
Buffer overflowBuffer overflow
Buffer overflowMihir Shah
 
Cracking the crypto
Cracking the cryptoCracking the crypto
Cracking the cryptoMihir Shah
 
Wi fi pentesting
Wi fi pentestingWi fi pentesting
Wi fi pentestingMihir Shah
 
Reversing with gdb
Reversing with gdbReversing with gdb
Reversing with gdbMihir Shah
 
Return Oriented Programming - ROP
Return Oriented Programming - ROPReturn Oriented Programming - ROP
Return Oriented Programming - ROPMihir Shah
 
PMKID ATTACK!!
PMKID ATTACK!!PMKID ATTACK!!
PMKID ATTACK!!Mihir Shah
 

More from Mihir Shah (13)

Windows custom shellcoding
Windows custom shellcodingWindows custom shellcoding
Windows custom shellcoding
 
Seh based attack
Seh based attackSeh based attack
Seh based attack
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Post exploitation using powershell
Post exploitation using powershellPost exploitation using powershell
Post exploitation using powershell
 
Buffer overflow
Buffer overflowBuffer overflow
Buffer overflow
 
Cracking the crypto
Cracking the cryptoCracking the crypto
Cracking the crypto
 
Stego.ppt
Stego.pptStego.ppt
Stego.ppt
 
Wi fi pentesting
Wi fi pentestingWi fi pentesting
Wi fi pentesting
 
Reversing with gdb
Reversing with gdbReversing with gdb
Reversing with gdb
 
ROP
ROPROP
ROP
 
Return Oriented Programming - ROP
Return Oriented Programming - ROPReturn Oriented Programming - ROP
Return Oriented Programming - ROP
 
PMKID ATTACK!!
PMKID ATTACK!!PMKID ATTACK!!
PMKID ATTACK!!
 
OAuth 2.0
OAuth 2.0OAuth 2.0
OAuth 2.0
 

Recently uploaded

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Recently uploaded (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Explore container security techniques and best practices

  • 1. $whoami MIHIR SHAH | SHAHENSHAH github.com/shahenshah99 Previous talks and content
  • 2. Hack ElasticSearch This particular exploit took advantage of the Elasticsearch search capabilities. In order for the attack to work, it requires data
  • 3. INSERT DATA Use cURL to add a record. ElasticSearch can take a minute to launch, so you may find it's not listening yet.
  • 4. EXPLOIT This particular version of Elasticsearch (1.4.2) allowed Java code to be used as part of the search. While whitelisting existed, there are other ways to gain access to the Java API required to potentially case damage.
  • 6. CGroups CGroups control how much resources a process can use. It is possible to ensure system protection from malicious users or applications against DoS attacks
  • 7. CPU-Shares While memory limits defined a set maximum, CPU limits are based on shares. These shares are a weight between how much processing time one process should get compared to another. If a CPU is idle, then the process will use all the available resources. If a second process requires the CPU then the available CPU time will be shared based on the weighting.
  • 8. Network Namespace Namespaces control what a process and see and access.
  • 9. Pid Namespace As with networks, the processes a container can see depends on which namespace it belongs too. By changing the Pid namespace allows a container to interact with processes beyond its normal scope.
  • 10. Shared Namespaces Providing containers access to the host namespace is sometimes required, such as for debugging tooling, but is regarded as bad practice.
  • 12. Copy the docker image to the registry
  • 13. Creating a SecComp Profile SecComp defines which system calls should and should not be allowed to be executed by a container. They're defined in a JSON file that is applied when a container starts.
  • 14. Lets launch a container
  • 15. IT DIDN’T WORK Because our container attempted to execute chmod, the call failed with Operation not permitted. This is because our seccomp profile blocked it.
  • 16. Trying strace on Ubuntu and Alpine and observing the results
  • 18. User Namespace By default, the Docker Daemon runs as root user on the host ps aux | grep docker As a result of the Daemon running as root, any containers started will have the same security context as the host's root user. This has the side-effect that if files owned by the root user are accessible from the container, then can be modified by the running container. docker run --rm alpine id
  • 19. Case Scenario Let’s create a copy of the touch binary sudo cp /bin/touch /bin/touch.bak && ls -lha /bin/touch.bak Because the container is both root inside the container and on the host, the file can be removed. docker run -it -v /bin/:/host/ alpine rm -f /host/touch.bak As a result, the command no longer exists. In this case, the container is capable of deleting the touch binary from the host.
  • 20. Mitigation Technique docker run --user=1000:1000 alpine id LETS TRY THIS ON PREVIOUS SCENARIO (DEMO)
  • 21. What if we required root level access inside the container?
  • 22. Enter User Namespaces User Namespaces are a Linux Kernel security feature. The feature allows a root user inside a namespace, or container, to a unprivileged user id on the Host.
  • 23. Docker Ignore Lets create an Image with a potentially sensitive file and see how it goes around
  • 24. But what if you want to use the passwords.txt in your image?
  • 25. Accessing .ssh files Create some data to use in the build within the .ssh mounted directory.
  • 26. Start a build secrets server. This server will be used by other containers are they're building built to access the .ssh mounted directory.
  • 27. Lets understand the dockerfile for OnVault and build the image docker build -f Dockerfile-onvault -t onvault-test .
  • 28. Time for the truth!! docker run -it onvault-test ls /root/.ssh
  • 29. Reading Vault secrets from docker containers To access the stored secrets, the container is configured to use a Volume Driver called LibSecret. The Volume Driver communicates with Vault meaning the applications don't require any additional configuration to access the secrets.
  • 30. Lets set up the environment first
  • 31. 1. The first script launches the Consul and Vault containers 1. The Vault starts sealed meaning you can't read/write data. Use the helper script to unseal the vault 1. The final stage is to obtain the access token; this is outputted when we initialised and unsealed the vault. 1. By logging in we can now start storing and persisting data
  • 32. Vault will encrypt the data before storing it in Consul. The name of the key is db-password which we're storing under the collection app-1. By grouping secrets around applications makes them easier to manage. It also allows you to add restrictions to only allow certain users to access certain groups.
  • 33. Configure Docker Volume Driver With the data saved, we now need our Docker Container to be able to read and access the secret, in this case, our password. We'll do this by using a 3rd party Docker Volume Driver called LibSecret. Volume drivers are plugins that extend Docker. Docker will communicate with the plugin when accessing the file-system.
  • 35. Let’s Start the container Our container never has access to Vault or access token. Everything is managed via the Volume Driver. Now let’s try reading the secrets
  • 36. Each key within our collection is accessed as a file. For example, to read decrypted value of db- password we'd just read the file.
  • 37. Try out these things - 1.Reading secrets with the password 2.Adding new content to the Vault 3.Reading other files stored in the vault
  • 38. That should be all!!! (Or is it?)