let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf ·...

54
Let’s play security JAX 2018 Dominik Schadow | bridgingIT

Upload: others

Post on 15-Sep-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Let’s play security

JAX 2018Dominik Schadow | bridgingIT

Page 2: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 3: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Security awareness

Page 4: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Add (some) fun to security

Page 5: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

The earlier you start, the more time to

plan and fix

Page 6: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Playing serious games at work

Page 7: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Preparation for a threat modeling game before integrating the team

Playing a threat modeling game with the development team

Extensions to deepen the security knowledge of the developers

Page 8: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

PreparationPlaying a threat modeling game requires preparation

Page 9: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Identify threats

Detail threats

Rank threats

Mitigate threats

Know the application

Identifying threats in applications

Page 10: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Using Data Flow Diagrams to show connections

Not a complete architecture diagramFocus on details that are relevant for security

What are you building?

Page 11: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 12: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 13: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

BrowserExternal Entity

People or code outside your control that interact with the application

Process Code and components that handle data and the dev team controls

Web Server

Data Flow

Represents data movement within the application (including direction)

Data Store

Anything that stores data and does not modify it

Database

http

https

Data Flow Diagrams

Page 14: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Generic Trust Boundary

Web Server

httpshttps

Generic Trust

BoundaryTrust Boundary

Represents the change of privilege levels as the data flows through the application (change in level of trust)

Web Server

httpshttps

Generic Trust Boundary

Trust Boundaries

Page 15: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Typical boundary locations

Anonymous user

Tomcat user

MySQL user

Follow the data, add boundary for new principal

Page 16: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Typical boundariesCan be technical or organizational

Page 17: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

A data flow diagram is a living documentVersion every diagram in a repo and keep it in sync with reality

Check and update them every time the application changes and regularly from time to time

Page 18: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

ExecutionTrack down and identify threats

Page 19: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 20: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 21: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Start with a Data Flow Diagram walkthrough

Page 22: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 23: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

The Elevation of Privilege gameHelps non-security-experts to find security flaws

Card game for 3 - 5 players (78 cards)Requires STRIDE knowledgeNot all are Java web application relevant

Page 24: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

STRIDE is the opposite of a property you want

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

Suits

Page 25: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Spoofing Pretending to be something or somebody elseViolated property: AuthenticationStandard defenses: Passwords, multi-factor authN

Tampering

Repudiation

Modifying something on disk, network or memory Violated property: IntegrityStandard defenses: Digital signatures, hashes

Claiming that someone didn’t do something Violated property: Non-RepudiationStandard defenses: Logging, auditing, timestamps

STRIDE

Page 26: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Information Disclosure

Denial of Service

Elevation of Privilege

Providing information to someone not authorized Violated property: ConfidentialityStandard defenses: Encryption, authorization

Absorbing resources needed to provide service Violated property: AvailabilityStandard defenses: Filtering, quotas, auto scaling

Doing something someone is not authorized to doViolated property: AuthorizationStandard defenses: Input validation, least privilege

STRIDE

Page 27: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Not all threats are likely to all elements

STRIDE per element

S T R I D E

External Entity X X

Process X X X X X X

Data Store X X X

Data Flow X X X

Page 28: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

CategoryDescription

Score

Page 29: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Identify security flaws in your web application

Start with external entitiesFollow the data flow through your application in a structured way

Follow the data

Page 30: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Developers tend to think in solutions

It’s important to find the threats firstPlay a threat even if you think it is already mitigated (really, everywhere?)Be specific in naming threats

Focus on threats

Page 31: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Score +1 for each card with a valid threat to the application under considerationScore +1 for the winner of a round

Page 32: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Identify application security requirements

Card game for 4 - 6 players (80 cards) Same ideas and rules as EoP Web application centric

The OWASP Cornucopia game

Page 33: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Structure based on different OWASP guides

Data Validation and Encoding, Authentication, Session Management, Authorization, Cryptography, Cornucopia („Füllhorn“, everything else, acts as trump)

Suits

Page 34: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Category

Description

Score

(OWASP Secure Coding Practices)OWASP Application Security Verification StandardOWASP Application Intrusion DetectionCommon Attack Pattern Enumeration and Classification(Practical Security Stories and Security Tasks for Agile Development Environments)

Page 35: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Score +1 for each card with a valid threat to the application under considerationScore +1 for the winner of a round

Page 36: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 37: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Hack yourself (first)

Page 38: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

A lot of threats are easily discoverable

Attack your web application on a TEST system or localhostTry to prove presence or absence of a threat

Threat verification

Page 39: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 40: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Wrap-up every game

Page 41: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 42: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Address each threatDecide for each threat how to handle it

Mitigate Eliminate Transfer Accept

Page 43: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Mitigate itPreferred solution

Do something to make it harder to take advantage of a threat

Add Spring Security AND configure it

Page 44: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Eliminate itMost secure solution

Results in feature elimination most of the time

Remove admin functionality from Internet facing application

Page 45: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Transfer itTeam solution

Someone/ something else handles the risk, depending who can easily fix the problem

Operations adds a web application firewall

Page 46: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Accept itLast resort solution

Stop worrying about it and live with the risk

Someone steals your servers’ hard disk

Page 47: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Continue hacking with vulnerable web apps

Use intentionally vulnerable web applications and hack them for educational purposes

Someday your web applications will be too secure for you to hack them easily

Page 48: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

ExtensionsIntegrate intentionally

vulnerable web applications

Page 49: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 50: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 51: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 52: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling
Page 53: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Security must be an important part of every development project

Use Threat Modeling to discover serious security

flaws

Vulnerable web applications deepen security knowledge

EoP and Cornucopia help developers to locate security

problems

Page 54: Let's play securityfiles.dominikschadow.de/events/jax-2018--lets_play_security.pdf · Preparation for a threat modeling game before integrating the team Playing a threat modeling

Marienstr. 17 70178 Stuttgart

[email protected] www.bridging-it.de

Blog blog.dominikschadow.de Twitter @dschadow

Common Attack Pattern Enumeration and Classificationhttps://capec.mitre.orgElevation of Privilege Card Game https://www.microsoft.com/en-us/SDL/adopt/eop.aspxGame of Hackshttp://www.gameofhacks.comhack.me https://hack.meHack Yourself First (Troy Hunt)http://hackyourselffirst.troyhunt.comMicrosoft Threat Modeling Tool https://docs.microsoft.com/de-de/azure/security/azure-security-threat-modeling-toolOWASP Application Security Verification Standardhttps://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_ProjectOWASP AppSensor https://www.owasp.org/index.php/OWASP_AppSensor_Project

OWASP Cornucopia https://www.owasp.org/index.php/OWASP_CornucopiaOWASP Juice Shophttps://github.com/bkimminich/juice-shopOWASP Secure Coding Practices https://www.owasp.org/index.php/OWASP_Secure_Coding_Practices_-_Quick_Reference_GuideOWASP WebGoathttps://github.com/WebGoat/WebGoatOWASP Zed Attack Proxy https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_ProjectPractical Security Stories and Security Tasks for Agile Development Environments http://www.safecode.org/publications/SAFECode_Agile_Dev_ Security0712.pdfPictures http://www.dreamstime.com