SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
David Rook

The Principles of Secure Development

SecurityBSides, Las Vegas
Agenda

• It is broken so lets fix it

• The current approach

• The Principles of Secure Development

• But I need to prevent vulnerability “X”
if (slide == introduction)
            System.out.println(“I’m David Rook”);

• Security Analyst, Realex Payments, Ireland
  CISSP, CISA, GCIH and many other acronyms



• Security Ninja (www.securityninja.co.uk)

• Secure Development (www.securedevelopment.co.uk)

• OWASP contributor and presenter

• IIA Web Development Working Group

• Facebook hacker and published security author (insecure
  magazine, bloginfosec etc)
It is broken so lets fix it


• Cross Site Scripting, 10 years old?

• SQL Injection, 7 years old?

33% of all vulnerabilities in 2008 and 2009 (so far) are
XSS or SQL Injection (Based on CVE numbers)




                        CVE statistics: http://web.nvd.nist.gov/view/vuln/statistics
It is broken so lets fix it
Philosophical Application Security


Give a man a fish and you feed him for a day, teach
him to fish and you feed him for a lifetime.

I want to apply this to secure application development:

Teach a developer about a vulnerability and he will
prevent it, teach him how to develop securely and
he will prevent many vulnerabilities.
The current approach
        (And why I think it fails to deliver secure applications)

• The cart before the horse

  • Security guys tell developers about specific vulnerabilities
  • We hope they figure out how to prevent them
  • Inevitably security flaws end up in live code
  • Security guys complain when data gets stolen
The current approach
         (And why I think it fails to deliver secure applications)

• What if we taught drivers in the same way?

  • Instructor tells driver about the different ways to crash
  • We hope the driver figures out how not to crash
  • Inevitably the driver will crash
  • People complain when they get crashed into
The current approach
         (And why I think it fails to deliver secure applications)

• Many lists of vulnerabilities

   • OWASP Top 10
   • White Hat Sec Top 10
   • SANS Top 25
   • Others??


• != Secure development guidance
What we need to do


• Put the application security horse before the cart

  • Security guys tell developers how to write secure code
  • Developer doesn’t need to guess anymore
   • Common vulnerabilities prevented in applications
  • Realistic or just a caffeine fuelled dream?
Lets make secure development easier


• Keep It Short and Simple (KISS)

  • The principles must be clearly defined
  • Language/Platform/Framework independant
  • Should cover more than just the common vulnerabilities
  • More secure software and greater ROI on security training?
The Principles of Secure Development


• Input Validation
• Output Validation
• Error Handling
• Authentication and Authorisation
• Session Management
• Secure Communications
• Secure Storage
• Secure Resource Access
The Principles of Secure Development


• Input Validation

  • Identify and define the data your application must accept
  • Create regex’s to validate each data type (content and size)
  • For example, a credit card number data type: d{12,16}$
  • Use whitelisting for validation where possible
  • Blacklisting approach harder and potentially less secure
  • Blacklist example, replacing single quotes:
    s.replaceAll(Pattern.quote(" ' "),
    Matcher.quoteReplacement(" " "))
The Principles of Secure Development


• Output Validation

    • Identify and define the data your application must output
    • Understand where (i.e. in a URL) your data should end up
    • Choose the correct output encoding for the data's destination
    • Proper encoding means this attack:
www.examplesite.com/home.html?day=<script>alert(document.cookie)</script>
      Becomes:
    day=%3Cscript%3Ealert%28document.cookie%29%3C/script%3E
The Principles of Secure Development


• Error Handling

  • Even the best apps will crash at some point, be prepared!
  • Crashes/errors can help an attacker if you don’t handle them
  • Handle error conditions securely, sanitise the message sent
  • No error handling = information leakage
    Microsoft OLE DB Provider for ODBC
    Drivers(0x80040E14)
    [Microsoft][ODBC SQL Server Driver][SQL
    Server]Invalid column name

    /examplesite/login.asp, line 10
The Principles of Secure Development


• Authentication and Authorisation

  • Even simple apps often have a need to authenticate users
  • Often at least two levels of authorisation
  • Need to prevent horizontal and vertical privilege escalation
  • Implement strong passwords and management systems
  • Ensure A+A is secure, not a false sense of security (CAPTCHA?)
  • Don’t rely on fields that are easily spoofed (referrer field)
The Principles of Secure Development


• Session Management

  • Used to manage authenticated users, no need to re-auth
  • You need to ensure that your sessionID’s have sufficient entropy
  • SessionID’s must not be predictable or reusable
  • Never build your own session management, it will fail
  • Protect sessionID’s when in transit (i.e. SSL!)
  • Issue a new value for sensitive actions (i.e. funds transfer)
The Principles of Secure Development


• Secure Communications

  • Protect data (i.e. CC no, passwords, sessionID’s) in transit
  • As with all crypto, don’t create your own
  • Don’t use broken protection mechanisms (i.e. SSLv2)
  • Don’t just use SSL/TLS for logon pages, protect the session!
  • Try to avoid mixing secure and insecure traffic on a page
The Principles of Secure Development


• Secure Storage

  • Protect data (i.e. CC no, passwords, sessionID’s) when stored
  • As with all crypto, don’t create your own
  • Don’t use broken protection mechanisms (i.e. DES)
  • Don’t store data in places where you can’t confidently secure it
  • Strong protection mechanisms, how strong should it be?
The Principles of Secure Development


• Secure Resource Access

  • Obscurity != security, don’t try to hide sensitive resources
  • Understand the users flow through an app, cover weak spots
  • T-Mobile didn’t do the above, Paris Hiltons account hacked
But I need to prevent vulnerability “X”


• So do I, PCI DSS Requirement 6.5!

  • Auditor’s checklist has OWASP top 10 listed
  • So how did I handle this?
  • The Secure Development Principes Matrix ( I want to be Neo   )
But I need to prevent vulnerability “X”
Lets redefine what secure development means


• Follow a small, repeatable set of principles

• Try not to focus on specific vulnerabilities

• Develop securely, not to prevent “hot vuln of the day”

• Build security into the code, don’t try to bolt it on at
  the end
The Secure Development Principles

• Input Validation
   –   XSS, * Injection

• Output Validation
   –   XSS, * Injection, Encoding issues

• Error Handling
   –   Information Leakage

• Authentication and Authorisation
   –   Weak Access Control, Insufficient A+A, CSRF

• Session Management
   –   Timeouts, Strong Session ID’s, CSRF

• Secure Communications
   –   Strong Protection in Transit

• Secure Storage
   –   Strong Protection when Stored

• Secure Resource Access
   –   Restrict Access to Sensitive Resources, Admin Pages, File Systems
Secure Development


Review code                                        Secure
 for flaws                                       Development
                      3                2
Check for:                                       Build security in
                    Code            Secure
Input Validation   Review         Development    Security is part of
Error Handling                                   the apps DNA
Secure Storage

etc, etc



 Try to hack                                     Plan to build
      it!                                         security in
                      4                1
Manual and                                       Threat Model
automated tests    Security       Requirements   Design app to
                   Testing           Design      eliminate threats
Use tests
defined in your
threat model
www.securityninja.co.uk
       www.securedevelopment.co.uk
          Twitter: @securityninja




David Rook, next speaking appearance: DEFCON, 1st August, Las Vegas

Contenu connexe

Tendances

Mobile security recipes for xamarin
Mobile security recipes for xamarinMobile security recipes for xamarin
Mobile security recipes for xamarinNicolas Milcoff
 
Threat Modeling: Best Practices
Threat Modeling: Best PracticesThreat Modeling: Best Practices
Threat Modeling: Best PracticesSource Conference
 
DevSecCon Asia 2017 Pishu Mahtani: Adversarial Modelling
DevSecCon Asia 2017 Pishu Mahtani: Adversarial ModellingDevSecCon Asia 2017 Pishu Mahtani: Adversarial Modelling
DevSecCon Asia 2017 Pishu Mahtani: Adversarial ModellingDevSecCon
 
Evil User Stories - Improve Your Application Security
Evil User Stories - Improve Your Application SecurityEvil User Stories - Improve Your Application Security
Evil User Stories - Improve Your Application SecurityAnne Oikarinen
 
Security in an Interconnected and Complex World of Software
Security in an Interconnected and Complex World of SoftwareSecurity in an Interconnected and Complex World of Software
Security in an Interconnected and Complex World of SoftwareMichael Coates
 
Introduction to Threat Modeling
Introduction to Threat ModelingIntroduction to Threat Modeling
Introduction to Threat ModelingInMobi Technology
 
Self Defending Applications
Self Defending ApplicationsSelf Defending Applications
Self Defending ApplicationsMichael Coates
 
Eirtight writing secure code
Eirtight writing secure codeEirtight writing secure code
Eirtight writing secure codeKieran Dundon
 
Threat Modeling for System Builders and System Breakers - Dan Cornell of Deni...
Threat Modeling for System Builders and System Breakers - Dan Cornell of Deni...Threat Modeling for System Builders and System Breakers - Dan Cornell of Deni...
Threat Modeling for System Builders and System Breakers - Dan Cornell of Deni...Denim Group
 
[OWASP Poland Day] Security knowledge framework
[OWASP Poland Day] Security knowledge framework[OWASP Poland Day] Security knowledge framework
[OWASP Poland Day] Security knowledge frameworkOWASP
 
Secure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa WorkshopSecure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa WorkshopPaul Ionescu
 
Application Security-Understanding The Horizon
Application Security-Understanding The HorizonApplication Security-Understanding The Horizon
Application Security-Understanding The HorizonLalit Kale
 
What Every Developer And Tester Should Know About Software Security
What Every Developer And Tester Should Know About Software SecurityWhat Every Developer And Tester Should Know About Software Security
What Every Developer And Tester Should Know About Software SecurityAnne Oikarinen
 
[OWASP Poland Day] OWASP for testing mobile applications
[OWASP Poland Day] OWASP for testing mobile applications[OWASP Poland Day] OWASP for testing mobile applications
[OWASP Poland Day] OWASP for testing mobile applicationsOWASP
 
Skills For Career In Security
Skills For Career In SecuritySkills For Career In Security
Skills For Career In SecurityPrasanna V
 
Mobile Security at OWASP - MASVS and MSTG
Mobile Security at OWASP - MASVS and MSTGMobile Security at OWASP - MASVS and MSTG
Mobile Security at OWASP - MASVS and MSTGRomuald SZKUDLAREK
 
[OWASP Poland Day] Security in developer's life
[OWASP Poland Day] Security in developer's life[OWASP Poland Day] Security in developer's life
[OWASP Poland Day] Security in developer's lifeOWASP
 

Tendances (19)

Mobile security recipes for xamarin
Mobile security recipes for xamarinMobile security recipes for xamarin
Mobile security recipes for xamarin
 
Threat Modeling: Best Practices
Threat Modeling: Best PracticesThreat Modeling: Best Practices
Threat Modeling: Best Practices
 
DevSecCon Asia 2017 Pishu Mahtani: Adversarial Modelling
DevSecCon Asia 2017 Pishu Mahtani: Adversarial ModellingDevSecCon Asia 2017 Pishu Mahtani: Adversarial Modelling
DevSecCon Asia 2017 Pishu Mahtani: Adversarial Modelling
 
Threat Modeling Using STRIDE
Threat Modeling Using STRIDEThreat Modeling Using STRIDE
Threat Modeling Using STRIDE
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practices
 
Evil User Stories - Improve Your Application Security
Evil User Stories - Improve Your Application SecurityEvil User Stories - Improve Your Application Security
Evil User Stories - Improve Your Application Security
 
Security in an Interconnected and Complex World of Software
Security in an Interconnected and Complex World of SoftwareSecurity in an Interconnected and Complex World of Software
Security in an Interconnected and Complex World of Software
 
Introduction to Threat Modeling
Introduction to Threat ModelingIntroduction to Threat Modeling
Introduction to Threat Modeling
 
Self Defending Applications
Self Defending ApplicationsSelf Defending Applications
Self Defending Applications
 
Eirtight writing secure code
Eirtight writing secure codeEirtight writing secure code
Eirtight writing secure code
 
Threat Modeling for System Builders and System Breakers - Dan Cornell of Deni...
Threat Modeling for System Builders and System Breakers - Dan Cornell of Deni...Threat Modeling for System Builders and System Breakers - Dan Cornell of Deni...
Threat Modeling for System Builders and System Breakers - Dan Cornell of Deni...
 
[OWASP Poland Day] Security knowledge framework
[OWASP Poland Day] Security knowledge framework[OWASP Poland Day] Security knowledge framework
[OWASP Poland Day] Security knowledge framework
 
Secure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa WorkshopSecure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa Workshop
 
Application Security-Understanding The Horizon
Application Security-Understanding The HorizonApplication Security-Understanding The Horizon
Application Security-Understanding The Horizon
 
What Every Developer And Tester Should Know About Software Security
What Every Developer And Tester Should Know About Software SecurityWhat Every Developer And Tester Should Know About Software Security
What Every Developer And Tester Should Know About Software Security
 
[OWASP Poland Day] OWASP for testing mobile applications
[OWASP Poland Day] OWASP for testing mobile applications[OWASP Poland Day] OWASP for testing mobile applications
[OWASP Poland Day] OWASP for testing mobile applications
 
Skills For Career In Security
Skills For Career In SecuritySkills For Career In Security
Skills For Career In Security
 
Mobile Security at OWASP - MASVS and MSTG
Mobile Security at OWASP - MASVS and MSTGMobile Security at OWASP - MASVS and MSTG
Mobile Security at OWASP - MASVS and MSTG
 
[OWASP Poland Day] Security in developer's life
[OWASP Poland Day] Security in developer's life[OWASP Poland Day] Security in developer's life
[OWASP Poland Day] Security in developer's life
 

En vedette

Injecting simplicity not SQL RSA Europe 2010
Injecting simplicity not SQL RSA Europe 2010Injecting simplicity not SQL RSA Europe 2010
Injecting simplicity not SQL RSA Europe 2010Security Ninja
 
Owasp talk-november-08
Owasp talk-november-08Owasp talk-november-08
Owasp talk-november-08Security Ninja
 
Dennis Clark & RYAN SEACREST - morning show magic
Dennis Clark & RYAN SEACREST - morning show magicDennis Clark & RYAN SEACREST - morning show magic
Dennis Clark & RYAN SEACREST - morning show magicMyRadioFashion
 
SecurityBSides las vegas - Agnitio
SecurityBSides las vegas - AgnitioSecurityBSides las vegas - Agnitio
SecurityBSides las vegas - AgnitioSecurity Ninja
 
SecurityBSides London - Agnitio: it's static analysis but not as we know it
SecurityBSides London - Agnitio: it's static analysis but not as we know itSecurityBSides London - Agnitio: it's static analysis but not as we know it
SecurityBSides London - Agnitio: it's static analysis but not as we know itSecurity Ninja
 
The Security Risks of Web 2.0 - DEF CON 17
The Security Risks of Web 2.0 - DEF CON 17The Security Risks of Web 2.0 - DEF CON 17
The Security Risks of Web 2.0 - DEF CON 17Security Ninja
 
SecurityBSides London - Jedi mind tricks for building application security pr...
SecurityBSides London - Jedi mind tricks for building application security pr...SecurityBSides London - Jedi mind tricks for building application security pr...
SecurityBSides London - Jedi mind tricks for building application security pr...Security Ninja
 
Injecting simplicity not SQL BSides Las Vegas 2010
Injecting simplicity not SQL BSides Las Vegas 2010Injecting simplicity not SQL BSides Las Vegas 2010
Injecting simplicity not SQL BSides Las Vegas 2010Security Ninja
 
SecurityBSides London - windows phone 7
SecurityBSides London - windows phone 7SecurityBSides London - windows phone 7
SecurityBSides London - windows phone 7Security Ninja
 
Application security and PCI DSS
Application security and PCI DSSApplication security and PCI DSS
Application security and PCI DSSSecurity Ninja
 
Hack in Paris - Agnitio
Hack in Paris - AgnitioHack in Paris - Agnitio
Hack in Paris - AgnitioSecurity Ninja
 

En vedette (13)

Injecting simplicity not SQL RSA Europe 2010
Injecting simplicity not SQL RSA Europe 2010Injecting simplicity not SQL RSA Europe 2010
Injecting simplicity not SQL RSA Europe 2010
 
Owasp talk-november-08
Owasp talk-november-08Owasp talk-november-08
Owasp talk-november-08
 
Dennis Clark & RYAN SEACREST - morning show magic
Dennis Clark & RYAN SEACREST - morning show magicDennis Clark & RYAN SEACREST - morning show magic
Dennis Clark & RYAN SEACREST - morning show magic
 
SecurityBSides las vegas - Agnitio
SecurityBSides las vegas - AgnitioSecurityBSides las vegas - Agnitio
SecurityBSides las vegas - Agnitio
 
SecurityBSides London - Agnitio: it's static analysis but not as we know it
SecurityBSides London - Agnitio: it's static analysis but not as we know itSecurityBSides London - Agnitio: it's static analysis but not as we know it
SecurityBSides London - Agnitio: it's static analysis but not as we know it
 
The Security Risks of Web 2.0 - DEF CON 17
The Security Risks of Web 2.0 - DEF CON 17The Security Risks of Web 2.0 - DEF CON 17
The Security Risks of Web 2.0 - DEF CON 17
 
SecurityBSides London - Jedi mind tricks for building application security pr...
SecurityBSides London - Jedi mind tricks for building application security pr...SecurityBSides London - Jedi mind tricks for building application security pr...
SecurityBSides London - Jedi mind tricks for building application security pr...
 
Injecting simplicity not SQL BSides Las Vegas 2010
Injecting simplicity not SQL BSides Las Vegas 2010Injecting simplicity not SQL BSides Las Vegas 2010
Injecting simplicity not SQL BSides Las Vegas 2010
 
SecurityBSides London - windows phone 7
SecurityBSides London - windows phone 7SecurityBSides London - windows phone 7
SecurityBSides London - windows phone 7
 
Baltic States Cultural Tour 2011 - Presentation
Baltic States Cultural Tour 2011 - PresentationBaltic States Cultural Tour 2011 - Presentation
Baltic States Cultural Tour 2011 - Presentation
 
Application security and PCI DSS
Application security and PCI DSSApplication security and PCI DSS
Application security and PCI DSS
 
Hack in Paris 2013
Hack in Paris 2013Hack in Paris 2013
Hack in Paris 2013
 
Hack in Paris - Agnitio
Hack in Paris - AgnitioHack in Paris - Agnitio
Hack in Paris - Agnitio
 

Similaire à The Principles of Secure Development - BSides Las Vegas 2009

Why 'positive security' is a software security game changer
Why 'positive security' is a software security game changerWhy 'positive security' is a software security game changer
Why 'positive security' is a software security game changerJaap Karan Singh
 
The What, Why, and How of DevSecOps
The What, Why, and How of DevSecOpsThe What, Why, and How of DevSecOps
The What, Why, and How of DevSecOpsCprime
 
AppSec in an Agile World
AppSec in an Agile WorldAppSec in an Agile World
AppSec in an Agile WorldDavid Lindner
 
Making DevSecOps a Reality in your Spring Applications
Making DevSecOps a Reality in your Spring ApplicationsMaking DevSecOps a Reality in your Spring Applications
Making DevSecOps a Reality in your Spring ApplicationsHdiv Security
 
EISA Considerations for Web Application Security
EISA Considerations for Web Application SecurityEISA Considerations for Web Application Security
EISA Considerations for Web Application SecurityLarry Ball
 
Started In Security Now I'm Here
Started In Security Now I'm HereStarted In Security Now I'm Here
Started In Security Now I'm HereChristopher Grayson
 
TechTalk 2021: Peran IT Security dalam Penerapan DevOps
TechTalk 2021: Peran IT Security dalam Penerapan DevOpsTechTalk 2021: Peran IT Security dalam Penerapan DevOps
TechTalk 2021: Peran IT Security dalam Penerapan DevOpsDicodingEvent
 
DevSecOps at Agile 2019
DevSecOps at   Agile 2019 DevSecOps at   Agile 2019
DevSecOps at Agile 2019 Elizabeth Ayer
 
SCS DevSecOps Seminar - State of DevSecOps
SCS DevSecOps Seminar - State of DevSecOpsSCS DevSecOps Seminar - State of DevSecOps
SCS DevSecOps Seminar - State of DevSecOpsStefan Streichsbier
 
System Security Beyond the Libraries
System Security Beyond the LibrariesSystem Security Beyond the Libraries
System Security Beyond the LibrariesEoin Woods
 
Create code confidence for better application security
Create code confidence for better application securityCreate code confidence for better application security
Create code confidence for better application securityRogue Wave Software
 
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...Achim D. Brucker
 
Succeeding-Marriage-Cybersecurity-DevOps final
Succeeding-Marriage-Cybersecurity-DevOps finalSucceeding-Marriage-Cybersecurity-DevOps final
Succeeding-Marriage-Cybersecurity-DevOps finalrkadayam
 
SC conference - Building AppSec Teams
SC conference  - Building AppSec TeamsSC conference  - Building AppSec Teams
SC conference - Building AppSec TeamsDinis Cruz
 
Security engineering 101 when good design & security work together
Security engineering 101  when good design & security work togetherSecurity engineering 101  when good design & security work together
Security engineering 101 when good design & security work togetherWendy Knox Everette
 
How to Get Started with DevSecOps
How to Get Started with DevSecOpsHow to Get Started with DevSecOps
How to Get Started with DevSecOpsCYBRIC
 
Developing Secure Applications and Defending Against Common Attacks
Developing Secure Applications and Defending Against Common AttacksDeveloping Secure Applications and Defending Against Common Attacks
Developing Secure Applications and Defending Against Common AttacksPayPalX Developer Network
 
Bringing Security Testing to Development: How to Enable Developers to Act as ...
Bringing Security Testing to Development: How to Enable Developers to Act as ...Bringing Security Testing to Development: How to Enable Developers to Act as ...
Bringing Security Testing to Development: How to Enable Developers to Act as ...Achim D. Brucker
 
Crash Course In Brain Surgery
Crash Course In Brain SurgeryCrash Course In Brain Surgery
Crash Course In Brain Surgerymorisson
 

Similaire à The Principles of Secure Development - BSides Las Vegas 2009 (20)

Why 'positive security' is a software security game changer
Why 'positive security' is a software security game changerWhy 'positive security' is a software security game changer
Why 'positive security' is a software security game changer
 
The What, Why, and How of DevSecOps
The What, Why, and How of DevSecOpsThe What, Why, and How of DevSecOps
The What, Why, and How of DevSecOps
 
AppSec in an Agile World
AppSec in an Agile WorldAppSec in an Agile World
AppSec in an Agile World
 
Making DevSecOps a Reality in your Spring Applications
Making DevSecOps a Reality in your Spring ApplicationsMaking DevSecOps a Reality in your Spring Applications
Making DevSecOps a Reality in your Spring Applications
 
Defining DevSecOps
Defining DevSecOpsDefining DevSecOps
Defining DevSecOps
 
EISA Considerations for Web Application Security
EISA Considerations for Web Application SecurityEISA Considerations for Web Application Security
EISA Considerations for Web Application Security
 
Started In Security Now I'm Here
Started In Security Now I'm HereStarted In Security Now I'm Here
Started In Security Now I'm Here
 
TechTalk 2021: Peran IT Security dalam Penerapan DevOps
TechTalk 2021: Peran IT Security dalam Penerapan DevOpsTechTalk 2021: Peran IT Security dalam Penerapan DevOps
TechTalk 2021: Peran IT Security dalam Penerapan DevOps
 
DevSecOps at Agile 2019
DevSecOps at   Agile 2019 DevSecOps at   Agile 2019
DevSecOps at Agile 2019
 
SCS DevSecOps Seminar - State of DevSecOps
SCS DevSecOps Seminar - State of DevSecOpsSCS DevSecOps Seminar - State of DevSecOps
SCS DevSecOps Seminar - State of DevSecOps
 
System Security Beyond the Libraries
System Security Beyond the LibrariesSystem Security Beyond the Libraries
System Security Beyond the Libraries
 
Create code confidence for better application security
Create code confidence for better application securityCreate code confidence for better application security
Create code confidence for better application security
 
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
 
Succeeding-Marriage-Cybersecurity-DevOps final
Succeeding-Marriage-Cybersecurity-DevOps finalSucceeding-Marriage-Cybersecurity-DevOps final
Succeeding-Marriage-Cybersecurity-DevOps final
 
SC conference - Building AppSec Teams
SC conference  - Building AppSec TeamsSC conference  - Building AppSec Teams
SC conference - Building AppSec Teams
 
Security engineering 101 when good design & security work together
Security engineering 101  when good design & security work togetherSecurity engineering 101  when good design & security work together
Security engineering 101 when good design & security work together
 
How to Get Started with DevSecOps
How to Get Started with DevSecOpsHow to Get Started with DevSecOps
How to Get Started with DevSecOps
 
Developing Secure Applications and Defending Against Common Attacks
Developing Secure Applications and Defending Against Common AttacksDeveloping Secure Applications and Defending Against Common Attacks
Developing Secure Applications and Defending Against Common Attacks
 
Bringing Security Testing to Development: How to Enable Developers to Act as ...
Bringing Security Testing to Development: How to Enable Developers to Act as ...Bringing Security Testing to Development: How to Enable Developers to Act as ...
Bringing Security Testing to Development: How to Enable Developers to Act as ...
 
Crash Course In Brain Surgery
Crash Course In Brain SurgeryCrash Course In Brain Surgery
Crash Course In Brain Surgery
 

Plus de Security Ninja

The Realex Payments Application Story
The Realex Payments Application StoryThe Realex Payments Application Story
The Realex Payments Application StorySecurity Ninja
 
Owasp App Sec Ireland Windows Phone 7 Security
Owasp App Sec Ireland Windows Phone 7 SecurityOwasp App Sec Ireland Windows Phone 7 Security
Owasp App Sec Ireland Windows Phone 7 SecuritySecurity Ninja
 
OWASP Birmingham - Mobile Application Security
OWASP Birmingham - Mobile Application SecurityOWASP Birmingham - Mobile Application Security
OWASP Birmingham - Mobile Application SecuritySecurity Ninja
 
BruCON Agnitio Workshop
BruCON Agnitio WorkshopBruCON Agnitio Workshop
BruCON Agnitio WorkshopSecurity Ninja
 
The Principles of Secure Development - Epicenter Dublin
The Principles of Secure Development - Epicenter DublinThe Principles of Secure Development - Epicenter Dublin
The Principles of Secure Development - Epicenter DublinSecurity Ninja
 
Developing secure web applications
Developing secure web applicationsDeveloping secure web applications
Developing secure web applicationsSecurity Ninja
 
The Principles of Secure Development
The Principles of Secure DevelopmentThe Principles of Secure Development
The Principles of Secure DevelopmentSecurity Ninja
 

Plus de Security Ninja (7)

The Realex Payments Application Story
The Realex Payments Application StoryThe Realex Payments Application Story
The Realex Payments Application Story
 
Owasp App Sec Ireland Windows Phone 7 Security
Owasp App Sec Ireland Windows Phone 7 SecurityOwasp App Sec Ireland Windows Phone 7 Security
Owasp App Sec Ireland Windows Phone 7 Security
 
OWASP Birmingham - Mobile Application Security
OWASP Birmingham - Mobile Application SecurityOWASP Birmingham - Mobile Application Security
OWASP Birmingham - Mobile Application Security
 
BruCON Agnitio Workshop
BruCON Agnitio WorkshopBruCON Agnitio Workshop
BruCON Agnitio Workshop
 
The Principles of Secure Development - Epicenter Dublin
The Principles of Secure Development - Epicenter DublinThe Principles of Secure Development - Epicenter Dublin
The Principles of Secure Development - Epicenter Dublin
 
Developing secure web applications
Developing secure web applicationsDeveloping secure web applications
Developing secure web applications
 
The Principles of Secure Development
The Principles of Secure DevelopmentThe Principles of Secure Development
The Principles of Secure Development
 

Dernier

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Dernier (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

The Principles of Secure Development - BSides Las Vegas 2009

  • 1. David Rook The Principles of Secure Development SecurityBSides, Las Vegas
  • 2. Agenda • It is broken so lets fix it • The current approach • The Principles of Secure Development • But I need to prevent vulnerability “X”
  • 3. if (slide == introduction) System.out.println(“I’m David Rook”); • Security Analyst, Realex Payments, Ireland CISSP, CISA, GCIH and many other acronyms • Security Ninja (www.securityninja.co.uk) • Secure Development (www.securedevelopment.co.uk) • OWASP contributor and presenter • IIA Web Development Working Group • Facebook hacker and published security author (insecure magazine, bloginfosec etc)
  • 4. It is broken so lets fix it • Cross Site Scripting, 10 years old? • SQL Injection, 7 years old? 33% of all vulnerabilities in 2008 and 2009 (so far) are XSS or SQL Injection (Based on CVE numbers) CVE statistics: http://web.nvd.nist.gov/view/vuln/statistics
  • 5. It is broken so lets fix it
  • 6. Philosophical Application Security Give a man a fish and you feed him for a day, teach him to fish and you feed him for a lifetime. I want to apply this to secure application development: Teach a developer about a vulnerability and he will prevent it, teach him how to develop securely and he will prevent many vulnerabilities.
  • 7. The current approach (And why I think it fails to deliver secure applications) • The cart before the horse • Security guys tell developers about specific vulnerabilities • We hope they figure out how to prevent them • Inevitably security flaws end up in live code • Security guys complain when data gets stolen
  • 8. The current approach (And why I think it fails to deliver secure applications) • What if we taught drivers in the same way? • Instructor tells driver about the different ways to crash • We hope the driver figures out how not to crash • Inevitably the driver will crash • People complain when they get crashed into
  • 9. The current approach (And why I think it fails to deliver secure applications) • Many lists of vulnerabilities • OWASP Top 10 • White Hat Sec Top 10 • SANS Top 25 • Others?? • != Secure development guidance
  • 10. What we need to do • Put the application security horse before the cart • Security guys tell developers how to write secure code • Developer doesn’t need to guess anymore • Common vulnerabilities prevented in applications • Realistic or just a caffeine fuelled dream?
  • 11. Lets make secure development easier • Keep It Short and Simple (KISS) • The principles must be clearly defined • Language/Platform/Framework independant • Should cover more than just the common vulnerabilities • More secure software and greater ROI on security training?
  • 12. The Principles of Secure Development • Input Validation • Output Validation • Error Handling • Authentication and Authorisation • Session Management • Secure Communications • Secure Storage • Secure Resource Access
  • 13. The Principles of Secure Development • Input Validation • Identify and define the data your application must accept • Create regex’s to validate each data type (content and size) • For example, a credit card number data type: d{12,16}$ • Use whitelisting for validation where possible • Blacklisting approach harder and potentially less secure • Blacklist example, replacing single quotes: s.replaceAll(Pattern.quote(" ' "), Matcher.quoteReplacement(" " "))
  • 14. The Principles of Secure Development • Output Validation • Identify and define the data your application must output • Understand where (i.e. in a URL) your data should end up • Choose the correct output encoding for the data's destination • Proper encoding means this attack: www.examplesite.com/home.html?day=<script>alert(document.cookie)</script> Becomes: day=%3Cscript%3Ealert%28document.cookie%29%3C/script%3E
  • 15. The Principles of Secure Development • Error Handling • Even the best apps will crash at some point, be prepared! • Crashes/errors can help an attacker if you don’t handle them • Handle error conditions securely, sanitise the message sent • No error handling = information leakage Microsoft OLE DB Provider for ODBC Drivers(0x80040E14) [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name /examplesite/login.asp, line 10
  • 16. The Principles of Secure Development • Authentication and Authorisation • Even simple apps often have a need to authenticate users • Often at least two levels of authorisation • Need to prevent horizontal and vertical privilege escalation • Implement strong passwords and management systems • Ensure A+A is secure, not a false sense of security (CAPTCHA?) • Don’t rely on fields that are easily spoofed (referrer field)
  • 17. The Principles of Secure Development • Session Management • Used to manage authenticated users, no need to re-auth • You need to ensure that your sessionID’s have sufficient entropy • SessionID’s must not be predictable or reusable • Never build your own session management, it will fail • Protect sessionID’s when in transit (i.e. SSL!) • Issue a new value for sensitive actions (i.e. funds transfer)
  • 18. The Principles of Secure Development • Secure Communications • Protect data (i.e. CC no, passwords, sessionID’s) in transit • As with all crypto, don’t create your own • Don’t use broken protection mechanisms (i.e. SSLv2) • Don’t just use SSL/TLS for logon pages, protect the session! • Try to avoid mixing secure and insecure traffic on a page
  • 19. The Principles of Secure Development • Secure Storage • Protect data (i.e. CC no, passwords, sessionID’s) when stored • As with all crypto, don’t create your own • Don’t use broken protection mechanisms (i.e. DES) • Don’t store data in places where you can’t confidently secure it • Strong protection mechanisms, how strong should it be?
  • 20. The Principles of Secure Development • Secure Resource Access • Obscurity != security, don’t try to hide sensitive resources • Understand the users flow through an app, cover weak spots • T-Mobile didn’t do the above, Paris Hiltons account hacked
  • 21. But I need to prevent vulnerability “X” • So do I, PCI DSS Requirement 6.5! • Auditor’s checklist has OWASP top 10 listed • So how did I handle this? • The Secure Development Principes Matrix ( I want to be Neo )
  • 22. But I need to prevent vulnerability “X”
  • 23. Lets redefine what secure development means • Follow a small, repeatable set of principles • Try not to focus on specific vulnerabilities • Develop securely, not to prevent “hot vuln of the day” • Build security into the code, don’t try to bolt it on at the end
  • 24. The Secure Development Principles • Input Validation – XSS, * Injection • Output Validation – XSS, * Injection, Encoding issues • Error Handling – Information Leakage • Authentication and Authorisation – Weak Access Control, Insufficient A+A, CSRF • Session Management – Timeouts, Strong Session ID’s, CSRF • Secure Communications – Strong Protection in Transit • Secure Storage – Strong Protection when Stored • Secure Resource Access – Restrict Access to Sensitive Resources, Admin Pages, File Systems
  • 25. Secure Development Review code Secure for flaws Development 3 2 Check for: Build security in Code Secure Input Validation Review Development Security is part of Error Handling the apps DNA Secure Storage etc, etc Try to hack Plan to build it! security in 4 1 Manual and Threat Model automated tests Security Requirements Design app to Testing Design eliminate threats Use tests defined in your threat model
  • 26. www.securityninja.co.uk www.securedevelopment.co.uk Twitter: @securityninja David Rook, next speaking appearance: DEFCON, 1st August, Las Vegas