Slide 1

Slide 1 text

abhaybhargav Ideas and Approaches to Threat Modeling as Code Abhay Bhargav

Slide 2

Slide 2 text

abhaybhargav we45 Yours Truly • Founder @ we45 • Chief Architect - Orchestron • Avid Pythonista and AppSec Automation Junkie • Trainer/Speaker at DEF CON, BlackHat, OWASP Events, etc world-wide • Lead Trainer - we45 Training and Workshops • Co-author of Secure Java For Web Application Development • Author of PCI Compliance: A Definitive Guide

Slide 3

Slide 3 text

abhaybhargav we45 Remote Trainings : April - June 2020 • Goto: we45.com/remote-training and select training of choice • DevSecOps, Cloud Security, Secrets Management, AppSec, Containers and Kubernetes streams • Get Live Training + Access to Labs + Access to Videos + Certification = • Discount code for DevSecOps Training DSO200 • Discount code for everything else: WEBINSUB20

Slide 4

Slide 4 text

abhaybhargav we45 Community Initiatives Youtube Channel: youtube.com/we45-appsec Blog: we45.com/blog Talks/Workshops at several OWASP Events

Slide 5

Slide 5 text

abhaybhargav Agenda • Perspective: Problems with Threat-Modeling as its done today • Rise of “Dev first” workflows • Threat-Modeling-as-Code • Conclusions

Slide 6

Slide 6 text

abhaybhargav Pray to the Demo Gods!

Slide 7

Slide 7 text

abhaybhargav Perspective - Problems with Threat Models today

Slide 8

Slide 8 text

abhaybhargav

Slide 9

Slide 9 text

abhaybhargav Observations • Threat Modeling is still a very “waterfall” activity • Security Teams generated - Very siloed • Doesn’t engender ownership with the product engineering team • Ergo: Rarely used

Slide 10

Slide 10 text

abhaybhargav On the other hand….

Slide 11

Slide 11 text

abhaybhargav Dev-First Workflows!

Slide 12

Slide 12 text

abhaybhargav Dev-First Workflows! Workflows that support iterative and continuous delivery of apps ^

Slide 13

Slide 13 text

abhaybhargav This means… • Dev has consumed Ops (Infrastructure-as-Code, Continuous Integration, Continuous Deployment) • Dev has consumed QA (Test Automation) • Dev is halfway through consuming security (Security-as-code) • Dev is coming for policy, compliance, etc next

Slide 14

Slide 14 text

abhaybhargav Why is this good? • ⬆ Automation! • ⬇ Human Intervention • ⏭ Faster delivery of features • ⛅ Highly Scalable, Immutable Environments ❎

Slide 15

Slide 15 text

abhaybhargav Security in DevOps Plan Code Build Test Release Deploy Operate Monitor Threat modeling SAST Security - Composition DAST IAST Deployment Security Security monitoring & attack detection Threat Modeling Inputs - Go here!

Slide 16

Slide 16 text

abhaybhargav Agile Threat Modeling Plan Code Build Test Release Deploy Operate Monitor Threat modeling SAST Security - Composition DAST IAST Deployment Security Security monitoring & attack detection Model Stories Security Acceptance Criteria Mitigations & Baselines Security Test Cases Attack Models Test Automation Detection Models

Slide 17

Slide 17 text

abhaybhargav Different Approaches to Agile Threat Modeling • Story-Driven Threat Modeling • Sprint-Delta Threat Modeling • Mozilla’s Rapid-Risk-Assessment (although its still full system/service model) • The two are NOT mutually exclusive

Slide 18

Slide 18 text

abhaybhargav Mozilla’s Rapid-Risk-Assessment • Done in 30 minutes, max 60 mins • Four Key Questions: • Are you making changes to the attack surface? (New Entry Points) • Are you changing application stack or application security controls? • Are you adding sensitive/confidential data? • Have threat agents changed? Any new risks?

Slide 19

Slide 19 text

abhaybhargav Story-Driven Threat Modeling

Slide 20

Slide 20 text

abhaybhargav Some Background • Story-Driven Threat Modeling is threat modeling against user stories/ functionality definitions in the sprint. • The idea is to break threat modeling down by feature to produce useful, effective, yet efficient threat models • Not perfect, and still doesn’t negate the need for a system-wide threat model. But most effective in Agile Development

Slide 21

Slide 21 text

abhaybhargav Pre-requisites • Cross-Functional Team running the Threat Model • Leave your egos at the door • Run in Sprint Planning Meeting • Consider multi-stage approach

Slide 22

Slide 22 text

abhaybhargav Put another way…. User Story/Feature Description Abuser Story Threat Scenario What abuses against Functionality How Abuse comes to life Mitigations Security Test Case

Slide 23

Slide 23 text

abhaybhargav User Stories As a I so I can • As a Project Manager, I approve legitimate expenses of my team so they can get reimbursed for their official purchases • As a user I want to search for the best deals on cars from Acme Travel to be able to rent a car for my next trip • As a teacher I want to grade each student’s quiz so the student gets a grade on their assignment

Slide 24

Slide 24 text

abhaybhargav Abuser Stories As an I so I can • As a malicious employee, I want to approve my own expenses, so I can get bogus expenses approved through the system • As a student I want to tamper with my grade so I can graduate college

Slide 25

Slide 25 text

abhaybhargav Why Abuser Stories? • Great starting points for direction of the Threat Model itself • Easy to collaborate - Everyone understands this abstraction of a threat • Great perspective of: • Threat Actor • Motivation • Expected Outcome • Focus in on the actual threat scenario(s)

Slide 26

Slide 26 text

abhaybhargav Threat Scenarios • Technical Scenarios for the abuser stories to “come to life” • Focus on specifics on how an abuser story can be compromised with a technical attack possibility • Helps drill down into Abuser Story - Makings of mitigations and test-cases

Slide 27

Slide 27 text

abhaybhargav Threat Scenario As a malicious employee, I want to access Customer Data of my competing salespersons, so I can start pitching and selling products to them • Injection - SQL, Command Injection other Remote Code Execution • Steal the colleague’s password through weak password and brute force attacks • Authorization Bypass - Insecure Direct Object Reference Attacks • Sniff the colleague’s session tokens and use • Social Engineering and CSRF payloads against the manager

Slide 28

Slide 28 text

abhaybhargav ThreatPlaybook • This is an effort at integrating Threat Models (as- Code) and AppSec Automation • Capture Threat Models in Spec files and run with AppSec Automation in the SDL, to ensure: • Iterative Threat Modeling • Incremental AppSec Automation • Ultimate Objective: Run an entire pipeline with Threat Modeling

Slide 29

Slide 29 text

abhaybhargav Our Philosophy

Slide 30

Slide 30 text

abhaybhargav Threat Modeling Process

Slide 31

Slide 31 text

abhaybhargav Demo

Slide 32

Slide 32 text

abhaybhargav Useful Links • ThreatPlaybook Github => github.com/we45/ThreatPlaybook • Thoughts on Scaling Threat Modeling: https://www.abhaybhargav.com/ thoughts-on-using-and-scaling-threat-modeling/