SlideShare a Scribd company logo
Securing Your
Applications
Michael Coates
mcoates@mozilla.com
@_mwc
Thursday, May 30, 13
You are a target
The attackers are talented and motivated
Thursday, May 30, 13
Data Loss: Growing Problem
http://datalossdb.org/statistics
Thursday, May 30, 13
Data Loss & Breaches from Hacking
http://datalossdb.org/statistics2013Verizon DBR
Thursday, May 30, 13
Data Loss: Outside Attackers
http://datalossdb.org/statistics2013Verizon DBR
Thursday, May 30, 13
Security The Basics
• Understand the problem space & challenges
• SSL isn’t as easy “https”
• You can’t store passwords with just hashing
• SQL Injection & Cross Site Scripting should be understood
by all developers
Thursday, May 30, 13
Where To Start?
• Focus on Risk - not vulnerability “flavor of the day”
• Reference top risks and customize
• OWASP Top 10
https://www.owasp.org/index.php/Top_10_2013-Top_10
1. Injection
2. Broken Authentication & Session
Management
3. Cross Site Scripting (XSS)
4. Insecure Direct Object References
5. Security Misconfiguration
6. Sensitive Data Exposure
7. Missing Function Level Access Control
8. Cross Site Request Forgery (CSRF)
9. Using Components with Known
Vulnerabilities
10. Unvalidated Redirects and Forwards
Thursday, May 30, 13
Password Storage
Thursday, May 30, 13
Password Storage Options
• Plain text / Home grown obfuscation
• md5
• sha2 (256 / 512)
• sha2 with generic salt
• sha2 with per user salt
• Bcrypt or PBKDF2
https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet
Weakest
Strongest
Currently Considered
Acceptable
Thursday, May 30, 13
SQL Injection
Thursday, May 30, 13
SQL Injection Worries
• Issue
• SQL statements don’t properly handle user supplied data
• Users change intent of SQL executed by DB
• Risk
• Data Compromise
• Corruption of Data
Thursday, May 30, 13
Into the Details
• Intent
Select * from users where lastname = ‘+ someVar +’;
• Attacker enters:
x’ or 1=1--
• Result
Select * from users where lastname = ‘+ x’ or 1=1-- +’;
• Solution
Parameterized Queries
Thursday, May 30, 13
Cross Site Scripting
Thursday, May 30, 13
<div class="featured">
<form action="/en-US/firefox/
users/login" method="post"
id="login" class="featured-inner
object-lead">
<div>
<input type="hidden"
name="data[Login][referer]"
XSS Example
Name:_____
submit
Login: ___
Pass: ____
submit to evil site
javascript
javascript
<install malware>
(1) Attacker submits malicious code
(2) Code is now part of webpage
(3) Malicious site steals
passwords & installs malware
(4) Attacker spreads malicious URL
http://site.com/%3cscript%3edocument%2e
Thursday, May 30, 13
Tackling Cross Site Scripting
• In Code
• Output encoding
• Context is important - see OWASP XSS Cheat Sheet
• Working with browsers to eliminate XSS
• Content Security Policy
https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet
https://developer.mozilla.org/en-US/docs/Security/CSP
Thursday, May 30, 13
SSL
Thursday, May 30, 13
Insecure Session Management
• Secure login over HTTPS
• Password submitted encrypted
• Immediate redirect to HTTP
• Session ID sent cleartext <-- vulnerability point
Request'
SessionID:'5593…'
Response'
SSL#
Request'
Response'
Set'SessionID:'5593…'
https://site.com/login
http://site.com/profile
Thursday, May 30, 13
Insecure Redirects
• User requests HTTP page, response redirects HTTPS
• 302 Response is HTTP <-- Vulnerability Point
SSL#
Get$http://mybank.com$
302$Redirect$
Location:$https://mybank.com$
Get$https://mybank.com$
200$Found$
mybank.com
Thursday, May 30, 13
Secure Design for Communication
• HTTP Strict Transport Security (HSTS)
• Opt-in security control
• Website instructs compatible browser to enable STS for
site
• HSTS Forces (for enabled site):
• All communication over HTTPS
• No insecure HTTP requests sent from browser
• No option for user to override untrusted certificates
Thursday, May 30, 13
Strict Transport Security
• Browser prevents HTTP requests to HSTS site
• Any request to site is “upgraded” to HTTPS
• No clear text HTTP traffic ever sent to HSTS site
• Browser assumes HTTPS for HSTS sites
SSL#
Get$$
http://mybank.com$ Get$https://mybank.com$
200$Found$
HSTS#
Thursday, May 30, 13
Building a Security
Culture
Thursday, May 30, 13
Security Culture
• Set guidelines that are usable
• Ensure security is a priority, not a “tax”
• Security can live in all stages:
• Planning, Dev, QA, Deployment, Monitoring
https://wiki.mozilla.org/WebAppSec/Secure_Coding_Guidelines
Thursday, May 30, 13
Tools to Assist
• Free
• OWASP ZAP Proxy - owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project
• Security Cheat Sheets - owasp.org/index.php/Cheat_Sheets
• Learning Lab OWASP Webgoat - owasp.org/index.php/Category:OWASP_WebGoat_Project
• Extensive OWASP guidelines - owasp.org
• Professional Tools
• Static / Dynamic Analysis
• Security Architecture Reviews
• Ongoing or point-in-time penetration tests
Thursday, May 30, 13
Take Aways
• Security is a concern for your business
• Tackle security fundamentals
• Build a culture of security & leverage available resources
Thursday, May 30, 13
Thanks!
mcoates@mozilla.com
@_mwc
Thursday, May 30, 13

More Related Content

PDF
Web security at Meteor (Pivotal Labs)
PPTX
Owasp Top 10 A3: Cross Site Scripting (XSS)
PDF
Introduction to Web Application Security - Blackhoodie US 2018
PDF
Http security response headers
PPTX
Story of http headers
PPTX
Xss what the heck-!
ODP
An Introduction to Hashing and Salting
PPT
Xss talk, attack and defense
Web security at Meteor (Pivotal Labs)
Owasp Top 10 A3: Cross Site Scripting (XSS)
Introduction to Web Application Security - Blackhoodie US 2018
Http security response headers
Story of http headers
Xss what the heck-!
An Introduction to Hashing and Salting
Xss talk, attack and defense

What's hot (20)

PPTX
Web site hacking;what does it mean
PPTX
Cross site scripting
PPTX
Browser Security by pratimesh Pathak ( Buldhana)
PPTX
Linux confau 2019: Web Security 2019
PPTX
Cross Site Scripting(XSS)
PDF
Oauth Behind The Scenes
PPTX
DLL Preloading Attack
PPT
Browser Security
PPTX
Secure coding | XSS Attacks on current Web Applications
PPTX
Cross-Site Scripting (XSS)
PDF
Web Security.pdf
PDF
XSS-Alert-Pentration testing tool
PDF
XSS Injection Vulnerabilities
PPTX
What is xss, blind xss and xploiting google gadgets
PPTX
Cross Site Scripting
PPTX
Reflective and Stored XSS- Cross Site Scripting
PDF
The Cross Site Scripting Guide
PPTX
Cross Site Scripting Defense Presentation
PPTX
Cross site scripting (xss)
Web site hacking;what does it mean
Cross site scripting
Browser Security by pratimesh Pathak ( Buldhana)
Linux confau 2019: Web Security 2019
Cross Site Scripting(XSS)
Oauth Behind The Scenes
DLL Preloading Attack
Browser Security
Secure coding | XSS Attacks on current Web Applications
Cross-Site Scripting (XSS)
Web Security.pdf
XSS-Alert-Pentration testing tool
XSS Injection Vulnerabilities
What is xss, blind xss and xploiting google gadgets
Cross Site Scripting
Reflective and Stored XSS- Cross Site Scripting
The Cross Site Scripting Guide
Cross Site Scripting Defense Presentation
Cross site scripting (xss)
Ad

Viewers also liked (6)

PDF
これからはじめるCoda2とSublime Text 2
PDF
第一回Mongo dbソースコードリーディング 20110628
PDF
産総研におけるプライベートクラウドへの取り組み
PDF
⑧Unityを使ってみよう(その2)
PDF
Domstolsverkets svar-riksrevisionen
PDF
デザイン・制作をはじめる前に
取り組む事
これからはじめるCoda2とSublime Text 2
第一回Mongo dbソースコードリーディング 20110628
産総研におけるプライベートクラウドへの取り組み
⑧Unityを使ってみよう(その2)
Domstolsverkets svar-riksrevisionen
デザイン・制作をはじめる前に
取り組む事
Ad

Similar to Sf startup-security (20)

PDF
Devbeat Conference - Developer First Security
PPTX
Web & Cloud Security in the real world
KEY
Cross Site Scripting - Mozilla Security Learning Center
PPTX
Oracle database threats - LAOUC Webinar
PPT
Django (Web Applications that are Secure by Default)
PPTX
Million Browser Botnet
PPSX
Web application security
PPTX
Don't blink creating secure software
PPTX
Website Hacking and Preventive Measures
PPTX
Owasp Top 10 A1: Injection
PDF
Million Browser Botnet
PDF
Solvay secure application layer v2015 seba
PPTX
Database Threats - Information System Security
PDF
Web Security attacks and defense
PPTX
Web Application Security Session for Web Developers
PPTX
Top 10 Web Application Security Risks - Murat Lostar @ ISACA EUROCACS 2013
PDF
Web security and OWASP
PDF
هک پایگاه داده و راهکارهای مقابلهDatabases hacking, safeguards and counterme...
PDF
How to Destroy a Database
PPTX
Attacking Web Applications
Devbeat Conference - Developer First Security
Web & Cloud Security in the real world
Cross Site Scripting - Mozilla Security Learning Center
Oracle database threats - LAOUC Webinar
Django (Web Applications that are Secure by Default)
Million Browser Botnet
Web application security
Don't blink creating secure software
Website Hacking and Preventive Measures
Owasp Top 10 A1: Injection
Million Browser Botnet
Solvay secure application layer v2015 seba
Database Threats - Information System Security
Web Security attacks and defense
Web Application Security Session for Web Developers
Top 10 Web Application Security Risks - Murat Lostar @ ISACA EUROCACS 2013
Web security and OWASP
هک پایگاه داده و راهکارهای مقابلهDatabases hacking, safeguards and counterme...
How to Destroy a Database
Attacking Web Applications

More from Michael Coates (8)

PPTX
Self Defending Applications
PPTX
Security in an Interconnected and Complex World of Software
PDF
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
PPTX
2013 michael coates-javaone
KEY
Bug Bounty Programs For The Web
KEY
SQL Injection - Mozilla Security Learning Center
PDF
Real Time Application Defenses - The Reality of AppSensor & ESAPI
PDF
SSL Screw Ups
Self Defending Applications
Security in an Interconnected and Complex World of Software
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
2013 michael coates-javaone
Bug Bounty Programs For The Web
SQL Injection - Mozilla Security Learning Center
Real Time Application Defenses - The Reality of AppSensor & ESAPI
SSL Screw Ups

Sf startup-security

  • 2. You are a target The attackers are talented and motivated Thursday, May 30, 13
  • 3. Data Loss: Growing Problem http://datalossdb.org/statistics Thursday, May 30, 13
  • 4. Data Loss & Breaches from Hacking http://datalossdb.org/statistics2013Verizon DBR Thursday, May 30, 13
  • 5. Data Loss: Outside Attackers http://datalossdb.org/statistics2013Verizon DBR Thursday, May 30, 13
  • 6. Security The Basics • Understand the problem space & challenges • SSL isn’t as easy “https” • You can’t store passwords with just hashing • SQL Injection & Cross Site Scripting should be understood by all developers Thursday, May 30, 13
  • 7. Where To Start? • Focus on Risk - not vulnerability “flavor of the day” • Reference top risks and customize • OWASP Top 10 https://www.owasp.org/index.php/Top_10_2013-Top_10 1. Injection 2. Broken Authentication & Session Management 3. Cross Site Scripting (XSS) 4. Insecure Direct Object References 5. Security Misconfiguration 6. Sensitive Data Exposure 7. Missing Function Level Access Control 8. Cross Site Request Forgery (CSRF) 9. Using Components with Known Vulnerabilities 10. Unvalidated Redirects and Forwards Thursday, May 30, 13
  • 9. Password Storage Options • Plain text / Home grown obfuscation • md5 • sha2 (256 / 512) • sha2 with generic salt • sha2 with per user salt • Bcrypt or PBKDF2 https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet Weakest Strongest Currently Considered Acceptable Thursday, May 30, 13
  • 11. SQL Injection Worries • Issue • SQL statements don’t properly handle user supplied data • Users change intent of SQL executed by DB • Risk • Data Compromise • Corruption of Data Thursday, May 30, 13
  • 12. Into the Details • Intent Select * from users where lastname = ‘+ someVar +’; • Attacker enters: x’ or 1=1-- • Result Select * from users where lastname = ‘+ x’ or 1=1-- +’; • Solution Parameterized Queries Thursday, May 30, 13
  • 14. <div class="featured"> <form action="/en-US/firefox/ users/login" method="post" id="login" class="featured-inner object-lead"> <div> <input type="hidden" name="data[Login][referer]" XSS Example Name:_____ submit Login: ___ Pass: ____ submit to evil site javascript javascript <install malware> (1) Attacker submits malicious code (2) Code is now part of webpage (3) Malicious site steals passwords & installs malware (4) Attacker spreads malicious URL http://site.com/%3cscript%3edocument%2e Thursday, May 30, 13
  • 15. Tackling Cross Site Scripting • In Code • Output encoding • Context is important - see OWASP XSS Cheat Sheet • Working with browsers to eliminate XSS • Content Security Policy https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet https://developer.mozilla.org/en-US/docs/Security/CSP Thursday, May 30, 13
  • 17. Insecure Session Management • Secure login over HTTPS • Password submitted encrypted • Immediate redirect to HTTP • Session ID sent cleartext <-- vulnerability point Request' SessionID:'5593…' Response' SSL# Request' Response' Set'SessionID:'5593…' https://site.com/login http://site.com/profile Thursday, May 30, 13
  • 18. Insecure Redirects • User requests HTTP page, response redirects HTTPS • 302 Response is HTTP <-- Vulnerability Point SSL# Get$http://mybank.com$ 302$Redirect$ Location:$https://mybank.com$ Get$https://mybank.com$ 200$Found$ mybank.com Thursday, May 30, 13
  • 19. Secure Design for Communication • HTTP Strict Transport Security (HSTS) • Opt-in security control • Website instructs compatible browser to enable STS for site • HSTS Forces (for enabled site): • All communication over HTTPS • No insecure HTTP requests sent from browser • No option for user to override untrusted certificates Thursday, May 30, 13
  • 20. Strict Transport Security • Browser prevents HTTP requests to HSTS site • Any request to site is “upgraded” to HTTPS • No clear text HTTP traffic ever sent to HSTS site • Browser assumes HTTPS for HSTS sites SSL# Get$$ http://mybank.com$ Get$https://mybank.com$ 200$Found$ HSTS# Thursday, May 30, 13
  • 22. Security Culture • Set guidelines that are usable • Ensure security is a priority, not a “tax” • Security can live in all stages: • Planning, Dev, QA, Deployment, Monitoring https://wiki.mozilla.org/WebAppSec/Secure_Coding_Guidelines Thursday, May 30, 13
  • 23. Tools to Assist • Free • OWASP ZAP Proxy - owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project • Security Cheat Sheets - owasp.org/index.php/Cheat_Sheets • Learning Lab OWASP Webgoat - owasp.org/index.php/Category:OWASP_WebGoat_Project • Extensive OWASP guidelines - owasp.org • Professional Tools • Static / Dynamic Analysis • Security Architecture Reviews • Ongoing or point-in-time penetration tests Thursday, May 30, 13
  • 24. Take Aways • Security is a concern for your business • Tackle security fundamentals • Build a culture of security & leverage available resources Thursday, May 30, 13