Writing Secure Code
Writing Secure Code
Alex Cespedes
About me
Software is everywhere
many vulnerabilities
Vulnerabilities can be classified
Humans
Network
Applications
Server Software
Operating System
Hardware
Applications
• Planning
• Development
• QA
OWASP Project
A3:2017 A4:2017
A1:2017 A2:2017
Sensitive Data XML External Entity
Injection Broken Authentication
Exposure (XXE)
A9:2017
A10:2017
Using Components
Insufficient Logging
with Known
& Monitoring
Vulnerabilities
SDLC
564132
Maintenance
Testing Planning
&
Analysis
Integration
Development
Design
SDLC
• Test Early and Test Often
• Understand the Scope of Security
• Develop the Right Mindset
• Understand the Subject
• Use the Right Tools
• Use Source Code When Available
• Develop Metrics
If more education and training are required
If there is a particular security mechanism that is not clearly understood by the dev team
If the total number of security related problems being found each month is going down
Security Techniques
Advantages Disadvantages
Manual Inspections & • Requires no supporting • Can be time consuming
Reviews technology • Requires significant
• Can be applied to variety human thought and skill
of situations to be effective
• Flexible
• Promotes teamwork
• Early in the SDLC
Threat Modeling • Decomposing the • Relatively new technique
application • Good threat models don’t
• Defining and classifying mean good software
the assets
• Exploring potential
vulnerabilities/threats
• Creating mitigation
strategies
Security Techniques
Advantages Disadvantages
Code Review • Completeness and • Requires highly skilled
effectiveness security dev
• Accuracy • Can miss issues in
• Fast compiled libraries
• The source code actually
deployed might differ
from the one being
analyzed
Penetration Testing • Can be fast • Too late in the SDLC
• Requires a relatively • From impact testing only
lower skill-set than
source code review
• Test the code that is
actually being exposed
Prevention
Securing applications
Prevention
Monitoring Detection
Recovery Response
Development
• Scan your code continuously
Application code
Packages / Libraries