Top Banner
SESSION ID: SESSION ID: #RSAC Chris Gates DevOOPS: Attacks And Defenses For DevOps Toolchains HTA-W02 Sr. Security Engineer Uber @carnal0wnage Ken Johnson CTO nVisium @cktricky
145

DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

Mar 30, 2018

Download

Documents

truongdien
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

SESSION ID:SESSION ID:

#RSAC

Chris Gates

DevOOPS: Attacks And Defenses For DevOps Toolchains

HTA-W02

Sr. Security EngineerUber@carnal0wnage

Ken JohnsonCTOnVisium@cktricky

Page 2: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

SOMETHING AWESOME TO GET US STARTEDLink to slides and URLs in this presentation:

http://bit.ly/RSA-Devoops

Page 3: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Yikes?!

Page 4: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Yikes?!

Page 5: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Yikes?!

Page 6: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Yikes?!

Page 7: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Yikes?!

Page 8: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Yikes?!

Page 9: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Yikes?!

Page 10: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Ken Johnson (@cktricky)

CTO (@nVisium)

Railsgoat Co-Author

Prior US Navy Spoke a ton about (In)Security of:

RailsDevOpsWeb FrameworksAWS

Who Ken

Page 11: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Who Chris

Chris Gates (CG) @carnal0wnage

Sr. Security Engineer (Uber)

NoVA Hackers Co-Founder

US Army, Army Red Team, Applied Security, Rapid7, Lares, Facebook

http://carnal0wnage.attackresearch.com

Page 12: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

TL;DR

Don’t prioritize speed over security

Understand devops tools’ auth model...or lack of itGet pwned real bad, then get a real auth model – hello mongodb

Out of date or insecure implementation can lead to pwnage

Dev/Ops building infrastructure can be dangerous without thought and training around security. It’s ok to teach them :-)

Page 13: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Why This Talk

Increase awareness around DevOps Infrastructure Security

Provide Solutions

Show common mistakes/misconfigurations with DevOps testing

Sections are broken up between Human, Host, and Infrastructure

Page 14: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Employee Intelligence(Human)

Making it difficult (for employees) to allow attackers to walk into our environment

Page 15: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring External Services

Numerous ways for employees to accidently release data Pastebin-like sitesGitHub— Gists— Code Repositories

BitBucket, CodeCommit, etc— https://en.wikipedia.org/wiki/Comparison_of_source_code_hosting_facilities

ExamplesSlack tokens in GitHubAWS creds in .dotfilesTokens in logs/dumps/configs/code snippets

Page 16: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Examples

Page 17: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Examples

Page 18: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Examples

Page 19: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Examples

Page 20: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring Slack (Solutions)

20

Slack Team Access logs (For Paid Slack Only)https://api.slack.com/methods/team.accessLogs

https://github.com/maus-/slack-auditor code to pull these logs

Page 21: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring GitHub (Solutions)

Solutions to move away from public GitHubGitlab, Gitolite, GitHub Enterprise, Phabricator

Enable 2 Factor on anything that has 2 Factor!

Audit who has access to your reposHave a process to remove ex-employeesAudit their personal repos for leaks Regularly search your repos for sensitive dataCreate work github accounts instead of joining personal ones to org

Page 22: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring GitHub (Solutions)

Gitrobhttps://github.com/michenriksen/gitrob

Page 23: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring GitHub (Solutions)

Page 24: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring GitHub (Solutions)

Page 25: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring GitHub (Solutions)

GitMonitor (for pay service)https://gitmonitor.com/

Page 26: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring GitHub (Solutions)

GitMonitor

Page 27: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring Pastebin* (Solutions)

27

Host internal PastebinPlugins for stashPhabricatorStikked

Multiple Open Source Tools for monitoring pastebin*https://github.com/jordan-wright/dumpmonhttps://github.com/xme/pastemonhttps://github.com/cvandeplas/pystemon

Page 28: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring Pastebin* (Solutions)

28

Dumpmon

Page 29: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Monitoring Pastebin* (Solutions)

29

For Pay Services

Page 30: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Workstation Protection(Host)

Protecting and monitoring employees on their development workstations (and servers too)

Page 31: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Why

Developer Laptop HardeningSensitive information stored on their systems

Almost always admin on their systems

Sloppy code/key/token hygiene can lead to loss of keys to the kingdomOne key to rule them all

Want to identify badness as soon as possible

Page 32: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

Developer Laptop HardeningOsquery (OSX/Linux/Windows*)

Doorman

Block Block

Little Snitch

Carbon Black / Sysmon

Splunk / ELK

Simian

Munki

Page 33: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

osquery (https://osquery.io/)

“osquery is an operating system instrumentation framework for OS X, Linux, and FreeBSD. The tools make low-level operating system analytics and monitoring both performant and intuitive.”

“osquery exposes an operating system as a high-performance relational database. This allows you to write SQL queries to explore operating system data. With osquery, SQL tables represent abstract concepts such as running processes, loaded kernel modules, open network connections, browser plugins, hardware events or file hashes.”

Page 34: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

Page 35: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

osquery

File Integrity Monitor

Yara Rules

Query Packs

Page 36: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

Doorman (https://github.com/mwielgoszewski/doorman)

“Doorman is an osquery fleet manager that allows administrators to remotely manage the osquery configurations retrieved by nodes.”

Page 37: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

Page 38: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

BlockBlock (https://objective-see.com/products/blockblock.html)

Kernel hook to identify any time software wants to persist

Prompt to allow or deny

Little Snitch (https://www.obdev.at/products/littlesnitch/index.html)

“Little Snitch intercepts these unwanted connection attempts, and lets you decide how to proceed.”

Page 39: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections (Block Block)

Page 40: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections (Little Snitch)

Page 41: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

CarbonBlack (https://www.carbonblack.com/)Host based agent

Monitor process create, writes, registry queries, net connections

Create rules/watchlist for known bad behaviorMimikatz --> company_name:*gentilkiwi*FileVault Encryption Disabled --> process_name:fdesetup cmdline:disableUnsigned JAR exe c--> process_name:*.jar digsig_result: (digsig_result:"Unsigned")OSX dump user hashes --> process_name:dscl cmdline:ShadowHashData

Page 42: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

Page 43: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

Page 44: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

Splunk

Page 45: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

ELK

Page 46: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections

StreamAlert

https://github.com/airbnb/streamalert

Page 47: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections (Patch Management)

Why do we bring this up?

Some people aren’t aware you can perform free OSX patch management

There are a lot of OSX developer shops without an “enterprise budget”

Patch management is a no-brainer and security 101

Solved for Windows, more difficult for OSX / Linux

Page 48: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections (Patch Management)

OSX Patch Management – Simian

“Simian is an enterprise-class Mac OS X software deployment solution.”

Allows you to push munki updates

Free / OSS

Runs on Google cloud

Project: https://github.com/google/simian

Page 49: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections (Patch Management)

OSX Patch Management – Simian

Page 50: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections (Patch Management)

OSX Software Management – Munki

“Munki is a set of tools that, used together with a webserver-based repository of packages and package metadata, can be used by OS X administrators to manage software installs (and in many cases removals) on OS X client machines.”

https://www.munki.org/munki/

Page 51: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Host Protections (Patch Management)OSX Software Management – Munki

Page 52: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Production Protection(Infra)

Jenkins, Redis, Memcache, Docker, Hadoop, AWS

Page 53: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Continuous Integration

Page 54: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hudson/Jenkins

“Hudson is a continuous integration (CI) tool written in Java, which runs in a servlet container, such as Apache Tomcat or the GlassFish application server”

Very popular

If you can’t pwn Jenkins then tryGlassFish or Tomcat :-)

Page 55: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Shodan search for X-Hudson

Hudson/Jenkins

Page 56: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hudson/Jenkins

Jenkins Issues

Multiple Remote Code Execution (RCE) vulnerabilities over the years

https://wiki.jenkins-ci.org/display/SECURITY/Home

Advisories are not well publicizedEx: CVE-2015-1814

Ex: CVE-2016-9299Weak coverage with Vulnerability Scanners

API token same access as passwordJenkins builds and deploys code

Page 57: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hudson/Jenkins

If no authentication required

Trivial to gain remote code execution via script console

Metasploit Moduleexploit/multi/http/jenkins_script_consoleExploit module will also use credentials

https://www.pentestgeek.com/2014/06/13/hacking-jenkins-servers-with-no-password/http://www.labofapenetrationtester.com/2014/06/hacking-jenkins-servers.htmlhttp://zeroknock.blogspot.com/search/label/Hacking%20Jenkins

Page 58: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hudson/Jenkins

Page 59: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hudson/Jenkins

Metasploit exploit module for script console

Page 60: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hudson/Jenkins

You can lock down script console access by turning on authentication

However, if it’s set to local auth, you can register as a regular user :-)

...then get access to the /script

Page 61: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hudson/Jenkins

Can you browse a workspace?

Page 62: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hudson/Jenkins

Page 63: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hudson/Jenkins

Page 64: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hudson/Jenkins (Solutions)

If possible, require authentication for everything on Hudson/JenkinsMonitor for security issues and updates

Challenging b/c full impact of issues can be watered down in the advisorySegment Hudson/Jenkins from CorpLogical separation by groups

Either on single instance or multiple serversMonitor Jenkins slave activity/net connections

osquery

Page 65: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

In-Memory Databases

Page 66: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Redis

DefaultsNo encrypted communicationNo credentials by defaultDoesn’t have to be root, but usually isPort 6379 (TCP)Binds to all interfaces

Moral of the story? Keep off the interwebs!Update redis.conf to bind to 127.0.0.1https://redis.io/topics/securityREAD

Page 67: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

RedisHow prevalent is this?

Page 68: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Redis

You can navigate the DB with the redis-cli

Page 69: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

RedisOr use the Redis Desktop Manager

Page 70: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

RedisFeel lucky?

Page 71: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Redis

Remote Code Execution (RCE) on Redishttp://antirez.com/news/96http://benmmurphy.github.io/blog/2015/06/04/redis-eval-lua-sandbox-escape/https://gist.github.com/lokielse/d4e62ae1bb2d5da50ec04aadccc6edf1

Writable redis running as root? Get shell

Page 72: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

RedisWanted to see how prevalent…what is that?!?!

Page 73: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

RedisWanted to see how prevalent…what is that?!?!

Altcoin miner!

Page 74: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

RedisHow are they doing? $$$

Page 75: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

RedisHow are they doing? $$$

Page 76: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

RedisOpen Redis? Get shells

Page 77: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

memcache

Free & open source, high-performance, distributed memory object caching system

No code exec, but fun things get put into memcache

Examples

Page 78: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

memcache

Page 79: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

memcache

Page 80: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

memcache

Page 81: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

memcache

Page 82: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

In-Memory Database (Solutions)

Apply authentication (strong passwords!)AUTH for redis

Bind to localhost if possibleIf possible, enable SSL/TLSSegment In-Memory Databases from Corp (and the public in general)Be aware of the data you put in these databases

Don’t store keys, passwords, etcLogs Logs Logs

Page 83: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Big Data

Page 84: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hadoop

The Apache Hadoop software library is a framework that allows for the distributed processing of large data sets across clusters of computers using simple programming models.

Page 85: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hadoop

Common Attack Points

No authentication by default (Kerberos possible)Front Ends (Hue, Ranger, etc)

https://hadoopecosystemtable.github.io/Hadoop WebUIRCE via Hadoop Streaming UtilityGreat Resource on Hadoop Hacking

http://archive.hack.lu/2016/Wavestone%20-%20Hack.lu%202016%20-%20Hadoop%20safari%20-%20Hunting%20for%20vulnerabilities%20-%20v1.0.pdf

Page 86: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hadoop (Attack Surface)

http://archive.hack.lu/2016/Wavestone%20-%20Hack.lu%202016%20-%20Hadoop%20safari%20-%20Hunting%20for%20vulnerabilities%20-%20v1.0.pdf

Page 87: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hadoop

Access gives you full HDFS access via the GUI

Page 88: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hadoop (RCE)

http://archive.hack.lu/2016/Wavestone%20-%20Hack.lu%202016%20-%20Hadoop%20safari%20-%20Hunting%20for%20vulnerabilities%20-%20v1.0.pdf

Page 89: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Hadoop Defenses

Use Kerberos Limit Exposed Hadoop Ports and ServicesChange default passwordsLogs Logs Logs

osquery

Page 90: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Vagrant/Docker

Page 91: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

DockerCommon Docker Security Issues

Protect Docker registryVulnerable/Backdoored Docker Images(Lack of) Isolation of ContainersSecrets in codeDocker daemon == root

Page 92: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

ShipyardShipyard (https://github.com/shipyard/shipyard)

Shipyard enables multi-host, Docker cluster management. It uses Docker Swarm for cluster resourcing and scheduling.

Default Creds: admin/shipyard

Page 93: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Shipyard

Default Creds: admin/shipyardCommand exec if you can gain access

Page 94: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Cloud Security - AWSCommon AWS flaws

Page 95: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

AWS – Attack

Exposed Credentials

Vulnerable Applications/Systems

Misconfiguration

Page 96: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Exposed Credentials

Page 97: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

AWS - Attack

https://www.quora.com/My-AWS-account-was-hacked-and-I-have-a-50-000-bill-how-can-I-reduce-the-amount-I-need-to-pay

Page 98: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Exposed Credentials

Stolen or lost machine

Commit of dotfiles to a repo, gist, pastebin, etc.

Commit source with keys in it

Compromised developer/ops/etc. machine

Page 99: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Exposed Credentials

Keys are often stored on developer or ops machines

Typically can be found under

1. ~/.aws/config

2. ~/.bashrc

3. ~/.zshrc

4. ~/.elasticbeanstalk/aws_credential_file

Page 100: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Exposed Credentials

Page 101: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Exposed Credentials

Page 102: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Exposed Credentials

More examples of AWS keys on GitHub

Page 103: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Exposed Credentials

And Another…

Page 104: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Vulnerable Applications/Systems

Once you have keys, utilize the interrogate tool to verify AWS permissions

https://github.com/carnal0wnage/aws-interrogate

The tool requests various functionality in order to determine authorization

Page 105: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Vulnerable Applications/Systems

Example of the tool in action

Page 106: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Vulnerable Applications/Systems

Page 107: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Vulnerable Applications/Systems

Page 108: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Vulnerable Applications/Systems

Machine is compromised

Attacker grabs metadata info

Uses these credentials to pivot

Page 109: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Vulnerable Applications/Systems

Browse to this address from compromised machine

http://169.254.169.254/latest/meta-data/iam/security-credentials/

Obtain credentials here and pivot

Page 110: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Vulnerable Applications/Systems

Talk/tool to help with this process

https://www.blackhat.com/docs/us-14/materials/us-14-Riancho-Pivoting-In-Amazon-Clouds-WP.pdfhttps://andresriancho.github.io/nimbostratus/

Page 111: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration

Page 112: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration

Insecurely Configured Services

Lack of Monitoring

Lack of IAM Hardening

Page 113: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Insecurely Configured Services

Page 114: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Insecurely Configured Services

We’re going to provide examples of two services

S3 – Insecure Bucket Policies

RDS – Default Credentials

Page 115: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration – Insecurely Configured Services

Open S3 buckets is a very popular way to bring pain to your company

Bucket permissions can be confusing and easy to mess up

Page 116: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration – Insecurely Configured Services

S3 has an interesting misconfiguration where buckets aren’t public but they are accessible to *any* AWS key.

Page 117: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration – Insecurely Configured Services

S3 has an interesting misconfiguration where buckets aren’t public but they are accessible to *any* AWS key.

Page 118: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration – Insecurely Configured Services

The misconfiguration appears to be “Any Authenticated AWS User” permission

Page 119: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration – Insecurely Configured Services

Review S3 buckets to determine security policy

https://gist.github.com/cktricky/faf0f40116e535a055b7412458136917

Page 120: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration – Insecurely Configured Services

Rdsadmin = Default account created by AWS

“To provide management services for each DB instance, the rdsadminuser is created when the DB instance is created.”

Have found rdsadmin with blank or weak passwords

Page 121: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration – Insecurely Configured Services

Page 122: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Lack of Monitoring

Page 123: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

127

AWS comes pre-packaged with services to do this

ServicesCloudTrail = LogsCloudWatch = Alarms and EventsConfig = Change ManagementVPC Flow Logs = Network Activity Logs

Page 124: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

CloudTrail is primarily used for log collection

Other services like CloudWatch, for example, use those logs to filter relevant data

Page 125: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

129

Page 126: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

130

CloudTrail

Config

CloudWatch

Page 127: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

An earlier talk on AWS security, dedicated to using these services:

https://www.youtube.com/watch?v=g-wy9NdATtA&feature=youtu.be

The gist is that it is very easy and yet often overlooked

Page 128: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

Tool to list the monitoring services configuration:CloudWatchCloudTrailConfig

https://gist.github.com/cktricky/f19e8d55ea5dcb1fdade6ede588c6576

Page 129: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

Output from an AWS environment we had keys for

Page 130: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

We see a lack of monitoring time and time again

ImpactIf the environment changes, nobody knowsIf your bill is being blown up, again, nobody knowsWon’t detect malicious activityWon’t be able to perform incident responseFINANCIALLY LIABLE TO AWS

Page 131: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

135

An example of creating an alert, that counteracts our interrogate tool shown earlier

Creates an alert for Unauthorized Activity Event on our AWS account

Is FREE and uses built-in AWS technology

Reports specific details to Slack

Page 132: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

http://www.slideshare.net/KenJohnson61/aws-surival-guide

Shows you have to trigger for interesting AWS events and alert in Slack, etc.

Page 133: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of Monitoring

Monitoring Takeaways

There are MANY things you can do with AWS technology to alert yourself to issues – this was one exampleReview “Well Architected Framework” from AWS which discuss monitoring and other controls: — http://d0.awsstatic.com/whitepapers/architecture/AWS_Well-

Architected_Framework.pdf

Page 134: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Lack of IAM Hardening

Page 135: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of IAM Hardening

IAM = User, Group, Roles, Access Policies, etc. – Management

You CAN take steps to make it harder to use compromised credentials

You CAN take steps to limit access to only required AWS assets

You CAN replace the need to hardcode AWS keys in source code

…. Its just that *very often*, people don’t

Page 136: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of IAM Hardening

140

IAM Hardening Checklist:

1. Don’t Use The Root Account!

2. Audit IAM user policies

3. Multi-Factor Authentication

4. Use Roles

Page 137: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of IAM Hardening

Don’t Use the Root Account!Disable or delete the access keysSetup CloudWatch Alarm (shown in “previous talk” links)

Page 138: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of IAM Hardening

Audit IAM Permissions

Tool to inspect each user’s permissions:https://gist.github.com/cktricky/257990df2f36aa3a01a8809777d49f5dWill create a CSV fileProvides you with— Usernames— Inline Policies— Managed Policies— Groups

Page 139: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of IAM Hardening

Why this is important

If you house sensitive data, you need to know who has accessPermissions should be a need-to-have/know situation in order to limit damage should creds get stolenAWS is a flexible environment that changes – your permission model might need to change with it (inventory it)

Page 140: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of IAM Hardening

Tool output

Page 141: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of IAM Hardening

Multi-Factor Authentication (MFA) = 2 Factor Authentication

Not just for the Web, place on the API as well

Page 142: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of IAM Hardening

Use RolesIs *like* a user but is not an IAM userReplaces the need for hardcoded Access Key ID & SecretThe extent of what a role can do is heavily controlled by you, the administratorCredentials automatically rotate via STS— Available here on an EC2 instance:http://169.254.169.254/latest/meta-data/iam/security-credentials/

If you’re using the AWS-SDK gem/egg/etc – credential handling is built-inIf you’re using something like Paperclip + Rails, try Fog to leverage Roles— https://github.com/thoughtbot/paperclip/issues/1591

Page 143: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Misconfiguration - Lack of IAM Hardening

Example attaching Role to ElasticBeanstalk instance

Page 144: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Conclusion

Don’t prioritize speed over security

Vulnerabilities are the same (what was old is new again)

Developers now deploy and manage the full stack for their application(s)

Equip & Educate them with ways to do this securely

Developers possibly have the keys to the whole kingdom on their laptop. Protect and monitor those assets

One token to rule them all

Page 145: DevOOPS: Attacks And Defenses For DevOps … Attacks And Defenses For DevOps Toolchains. ... Dev/Ops building infrastructure can be dangerous ... Memcache, Docker, Hadoop, AWS. #RSAC

#RSAC

Thanks and Contact

Chris GatesSr. Security EngineerUber@carnal0wnage

Ken JohnsonCTOnVisium@cktricky

For slides and URLs in this presentation:

http://bit.ly/RSA-Devoops