SlideShare a Scribd company logo
Application Security for HTML5
Chuck Ben-Tzur
October 23, 2012
Overview
    • Goal
           Review (some of) HTML5 new features and the related application security attacks
           scenarios, risks and recommendations.

    • Agenda
           – The History of HTML5 (The short version)
           – HTML5 Updates (The incomplete version)
           – Local Storage
           – Web Messaging
           – Web Sockets
           – Full Screen API (Phishing)
           – Implementation Considerations



    Originally delivered at Sector (Oct 2, 2012).
    Current version includes specific security controls demo and the Full Screen API.
2
History of HTML5
    • HTML4 was published as a W3C Recommendation in… December 1997
    • 2002 - W3C recommended XHTML 1.0 as the “next step in the evolution of
      the Internet” – no plans for future HTML versions.
    • 2004 - the Web Hypertext Application Technology Working Group
      (WHATWG) started working on the next version of HTML (not XHTML
      based).
      The WHATWG was founded by individuals from Apple, the Mozilla
      Foundation and Opera Software.
    • 2009 - W3C allowed the XHTML 2.0 working group to expire and started
      working with WHATWG on the development of HTML5 (WHATWG HTML).
    • Current target date for Recommendation status is 2014 for HTML 5.0 and
      2016 for HTML 5.1 (better than 2022…)
3
HTML5 Updates
    • Markup
        – New tags such as <video>, <audio>, <canvas>

        – Deprecation of tags such as <frame>, <frameset>, <font>

    • Backward compatibility with older versions of HTML.
    • Scripting APIs - Offline Web Applications, Drag and Drop, Local Storage, 2D
      Drawing (Canvas), Web Sockets, Web Workers and more.
    • Detailed rules for lexing and parsing (browsers will produce the same
      result in the case of incorrect syntax).
    • Related Technologies (not part of the HTML5 specifications):
      Geo Locations, Microdata, File API, MathML



4
HTML5 Updates




5
Local Storage
    • Started as part of HTML5 (not anymore)
    • Like cookies but with better functionality:
        – Greater Storage Capacity (Cookies – 4K, Firefox and Chrome – 5MB, IE – 10MB)

        – Client Only access (Scripts) – not sent to the server (but may be leveraged as client side
           input!)

        – Better API as it is using structured data (Associative array – Key, Value pairs)

    • Storage types
        – Local (per domain, persists after browser is closed)

        – Session (limited to the window’s lifetime)

    • Managed and accessed using client side scripts only



6
Demo Applications
    • ACME Social Media Manager (www.acmesmm.com)
        – LocalStorage management (.htm)

        – Edit and Confirm post pages (.aspx) – Hiding keys with “_” prefix.

    • AtomInfoSec Website (www.evilsite.com:81)
        – Contains static script pages (.htm)

        – Pages background is light-blue

    • C# (.NET 4.0)
    • HTML5, JavaScript
    • Internet Explorer 9 (Local Storage and Web Messaging)
    • Google Chrome 22 (Web Socket)
    • Safari 5.1.7 (Full Screen)

7
Local Storage - Demo




8
Local Storage - Security
    • Follows “Same Origin” principle
    • Session Storage is not persistent


    • Large storage area creates a bigger attack surface
    • Not protected (e.g. encryption, object types)
    • No expiration date on the LocalStorage or the stored information
    • No HTTPOnly, secure or path attributes (similar to cookies functionality).
    • Accessible via console and file (cleartext XML)
    • Relies on client based security controls


    • Do not use for sensitive information
9
Web Messaging
     • Also known as “Cross Domain Messaging”.
     • Allows messaging between documents from different origins
       (to allow communication between two non-hostile pages).
     • messages can be posted to the following:
         – Other frames or iframes within the document
         – Windows explicitly opened through Javascript calls
         – The parent window
     • Initiated and managed using client side scripts only.




10
Web Messaging - Demo




11
Web Messaging - Security
     • Relies on client based security controls


     • Verify Origin:
         – Explicitly state the expected origin as the second argument to postMessage() method.

         – Check the origin attribute of the sender

     • Both pages should only interpret the exchanged messages as data.
     • Never evaluate received messages as code or insert it to a page DOM.
     • Check the origin properly exactly to match the FQDN.
     • Use the sandbox attribute for iFrame objects.




12
Web Socket
     • Providing for bi-directional, full-duplex communications channels between
       client and server.
     • Drastically reduces the amount of unnecessary traffic between server and
       browser.
     • Easy to initiate and manage using scripts.
     • Defines two new URI schemes (ws: and wss:) for unencrypted and
       encrypted connections .




13
Web Socket - Demo




14
Web Socket - Security
     • Not supported in all browsers (e.g. Internet Explorer 10, IIS8)
     • Using standard web ports (80, 443) impacting security controls such as
       Data Loss Prevention (DLP), Intrusion Prevention System (IPS) and Logging
       and Monitoring.
     • In a WebSocket port, the packets lack the traditional headers. Requires
       Deep Packet Inspection solutions as security controls.


     • Avoid backward compatibility - use only hybi-00 and RFC 6455 protocols.
     • Server must check the origin of the WebSocket client .
     • Leverage server side component to perform Input Validation.



15
FullScreen API
     • Posted on October 8th, 2012 by Feross Aboukhadijeh.
     • Mouse hovering over the link to see where it goes - a completely normal
       link.
     • On click, browser automatically enters FullScreen mode and load a fake
       version of website (including browser and OS images).
     • FullScreen API Implementation differs between browsers (different scripts
       and alerts).




16
FullScreen API - Demo




17
Implementation/Security Considerations
     • HTML5 Reduces the usage of Objects, ActiveX and other “out of browser”
       technologies.


     • HTML5 standard and browser support are still evolving.
     • HTML5 provides far more client side based activity and functionality, more
       access to the computer's resources (Upgrades the script kiddie “toolkit”)
     • Impact on risk and compliance efforts not clear (such as OWASP Top 10
       and Risk Assessments)
     • Security tools are not up to date
     • Check online Resources for latest updates and security risks
     • Early adapters are usually the early victims

18
Resources - Specifications
     •   HTML5 (Working Draft)
         http://www.w3.org/TR/2011/WD-html5-20110525/
     •   Web Hypertext Application Technology Working Group (WHATWG)
         http://www.whatwg.org/
     •   Local Storage (Candidate Recommendation)
         http://www.w3.org/TR/webstorage/
     •   HTML5 Web Messaging (Working Draft)
         http://www.w3.org/TR/2010/WD-webmessaging-20101118/
     •   Web Socket
         http://www.websocket.org/aboutwebsocket.html


     •   HTML5 differences from HTML4
         http://dev.w3.org/html5/html4-differences/




19
Resources – HTML5 Security
     •   HTML5 Security Resources Repository
         http://html5security.org/
     •   HTML5 Security Cheat Sheet
         https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet


     •   Using the HTML5 FullScreen API for Phishing Attacks
         http://feross.org/html5-fullscreen-api-attack/


     •   This Presentation (Presented at Sector – October 2, 2012)
         http://www.atominformationsecurity.com//Resources/HTML5AppSec.pdf
     •   Demo Code Used
         http://www.atominformationsecurity.com/Resources/HTML5AppSec.zip




20
Thank You
cbentzur@atominfosec.com

More Related Content

PDF
Html5 hacking
Iftach Ian Amit
 
PPT
HTML5 hacking
Blueinfy Solutions
 
PDF
Non-Invasive Elimination of Logical Access Control Vulnerabilities in Web A...
Denis Kolegov
 
PPT
Html5 on mobile
Blueinfy Solutions
 
PDF
CNIT 129: 6. Attacking Authentication
Sam Bowne
 
PPT
Applciation footprinting, discovery and enumeration
Blueinfy Solutions
 
PDF
Html5 localstorage attack vectors
Shreeraj Shah
 
PDF
CSRF, ClickJacking & Open Redirect
Blueinfy Solutions
 
Html5 hacking
Iftach Ian Amit
 
HTML5 hacking
Blueinfy Solutions
 
Non-Invasive Elimination of Logical Access Control Vulnerabilities in Web A...
Denis Kolegov
 
Html5 on mobile
Blueinfy Solutions
 
CNIT 129: 6. Attacking Authentication
Sam Bowne
 
Applciation footprinting, discovery and enumeration
Blueinfy Solutions
 
Html5 localstorage attack vectors
Shreeraj Shah
 
CSRF, ClickJacking & Open Redirect
Blueinfy Solutions
 

What's hot (20)

PDF
Big problems with big data – Hadoop interfaces security
SecuRing
 
PDF
aclpwn - Active Directory ACL exploitation with BloodHound
DirkjanMollema
 
PPTX
Rapid Android Application Security Testing
Nutan Kumar Panda
 
PDF
Ch 3: Web Application Technologies
Sam Bowne
 
PDF
A Novel methodology for handling Document Level Security in Search Based Appl...
lucenerevolution
 
PPT
iOS Application Security Testing
Blueinfy Solutions
 
PPT
Android attacks
Blueinfy Solutions
 
PDF
HTML5 Top 10 Threats - Silent Attacks and Stealth Exploits
Shreeraj Shah
 
PDF
Blackhat11 shreeraj reverse_engineering_browser
Shreeraj Shah
 
PPTX
In The Middle of Printers - The (In)Security of Pull Printing solutions - Hac...
Jakub Kałużny
 
PPTX
Vulnerabilities in data processing levels
beched
 
PDF
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
nyccamp
 
PPTX
OWASP Top 10 vs Drupal - OWASP Benelux 2012
ZIONSECURITY
 
PPTX
Ten Commandments of Secure Coding
Mateusz Olejarka
 
PPTX
Web Exploitation Security
Aman Singh
 
PDF
CNIT 129S: 13: Attacking Users: Other Techniques (Part 1 of 2)
Sam Bowne
 
PPTX
powershell-is-dead-epic-learnings-london
nettitude_labs
 
PDF
Chrome extensions threat analysis and countermeasures
Roel Palmaers
 
PPT
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
Shreeraj Shah
 
PDF
Wfuzz para Penetration Testers
Source Conference
 
Big problems with big data – Hadoop interfaces security
SecuRing
 
aclpwn - Active Directory ACL exploitation with BloodHound
DirkjanMollema
 
Rapid Android Application Security Testing
Nutan Kumar Panda
 
Ch 3: Web Application Technologies
Sam Bowne
 
A Novel methodology for handling Document Level Security in Search Based Appl...
lucenerevolution
 
iOS Application Security Testing
Blueinfy Solutions
 
Android attacks
Blueinfy Solutions
 
HTML5 Top 10 Threats - Silent Attacks and Stealth Exploits
Shreeraj Shah
 
Blackhat11 shreeraj reverse_engineering_browser
Shreeraj Shah
 
In The Middle of Printers - The (In)Security of Pull Printing solutions - Hac...
Jakub Kałużny
 
Vulnerabilities in data processing levels
beched
 
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
nyccamp
 
OWASP Top 10 vs Drupal - OWASP Benelux 2012
ZIONSECURITY
 
Ten Commandments of Secure Coding
Mateusz Olejarka
 
Web Exploitation Security
Aman Singh
 
CNIT 129S: 13: Attacking Users: Other Techniques (Part 1 of 2)
Sam Bowne
 
powershell-is-dead-epic-learnings-london
nettitude_labs
 
Chrome extensions threat analysis and countermeasures
Roel Palmaers
 
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
Shreeraj Shah
 
Wfuzz para Penetration Testers
Source Conference
 
Ad

Viewers also liked (9)

PDF
Privacy &amp; Social Media
chuckbt
 
PPTX
cross document messaging, html 5
Kristoffer Snabb
 
PPS
Virtual Tech Days 2010 - Integrating Social Networks with ASP.NET
Krishna T
 
PPTX
Html5 security
Krishna T
 
PPTX
Authentication vs authorization
Frank Victory
 
PPTX
Authentication and Authorization in Asp.Net
Shivanand Arur
 
PDF
Html 5 in a big nutshell
Lennart Schoors
 
PPSX
Introduction to Html5
www.netgains.org
 
PPTX
html5.ppt
Niharika Gupta
 
Privacy &amp; Social Media
chuckbt
 
cross document messaging, html 5
Kristoffer Snabb
 
Virtual Tech Days 2010 - Integrating Social Networks with ASP.NET
Krishna T
 
Html5 security
Krishna T
 
Authentication vs authorization
Frank Victory
 
Authentication and Authorization in Asp.Net
Shivanand Arur
 
Html 5 in a big nutshell
Lennart Schoors
 
Introduction to Html5
www.netgains.org
 
html5.ppt
Niharika Gupta
 
Ad

Similar to Html5 Application Security (20)

PPT
Top 10 HTML5 Features for Oracle Cloud Developers
Brian Huff
 
PPTX
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Divyanshu
 
PDF
Ch 10: Hacking Web Servers
Sam Bowne
 
PDF
cyber security-ethical hacking web servers.pdf
jayaprasanna10
 
PPT
526_topic08.ppt
sajeedmalagi
 
PPTX
Transforming the web into a real application platform
Mohanadarshan Vivekanandalingam
 
PPTX
Prueba ppt
Ulises Torelli
 
PPTX
Html5v1
Ulises Torelli
 
PDF
Cloud Computing in Systems Programming Curriculum
Steven Miller
 
PDF
Building Client-Side Attacks with HTML5 Features
Conviso Application Security
 
PPTX
AMF Flash and .NET
Yaniv Uriel
 
PDF
The Mobile Web - HTML5 on mobile devices
Wesley Hales
 
PDF
The Web, After HTML5
Jonathan Jeon
 
PDF
Internet Explorer 8
David Chou
 
PPT
HTML5 Webinar - Mind Storm Software
Romin Irani
 
PPTX
Html5
Zahin Omar Alwa
 
PPT
WebSphere Portal Technical Overview
Vincent Perrin
 
PPTX
9 10 july2020
PreetiSaini55
 
PPTX
HTML5 Programming
hotrannam
 
PDF
How do JavaScript frameworks impact the security of applications?
Ksenia Peguero
 
Top 10 HTML5 Features for Oracle Cloud Developers
Brian Huff
 
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Divyanshu
 
Ch 10: Hacking Web Servers
Sam Bowne
 
cyber security-ethical hacking web servers.pdf
jayaprasanna10
 
526_topic08.ppt
sajeedmalagi
 
Transforming the web into a real application platform
Mohanadarshan Vivekanandalingam
 
Prueba ppt
Ulises Torelli
 
Cloud Computing in Systems Programming Curriculum
Steven Miller
 
Building Client-Side Attacks with HTML5 Features
Conviso Application Security
 
AMF Flash and .NET
Yaniv Uriel
 
The Mobile Web - HTML5 on mobile devices
Wesley Hales
 
The Web, After HTML5
Jonathan Jeon
 
Internet Explorer 8
David Chou
 
HTML5 Webinar - Mind Storm Software
Romin Irani
 
WebSphere Portal Technical Overview
Vincent Perrin
 
9 10 july2020
PreetiSaini55
 
HTML5 Programming
hotrannam
 
How do JavaScript frameworks impact the security of applications?
Ksenia Peguero
 

Html5 Application Security

  • 1. Application Security for HTML5 Chuck Ben-Tzur October 23, 2012
  • 2. Overview • Goal Review (some of) HTML5 new features and the related application security attacks scenarios, risks and recommendations. • Agenda – The History of HTML5 (The short version) – HTML5 Updates (The incomplete version) – Local Storage – Web Messaging – Web Sockets – Full Screen API (Phishing) – Implementation Considerations Originally delivered at Sector (Oct 2, 2012). Current version includes specific security controls demo and the Full Screen API. 2
  • 3. History of HTML5 • HTML4 was published as a W3C Recommendation in… December 1997 • 2002 - W3C recommended XHTML 1.0 as the “next step in the evolution of the Internet” – no plans for future HTML versions. • 2004 - the Web Hypertext Application Technology Working Group (WHATWG) started working on the next version of HTML (not XHTML based). The WHATWG was founded by individuals from Apple, the Mozilla Foundation and Opera Software. • 2009 - W3C allowed the XHTML 2.0 working group to expire and started working with WHATWG on the development of HTML5 (WHATWG HTML). • Current target date for Recommendation status is 2014 for HTML 5.0 and 2016 for HTML 5.1 (better than 2022…) 3
  • 4. HTML5 Updates • Markup – New tags such as <video>, <audio>, <canvas> – Deprecation of tags such as <frame>, <frameset>, <font> • Backward compatibility with older versions of HTML. • Scripting APIs - Offline Web Applications, Drag and Drop, Local Storage, 2D Drawing (Canvas), Web Sockets, Web Workers and more. • Detailed rules for lexing and parsing (browsers will produce the same result in the case of incorrect syntax). • Related Technologies (not part of the HTML5 specifications): Geo Locations, Microdata, File API, MathML 4
  • 6. Local Storage • Started as part of HTML5 (not anymore) • Like cookies but with better functionality: – Greater Storage Capacity (Cookies – 4K, Firefox and Chrome – 5MB, IE – 10MB) – Client Only access (Scripts) – not sent to the server (but may be leveraged as client side input!) – Better API as it is using structured data (Associative array – Key, Value pairs) • Storage types – Local (per domain, persists after browser is closed) – Session (limited to the window’s lifetime) • Managed and accessed using client side scripts only 6
  • 7. Demo Applications • ACME Social Media Manager (www.acmesmm.com) – LocalStorage management (.htm) – Edit and Confirm post pages (.aspx) – Hiding keys with “_” prefix. • AtomInfoSec Website (www.evilsite.com:81) – Contains static script pages (.htm) – Pages background is light-blue • C# (.NET 4.0) • HTML5, JavaScript • Internet Explorer 9 (Local Storage and Web Messaging) • Google Chrome 22 (Web Socket) • Safari 5.1.7 (Full Screen) 7
  • 9. Local Storage - Security • Follows “Same Origin” principle • Session Storage is not persistent • Large storage area creates a bigger attack surface • Not protected (e.g. encryption, object types) • No expiration date on the LocalStorage or the stored information • No HTTPOnly, secure or path attributes (similar to cookies functionality). • Accessible via console and file (cleartext XML) • Relies on client based security controls • Do not use for sensitive information 9
  • 10. Web Messaging • Also known as “Cross Domain Messaging”. • Allows messaging between documents from different origins (to allow communication between two non-hostile pages). • messages can be posted to the following: – Other frames or iframes within the document – Windows explicitly opened through Javascript calls – The parent window • Initiated and managed using client side scripts only. 10
  • 11. Web Messaging - Demo 11
  • 12. Web Messaging - Security • Relies on client based security controls • Verify Origin: – Explicitly state the expected origin as the second argument to postMessage() method. – Check the origin attribute of the sender • Both pages should only interpret the exchanged messages as data. • Never evaluate received messages as code or insert it to a page DOM. • Check the origin properly exactly to match the FQDN. • Use the sandbox attribute for iFrame objects. 12
  • 13. Web Socket • Providing for bi-directional, full-duplex communications channels between client and server. • Drastically reduces the amount of unnecessary traffic between server and browser. • Easy to initiate and manage using scripts. • Defines two new URI schemes (ws: and wss:) for unencrypted and encrypted connections . 13
  • 14. Web Socket - Demo 14
  • 15. Web Socket - Security • Not supported in all browsers (e.g. Internet Explorer 10, IIS8) • Using standard web ports (80, 443) impacting security controls such as Data Loss Prevention (DLP), Intrusion Prevention System (IPS) and Logging and Monitoring. • In a WebSocket port, the packets lack the traditional headers. Requires Deep Packet Inspection solutions as security controls. • Avoid backward compatibility - use only hybi-00 and RFC 6455 protocols. • Server must check the origin of the WebSocket client . • Leverage server side component to perform Input Validation. 15
  • 16. FullScreen API • Posted on October 8th, 2012 by Feross Aboukhadijeh. • Mouse hovering over the link to see where it goes - a completely normal link. • On click, browser automatically enters FullScreen mode and load a fake version of website (including browser and OS images). • FullScreen API Implementation differs between browsers (different scripts and alerts). 16
  • 17. FullScreen API - Demo 17
  • 18. Implementation/Security Considerations • HTML5 Reduces the usage of Objects, ActiveX and other “out of browser” technologies. • HTML5 standard and browser support are still evolving. • HTML5 provides far more client side based activity and functionality, more access to the computer's resources (Upgrades the script kiddie “toolkit”) • Impact on risk and compliance efforts not clear (such as OWASP Top 10 and Risk Assessments) • Security tools are not up to date • Check online Resources for latest updates and security risks • Early adapters are usually the early victims 18
  • 19. Resources - Specifications • HTML5 (Working Draft) http://www.w3.org/TR/2011/WD-html5-20110525/ • Web Hypertext Application Technology Working Group (WHATWG) http://www.whatwg.org/ • Local Storage (Candidate Recommendation) http://www.w3.org/TR/webstorage/ • HTML5 Web Messaging (Working Draft) http://www.w3.org/TR/2010/WD-webmessaging-20101118/ • Web Socket http://www.websocket.org/aboutwebsocket.html • HTML5 differences from HTML4 http://dev.w3.org/html5/html4-differences/ 19
  • 20. Resources – HTML5 Security • HTML5 Security Resources Repository http://html5security.org/ • HTML5 Security Cheat Sheet https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet • Using the HTML5 FullScreen API for Phishing Attacks http://feross.org/html5-fullscreen-api-attack/ • This Presentation (Presented at Sector – October 2, 2012) http://www.atominformationsecurity.com//Resources/HTML5AppSec.pdf • Demo Code Used http://www.atominformationsecurity.com/Resources/HTML5AppSec.zip 20