controlled chaos · @swagitda_ “chaos isn’t a pit. chaos is a ladder.” ― petyr baelish,...

69
C ONTROLLED C HAOS The Inevitable Marriage of DevOps & Security Kelly Shortridge (@ swagitda _) Velocity Berlin 2019

Upload: others

Post on 18-Jul-2020

19 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

CONTROLLED CHAOSThe Inevitable Marriage of DevOps & Security

Kelly Shortridge (@swagitda_) Velocity Berlin 2019

Page 2: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Hi, I’m Kelly

2

Page 3: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

“Chaos isn’t a pit. Chaos is a ladder.”

― Petyr Baelish, Game of Thrones

3

Page 4: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Infosec has a choice: marry DevOps or be rendered impotent & irrelevant

4

Page 5: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Infosec won’t survive in a silo. It must be embedded in software delivery.

5

Page 6: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

DevOps can learn to carve its own path to secure software delivery

Page 7: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

How can controlling chaos create a marriage of infosec and DevOps?

7

Page 8: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

1. Chaos Theory

2. Time to D.I.E.

3. A Phoenix Rises

8

Page 9: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

Chaos Theory

Page 10: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Chaos engineering = continual experimentation to test resilience

Page 11: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

“Things will fail” naturally extends into “things will be pwned”

11

Page 12: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Security failure is when security controls don’t operate as intended

12

Page 13: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

What are the principles of chaotic security engineering?

13

Page 14: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

1. Expect that security controls will fail & prepare accordingly

14

Page 15: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

2. Don’t try to avoid incidents – hone your ability to respond to them

15

Page 16: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Game days: like planned firedrills

16

Page 17: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Prioritize security game days based on potential business impacts

17

Page 18: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Decision trees: start at target asset, work back to easiest attacker paths

18

Page 19: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Determine the attacker’s least-cost path (hint: it doesn’t involve 0day)

19

Page 20: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Your goal is to raise the cost of attack, ideally beginning at design

20

Page 21: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

Time to D.I.E.

Page 22: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

We need a model promoting qualitiesthat make systems more secure

22

Page 23: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Enter the D.I.E. model by Sounil Yu: Distributed, Immutable, Ephemeral

23

Page 24: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Distributed: multiple systems supporting the same overarching goal

24

Page 25: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Distributed infrastructure reduces risk of DoS attacks by design

25

Page 26: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

A service mesh is like an on-demand VPN at the application level

26

Page 27: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Attackers are forced to escalate privileges to access the iptables layer

27

Page 28: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Immutable: infrastructure that doesn’t change after it’s deployed

28

Page 29: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Immutable infra is more secure by design – ban shell access entirely

29

Page 30: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Patching is no longer a nightmare with version-controlled images

Page 31: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Ephemeral: infrastructure with a very short lifespan (dies after a task)

31

Page 32: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Ephemerality creates uncertainty for attackers (persistence = nightmare)

32

Page 33: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Installing a rootkit on a resource that dies in minutes is a waste of effort

33

Page 34: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Optimizing for D.I.E. reduces risk by design & supports resilience

34

Page 35: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

A Phoenix Rises

Page 36: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Begin with “dumb” testing before moving to “fancy” testing

36

Page 37: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

D.I.E.ing is an art, like everything else

Page 38: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Controlling Chaos: Distributed

38

Page 39: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Distributed is mostly covered by the existing repertoire of chaos eng tools

39

Page 40: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Repurpose these tools, but make attackers the source of failure

40

Page 41: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Multi-region services present a fun opportunity to mess with attackers

41

Page 42: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Shuffle IP blocks regularly to change attackers’ lateral movement game

42

Page 43: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Test: inject failure into your service mesh to test authentication controls

43

Page 44: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Controlling Chaos: Immutable

44

Page 45: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Immutable infra is like a phoenix – it disappears & comes back a lot

45

Page 46: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Volatile environments with continually moving parts raise the cost of attack

46

Page 47: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Create rules like, “If there’s ever a write to disk, crash the node”

47

Page 48: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Attackers must stay in-memory, which hopefully makes them cry

48

Page 49: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Bonus: disallowing all local IO improves service reliability

49

Page 50: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Metasploit Meterpreter + webshell:Touch passwords.txt & kaboom

50

Page 51: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Build your Docker images with a garbage-filled “bamboozle layer”

51

Page 52: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Mark garbage files as “unreadable” to craft enticing bait for attackers

52

Page 53: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

A potential goal: architect immutability turtles all the way down

53

Page 54: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Test: inject attempts at writing to disk to ensure detection & reversion

54

Page 55: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Treat changes to disk by adversaries similarly to failing disks: mercy kill

55

Page 56: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Controlling Chaos: Ephemeral

56

Page 57: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Most infosec bugs are stated-related – get rid of state, get rid of bugs

57

Page 58: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Reverse uptime: longer host uptime adds greater security risk

58

Page 59: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Test: change API tokens & test if services still accept old tokens

59

Page 60: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Test: retrograde libraries, containers, other resources in CI/CD pipelines

60

Page 61: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Test: inject hashes of old pieces of data to ensure no data persistence

61

Page 62: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Leverage lessons from toll fraud –cloud billing becomes security signal

62

Page 63: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Test: exfil TBs or run a cryptominerto inform billing spike detection

63

Page 64: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

Conclusion

Page 65: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Chaos/resilience are natural homes for infosec & represent its future.

65

Page 66: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

The future of infosec involves unified responsibility & accountability.

66

Page 67: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

Security can be innovative and fuel the engine of business as well.

67

Page 68: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

“You must have chaos within you to give birth to a dancing star.”

― Friedrich Nietzsche

68

Page 69: CONTROLLED CHAOS · @swagitda_ “Chaos isn’t a pit. Chaos is a ladder.” ― Petyr Baelish, Game of Thrones 3

@swagitda_

@swagitda_

/in/kellyshortridge

[email protected]

69