SlideShare a Scribd company logo
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Web Application SecurityWeb Application Security
Winning When The Odds Are Against YouWinning When The Odds Are Against You
NewZealandPHPConference2014
Ben DechraiBen Dechrai
@bendechrai@bendechrai
#webappsec #phpnz14#webappsec #phpnz14 https://joind.in/talk/view/11435https://joind.in/talk/view/11435
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
What Is WebWhat Is Web
Application Security?Application Security?
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
What's Applicable to PHP
Developers?
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Where to Start?
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Top Ten Cheat Sheet
Injection Cross Site Scripting
Weak authentication
& session management
Insecure Direct
Object Reference
Cross Site
Request Forgery
Security
Misconfiguration
Insufficient
Cryptographic Storage
Failure to Restrict
URL access
Insufficient Transport
Layer Protection
Unvalidated Redirects
and Forwards
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Top Ten Cheat Sheet
Injection Cross Site Scripting
Weak authentication
& session management
Insecure Direct
Object Reference
Cross Site
Request Forgery
Security
Misconfiguration
Insufficient
Cryptographic Storage
Failure to Restrict
URL access
Insufficient Transport
Layer Protection
Unvalidated Redirects
and Forwards
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
DemoDemo
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
What AreWhat Are
The Odds?The Odds?
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Solutions?
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Think like PHP...
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Not in PHP...
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Think LIKE PHP...
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
HTTP
GET /index.html
<html>..</html>
GET /css/styles.css
GET /js/script.js
GET /images/logo.jpg
body { ... }
$(document).ready(...)
data:image/jpg;base64,/9j/4AAQSkZJRgA...
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
HTTP
GET /index.php
<html>..</html>
PHP process
PHP returns
POST /login.php
PHP process
PHP returns<html>..</html>
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
HTTP
POST /images.php/logo.jpg
<html>..</html>
PHP process
PHP returns
POST /images/logo.jpg
PHP process
PHP returns<html>..</html>
URL rewriting means anything
can be passed to PHP
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Cross-Site Request Forgeries
visage.cto.to
POST /login
<html>..</html>
PHP process
PHP returns
POST /checkout PHP process
PHP returns<html>..</html>
POST /address/edit
{401}
POST /address/edit
{ 200 }
evil.com
POST /payment
<html>..</html>
PHP process
PHP returns
GET /confirmation PHP process
PHP returns<html>..</html>
PHP process
PHP returns
PHP process
PHP returns
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
PHP Ain't Clever
(hint, not many programming languages are!)
Data Data
Database
User Input
Files
Other sites via API
DatabaseBrowser Response
Other systemsSending emails
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
PHP Environment
● 1 page load = 1 PHP process
● Web server passes whole request to the PHP
process
● When a script ends, all data are lost
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Piecing Data
Together
$_GET $_POST
$_COOKIE $_FILES
$_REQUEST
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Request Basics
● $_REQUEST variables can come from
Environment, Post, Get, Cookie or Session
variables!
● Don't use them, specify the source
● Even then, don't trust $_POST, et al
● Consider all data harmful
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Whitelist All Incoming Data
● Treat all data as untrusted
● Only if it passed a whitelist, let it through
● Look for odd data entry points
– Did you know the filename of an uploaded
file is user generated input?
● Email addresses have fixed validation rules
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Whitelist All Incoming Data
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*
| "(?:[x01-x08x0bx0cx0e-x1fx21x23-x5bx5d-x7f]
| [x01-x09x0bx0cx0e-x7f])*")
@ (?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
| [(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}
(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:
(?:[x01-x08x0bx0cx0e-x1fx21-x5ax53-x7f]
| [x01-x09x0bx0cx0e-x7f])+)
])
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Whitelist All Incoming Data
Some people, when confronted
with a problem, think, “I know, I’ll
use regular expressions.”
Now they have two problems.
— Jamie Zawinksi
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Whitelist All Incoming Data
filter_var($email, FILTER_VALIDATE_EMAIL);
(Or just send them an email)
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Whitelist All Incoming Data
● Names are a big topic
(see http://is.gd/validating_names)
● Who decides if a name is valid?
– Josè Smith
– La amonȝ
– Þórinn Eikinskjaldi
– Πηληϊάδεω χιλ οςἈ ῆ
– Federico del Sagrado Corazón de Jesús García
Lorca
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Encode on Output
● Avoid encoding for storage
● Keep valid user input intact
● Encode when used in an output stream
– HTML encode for screen
– URL encode for querystrings
– Escape for CSV output
● By keeping the original data, you can repurpose
for many outputs
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Encode on Output
User Generated
Content
User Generated
Content
Sanitize
HTML EMAIL
Sanitize
XML/JSON/CSV
Sanitize
UNKNOWN
FUTURE APP
Sanitize
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Encode on Output
filter_var($comment,
FILTER_SANITIZE_FULL_SPECIAL_CHARS);
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Cross-Site Request Forgeries
Tokens
Username
Password
Token
SUBMIT
ABC123
ABC123
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Cross-Site Request Forgeries
Referrers can be
easily forged;
don't rely on them
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Credits
● Security Camera image by Henning Mühlinghaus
● Conception image by Lynn (Gracie's mom)
● Piecing Data by José Manuel Ríos Valiente
References
● OWASP Top 10 Cheat Sheet
Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
Thank You!Thank You!
Questions?Questions?
Ben DechraiBen Dechrai
@bendechrai@bendechrai
NewZealandPHPConference2014

More Related Content

PDF
OAuth2 - The Swiss Army Framework
PDF
Web Security 101
PDF
Securing WordPress
ODP
Top 10 Web Security Vulnerabilities
PPTX
[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...
PPT
PPTX
04. xss and encoding
PPTX
OWASP Top 10 - Day 1 - A1 injection attacks
OAuth2 - The Swiss Army Framework
Web Security 101
Securing WordPress
Top 10 Web Security Vulnerabilities
[CB16] Electron - Build cross platform desktop XSS, it’s easier than you thin...
04. xss and encoding
OWASP Top 10 - Day 1 - A1 injection attacks

What's hot (20)

PDF
Browser Horror Stories
PPT
PHPUG Presentation
PPT
Securing Your WordPress Website - WordCamp GC 2011
PDF
DEF CON 27 - BEN SADEGHIPOUR - owning the clout through ssrf and pdf generators
PPTX
Owasp Top 10 A1: Injection
KEY
Advanced CSRF and Stateless Anti-CSRF
PPTX
WordPress Security Tips
PPT
Django (Web Applications that are Secure by Default)
PPTX
Elegant Rest Design Webinar
PPTX
2013 michael coates-javaone
PPTX
Make profit with UI-Redressing attacks.
PDF
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
PPTX
Case Study of Django: Web Frameworks that are Secure by Default
PDF
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
PDF
When Ajax Attacks! Web application security fundamentals
PPTX
REST API Design for JAX-RS And Jersey
PDF
Top Ten Web Hacking Techniques (2010)
PDF
Layer one 2011-joe-mccray-you-spent-all-that-money-and-still-got-0wned
PPTX
Owasp Top 10 - A1 Injection
PDF
OAuth Hacks A gentle introduction to OAuth 2 and Apache Oltu
Browser Horror Stories
PHPUG Presentation
Securing Your WordPress Website - WordCamp GC 2011
DEF CON 27 - BEN SADEGHIPOUR - owning the clout through ssrf and pdf generators
Owasp Top 10 A1: Injection
Advanced CSRF and Stateless Anti-CSRF
WordPress Security Tips
Django (Web Applications that are Secure by Default)
Elegant Rest Design Webinar
2013 michael coates-javaone
Make profit with UI-Redressing attacks.
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
Case Study of Django: Web Frameworks that are Secure by Default
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
When Ajax Attacks! Web application security fundamentals
REST API Design for JAX-RS And Jersey
Top Ten Web Hacking Techniques (2010)
Layer one 2011-joe-mccray-you-spent-all-that-money-and-still-got-0wned
Owasp Top 10 - A1 Injection
OAuth Hacks A gentle introduction to OAuth 2 and Apache Oltu
Ad

Similar to Web Application Security: Winning When The Odds Are Against You (20)

PPTX
Hackers versus Developers and Secure Web Programming
ODP
My app is secure... I think
PPT
Starwest 2008
PPT
Developing Secure Applications and Defending Against Common Attacks
PPT
Phpnw security-20111009
PPS
Hacking Client Side Insecurities
PDF
Web Application Security with PHP
PDF
Become a Security Ninja
PPTX
Steve Kosten - Exploiting common web application vulnerabilities
PDF
Cyber Security Workshop @SPIT- 3rd October 2015
PPTX
Believe It Or Not SSL Attacks
PPT
Jan 2008 Allup
PDF
Securing Your BBC Identity
PPTX
Make Every Spin Count: Putting the Security Odds in Your Favor
PDF
Secure input and output handling - ViennaPHP
PPTX
Jon McCoy - AppSec-USA-2014 Hacking C#(.NET) Applications:Defend by Design
PPTX
Widespread security flaws in web application development 2015
PDF
Devbeat Conference - Developer First Security
PDF
Online Security and Privacy Issues
PPT
Security 101
Hackers versus Developers and Secure Web Programming
My app is secure... I think
Starwest 2008
Developing Secure Applications and Defending Against Common Attacks
Phpnw security-20111009
Hacking Client Side Insecurities
Web Application Security with PHP
Become a Security Ninja
Steve Kosten - Exploiting common web application vulnerabilities
Cyber Security Workshop @SPIT- 3rd October 2015
Believe It Or Not SSL Attacks
Jan 2008 Allup
Securing Your BBC Identity
Make Every Spin Count: Putting the Security Odds in Your Favor
Secure input and output handling - ViennaPHP
Jon McCoy - AppSec-USA-2014 Hacking C#(.NET) Applications:Defend by Design
Widespread security flaws in web application development 2015
Devbeat Conference - Developer First Security
Online Security and Privacy Issues
Security 101
Ad

Recently uploaded (20)

PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
newyork.pptxirantrafgshenepalchinachinane
PPTX
Digital Literacy And Online Safety on internet
PPTX
Mathew Digital SEO Checklist Guidlines 2025
PPTX
artificial intelligence overview of it and more
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PPTX
Funds Management Learning Material for Beg
DOCX
Unit-3 cyber security network security of internet system
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPTX
artificialintelligenceai1-copy-210604123353.pptx
DOC
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
PPTX
Database Information System - Management Information System
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
Introduction to the IoT system, how the IoT system works
SAP Ariba Sourcing PPT for learning material
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Design_with_Watersergyerge45hrbgre4top (1).ppt
newyork.pptxirantrafgshenepalchinachinane
Digital Literacy And Online Safety on internet
Mathew Digital SEO Checklist Guidlines 2025
artificial intelligence overview of it and more
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
Funds Management Learning Material for Beg
Unit-3 cyber security network security of internet system
An introduction to the IFRS (ISSB) Stndards.pdf
presentation_pfe-universite-molay-seltan.pptx
artificialintelligenceai1-copy-210604123353.pptx
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
Database Information System - Management Information System
INTERNET------BASICS-------UPDATED PPT PRESENTATION
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Introduction to the IoT system, how the IoT system works

Web Application Security: Winning When The Odds Are Against You

  • 1. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Web Application SecurityWeb Application Security Winning When The Odds Are Against YouWinning When The Odds Are Against You NewZealandPHPConference2014 Ben DechraiBen Dechrai @bendechrai@bendechrai #webappsec #phpnz14#webappsec #phpnz14 https://joind.in/talk/view/11435https://joind.in/talk/view/11435
  • 2. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You What Is WebWhat Is Web Application Security?Application Security?
  • 3. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
  • 4. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You What's Applicable to PHP Developers?
  • 5. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
  • 6. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Where to Start?
  • 7. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You
  • 8. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Top Ten Cheat Sheet Injection Cross Site Scripting Weak authentication & session management Insecure Direct Object Reference Cross Site Request Forgery Security Misconfiguration Insufficient Cryptographic Storage Failure to Restrict URL access Insufficient Transport Layer Protection Unvalidated Redirects and Forwards
  • 9. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Top Ten Cheat Sheet Injection Cross Site Scripting Weak authentication & session management Insecure Direct Object Reference Cross Site Request Forgery Security Misconfiguration Insufficient Cryptographic Storage Failure to Restrict URL access Insufficient Transport Layer Protection Unvalidated Redirects and Forwards
  • 10. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You DemoDemo
  • 11. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You What AreWhat Are The Odds?The Odds?
  • 12. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Solutions?
  • 13. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Think like PHP...
  • 14. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Not in PHP...
  • 15. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Think LIKE PHP...
  • 16. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You HTTP GET /index.html <html>..</html> GET /css/styles.css GET /js/script.js GET /images/logo.jpg body { ... } $(document).ready(...) data:image/jpg;base64,/9j/4AAQSkZJRgA...
  • 17. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You HTTP GET /index.php <html>..</html> PHP process PHP returns POST /login.php PHP process PHP returns<html>..</html>
  • 18. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You HTTP POST /images.php/logo.jpg <html>..</html> PHP process PHP returns POST /images/logo.jpg PHP process PHP returns<html>..</html> URL rewriting means anything can be passed to PHP
  • 19. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Cross-Site Request Forgeries visage.cto.to POST /login <html>..</html> PHP process PHP returns POST /checkout PHP process PHP returns<html>..</html> POST /address/edit {401} POST /address/edit { 200 } evil.com POST /payment <html>..</html> PHP process PHP returns GET /confirmation PHP process PHP returns<html>..</html> PHP process PHP returns PHP process PHP returns
  • 20. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You PHP Ain't Clever (hint, not many programming languages are!) Data Data Database User Input Files Other sites via API DatabaseBrowser Response Other systemsSending emails
  • 21. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You PHP Environment ● 1 page load = 1 PHP process ● Web server passes whole request to the PHP process ● When a script ends, all data are lost
  • 22. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Piecing Data Together $_GET $_POST $_COOKIE $_FILES $_REQUEST
  • 23. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Request Basics ● $_REQUEST variables can come from Environment, Post, Get, Cookie or Session variables! ● Don't use them, specify the source ● Even then, don't trust $_POST, et al ● Consider all data harmful
  • 24. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Whitelist All Incoming Data ● Treat all data as untrusted ● Only if it passed a whitelist, let it through ● Look for odd data entry points – Did you know the filename of an uploaded file is user generated input? ● Email addresses have fixed validation rules
  • 25. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Whitelist All Incoming Data (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)* | "(?:[x01-x08x0bx0cx0e-x1fx21x23-x5bx5d-x7f] | [x01-x09x0bx0cx0e-x7f])*") @ (?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])? | [(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3} (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]: (?:[x01-x08x0bx0cx0e-x1fx21-x5ax53-x7f] | [x01-x09x0bx0cx0e-x7f])+) ])
  • 26. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Whitelist All Incoming Data Some people, when confronted with a problem, think, “I know, I’ll use regular expressions.” Now they have two problems. — Jamie Zawinksi
  • 27. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Whitelist All Incoming Data filter_var($email, FILTER_VALIDATE_EMAIL); (Or just send them an email)
  • 28. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Whitelist All Incoming Data ● Names are a big topic (see http://is.gd/validating_names) ● Who decides if a name is valid? – Josè Smith – La amonȝ – Þórinn Eikinskjaldi – Πηληϊάδεω χιλ οςἈ ῆ – Federico del Sagrado Corazón de Jesús García Lorca
  • 29. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Encode on Output ● Avoid encoding for storage ● Keep valid user input intact ● Encode when used in an output stream – HTML encode for screen – URL encode for querystrings – Escape for CSV output ● By keeping the original data, you can repurpose for many outputs
  • 30. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Encode on Output User Generated Content User Generated Content Sanitize HTML EMAIL Sanitize XML/JSON/CSV Sanitize UNKNOWN FUTURE APP Sanitize
  • 31. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Encode on Output filter_var($comment, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
  • 32. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Cross-Site Request Forgeries Tokens Username Password Token SUBMIT ABC123 ABC123
  • 33. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Cross-Site Request Forgeries Referrers can be easily forged; don't rely on them
  • 34. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Credits ● Security Camera image by Henning Mühlinghaus ● Conception image by Lynn (Gracie's mom) ● Piecing Data by José Manuel Ríos Valiente References ● OWASP Top 10 Cheat Sheet
  • 35. Web Application Security: Winning When The Odds Are Against YouWeb Application Security: Winning When The Odds Are Against You Thank You!Thank You! Questions?Questions? Ben DechraiBen Dechrai @bendechrai@bendechrai NewZealandPHPConference2014