turtles all the way down - schedschd.ws/hosted_files/appsecusa2015/a5/turtles.pdf ·...

42
TURTLES ALL THE WAY DOWN Storing Secrets in the Cloud and in the Data Center 1

Upload: nguyennhi

Post on 22-May-2018

220 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

TURTLES  ALL  THE  WAY  DOWN

Storing  Secrets  in  the  Cloud  and  in  the  Data  Center

1

Page 2: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

INTRODUCTION

Daniel  Somerfield  [email protected]

Page 3: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

TURTLES  COMPANION  SITE

h:p://danielsomerfield.github.io/turtles

3

Page 4: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

WHAT'S  THE  PROBLEM?

We  all  have  secrets  

We  want  to  know  they're  safe  

And…

Page 5: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

WHAT'S  THE  PROBLEM?

We  need  reliable,  reproducible  deployments

Page 6: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

SETTING  GOALS

6

Page 7: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

WHAT  GOOD  LOOKS  LIKE

Security  Goals  • Secrets  are  secrets  • AudiIng  • No  reliance  on  heroes  • Standard  pracIces

Page 8: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

WHAT  DOES  GOOD  LOOK  LIKE

OperaDonal  Goals  • Automated  • Scales  operaIonally  

Page 9: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

It haz 2B EZ 2 uze!!!!

WHAT  DOES  GOOD  LOOK  LIKE

Page 10: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

SEARCHING  FOR  THE  ELUSIVE  LAST  TURTLE

10

Page 11: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

THE  FIRST  TURTLE

Does  this  sound  familiar?  • Secrets  in  SCM  • Admins,  admins  everywhere  • CredenIal  reuse  • Secrets  are  not  really  secrets

Page 12: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

THE  FIRST  TURTLE

Goals  • Encrypted  secrets  • Controlled  distribuIon  • Secrets  are  automated

Page 13: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

orchestrationserver

orchestrator decryption

target application encrypted store

encrypted secret

plaintext secret

plaintext secret

encrypted secret

plaintext secret

secure channel

orchestrationserver

application decryption

target applicationencrypted store

encrypted secret

encrypted secret

plaintext secret

encrypted secret

STRATEGIES

secret deploymentapplication deploymentoperational compartmentalization

encrypted store

orchestrationserver

artifact repo

orchestrationserver

plaintext secret

target application

Page 14: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

ORCHESTRATOR  DECRYPTION

orchestrationserver

orchestrator decryption

target application encrypted store

encrypted secret

plaintext secret

plaintext secret

encrypted secret

plaintext secret

secure channel

Page 15: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

orchestrationserver

orchestrator decryption

target application encrypted store

encrypted secret

plaintext secret

plaintext secret

encrypted secret

plaintext secret

secure channel

ORCHESTRATOR  DECRYPTION

Advantages  – Key  management  – IntegraIon

Disadvantages  – Exploit  severity  – Secrets  at  rest  – One  more  turtle…

Page 16: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

APPLICATION  DECRYPTION

orchestrationserver

application decryption

target applicationencrypted store

encrypted secret

encrypted secret

plaintext secret

encrypted secret

Page 17: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

orchestrationserver

application decryption

target applicationencrypted store

encrypted secret

encrypted secret

plaintext secret

encrypted secret

APPLICATION  DECRYPTION

Advantages  – CompartmentalizaIon  – IntegraIon

Disadvantages  – Key  management  – Secrets  at  rest  – One  more  turtle…

Page 18: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

OPERATIONAL  COMPARTMENTALIZATION

secret deploymentapplication deploymentoperational compartmentalization

encrypted store

orchestrationserver

artifact repo

orchestrationserver

plaintext secret

target application

Page 19: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

ORGANIZATIONAL  COMPARTMENTALIZATION

Advantages  – Clear  responsibiliIes  – IntegraIon

Disadvantages  – OrganizaIonal  silos  – Lack  of  transparency

secret deploymentapplication deploymentoperational compartmentalization

encrypted store

orchestrationserver

artifact repo

orchestrationserver

plaintext secret

target application

Page 20: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

TOOLS

SCM  encrypIon

OrchestraIon  tools

Secret  service

Page 21: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

SCM  ENCRYPTION

EncrypIon  of  enIre  SCM  repo  or  individual  items  within  them.

Page 22: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

SCM  ENCRYPTION

Strengths  •  IntegraIon  •  SCM-­‐based  audit

Page 23: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

SCM  ENCRYPTION

Weaknesses  • Secret  rotaIon  support  • Data  at  rest  • AudiIng  of  usage  • More  turtles…

Page 24: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

SCM  ENCRYPTION  TOOLS

Blackbox

GitCrypt

Transcrypt

Page 25: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

ORCHESTRATOR  ENCRYPTION

Page 26: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

ORCHESTRATOR  ENCRYPTION

Strengths  • AutomaIon  • Familiar  workflow

Page 27: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

ORCHESTRATION  ENCRYPTION

Weaknesses  • Similar  to  SCM  encrypIon,  plus:  • Vendor  lock-­‐in  • Another  turtle…

Page 28: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

ORCHESTRATION  ENCRYPTION  TOOLS

Chef  Vault

Ansible  Vault

Blackbox

Chef  

hiera-­‐eyaml

Page 29: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

TOOLS

SCM  encrypIon

OrchestraIon  tools

Secret  service

Page 30: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

THE  SECOND  TURTLE

Goals  • Key  RotaIon  • Limit  secrets  at  rest

Page 31: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

PULLING

application-pull

target application

encrypted store

secure channel

plaintext secret

secret server

encrypted secret

plaintext secret

Page 32: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

SECRET  SERVICES

A  separate  endpoint  providing  secrets  on  demand  over  a  secure  channel.

Page 33: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

SECRETS  SERVICES

Strengths  • Minimizes  at  rest  • Facilitates  rotaIon  • CompartmentalizaIon  • Ephemeral  credenIals  • Access  policies  • AudiIng

Page 34: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

SECRETS  AS  A  SERVICE

Weaknesses  • AdopIon  • Single  point  of  failure  • Few  opIons  • One  more  turtle…

Page 35: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

SECRETS  AS  A  SERVICE

HashiCorp  Vault

Square  KeyWhiz

Page 36: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

TOOLS

SCM  encrypIon

OrchestraIon  tools

Secret  service

Page 37: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

THE  THIRD  TURTLE

Goals  • Ephemeral  credenIals  • Instances  without  remote  access  • Immutable  infrastructure  • CredenIal-­‐less  architecture

Page 38: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

???

TOOLS

OrchestraIon  tools

Secret  service

Page 39: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

FINAL  THOUGHTS

39

Page 40: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

THE  BIG  PICTURE

application

private key

orchestrationpackage

secret

artifact repo

build serverorchestration

server

secret store

public key encrypted

secret

application

private key

orchestrationpackage

secret

artifact repo

build serverorchestration

server

secret store

public key encrypted

secret1. publishes artifact

application

private key

orchestrationpackage

secret

artifact repo

build serverorchestration

server

secret store

public key encrypted

secret1. publishes artifact 2. push orchestration package

application

private key

orchestrationpackage

secret

artifact repo

build serverorchestration

server

secret store

public key encrypted

secret1. publishes artifact 2. push orchestration package

3. download app package

application

private key

orchestrationpackage

secret

artifact repo

build serverorchestration

server

secret store

public key encrypted

secret1. publishes artifact 2. push orchestration package

3. download app package 4. download secret

application

private key

orchestrationpackage

secret

artifact repo

build serverorchestration

server

secret store

public key encrypted

secret1. publishes artifact 2. push orchestration package

3. download app package 4. download secret

5. decrypt secret

application

private key

orchestrationpackage

secret

artifact repo

build serverorchestration

server

secret store

public key encrypted

secret1. publishes artifact 2. push orchestration package

3. download app package 4. download secret

5. decrypt secret

6. start application

application

private key

orchestrationpackage

artifact repo

build serverorchestration

server

secret store

public key encrypted

secret1. publishes artifact 2. push orchestration package

3. download app package 4. download secret

5. decrypt secret

6. start application

7. delete secret

Page 41: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

IN  CLOSING

So  how  do  you  find  the  last  turtle?  

- TacIcal  human  intervenIon  - Audit  - Automate  - Evolve

Page 42: TURTLES ALL THE WAY DOWN - Schedschd.ws/hosted_files/appsecusa2015/a5/Turtles.pdf · TURTLES’ALL’THE’WAY ... orchestration server artifact repo orchestration server plaintext

Q  &  A

Daniel  Somerfield  [email protected]  

h:p://danielsomerfield.github.io/turtles