SlideShare a Scribd company logo
1 of 30
Developer-First
Security
Andy Chou
CTO and Founder
Coverity

Copyright Coverity, Inc., 2013
Developer Priorities
Building features
on schedule
that delight users
that don’t crash or become unreliable
that perform well and scale up
that can be efficiently maintained
and don’t have security holes.

2
Security can be Complex
<a href="javascript:hello('${input}')">
Single Quoted JavaScript String

JavaScript Code

HTML Contexts
Stack
Single quoted
JavaScript string
JavaScript code
URI

URI

Double Quoted HTML Attribute Value

input = ');alert('bad
input = %27);alert(%27bad

Double quoted
HTML attribute
value
4
CVEs: 1995-2013
7000

6000

5000

11/2013

# CVEs

4000

3000

2000

1000

0

1995

1996

1997

1998

1999

2000

2001

2002

2003

2004

2005

2006

2007

2008

2009

2010

2011

2012

2013

High Severity

18

45

145

134

424

451

773

1,004

678

969

2,040 2,761 3,158 2,839 2,719 2,094 1,821 1,765 1,518

Med Severity

6

21

88

90

357

471

714

999

749

Low Severity

1

9

19

22

113

98

190

153

100

1,274 2,437 3,332 3,125 2,607 2,814 2,267 2,069 3,013 2,450
208

454

515

231

186

199

278

260

511

426

* There is some debate about the validity of this data, but nobody would argue we have security anywhere near licked
5
What’s Usually Done
•
•
•
•

Ignore it.
Wait until the application is about to ship – then pen test.
Wait until deployment – and pray.
Hope that security people will find all the vulnerabilities for us.

Developer view of developer

6

Security view of developer
7
Communicating with Security People
• Ask how to remediate.
• Leverage bug tracking systems.
• Tell them your timeframe for design, coding, and
testing.

•
•
•
•
•

Give access to your code and how to build it easily.
Share architecture diagrams.
Prepare a testing environment.
Budget time to fix the issues that come back.
Know what you don’t know – ask questions about
anything you don’t fully understand, especially how
to fix.

• Move away from the “prove it’s exploitable” attitude
and toward positive “how can I fix it properly”

8
Fix Earlier = Cheaper
30-100x
It pays to address security
weaknesses as soon as
they are introduced

1x

3x

Requirements

Design

5x
Coding

10x

Quality
Assurance

* Based on NIST report “The Economic Impacts of Inadequate Infrastructure for Software Testing”
9

Release
We Need a New Persona for Attackers

10
Security in Embedded in All Development Activities

Security
Requirements

Train

Focused
Developer
Training

11

Design

Code

Threat
Modeling

Supply Chain

Attack
Surface
Reduction

Static
Analysis

Test

Security
Testing
Threat Modeling Starts with Architecture
web

Internal network

Trust Boundaries
CIM DB

Data flows

File System

jdbc

browser

hibernate

http
controllers
CIM

JSON

conf-push

REST API

Commit
Interface

WS

LDAP

http

Components
http/soap
WS client

Cache

(Actors – not shown)
12

web server

Assets
Analyze for Threats

web

Your friendly
security expert

Internal network

CIM DB
File System

•
•
•
•
•

jdbc

browser

hibernate

http
controllers
CIM

JSON

conf-push

REST API

Commit
Interface

WS

LDAP

http

http/soap
WS client

Set aside time for threat modeling
Treat it as part of the design process
Incrementally update it
Get key architects involved
Make developers accessible

Cache

web server

Developers
Architects

Abuse
Cases

13

Top-N list
Behind the Curtain: No Magic
“Elaborate possible threats”
web

Internal network

CIM DB
File System

jdbc

browser

hibernate

http
controllers
CIM

JSON

conf-push

REST API

Commit
Interface

WS

LDAP

http

http/soap
WS client

Cache

web server

STRIDE = {
Spoofing,
Tampering,
Repudiation,
Information disclosure,
Denial of service,
Elevation of privilege
}

Abuse
Cases

“Educated guess of risk”

Abuse
Cases

14

DREAD(x) =
Avg(Damage potential(x),
Reproducibility(x),
Exploitability(x),
Affected users(x),
Discoverability(x))

Top-N list
Example: XML External Entity (XXE)
web

Internal network

CIM DB

3 - Access to
config files

File System

jdbc

2 - Entity reference
to system file

browser

hibernate

http
controllers
CIM

JSON

conf-push

REST API

Commit
Interface

WS

LDAP

http

http/soap
WS client

1 - XML parser
misconfiguration

Cache

web server

15
16
CWE Top 25
Find and Fix

Applicable

Design
Review

[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
[18]
[19]
[20]
[21]
[22]
[23]
[24]
[25]
17

SQL Injection
OS Command Injection
Classic Buffer Overflow
Cross-site Scripting
Missing Authentication for Critical Function
Missing Authorization
Use of Hard-coded Credentials
Missing Encryption of Sensitive Data
Unrestricted Upload of File with Dangerous Type
Reliance on Untrusted Inputs in a Security Decision
Execution with Unnecessary Privileges
Cross-Site Request Forgery (CSRF)
Path Traversal
Download of Code Without Integrity Check
Incorrect Authorization
Inclusion of Functionality from Untrusted Control Sphere
Incorrect Permission Assignment for Critical Resource
Use of Potentially Dangerous Function
Use of a Broken or Risky Cryptographic Algorithm
Incorrect Calculation of Buffer Size
Improper Restriction of Excessive Authentication Attempts
URL Redirection to Untrusted Site ('Open Redirect')
Uncontrolled Format String
Integer Overflow or Wraparound
Use of a One-Way Hash without a Salt

SA

DA

✗
✗

✗
✗

✗

Mitigations
Code
Review

Pen
Test CSP HSTS

✗

✗

✗
✗
✗

✗
✗
✗

✗
✗

✗
✗

✗

✗
✗
✗

✗

✗
✗
✗
✗

✗
✗
✗
✗
✗

✗
✗
✗
✗

✗
✗
✗
✗
✗
✗
Top Design-Time Mitigations
Choice of programming
language
• C/C++ has memory corruption
Choice of Frameworks
• Ask for an expert opinion.
• Keep frameworks up to date.
Choice of Templating
• Contextual auto-escaping helps
prevent XSS.

• Warning: only HTML escaping

isn’t enough in all cases. For
example, Ruby’s ERB only does
this (and not quite right…)

18

Web Applications
• Content Security Policy (CSP)
• Makes exploitation of XSS harder.
• Requires refactoring of inline
scripts.

• X-Frame-Options (XFO)
• The fix for clickjacking.

Native Applications
• Stack protection, DEP, ASLR, etc.
• Secure compiler and runtime
options give big bang for buck.

Databases
• Object-Relational Mapping

(ORM) helps but still need to be
vigilant about any explicit querylike strings.
Top Code-Time Fixes
Input validation
• Check inputs are actually

within their expected data
type

Output Escaping
•

Escape metacharacters when putting
string data into another parser.

• Misconception: data is “clean”
and “safe” after input
validation. Not always so!!

• Security by Serendipity is
good, but not enough.

• When input validation fails,

assume the data is malicious
and treat accordingly.

19

String x = Input()
HTML: Escape.html(x)
JS String: Escape.jsString(x)
CSS String: Escape.cssString(x)
URI query parm: Escape.uri(x)
Nested contexts: seek help
Static Analysis
Code

Defects
char *p
if (x == 0)

Static Analysis

true
p=0

false
p = foo()
if(x != 0)

true

false

...

s=*p

return

• It’s about automation and built-in knowledge.
• One of the few tools that work in the inner loop of development.
• Make sure it gets tuned, configured, deployed, and adopted.
20
21
Supply Chain
3rd Party
Developer

Open Source

• Keep dependencies up to date
• Check for CVEs and security
notifications
• Due diligence before selecting
open source projects
22
End of Tour
Security
Requirements

Train

Focused
Developer
Training

23

Design

Code

Threat
Modeling

Supply Chain

Attack
Surface
Reduction

Static
Analysis

Test

Security
Testing
Program Behaviors on Two Axes

24
A Typical Program

25
Development Responsibility Includes a Lot of
Security

26
How to Get Started with Security
• Specialize: assign a developer from your team to learn about security for the
specific technologies you are using. Reward it.

• Apply common mitigations. Automate as much of the “find and fix” process
as possible.

• Start a discussion among your team about the attacker persona and abuse
cases.

• Look for security expertise when hiring developers.
• Adapt a Secure Development Lifecycle to your development processes. See
SafeCode’s Agile stories for security: http://www.safecode.org

27
Resources: Learning More
Microsoft SDL
http://www.microsoft.com/security/sdl (Secure Development Lifecycle)
OWASP
http://www.owasp.org (web apps; focus on the cheat sheets)
SafeCode
http://www.safecode.org (excellent security-focused Agile stories)
CWE

http://cwe.mitre.org (taxonomy of security weaknesses)
Security blogs
http://security.coverity.com (Coverity Security Research Lab blog)

28
Thank You
Andy Chou
andy@coverity.com
@_achou
Want to try Coverity on your code?
For a free trial, visit:
www.coverity.com

More Related Content

What's hot

Server Side Template Injection by Mandeep Jadon
Server Side Template Injection by Mandeep JadonServer Side Template Injection by Mandeep Jadon
Server Side Template Injection by Mandeep JadonMandeep Jadon
 
Code Review Best Practices
Code Review Best PracticesCode Review Best Practices
Code Review Best PracticesTrisha Gee
 
Crowd debugging (FSE 2015)
Crowd debugging (FSE 2015)Crowd debugging (FSE 2015)
Crowd debugging (FSE 2015)Sung Kim
 
Utility of Test Coverage Metrics in TDD
Utility of Test Coverage Metrics in TDDUtility of Test Coverage Metrics in TDD
Utility of Test Coverage Metrics in TDDXP Conference India
 
Concurrency Errors in Java
Concurrency Errors in JavaConcurrency Errors in Java
Concurrency Errors in JavaCoverity
 
Code Review
Code ReviewCode Review
Code ReviewDivante
 
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)Sung Kim
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelinesLalit Kale
 
How to get the most out of code reviews
How to get the most out of code reviewsHow to get the most out of code reviews
How to get the most out of code reviewsJavaDayUA
 
Continuous Integration: Live Static Analysis with Puma Scan
Continuous Integration: Live Static Analysis with Puma ScanContinuous Integration: Live Static Analysis with Puma Scan
Continuous Integration: Live Static Analysis with Puma ScanCypress Data Defense
 
Joxean Koret - Interactive Static Analysis Tools for Vulnerability Discovery ...
Joxean Koret - Interactive Static Analysis Tools for Vulnerability Discovery ...Joxean Koret - Interactive Static Analysis Tools for Vulnerability Discovery ...
Joxean Koret - Interactive Static Analysis Tools for Vulnerability Discovery ...RootedCON
 
DevSecOps: Securing Applications with DevOps
DevSecOps: Securing Applications with DevOpsDevSecOps: Securing Applications with DevOps
DevSecOps: Securing Applications with DevOpsWouter de Kort
 
Random testing
Random testingRandom testing
Random testingLocaweb
 

What's hot (20)

Server Side Template Injection by Mandeep Jadon
Server Side Template Injection by Mandeep JadonServer Side Template Injection by Mandeep Jadon
Server Side Template Injection by Mandeep Jadon
 
Code Review Best Practices
Code Review Best PracticesCode Review Best Practices
Code Review Best Practices
 
Code Review for iOS
Code Review for iOSCode Review for iOS
Code Review for iOS
 
Crowd debugging (FSE 2015)
Crowd debugging (FSE 2015)Crowd debugging (FSE 2015)
Crowd debugging (FSE 2015)
 
Utility of Test Coverage Metrics in TDD
Utility of Test Coverage Metrics in TDDUtility of Test Coverage Metrics in TDD
Utility of Test Coverage Metrics in TDD
 
Code Review
Code ReviewCode Review
Code Review
 
Concurrency Errors in Java
Concurrency Errors in JavaConcurrency Errors in Java
Concurrency Errors in Java
 
Code Review
Code ReviewCode Review
Code Review
 
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
 
Null meet Code Review
Null meet Code ReviewNull meet Code Review
Null meet Code Review
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
How to get the most out of code reviews
How to get the most out of code reviewsHow to get the most out of code reviews
How to get the most out of code reviews
 
Static Code Analysis
Static Code AnalysisStatic Code Analysis
Static Code Analysis
 
Continuous Integration: Live Static Analysis with Puma Scan
Continuous Integration: Live Static Analysis with Puma ScanContinuous Integration: Live Static Analysis with Puma Scan
Continuous Integration: Live Static Analysis with Puma Scan
 
Code Review
Code ReviewCode Review
Code Review
 
Joxean Koret - Interactive Static Analysis Tools for Vulnerability Discovery ...
Joxean Koret - Interactive Static Analysis Tools for Vulnerability Discovery ...Joxean Koret - Interactive Static Analysis Tools for Vulnerability Discovery ...
Joxean Koret - Interactive Static Analysis Tools for Vulnerability Discovery ...
 
DevSecOps: Securing Applications with DevOps
DevSecOps: Securing Applications with DevOpsDevSecOps: Securing Applications with DevOps
DevSecOps: Securing Applications with DevOps
 
Static code analysis
Static code analysisStatic code analysis
Static code analysis
 
Random testing
Random testingRandom testing
Random testing
 
Code coverage
Code coverageCode coverage
Code coverage
 

Viewers also liked

Adopting a security attitude in DevOps via DevOpsSec
Adopting a security attitude in DevOps via DevOpsSecAdopting a security attitude in DevOps via DevOpsSec
Adopting a security attitude in DevOps via DevOpsSecTapabrata Pal
 
What Good is this Tool? A Guide to Choosing the Right Application Security Te...
What Good is this Tool? A Guide to Choosing the Right Application Security Te...What Good is this Tool? A Guide to Choosing the Right Application Security Te...
What Good is this Tool? A Guide to Choosing the Right Application Security Te...Kevin Fealey
 
AppSec is Eating Security
AppSec is Eating SecurityAppSec is Eating Security
AppSec is Eating SecurityAlex Stamos
 
Web Application Firewall (WAF) DAST/SAST combination
Web Application Firewall (WAF) DAST/SAST combinationWeb Application Firewall (WAF) DAST/SAST combination
Web Application Firewall (WAF) DAST/SAST combinationTjylen Veselyj
 
How to secure your web applications with NGINX
How to secure your web applications with NGINXHow to secure your web applications with NGINX
How to secure your web applications with NGINXWallarm
 
AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application Carlo Bonamico
 
Periodismo chiquinquireño
Periodismo chiquinquireñoPeriodismo chiquinquireño
Periodismo chiquinquireñoErikaSeb
 
Datos importantes para planificar un evento edith giraldo productora de eve...
Datos importantes para planificar un evento   edith giraldo productora de eve...Datos importantes para planificar un evento   edith giraldo productora de eve...
Datos importantes para planificar un evento edith giraldo productora de eve...Edith Giraldo
 
LISTADO OPOSICION + MERITOS
LISTADO OPOSICION + MERITOSLISTADO OPOSICION + MERITOS
LISTADO OPOSICION + MERITOSguest0dbad523
 
Teclado manuel barraza 1ºh
Teclado manuel barraza 1ºhTeclado manuel barraza 1ºh
Teclado manuel barraza 1ºhmartinamoraga12
 
Compuertas técnicas avanzadas parte 2
Compuertas   técnicas avanzadas parte 2Compuertas   técnicas avanzadas parte 2
Compuertas técnicas avanzadas parte 2Andrés Cuervo
 
مراجعة الصف الثانى الاعدادى
مراجعة الصف الثانى الاعدادىمراجعة الصف الثانى الاعدادى
مراجعة الصف الثانى الاعدادىHanaa Ahmed
 
Presentacion de economica politica
Presentacion de economica politicaPresentacion de economica politica
Presentacion de economica politicaabelardoac
 
Alba Lucia Sanchez Mejia
Alba Lucia Sanchez Mejia	Alba Lucia Sanchez Mejia
Alba Lucia Sanchez Mejia astrydquintero
 
F1041028_George_Chen_Resume_9_with_Publications_Training
F1041028_George_Chen_Resume_9_with_Publications_TrainingF1041028_George_Chen_Resume_9_with_Publications_Training
F1041028_George_Chen_Resume_9_with_Publications_TrainingWei-Su Chen
 

Viewers also liked (20)

Adopting a security attitude in DevOps via DevOpsSec
Adopting a security attitude in DevOps via DevOpsSecAdopting a security attitude in DevOps via DevOpsSec
Adopting a security attitude in DevOps via DevOpsSec
 
Обзор возможностей HTML5
Обзор возможностей HTML5Обзор возможностей HTML5
Обзор возможностей HTML5
 
What Good is this Tool? A Guide to Choosing the Right Application Security Te...
What Good is this Tool? A Guide to Choosing the Right Application Security Te...What Good is this Tool? A Guide to Choosing the Right Application Security Te...
What Good is this Tool? A Guide to Choosing the Right Application Security Te...
 
Code Coverage
Code CoverageCode Coverage
Code Coverage
 
AppSec is Eating Security
AppSec is Eating SecurityAppSec is Eating Security
AppSec is Eating Security
 
Web Application Firewall (WAF) DAST/SAST combination
Web Application Firewall (WAF) DAST/SAST combinationWeb Application Firewall (WAF) DAST/SAST combination
Web Application Firewall (WAF) DAST/SAST combination
 
How to secure your web applications with NGINX
How to secure your web applications with NGINXHow to secure your web applications with NGINX
How to secure your web applications with NGINX
 
AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application AngularJS Security: defend your Single Page Application
AngularJS Security: defend your Single Page Application
 
Periodismo chiquinquireño
Periodismo chiquinquireñoPeriodismo chiquinquireño
Periodismo chiquinquireño
 
Datos importantes para planificar un evento edith giraldo productora de eve...
Datos importantes para planificar un evento   edith giraldo productora de eve...Datos importantes para planificar un evento   edith giraldo productora de eve...
Datos importantes para planificar un evento edith giraldo productora de eve...
 
LISTADO OPOSICION + MERITOS
LISTADO OPOSICION + MERITOSLISTADO OPOSICION + MERITOS
LISTADO OPOSICION + MERITOS
 
Teclado manuel barraza 1ºh
Teclado manuel barraza 1ºhTeclado manuel barraza 1ºh
Teclado manuel barraza 1ºh
 
Compuertas técnicas avanzadas parte 2
Compuertas   técnicas avanzadas parte 2Compuertas   técnicas avanzadas parte 2
Compuertas técnicas avanzadas parte 2
 
GANGA
GANGAGANGA
GANGA
 
Del mito a la actualidad
Del mito a la actualidadDel mito a la actualidad
Del mito a la actualidad
 
Nelly Osorio Godoy
Nelly Osorio Godoy	Nelly Osorio Godoy
Nelly Osorio Godoy
 
مراجعة الصف الثانى الاعدادى
مراجعة الصف الثانى الاعدادىمراجعة الصف الثانى الاعدادى
مراجعة الصف الثانى الاعدادى
 
Presentacion de economica politica
Presentacion de economica politicaPresentacion de economica politica
Presentacion de economica politica
 
Alba Lucia Sanchez Mejia
Alba Lucia Sanchez Mejia	Alba Lucia Sanchez Mejia
Alba Lucia Sanchez Mejia
 
F1041028_George_Chen_Resume_9_with_Publications_Training
F1041028_George_Chen_Resume_9_with_Publications_TrainingF1041028_George_Chen_Resume_9_with_Publications_Training
F1041028_George_Chen_Resume_9_with_Publications_Training
 

Similar to DevBeat 2013 - Developer-first Security

Prevoty NYC Java SIG 20150730
Prevoty NYC Java SIG 20150730Prevoty NYC Java SIG 20150730
Prevoty NYC Java SIG 20150730chadtindel
 
[OPD 2019] Threat modeling at scale
[OPD 2019] Threat modeling at scale[OPD 2019] Threat modeling at scale
[OPD 2019] Threat modeling at scaleOWASP
 
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh  - Some new vulnerabilities in modern web applicationNguyen Phuong Truong Anh  - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web applicationSecurity Bootcamp
 
Application and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionApplication and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionDaniel Owens
 
Jim Manico: Developer Top 10 Core Controls, web application security @ OWASP ...
Jim Manico: Developer Top 10 Core Controls, web application security @ OWASP ...Jim Manico: Developer Top 10 Core Controls, web application security @ OWASP ...
Jim Manico: Developer Top 10 Core Controls, web application security @ OWASP ...Xlator
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 sebaSebastien Deleersnyder
 
Matthew Coles - Izar Tarandach - Security Toolbox
Matthew Coles - Izar Tarandach - Security ToolboxMatthew Coles - Izar Tarandach - Security Toolbox
Matthew Coles - Izar Tarandach - Security ToolboxSource Conference
 
Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Jim Manico
 
10 Rules for Safer Code
10 Rules for Safer Code10 Rules for Safer Code
10 Rules for Safer CodeQuang Ngoc
 
JavaScript security and tools evolution at 2017 OWASP Taiwan Week
JavaScript security and tools evolution at 2017 OWASP Taiwan WeekJavaScript security and tools evolution at 2017 OWASP Taiwan Week
JavaScript security and tools evolution at 2017 OWASP Taiwan Weekdcervigni
 
Application Security 101 (OWASP DC)
Application Security 101 (OWASP DC)Application Security 101 (OWASP DC)
Application Security 101 (OWASP DC)mikemcbryde
 
10 Rules for Safer Code [Odoo Experience 2016]
10 Rules for Safer Code [Odoo Experience 2016]10 Rules for Safer Code [Odoo Experience 2016]
10 Rules for Safer Code [Odoo Experience 2016]Olivier Dony
 
Positive Technologies - S4 - Scada under x-rays
Positive Technologies - S4 - Scada under x-raysPositive Technologies - S4 - Scada under x-rays
Positive Technologies - S4 - Scada under x-raysqqlan
 
Secure development in .NET with EPiServer Solita
Secure development in .NET with EPiServer SolitaSecure development in .NET with EPiServer Solita
Secure development in .NET with EPiServer SolitaJoona Immonen
 
Secure SDLC for Software
Secure SDLC for Software Secure SDLC for Software
Secure SDLC for Software Shreeraj Shah
 
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...Apostolos Giannakidis
 
For Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSecFor Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSecLalit Kale
 
Code Quality - Security
Code Quality - SecurityCode Quality - Security
Code Quality - Securitysedukull
 

Similar to DevBeat 2013 - Developer-first Security (20)

Prevoty NYC Java SIG 20150730
Prevoty NYC Java SIG 20150730Prevoty NYC Java SIG 20150730
Prevoty NYC Java SIG 20150730
 
[OPD 2019] Threat modeling at scale
[OPD 2019] Threat modeling at scale[OPD 2019] Threat modeling at scale
[OPD 2019] Threat modeling at scale
 
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh  - Some new vulnerabilities in modern web applicationNguyen Phuong Truong Anh  - Some new vulnerabilities in modern web application
Nguyen Phuong Truong Anh - Some new vulnerabilities in modern web application
 
Application and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental EditionApplication and Website Security -- Fundamental Edition
Application and Website Security -- Fundamental Edition
 
Jim Manico: Developer Top 10 Core Controls, web application security @ OWASP ...
Jim Manico: Developer Top 10 Core Controls, web application security @ OWASP ...Jim Manico: Developer Top 10 Core Controls, web application security @ OWASP ...
Jim Manico: Developer Top 10 Core Controls, web application security @ OWASP ...
 
Solvay secure application layer v2015 seba
Solvay secure application layer v2015   sebaSolvay secure application layer v2015   seba
Solvay secure application layer v2015 seba
 
Matthew Coles - Izar Tarandach - Security Toolbox
Matthew Coles - Izar Tarandach - Security ToolboxMatthew Coles - Izar Tarandach - Security Toolbox
Matthew Coles - Izar Tarandach - Security Toolbox
 
Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2
 
10 Rules for Safer Code
10 Rules for Safer Code10 Rules for Safer Code
10 Rules for Safer Code
 
JavaScript security and tools evolution at 2017 OWASP Taiwan Week
JavaScript security and tools evolution at 2017 OWASP Taiwan WeekJavaScript security and tools evolution at 2017 OWASP Taiwan Week
JavaScript security and tools evolution at 2017 OWASP Taiwan Week
 
Application Security 101 (OWASP DC)
Application Security 101 (OWASP DC)Application Security 101 (OWASP DC)
Application Security 101 (OWASP DC)
 
10 Rules for Safer Code [Odoo Experience 2016]
10 Rules for Safer Code [Odoo Experience 2016]10 Rules for Safer Code [Odoo Experience 2016]
10 Rules for Safer Code [Odoo Experience 2016]
 
Positive Technologies - S4 - Scada under x-rays
Positive Technologies - S4 - Scada under x-raysPositive Technologies - S4 - Scada under x-rays
Positive Technologies - S4 - Scada under x-rays
 
ISSA Siem Fraud
ISSA Siem FraudISSA Siem Fraud
ISSA Siem Fraud
 
Secure development in .NET with EPiServer Solita
Secure development in .NET with EPiServer SolitaSecure development in .NET with EPiServer Solita
Secure development in .NET with EPiServer Solita
 
Secure SDLC for Software
Secure SDLC for Software Secure SDLC for Software
Secure SDLC for Software
 
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
Unsafe Deserialization Attacks In Java and A New Approach To Protect The JVM ...
 
For Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSecFor Business's Sake, Let's focus on AppSec
For Business's Sake, Let's focus on AppSec
 
Introduction to threat_modeling
Introduction to threat_modelingIntroduction to threat_modeling
Introduction to threat_modeling
 
Code Quality - Security
Code Quality - SecurityCode Quality - Security
Code Quality - Security
 

Recently uploaded

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Recently uploaded (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

DevBeat 2013 - Developer-first Security

  • 1. Developer-First Security Andy Chou CTO and Founder Coverity Copyright Coverity, Inc., 2013
  • 2. Developer Priorities Building features on schedule that delight users that don’t crash or become unreliable that perform well and scale up that can be efficiently maintained and don’t have security holes. 2
  • 3. Security can be Complex <a href="javascript:hello('${input}')"> Single Quoted JavaScript String JavaScript Code HTML Contexts Stack Single quoted JavaScript string JavaScript code URI URI Double Quoted HTML Attribute Value input = ');alert('bad input = %27);alert(%27bad Double quoted HTML attribute value
  • 4. 4
  • 5. CVEs: 1995-2013 7000 6000 5000 11/2013 # CVEs 4000 3000 2000 1000 0 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 High Severity 18 45 145 134 424 451 773 1,004 678 969 2,040 2,761 3,158 2,839 2,719 2,094 1,821 1,765 1,518 Med Severity 6 21 88 90 357 471 714 999 749 Low Severity 1 9 19 22 113 98 190 153 100 1,274 2,437 3,332 3,125 2,607 2,814 2,267 2,069 3,013 2,450 208 454 515 231 186 199 278 260 511 426 * There is some debate about the validity of this data, but nobody would argue we have security anywhere near licked 5
  • 6. What’s Usually Done • • • • Ignore it. Wait until the application is about to ship – then pen test. Wait until deployment – and pray. Hope that security people will find all the vulnerabilities for us. Developer view of developer 6 Security view of developer
  • 7. 7
  • 8. Communicating with Security People • Ask how to remediate. • Leverage bug tracking systems. • Tell them your timeframe for design, coding, and testing. • • • • • Give access to your code and how to build it easily. Share architecture diagrams. Prepare a testing environment. Budget time to fix the issues that come back. Know what you don’t know – ask questions about anything you don’t fully understand, especially how to fix. • Move away from the “prove it’s exploitable” attitude and toward positive “how can I fix it properly” 8
  • 9. Fix Earlier = Cheaper 30-100x It pays to address security weaknesses as soon as they are introduced 1x 3x Requirements Design 5x Coding 10x Quality Assurance * Based on NIST report “The Economic Impacts of Inadequate Infrastructure for Software Testing” 9 Release
  • 10. We Need a New Persona for Attackers 10
  • 11. Security in Embedded in All Development Activities Security Requirements Train Focused Developer Training 11 Design Code Threat Modeling Supply Chain Attack Surface Reduction Static Analysis Test Security Testing
  • 12. Threat Modeling Starts with Architecture web Internal network Trust Boundaries CIM DB Data flows File System jdbc browser hibernate http controllers CIM JSON conf-push REST API Commit Interface WS LDAP http Components http/soap WS client Cache (Actors – not shown) 12 web server Assets
  • 13. Analyze for Threats web Your friendly security expert Internal network CIM DB File System • • • • • jdbc browser hibernate http controllers CIM JSON conf-push REST API Commit Interface WS LDAP http http/soap WS client Set aside time for threat modeling Treat it as part of the design process Incrementally update it Get key architects involved Make developers accessible Cache web server Developers Architects Abuse Cases 13 Top-N list
  • 14. Behind the Curtain: No Magic “Elaborate possible threats” web Internal network CIM DB File System jdbc browser hibernate http controllers CIM JSON conf-push REST API Commit Interface WS LDAP http http/soap WS client Cache web server STRIDE = { Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, Elevation of privilege } Abuse Cases “Educated guess of risk” Abuse Cases 14 DREAD(x) = Avg(Damage potential(x), Reproducibility(x), Exploitability(x), Affected users(x), Discoverability(x)) Top-N list
  • 15. Example: XML External Entity (XXE) web Internal network CIM DB 3 - Access to config files File System jdbc 2 - Entity reference to system file browser hibernate http controllers CIM JSON conf-push REST API Commit Interface WS LDAP http http/soap WS client 1 - XML parser misconfiguration Cache web server 15
  • 16. 16
  • 17. CWE Top 25 Find and Fix Applicable Design Review [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] 17 SQL Injection OS Command Injection Classic Buffer Overflow Cross-site Scripting Missing Authentication for Critical Function Missing Authorization Use of Hard-coded Credentials Missing Encryption of Sensitive Data Unrestricted Upload of File with Dangerous Type Reliance on Untrusted Inputs in a Security Decision Execution with Unnecessary Privileges Cross-Site Request Forgery (CSRF) Path Traversal Download of Code Without Integrity Check Incorrect Authorization Inclusion of Functionality from Untrusted Control Sphere Incorrect Permission Assignment for Critical Resource Use of Potentially Dangerous Function Use of a Broken or Risky Cryptographic Algorithm Incorrect Calculation of Buffer Size Improper Restriction of Excessive Authentication Attempts URL Redirection to Untrusted Site ('Open Redirect') Uncontrolled Format String Integer Overflow or Wraparound Use of a One-Way Hash without a Salt SA DA ✗ ✗ ✗ ✗ ✗ Mitigations Code Review Pen Test CSP HSTS ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗
  • 18. Top Design-Time Mitigations Choice of programming language • C/C++ has memory corruption Choice of Frameworks • Ask for an expert opinion. • Keep frameworks up to date. Choice of Templating • Contextual auto-escaping helps prevent XSS. • Warning: only HTML escaping isn’t enough in all cases. For example, Ruby’s ERB only does this (and not quite right…) 18 Web Applications • Content Security Policy (CSP) • Makes exploitation of XSS harder. • Requires refactoring of inline scripts. • X-Frame-Options (XFO) • The fix for clickjacking. Native Applications • Stack protection, DEP, ASLR, etc. • Secure compiler and runtime options give big bang for buck. Databases • Object-Relational Mapping (ORM) helps but still need to be vigilant about any explicit querylike strings.
  • 19. Top Code-Time Fixes Input validation • Check inputs are actually within their expected data type Output Escaping • Escape metacharacters when putting string data into another parser. • Misconception: data is “clean” and “safe” after input validation. Not always so!! • Security by Serendipity is good, but not enough. • When input validation fails, assume the data is malicious and treat accordingly. 19 String x = Input() HTML: Escape.html(x) JS String: Escape.jsString(x) CSS String: Escape.cssString(x) URI query parm: Escape.uri(x) Nested contexts: seek help
  • 20. Static Analysis Code Defects char *p if (x == 0) Static Analysis true p=0 false p = foo() if(x != 0) true false ... s=*p return • It’s about automation and built-in knowledge. • One of the few tools that work in the inner loop of development. • Make sure it gets tuned, configured, deployed, and adopted. 20
  • 21. 21
  • 22. Supply Chain 3rd Party Developer Open Source • Keep dependencies up to date • Check for CVEs and security notifications • Due diligence before selecting open source projects 22
  • 23. End of Tour Security Requirements Train Focused Developer Training 23 Design Code Threat Modeling Supply Chain Attack Surface Reduction Static Analysis Test Security Testing
  • 24. Program Behaviors on Two Axes 24
  • 26. Development Responsibility Includes a Lot of Security 26
  • 27. How to Get Started with Security • Specialize: assign a developer from your team to learn about security for the specific technologies you are using. Reward it. • Apply common mitigations. Automate as much of the “find and fix” process as possible. • Start a discussion among your team about the attacker persona and abuse cases. • Look for security expertise when hiring developers. • Adapt a Secure Development Lifecycle to your development processes. See SafeCode’s Agile stories for security: http://www.safecode.org 27
  • 28. Resources: Learning More Microsoft SDL http://www.microsoft.com/security/sdl (Secure Development Lifecycle) OWASP http://www.owasp.org (web apps; focus on the cheat sheets) SafeCode http://www.safecode.org (excellent security-focused Agile stories) CWE http://cwe.mitre.org (taxonomy of security weaknesses) Security blogs http://security.coverity.com (Coverity Security Research Lab blog) 28
  • 30. Want to try Coverity on your code? For a free trial, visit: www.coverity.com