SlideShare a Scribd company logo
Developing Secure Web
Application
Cross-Site Scripting
(XSS)
Cezar Coca
Endava

10th of November 2012
Agenda


• Why?
• Formal description
• Same Origin Policy
• How to perform an XSS attack
• Demo
• Prevention of XSS attacks
OWASP Top Ten (2010 Edition)




                        http://www.owasp.org/index.php/Top_10
At first sight




                 =
Second sight
XSS formal description

Types – at least two primary flavors

• Non-persistent (or reflected)
• Persistent (or stored)
Typical impact
• Steal user’s session (hijack session)
• Rewrite web page
• Redirect user to phishing or malware site
• Most Severe: Install XSS proxy
Same Origin Policy – Security Domain
Same Origin Policy - DOM
Same Origin Policy - DOM
Same Origin Policy - DOM
Reflected XSS Illustrated




             Attacker send the victim a misleading email with a link
         1
             containing malicious JavaScript
Reflected XSS Illustrated


When the victim clicks on the
link, the HTTP request is initiated
from the victim's browser and
sent to the vulnerable Web
application.                                  2




                    Attacker send the victim a misleading email with a link
              1
                    containing malicious JavaScript
Reflected XSS Illustrated
                                                  The malicious JavaScript is then
                                                  reflected back to the victim's browser,
                                                  where it is executed in the context of
When the victim clicks on the                     the victim user's session
link, the HTTP request is initiated
from the victim's browser and                           3
sent to the vulnerable Web
application.                                  2




                    Attacker send the victim a misleading email with a link
              1
                    containing malicious JavaScript
DEMO – deployment diagram
LET’S HACK
Second sight
Prevention of XSS Attack – part 1
• Input Validation
  • Canonicalize data first
      •   Prevent encoded attacks

  •   Black list testing is no solution
      •    Black lists are never complete!

  •   White list testing is better
      •   Only what you expect will pass

      •   Regular expressions

  • HTML Encoding
      •   HTML encoding of all input when put into output pages
Prevention of XSS Attack – Multiple contexts
Browser have multiple contexts that must be considered!




     HTML        HTML       <STYLE>    <SCRIPT>      URL
     Body      Attributes   Context     Context     Context
Prevention of XSS Attack – Session Hijacking
• Session hijacking
  • “HttpOnly" Cookies
  • "secure" Cookies. Cookies are only sent over SSL
  • Disable TRACE
• References:
  • http://www.owasp.org/index.php/XSS_(Cross Site Scripting) Prevention
    Cheat Sheet

  • http://ha.ckers.org/xss.html
  • http://www.owasp.org/index.php/ESAPI
Developing Secure Web Application - Cross-Site Scripting (XSS)
Developing Secure Web Application - Cross-Site Scripting (XSS)
Diamond Sponsors




Platinum Sponsors                    Gold Sponsors


Training Partners   Media Partners          Other Partners

More Related Content

What's hot (20)

PPTX
Cross Site Scripting (XSS)
Barrel Software
 
PPTX
XSS- an application security vulnerability
Soumyasanto Sen
 
PPTX
Cross site scripting
ashutosh rai
 
PPTX
Reflective and Stored XSS- Cross Site Scripting
InMobi Technology
 
PPTX
Cm7 secure code_training_1day_xss
dcervigni
 
PPTX
Cross Site Scripting Defense Presentation
Ikhade Maro Igbape
 
PPTX
Cross Site Scripting
Ali Mattash
 
PPTX
Xss (cross site scripting)
vinayh.vaghamshi _
 
PPTX
Secure coding | XSS Attacks on current Web Applications
n|u - The Open Security Community
 
PPTX
Xss what the heck-!
VodqaBLR
 
PPTX
What is xss, blind xss and xploiting google gadgets
Ziv Ginsberg
 
PDF
Cross site scripting
n|u - The Open Security Community
 
PPTX
Identifying XSS Vulnerabilities
n|u - The Open Security Community
 
PDF
Xss 101 by-sai-shanthan
Raghunath G
 
PPTX
Cross Site Scripting ( XSS)
Amit Tyagi
 
PPTX
Deep understanding on Cross-Site Scripting and SQL Injection
Vishal Kumar
 
PPTX
Cross-Site Scripting (XSS)
Daniel Tumser
 
PPT
Cross site scripting (xss)
Manish Kumar
 
PDF
The Cross Site Scripting Guide
Daisuke_Dan
 
Cross Site Scripting (XSS)
Barrel Software
 
XSS- an application security vulnerability
Soumyasanto Sen
 
Cross site scripting
ashutosh rai
 
Reflective and Stored XSS- Cross Site Scripting
InMobi Technology
 
Cm7 secure code_training_1day_xss
dcervigni
 
Cross Site Scripting Defense Presentation
Ikhade Maro Igbape
 
Cross Site Scripting
Ali Mattash
 
Xss (cross site scripting)
vinayh.vaghamshi _
 
Secure coding | XSS Attacks on current Web Applications
n|u - The Open Security Community
 
Xss what the heck-!
VodqaBLR
 
What is xss, blind xss and xploiting google gadgets
Ziv Ginsberg
 
Cross site scripting
n|u - The Open Security Community
 
Identifying XSS Vulnerabilities
n|u - The Open Security Community
 
Xss 101 by-sai-shanthan
Raghunath G
 
Cross Site Scripting ( XSS)
Amit Tyagi
 
Deep understanding on Cross-Site Scripting and SQL Injection
Vishal Kumar
 
Cross-Site Scripting (XSS)
Daniel Tumser
 
Cross site scripting (xss)
Manish Kumar
 
The Cross Site Scripting Guide
Daisuke_Dan
 

Similar to Developing Secure Web Application - Cross-Site Scripting (XSS) (20)

PPTX
Cross site scripting XSS
Ronan Dunne, CEH, SSCP
 
PPTX
Convincing Developers to take Cross-Site Scripting Seriously
jpubal
 
KEY
Cross Site Scripting - Mozilla Security Learning Center
Michael Coates
 
PPT
CROSS SITE SCRIPTING.ppt
yashvirsingh48
 
PPTX
Secure Code Warrior - Cross site scripting
Secure Code Warrior
 
DOCX
logout.php Session Data after Logout Username Email . $_.docx
smile790243
 
PDF
CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)
Sam Bowne
 
PDF
XSS Exploitation
Hacking Articles
 
PPTX
Cross Site Scripting: Prevention and Detection(XSS)
Aman Singh
 
PDF
XSS.pdf
Okan YILDIZ
 
PDF
XSS.pdf
Okan YILDIZ
 
DOCX
Pantallas escaneo Sitio Web
andres1422
 
PDF
Webapplicationsecurity05 2010 100601100553 Phpapp02
Rafel Ivgi
 
PPTX
Secure webbrowsing 1
UT, San Antonio
 
PPTX
Website hacking and prevention (All Tools,Topics & Technique )
Jay Nagar
 
PDF
Web Vulnerabilities And Exploitation - Compromising The Web
Zero Science Lab
 
PDF
Rich Web App Security - Keeping your application safe
Jeremiah Grossman
 
PPT
Intro to Web Application Security
Rob Ragan
 
DOC
HallTumserFinalPaper
Daniel Tumser
 
Cross site scripting XSS
Ronan Dunne, CEH, SSCP
 
Convincing Developers to take Cross-Site Scripting Seriously
jpubal
 
Cross Site Scripting - Mozilla Security Learning Center
Michael Coates
 
CROSS SITE SCRIPTING.ppt
yashvirsingh48
 
Secure Code Warrior - Cross site scripting
Secure Code Warrior
 
logout.php Session Data after Logout Username Email . $_.docx
smile790243
 
CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)
Sam Bowne
 
XSS Exploitation
Hacking Articles
 
Cross Site Scripting: Prevention and Detection(XSS)
Aman Singh
 
XSS.pdf
Okan YILDIZ
 
XSS.pdf
Okan YILDIZ
 
Pantallas escaneo Sitio Web
andres1422
 
Webapplicationsecurity05 2010 100601100553 Phpapp02
Rafel Ivgi
 
Secure webbrowsing 1
UT, San Antonio
 
Website hacking and prevention (All Tools,Topics & Technique )
Jay Nagar
 
Web Vulnerabilities And Exploitation - Compromising The Web
Zero Science Lab
 
Rich Web App Security - Keeping your application safe
Jeremiah Grossman
 
Intro to Web Application Security
Rob Ragan
 
HallTumserFinalPaper
Daniel Tumser
 
Ad

More from Codecamp Romania (20)

PDF
Cezar chitac the edge of experience
Codecamp Romania
 
PPTX
Cloud powered search
Codecamp Romania
 
PPTX
Business analysis techniques exercise your 6-pack
Codecamp Romania
 
PPTX
Bpm company code camp - configuration or coding with pega
Codecamp Romania
 
PPT
Andrei prisacaru takingtheunitteststothedatabase
Codecamp Romania
 
PPTX
Agility and life
Codecamp Romania
 
PPTX
2015 dan ardelean develop for windows 10
Codecamp Romania
 
PDF
The bigrewrite
Codecamp Romania
 
PDF
The case for continuous delivery
Codecamp Romania
 
PPTX
Stefan stolniceanu spritekit, 2 d or not 2d
Codecamp Romania
 
PPTX
Sizing epics tales from an agile kingdom
Codecamp Romania
 
PPTX
Scale net apps in aws
Codecamp Romania
 
PPTX
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
Codecamp Romania
 
PPTX
Parallel & async processing using tpl dataflow
Codecamp Romania
 
PDF
Material design screen transitions in android
Codecamp Romania
 
PDF
Kickstart your own freelancing career
Codecamp Romania
 
PDF
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
Codecamp Romania
 
PDF
Ecma6 in the wild
Codecamp Romania
 
PPTX
Diana antohi me against myself or how to fail and move forward
Codecamp Romania
 
Cezar chitac the edge of experience
Codecamp Romania
 
Cloud powered search
Codecamp Romania
 
Business analysis techniques exercise your 6-pack
Codecamp Romania
 
Bpm company code camp - configuration or coding with pega
Codecamp Romania
 
Andrei prisacaru takingtheunitteststothedatabase
Codecamp Romania
 
Agility and life
Codecamp Romania
 
2015 dan ardelean develop for windows 10
Codecamp Romania
 
The bigrewrite
Codecamp Romania
 
The case for continuous delivery
Codecamp Romania
 
Stefan stolniceanu spritekit, 2 d or not 2d
Codecamp Romania
 
Sizing epics tales from an agile kingdom
Codecamp Romania
 
Scale net apps in aws
Codecamp Romania
 
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
Codecamp Romania
 
Parallel & async processing using tpl dataflow
Codecamp Romania
 
Material design screen transitions in android
Codecamp Romania
 
Kickstart your own freelancing career
Codecamp Romania
 
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
Codecamp Romania
 
Ecma6 in the wild
Codecamp Romania
 
Diana antohi me against myself or how to fail and move forward
Codecamp Romania
 
Ad

Developing Secure Web Application - Cross-Site Scripting (XSS)

  • 1. Developing Secure Web Application Cross-Site Scripting (XSS) Cezar Coca Endava 10th of November 2012
  • 2. Agenda • Why? • Formal description • Same Origin Policy • How to perform an XSS attack • Demo • Prevention of XSS attacks
  • 3. OWASP Top Ten (2010 Edition) http://www.owasp.org/index.php/Top_10
  • 6. XSS formal description Types – at least two primary flavors • Non-persistent (or reflected) • Persistent (or stored) Typical impact • Steal user’s session (hijack session) • Rewrite web page • Redirect user to phishing or malware site • Most Severe: Install XSS proxy
  • 7. Same Origin Policy – Security Domain
  • 11. Reflected XSS Illustrated Attacker send the victim a misleading email with a link 1 containing malicious JavaScript
  • 12. Reflected XSS Illustrated When the victim clicks on the link, the HTTP request is initiated from the victim's browser and sent to the vulnerable Web application. 2 Attacker send the victim a misleading email with a link 1 containing malicious JavaScript
  • 13. Reflected XSS Illustrated The malicious JavaScript is then reflected back to the victim's browser, where it is executed in the context of When the victim clicks on the the victim user's session link, the HTTP request is initiated from the victim's browser and 3 sent to the vulnerable Web application. 2 Attacker send the victim a misleading email with a link 1 containing malicious JavaScript
  • 17. Prevention of XSS Attack – part 1 • Input Validation • Canonicalize data first • Prevent encoded attacks • Black list testing is no solution • Black lists are never complete! • White list testing is better • Only what you expect will pass • Regular expressions • HTML Encoding • HTML encoding of all input when put into output pages
  • 18. Prevention of XSS Attack – Multiple contexts Browser have multiple contexts that must be considered! HTML HTML <STYLE> <SCRIPT> URL Body Attributes Context Context Context
  • 19. Prevention of XSS Attack – Session Hijacking • Session hijacking • “HttpOnly" Cookies • "secure" Cookies. Cookies are only sent over SSL • Disable TRACE • References: • http://www.owasp.org/index.php/XSS_(Cross Site Scripting) Prevention Cheat Sheet • http://ha.ckers.org/xss.html • http://www.owasp.org/index.php/ESAPI
  • 22. Diamond Sponsors Platinum Sponsors Gold Sponsors Training Partners Media Partners Other Partners