Top Banner
JavaLand 2016 Dominik Schadow | bridgingIT Threat Modeling
41

Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Mar 29, 2018

Download

Documents

dinhduong
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: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

JavaLand 2016Dominik Schadow | bridgingIT

Threat Modeling

Page 2: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Java Web ApplicationJava 8Spring Boot 1.3 (Spring 4.2, Spring Security 4)Thymeleaf 2.1Tomcat 8MySQL 5 database (users and application data)

Page 3: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Where are the threats?

XSSSQL Injection

CSRF

Authentication/Authorization

Page 4: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

We developers tend to focus on programming errors and ignore the underlying flaws.

Page 5: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Agenda

Threat Modeling in Action

Threat Modeling Basics

Identifying Threats in

Applications

Page 6: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Threat Modeling Basics

Security flaws are introduced early in the development lifecycle, with no code developed yet

Threat modeling is all about finding security problems Threat modeling starts early

Page 7: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Different ways to threat modelWhich one is working out for you?

Focus on attackers: Can you really think like an attacker? Focus on assets: What is an asset in your application? How do you link assets to threats?

Page 8: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Problems tend to

follow the data flow

Page 9: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

We are developersFocus on the application

you are developing

Start with external entities - events which drive activity like a click in the browser

Page 10: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Movie Plot Threats

Fun to discuss But not really helpful Focus on realistic threats

Page 11: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Creative processIntegrate with bug tracking

Add any discovered threat, even if you are looking for something elseTag as security bug in your bug tracker

Page 12: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Data Flow DiagramsBrowserExternal

EntityPeople or code outside your control

Process Any running code Web Server

Data Flow

Communication between processes or processes and data stores

Data Store

Things that store data Database

http

https

Page 13: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Trust BoundariesGeneric

Trust Boundary

Trust Boundary

Where entities with different privileges interact

Generic Trust Boundary

Web Server

httpshttpsWeb

Serverhttpshttps

Generic Trust Boundary

Page 14: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

What are typical boundaries?Can be technical or organizational

Networks Servers VMs Firewalls

Page 15: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Where are the boundaries?Start on one side, add a boundary every time the

principal changes

1. Browser - anonymous Internet user 2. Web Server - Tomcat user 3. Database - MySQL user

Page 16: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Identifying Threats in Applications

1. What are you building? 2. What can go wrong? 3. What should you do about those things that can go wrong? 4. Did you do a decent job of analysis?

Page 17: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

What are you building?Focus on data flow

„Sometimes“ indicates alternatives: model allNo data sinks: show the consumersData does not move by itself: draw the process moving it

Page 18: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Follow the data

Browser Web Server DatabaseApp

Server

Page 19: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Add trust boundaries

Data Center Cloud

Browser Web Server DatabaseApp

Server

Page 20: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Identify each element

Data Center Cloud

Browser Web Server DatabaseApp

Server12

34

56 7

Page 21: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

What can go wrong?Start with the data crossing trust boundaries

Brainstorm meetings with technology expertsElevation of Privilege game

Page 22: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

STRIDEFocus on threat, not on category

Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of Privilege

Page 23: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

STRIDESpoofing Pretending to be something or somebody else

Violated property: Authentication

Tampering

Repudiation

Modifying something on disk, network or memory Violated property: Integrity

Claiming that someone didn’t do something Violated property: Non-Repudiation

Page 24: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

STRIDEInformation Disclosure

Denial of Service

Elevation of Privilege

Providing information to someone not authorized Violated property: Confidentiality

Absorbing resources needed to provide service Violated property: Availability

Doing something someone is not authorized to do Violated property: Authorization

Page 25: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Add threats

Spoofing - CSRF - Identify user (authentication) - Identify website (certificate)

Denial of Service Repudiation

- Protect logs against tampering

Elevation of Privilege - Can someone access

backend logic directly?

Tampering - Data manipulation

Information Disclosure - Read/ write

access to DB

Data Center Cloud

Browser Web Server DatabaseApp

Server12

34

56 7

Page 26: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Addressing each threatDecide for each threat how to handle it

Mitigate Eliminate Transfer Accept

Page 27: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Mitigate itPreferred solution

Do something to make it harder to take advantage of a threat (like introducing a password policy)

Page 28: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Eliminate itMost secure solution

Results in feature elimination most of the time (like removing admin functionality)

Page 29: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Transfer itTeam solution

Someone/ something else handles the risk - make sure they do (like operations adding a web application firewall)

Page 30: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Accept itLast resort solution

Stop worrying about it and live with the risk (like someone stealing your server hard disk)

Page 31: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Threat Target

Mitigation Strategy Mitigation Technique Priority Issue

ID

Repudiating actions Log Logging all security relevant

actions in an audit log 2 1001

Spoofing a user

Identification and

authentication

Password policy, token, password reset process 1 1002

Network flooding Elastic cloud Dynamic cloud resources (servers

and databases) to provide service 3 1006

Tampering network packets

Cryptography HTTPS/TLS 1 1007

Page 32: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Is it complete?Let someone introduce the application by

following the data flow

Watch out for phrases like „Sometimes we have to do … instead of … here“ or „A lot of things are happening here which are not completely listed…“

Page 33: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Breadth before depthCriteria exist to show you are NOT done, but none

to show you are done

Easy way: Have a threat of each type in STRIDEHarder way: Have one threat per element of the diagram

Page 34: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Threat Modeling in Action

Use one tool to threat model, version your models in a repo and check/ update them every time the application changes.

Page 35: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:
Page 36: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:
Page 37: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Demo

Page 38: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Spoofing

Threat Target Mitigation Strategy Mitigation Technique

Spoofing a user Identification and authentication

Password policy, token, password reset process

Fake usersRegistration form

protection and email verification

Captcha in registration form, pending account unless verified by clicking

on email link

Page 39: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:
Page 40: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

Threat model before you start to code

Make sure you have addressed every threat

Update your threat model frequently

Summary

Page 41: Threat Modeling - DOAG Deutsche ORACLE … 8 MySQL 5 database (users and application data) Where are the threats? XSS SQL Injection CSRF Authentication/ Authorization. ... Threat Modeling:

[email protected] www.bridging-it.de

Microsoft Threat Modeling Tool www.microsoft.com/en-us/sdl/adopt/threatmodeling.aspx Mozilla SeaSponge air.mozilla.org/mozilla-winter-of-security-seasponge-a-tool-for-easy-threat-modeling

Threat Modeling: Designing for Security (Adam Shostack) eu.wiley.com/WileyCDA/WileyTitle/productCd-1118809998.html

Pictures www.dreamstime.com

Königstraße 4270173 Stuttgart

Blog blog.dominikschadow.de Twitter @dschadow