SlideShare a Scribd company logo
(IN)SECURE AJAX-Y WEBSITES WITH PHP Christian Wenz
Some Statistics 9 out of 10 web sites have security vulnerabilities. whitehat website security statistics report, March 2008 7.72% of web sites can be automatically compromised. 96.85% of web sites can be compromised with manual means.  WASC Web Application Security Statistics Project 2007 Jun 5, 2009   |     |
Why?  // The Problem Numerous talks, whitepapers, articles  and books on web application security Foundation of non-profit organizations  like  OWASP Heightened awareness in the media But it does not seem to help Jun 5, 2009   |     |
Why?  // "Hall of Shame" Recent evaluation of two dozen ramdomly picked Web 2.0 sites had an incredible "success rate" Some high-profile sites have had issues, too Most notably: MySpace, Facebook, Orkut, ... Jun 5, 2009   |     |
Why?  // Explanations Bad, inconsistent advice in talks, whitepapers, articles and books Lack of time Ajax applications make it very easy to introduce vulnerabilities Many new (unchecked?) server APIs Applications rely on UGC (user-generated content) Jun 5, 2009   |     |
Why?  // Traditional Model Jun 5, 2009   |     | Server Client
Why?  // Ajax Model Jun 5, 2009   |     | Server Client
XSS  // Problem Cross-Site Scripting (XSS) (Old) Problem: Dynamic data is sent to the client – without validation  The following content can be dangerous HTML CSS JavaScript Jun 5, 2009   |     |
XSS  // New Dangers XSS everywhere XML RSS HTTP Headers … Validate  all  incoming data! Validate in all dynamic files! Including REST-y web service APIs; not only Ajax applications may use them! Jun 5, 2009   |     |
XSS  // More Dangers Fancy XSS XSS without JavaScript Advanced JavaScript Attacks using embedded media The browser's same origin policy does not help much Filter using a whitelist approach, not blacklist! Jun 5, 2009   |     |
CSRF  // Problem Cross Site Request Forgeries (CSRF) Problem: HTTP requests do not always happen voluntarily Victim (client) Attacker (web site) Other web site (1) Requests page (2) Sends JavaScript (3) Requests page Jun 5, 2009   |     |
CSRF  // Countermeasures As user Logout whenever possible, as soon as possible Do not visit unknown sites Apart from that almost no chance to prevent attacks As developer Request login before „critical“ operations Include secret/random token in forms Use random names for form elements (?!) Jun 5, 2009   |     |
SQL Injection  // Problem SQL Injection (Old) Problem: Dynamic data is used in SQL statements – without validation  The list of attacks does not end with  ' OR ''='  ! Jun 5, 2009   |     |
SQL Injection  // Bad Ideas Filter for „1=1“ Filter for  ' Filter for # Filter for -- What's next?! Again: No blacklist, but whitelist Or database-specific escape functions/methods Or even better: Prepared statements (if supported) Jun 5, 2009   |     |
SQL Injection  // Fancy attacks Prompting error messages UNION  attacks Blind SQL attacks Using built-in functionality Second-order attacks DoS attacks Jun 5, 2009   |     |
Ajax  // JavaScript attacks JavaScript Hijacking Vulnerable: GET requests that retrieve JSON information Malicious JavaScript code overrides constructors, enabling to intercept and steal (or modify) JSON data http://www.fortifysoftware.com/servlet/downloads/public/JavaScript_Hijacking.pdf   Jun 5, 2009   |     |
Ajax  // Countermeasures Require POST for server APIs Demand a certain HTTP header (e.g.  Content-type: application/json ) Jun 5, 2009   |     |
Ajax  // Further Concerns Need to maintain state Bookmarks Back/forward buttons Usually implemented using the hash portion of the URL Then, parsed upon load Check your parser! Don't get me started with mashups! Jun 5, 2009   |     |
XML  // XML attacks Feeding web services with incorrect XML XPath Injection Nasty entities All input is evil! Jun 5, 2009   |     |
Regular Expressions  // RegEx attacks Problem:  e  modifier in regular expressions Extremely dangerous if user-supplied  data is embedded in this regular  expression Arbitrary code execution may be  possible Jun 5, 2009   |     |
Automation  // Trackbacks Problem: Spammers create trackbacks  to weblogs to get their URL mentioned and therefore increasing their Google  PageRank Trackback API is very simple POST http://victim.tld/trackback?id=0815 Content-type: application/x-www-form-urlencoded title=Buy+stuff&url=http://spammer.tld/&excerpt= Buy+my+stuff&blog_name=Spamblog Jun 5, 2009   |     |
Automation  // Comments Problem: Spammers (automatically) post  comments to weblogs to get their URL  mentioned which in turn might increase their Google PageRank Also works with feedback forms and  „send-a-friend“ features of websites Jun 5, 2009   |     |
Automation  // CAPTCHAs Completely Automated Turing  Test to Tell Computers and  Humans Apart Turing tests: Decide whether the communication partner is a person or a machine Mostly, an image with text/numbers ASCII and audio CAPTCHAs also  exist Jun 5, 2009   |     |
CAPTCHAs  // Countermeasures Implementation bugs Cheap workers Horny surfers Jun 5, 2009   |     |
Because!  // Conclusion There is no 100% security But you should try Rule #1: Validate all input Rule #2: Escape all output Ajax applications do not always generate new attacks, but allow more entry points Better paranoid than offline ™ Jun 5, 2009   |     |
Christian's Conference Guide Tomorrow's security- and Ajax-related sessions Security 11:00am, Hall B: Lesser Known Security Problems in PHP Applications 2:45pm, Hall B: Security-Centered Design (Hall B) Ajax 11:00am, Room 203: The Power and Beauty of Dojo 1:30pm, Hall B: State of Ajax (Keynote) 2:45pm, Room 209: Building RIA with ZF and PHP 4:00pm, Room 203: PHP and Ajax Made Easier with Zend Jun 5, 2009   |     |
Thank You! http://www.hauser-wenz.de/blog/ [email_address]   Please don't forget the session evals! Jun 5, 2009   |     |

More Related Content

PDF
Making ES6 available to all with ChakraCore and Typescript
PDF
Old and new perils of open source - Great Wide Open keynote
PDF
Making ES6 available to all with ChakraCore
PDF
Fixing web and JS gaps
PPTX
Front-end Performance 101
PDF
GoSec 2015 - Protecting the web from within
PDF
RailsConf 2015 - Metasecurity: Beyond Patching Vulnerabilities
Making ES6 available to all with ChakraCore and Typescript
Old and new perils of open source - Great Wide Open keynote
Making ES6 available to all with ChakraCore
Fixing web and JS gaps
Front-end Performance 101
GoSec 2015 - Protecting the web from within
RailsConf 2015 - Metasecurity: Beyond Patching Vulnerabilities

What's hot (12)

PDF
State of Web Security RailsConf 2016
PPTX
Why I Hope ENCompass Continues to Fail
PPTX
WordPress Security for Beginners
PPT
AppSec DC 2009 - Learning by breaking by Chuck Willis
PPS
“Automation in development processes: why, when and how
PPTX
How i got my first cve
PDF
Moore vs. May - everything is faster and better: we can fix that
PDF
InnoTech 2017_Defend_Against_Ransomware 3.0
PDF
jQuery Mobile, Backbone.js, and ASP.NET MVC
PPT
Hour 4
 
PDF
Overboard.js - where are we going with with jsconfasia / devfestasia
PDF
Can we make es6 the baseline of the “modern web”? - BrazilJS 2105
State of Web Security RailsConf 2016
Why I Hope ENCompass Continues to Fail
WordPress Security for Beginners
AppSec DC 2009 - Learning by breaking by Chuck Willis
“Automation in development processes: why, when and how
How i got my first cve
Moore vs. May - everything is faster and better: we can fix that
InnoTech 2017_Defend_Against_Ransomware 3.0
jQuery Mobile, Backbone.js, and ASP.NET MVC
Hour 4
 
Overboard.js - where are we going with with jsconfasia / devfestasia
Can we make es6 the baseline of the “modern web”? - BrazilJS 2105
Ad

Similar to (In)Secure Ajax-Y Websites With PHP (20)

PDF
www.webre24h.com - Ajax security
PDF
null Bangalore meet - Php Security
PPTX
Hackers versus Developers and Secure Web Programming
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
PDF
API Upload Test
www.webre24h.com - Ajax security
null Bangalore meet - Php Security
Hackers versus Developers and Secure Web Programming
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
API Upload Test
Ad

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
KodekX | Application Modernization Development
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
Teaching material agriculture food technology
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation theory and applications.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
cuic standard and advanced reporting.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Approach and Philosophy of On baking technology
Dropbox Q2 2025 Financial Results & Investor Presentation
KodekX | Application Modernization Development
MIND Revenue Release Quarter 2 2025 Press Release
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Teaching material agriculture food technology
sap open course for s4hana steps from ECC to s4
Programs and apps: productivity, graphics, security and other tools
Reach Out and Touch Someone: Haptics and Empathic Computing
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation theory and applications.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Empathic Computing: Creating Shared Understanding
cuic standard and advanced reporting.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf

(In)Secure Ajax-Y Websites With PHP

  • 1. (IN)SECURE AJAX-Y WEBSITES WITH PHP Christian Wenz
  • 2. Some Statistics 9 out of 10 web sites have security vulnerabilities. whitehat website security statistics report, March 2008 7.72% of web sites can be automatically compromised. 96.85% of web sites can be compromised with manual means. WASC Web Application Security Statistics Project 2007 Jun 5, 2009 | |
  • 3. Why? // The Problem Numerous talks, whitepapers, articles and books on web application security Foundation of non-profit organizations like OWASP Heightened awareness in the media But it does not seem to help Jun 5, 2009 | |
  • 4. Why? // "Hall of Shame" Recent evaluation of two dozen ramdomly picked Web 2.0 sites had an incredible "success rate" Some high-profile sites have had issues, too Most notably: MySpace, Facebook, Orkut, ... Jun 5, 2009 | |
  • 5. Why? // Explanations Bad, inconsistent advice in talks, whitepapers, articles and books Lack of time Ajax applications make it very easy to introduce vulnerabilities Many new (unchecked?) server APIs Applications rely on UGC (user-generated content) Jun 5, 2009 | |
  • 6. Why? // Traditional Model Jun 5, 2009 | | Server Client
  • 7. Why? // Ajax Model Jun 5, 2009 | | Server Client
  • 8. XSS // Problem Cross-Site Scripting (XSS) (Old) Problem: Dynamic data is sent to the client – without validation The following content can be dangerous HTML CSS JavaScript Jun 5, 2009 | |
  • 9. XSS // New Dangers XSS everywhere XML RSS HTTP Headers … Validate all incoming data! Validate in all dynamic files! Including REST-y web service APIs; not only Ajax applications may use them! Jun 5, 2009 | |
  • 10. XSS // More Dangers Fancy XSS XSS without JavaScript Advanced JavaScript Attacks using embedded media The browser's same origin policy does not help much Filter using a whitelist approach, not blacklist! Jun 5, 2009 | |
  • 11. CSRF // Problem Cross Site Request Forgeries (CSRF) Problem: HTTP requests do not always happen voluntarily Victim (client) Attacker (web site) Other web site (1) Requests page (2) Sends JavaScript (3) Requests page Jun 5, 2009 | |
  • 12. CSRF // Countermeasures As user Logout whenever possible, as soon as possible Do not visit unknown sites Apart from that almost no chance to prevent attacks As developer Request login before „critical“ operations Include secret/random token in forms Use random names for form elements (?!) Jun 5, 2009 | |
  • 13. SQL Injection // Problem SQL Injection (Old) Problem: Dynamic data is used in SQL statements – without validation The list of attacks does not end with ' OR ''=' ! Jun 5, 2009 | |
  • 14. SQL Injection // Bad Ideas Filter for „1=1“ Filter for ' Filter for # Filter for -- What's next?! Again: No blacklist, but whitelist Or database-specific escape functions/methods Or even better: Prepared statements (if supported) Jun 5, 2009 | |
  • 15. SQL Injection // Fancy attacks Prompting error messages UNION attacks Blind SQL attacks Using built-in functionality Second-order attacks DoS attacks Jun 5, 2009 | |
  • 16. Ajax // JavaScript attacks JavaScript Hijacking Vulnerable: GET requests that retrieve JSON information Malicious JavaScript code overrides constructors, enabling to intercept and steal (or modify) JSON data http://www.fortifysoftware.com/servlet/downloads/public/JavaScript_Hijacking.pdf Jun 5, 2009 | |
  • 17. Ajax // Countermeasures Require POST for server APIs Demand a certain HTTP header (e.g. Content-type: application/json ) Jun 5, 2009 | |
  • 18. Ajax // Further Concerns Need to maintain state Bookmarks Back/forward buttons Usually implemented using the hash portion of the URL Then, parsed upon load Check your parser! Don't get me started with mashups! Jun 5, 2009 | |
  • 19. XML // XML attacks Feeding web services with incorrect XML XPath Injection Nasty entities All input is evil! Jun 5, 2009 | |
  • 20. Regular Expressions // RegEx attacks Problem: e modifier in regular expressions Extremely dangerous if user-supplied data is embedded in this regular expression Arbitrary code execution may be possible Jun 5, 2009 | |
  • 21. Automation // Trackbacks Problem: Spammers create trackbacks to weblogs to get their URL mentioned and therefore increasing their Google PageRank Trackback API is very simple POST http://victim.tld/trackback?id=0815 Content-type: application/x-www-form-urlencoded title=Buy+stuff&url=http://spammer.tld/&excerpt= Buy+my+stuff&blog_name=Spamblog Jun 5, 2009 | |
  • 22. Automation // Comments Problem: Spammers (automatically) post comments to weblogs to get their URL mentioned which in turn might increase their Google PageRank Also works with feedback forms and „send-a-friend“ features of websites Jun 5, 2009 | |
  • 23. Automation // CAPTCHAs Completely Automated Turing Test to Tell Computers and Humans Apart Turing tests: Decide whether the communication partner is a person or a machine Mostly, an image with text/numbers ASCII and audio CAPTCHAs also exist Jun 5, 2009 | |
  • 24. CAPTCHAs // Countermeasures Implementation bugs Cheap workers Horny surfers Jun 5, 2009 | |
  • 25. Because! // Conclusion There is no 100% security But you should try Rule #1: Validate all input Rule #2: Escape all output Ajax applications do not always generate new attacks, but allow more entry points Better paranoid than offline ™ Jun 5, 2009 | |
  • 26. Christian's Conference Guide Tomorrow's security- and Ajax-related sessions Security 11:00am, Hall B: Lesser Known Security Problems in PHP Applications 2:45pm, Hall B: Security-Centered Design (Hall B) Ajax 11:00am, Room 203: The Power and Beauty of Dojo 1:30pm, Hall B: State of Ajax (Keynote) 2:45pm, Room 209: Building RIA with ZF and PHP 4:00pm, Room 203: PHP and Ajax Made Easier with Zend Jun 5, 2009 | |
  • 27. Thank You! http://www.hauser-wenz.de/blog/ [email_address] Please don't forget the session evals! Jun 5, 2009 | |