thinking evil thoughts

96
(without introducing more risk) Thinking Evil Thoughts Puppet Gareth Rushgrove A taste of threat modeling

Upload: gareth-rushgrove

Post on 10-Jan-2017

246 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Thinking Evil Thoughts

(without introducing more risk)

Thinking Evil Thoughts

PuppetGareth Rushgrove

A taste of threat modeling

Page 2: Thinking Evil Thoughts

(without introducing more risk)

@garethr

Page 3: Thinking Evil Thoughts

(without introducing more risk)

Gareth Rushgrove

Page 4: Thinking Evil Thoughts

(without introducing more risk)This Talk

What to expect

Page 5: Thinking Evil Thoughts

- What is threat modeling?- Getting the scope right- Identifying risks- Using conferences to hack people

Gareth Rushgrove

Page 6: Thinking Evil Thoughts

Introduce some security language to help you navigate the domain

Gareth Rushgrove

Page 7: Thinking Evil Thoughts

Dive straight into examples

Gareth Rushgrove

Page 8: Thinking Evil Thoughts

Empower you to ask questions more than provide easy answers

Gareth Rushgrove

Page 9: Thinking Evil Thoughts

(without introducing more risk)Threat modeling

A brief introduction

Page 10: Thinking Evil Thoughts

Gareth Rushgrove

a procedure for optimizing network security by identifying objectives and vulnerabilities

THREAT MODELING

Page 11: Thinking Evil Thoughts

- Determine scope- Identify threat agents and attacks- Understand existing countermeasures- Identify vulnerabilities- Prioritise risks- Identify countermeasures

Gareth Rushgrove

https://www.owasp.org/index.php/Category:Threat_Modeling

Page 12: Thinking Evil Thoughts

Inside each of us, there is theseed of both good and evil.It's a constant struggle as towhich one will win.

Gareth Rushgrove

”Eric Burdon

Page 13: Thinking Evil Thoughts

(without introducing more risk)Think evil.

Page 14: Thinking Evil Thoughts

(without introducing more risk)

Getting the scope rights

Avoiding gaps in your threat model

Page 15: Thinking Evil Thoughts

Ignoring part of your systemwhen considering security isa common mistake

Gareth Rushgrove

Page 16: Thinking Evil Thoughts

Gareth Rushgrove

the attack surface of a software environment is the sum of the different points (the "attack vectors") where an unauthorized user (the "attacker") can try to enter data to or extract data from an environment.

ATTACK SURFACE

Page 17: Thinking Evil Thoughts

(without introducing more risk)ExampleWhat is Production?

Gareth Rushgrove

Page 18: Thinking Evil Thoughts

LOAD BALANCER

FRONT END

BACK END

DATABASE

PRODUCTION?

Page 19: Thinking Evil Thoughts

LOAD BALANCER

FRONT END

BACK END

DATABASE

PRODUCTION?

PEOPLE

DESKTOPS

CI SERVER

Page 20: Thinking Evil Thoughts

LOAD BALANCER

FRONT END

BACK END

DATABASE

PRODUCTION?

PEOPLE

DESKTOPS

CI SERVER

HYPERVISOR MANAGEMENT MONITORING

Page 21: Thinking Evil Thoughts

Do you protect your CI stack as well as your production database?

Gareth Rushgrove

Page 22: Thinking Evil Thoughts

Could I execute a query on your production database if I compromised your CI server?

Gareth Rushgrove

Page 23: Thinking Evil Thoughts

ExampleThird party services

Gareth Rushgrove

Page 24: Thinking Evil Thoughts

Gareth Rushgrove

an entity which facilitates interactions between two parties who both trustthe third party

TRUSTED THIRD PARTY

Page 25: Thinking Evil Thoughts

Gareth Rushgrove

a term in computer science and security used to describe a boundary where program data or execution changes its level of "trust". The term refers to any distinct boundary within which a system trusts all sub-systems (including data).

TRUST BOUNDARY

Page 26: Thinking Evil Thoughts

Gareth Rushgrove

Page 27: Thinking Evil Thoughts

Why Serverless is a bad name

Gareth Rushgrove

Page 28: Thinking Evil Thoughts

(without introducing more risk)There are still servers somewhere

Gareth Rushgrove

Page 29: Thinking Evil Thoughts

How you think about the servers changes, and the respectiverisks and mitigations change.But servers still exist.

Gareth Rushgrove

Page 30: Thinking Evil Thoughts

Why NoOps is a bad name

Gareth Rushgrove

Page 31: Thinking Evil Thoughts
Page 32: Thinking Evil Thoughts
Page 33: Thinking Evil Thoughts

How you think about operations changes, and the respectiverisks and mitigations change.But operations still exist.

Gareth Rushgrove

Page 34: Thinking Evil Thoughts

Your attack surface is biggerthan you think

Gareth Rushgrove

Page 35: Thinking Evil Thoughts

(without introducing more risk)Identifying risks

The need to understand your system

Page 36: Thinking Evil Thoughts

Differences in how you perceivea system and how it actually works can be used to exploit it

Gareth Rushgrove

Page 37: Thinking Evil Thoughts

ExampleImmutable infrastructure

Gareth Rushgrove

Page 38: Thinking Evil Thoughts

Out systems are immutable,we don’t need runtime fileintegrity checking

Gareth Rushgrove

“”A possibly naive developer

Page 39: Thinking Evil Thoughts

Gareth Rushgrove

unchanging over time or unableto be changed.synonyms: unchangeable, fixed

IMMUTABLE

Page 40: Thinking Evil Thoughts

(without introducing more risk)Containers are notimmutable by default

Gareth Rushgrove

Page 41: Thinking Evil Thoughts

(without introducing more risk)

Containers are not immutable by default

Gareth Rushgrove

Page 42: Thinking Evil Thoughts

(without introducing more risk)

Gareth Rushgrove

$ docker run -d alpine /bin/sh \ -c "while true; do echo hello world; sleep 1; done"

Page 43: Thinking Evil Thoughts

(without introducing more risk)

Gareth Rushgrove

$ docker exec a7a01beb14de touch /tmp/surprise

Page 44: Thinking Evil Thoughts

(without introducing more risk)

Gareth Rushgrove

$ docker diff a7a01beb14deC /tmpA /tmp/surprise

Page 45: Thinking Evil Thoughts

(without introducing more risk)

Gareth Rushgrove

$ docker run --read-only -d alpine /bin/sh \ -c "while true; do echo hello world; sleep 1; done"

Page 46: Thinking Evil Thoughts

(without introducing more risk)

Gareth Rushgrove

$ docker exec 379150b2cf05 touch /tmp/surprisetouch: cannot touch '/tmp/surprise': Read-only file system

Page 47: Thinking Evil Thoughts

(without introducing more risk)

Do your immutable EC2 instances have read-only filesystems?

Gareth Rushgrove

Page 48: Thinking Evil Thoughts

(without introducing more risk)Most ImmutableInfrastructure isn’t

Gareth Rushgrove

Page 49: Thinking Evil Thoughts

(without introducing more risk)

Without technical controls you only have social guaranteesof immutability

Gareth Rushgrove

Page 50: Thinking Evil Thoughts

(without introducing more risk)

Hacking conferencesLooking for vulnerabilities

Page 51: Thinking Evil Thoughts

Let’s assume your applications and infrastructure are super secure*

Gareth Rushgrove

* This probably isn’t true. You should worry about that as well.

Page 52: Thinking Evil Thoughts

- Penetration testing- Intrusion detection system- Web application firewall- Network firewalls- Malware scanning- Configuration management

Gareth Rushgrove

Page 53: Thinking Evil Thoughts

Gareth Rushgrove

How secure is your laptop?

Page 54: Thinking Evil Thoughts

- Hand maintained configuration- Updated whenever - No central monitoring - Administrative access- Single factor authentication

Gareth Rushgrove

Page 55: Thinking Evil Thoughts

Can you push new Dockerimages from your laptop?

Gareth Rushgrove

Page 56: Thinking Evil Thoughts

Can you create jobs on your Jenkins instance from your laptop?

Gareth Rushgrove

Page 57: Thinking Evil Thoughts

Can you launch new replication controllers from your laptop?

Gareth Rushgrove

Page 58: Thinking Evil Thoughts

Can you release new functionsto Lambda from your laptop?

Gareth Rushgrove

Page 59: Thinking Evil Thoughts

Real world threat

Page 60: Thinking Evil Thoughts

(without introducing more risk)

As a hacker how do I own your laptop?

The fun stuff

Page 61: Thinking Evil Thoughts

Where can I find hundreds of developer laptops…

Gareth Rushgrove

Page 62: Thinking Evil Thoughts

Developer Conferences are a Target Rich Environment

Gareth Rushgrove

Page 63: Thinking Evil Thoughts

Gareth Rushgrove

More InternetSome InternetMarks iPhoneFREE CONFERENCE WIFIHacked AndroidCONFERENCE VENUEPrivateSoftware CircusCompany next doorCoffee shop downstairsSoftware Circus IIDocker CorpAvengers TowerFONMy BlackberryNokia4everABANK

Page 64: Thinking Evil Thoughts

Gareth Rushgrove

More InternetSome InternetMarks iPhoneFREE CONFERENCE WIFIHacked AndroidCONFERENCE VENUEPrivateSoftware CircusCompany next doorCoffee shop downstairsSoftware Circus IIDocker CorpAvengers TowerFONMy BlackberryNokia4everABANK

This is the official conference wifi right?

Page 65: Thinking Evil Thoughts

Gareth Rushgrove

More InternetSome InternetMarks iPhoneFREE CONFERENCE WIFIHacked AndroidCONFERENCE VENUEPrivateSoftware CircusCompany next doorCoffee shop downstairsSoftware Circus IIDocker CorpAvengers TowerFONMy BlackberryNokia4everABANK

Or is it this one? Whatever, both work

Page 66: Thinking Evil Thoughts

Devices exist to man-in-the-middle wireless networks

Gareth Rushgrove

Page 67: Thinking Evil Thoughts

Who has ever picked up a USB memory stick at a conference?

Gareth Rushgrove

Page 68: Thinking Evil Thoughts

Gareth Rushgrove

Page 69: Thinking Evil Thoughts

USB devices exist which will run a script on connect (normally by impersonating a keyboard)

Gareth Rushgrove

Page 70: Thinking Evil Thoughts

(without introducing more risk)

DELAY 1000COMMAND SPACEDELAY 500STRING TerminalDELAY 500ENTERDELAY 800STRING echo 'RSA_PUB_ID' >> ~/.ssh/authorized_keysENTERDELAY 1000STRING killall TerminalENTER

Add my public key

https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Payload---OSX-Passwordless-SSH-access-%28ssh-keys%29

Page 71: Thinking Evil Thoughts

Local databases

Page 72: Thinking Evil Thoughts

Lots of people here are on Twitter and using the conference hashtag

Gareth Rushgrove

Page 73: Thinking Evil Thoughts

Lots of people here are on GitHub with the same username

Gareth Rushgrove

Page 74: Thinking Evil Thoughts

(without introducing more risk)

$ curl -s https://api.github.com/users/<username>/events/public \ | jq '.[].payload.commits[0].author.email' \ | sort \ | uniq \ | grep -v "null"

Email from GitHub user

Page 75: Thinking Evil Thoughts

an e-mail spoofing fraud attempt that targets a specific organization or individual, seeking unauthorized access to confidential data.

Gareth Rushgrove

SPEAR PHISHING

Page 76: Thinking Evil Thoughts

Hi <your name>

Great to see you at <conference name here> last week.

I thought you’d be interested in the container testing tool I mentioned. http://nothingevilhere.com. Would love to know what you think.

Hopefully see you at DockerCon next year too.

Page 77: Thinking Evil Thoughts

(without introducing more risk)

So you’re saying we’re all doomed?

This is quite depressing now I think about it

Page 78: Thinking Evil Thoughts

Part of threat modeling is coming up with suitable mitigations to the risks identified

Gareth Rushgrove

Page 79: Thinking Evil Thoughts

- 2 factor authentication- Time-limited credentials- Separation of duties- Two person rule- Configuration management

Gareth Rushgrove

Page 80: Thinking Evil Thoughts

having more than one person required to complete a task. In business the separation by sharing of more than one individual in one single task is an internal control intended to prevent fraud and error.

Gareth Rushgrove

SEPARATION OF DUTIES

Page 81: Thinking Evil Thoughts

a control mechanism designed to achieve a high level of security for especially critical material or operations. Under this rule all access and actions requires the presence of two authorized people at all times.

Gareth Rushgrove

TWO-PERSON RULE

Page 82: Thinking Evil Thoughts

Gareth Rushgrove

a process that identifies critical information to determine if friendly actions can be observed by enemy intelligence and determines if information obtained by adversaries could be interpreted to be useful to them.

OPERATIONAL SECURITY (OPSEC)

Page 83: Thinking Evil Thoughts

Once you understand the threat you can seek out specific guidance

Gareth Rushgrove

Page 84: Thinking Evil Thoughts
Page 85: Thinking Evil Thoughts

- Protect data in transit- Protect data at rest- Authentication- Secure boot- Platform integrity and sandboxing- Application whitelisting

Gareth Rushgrove

- Malicious code detection- Security policy enforcement- External interface protection- Device update policy- Event collection and analysis- Incident response

https://www.cesg.gov.uk/guidance/end-user-devices-security-principles

Page 86: Thinking Evil Thoughts

Education. Education. Education.

Gareth Rushgrove

Page 87: Thinking Evil Thoughts

Gareth Rushgrove

Page 88: Thinking Evil Thoughts

(without introducing more risk)ConclusionsIf all you remember is…

Page 89: Thinking Evil Thoughts

With Cloud Native approachesdevelopers are nearer to production than ever before

Gareth Rushgrove

Page 90: Thinking Evil Thoughts

The efficiency of modern tooling introduces new threats, and magnifies existing ones

Gareth Rushgrove

Page 91: Thinking Evil Thoughts

Existing mitigations and security controls won’t be enough. You need to collaborate with security colleagues on new approaches

Gareth Rushgrove

Page 92: Thinking Evil Thoughts

Threat modeling should be part of your development process

Gareth Rushgrove

Page 93: Thinking Evil Thoughts

Gareth Rushgrove

Page 94: Thinking Evil Thoughts

Elevation of privilege

Page 95: Thinking Evil Thoughts

Gareth Rushgrove

Page 96: Thinking Evil Thoughts

(without introducing more risk)Thanks

And any questions?