Html5

Kochi, India
1 / 81
Slide 1 of Html5
Slide 2 of Html5
Slide 3 of Html5
Slide 4 of Html5
Slide 5 of Html5
Slide 6 of Html5
Slide 7 of Html5
Slide 8 of Html5
Slide 9 of Html5
Slide 10 of Html5
Slide 11 of Html5
Slide 12 of Html5
Slide 13 of Html5
Slide 14 of Html5
Slide 15 of Html5
Slide 16 of Html5
Slide 17 of Html5
Slide 18 of Html5
Slide 19 of Html5
Slide 20 of Html5
Slide 21 of Html5
Slide 22 of Html5
Slide 23 of Html5
Slide 24 of Html5
Slide 25 of Html5
Slide 26 of Html5
Slide 27 of Html5
Slide 28 of Html5
Slide 29 of Html5
Slide 30 of Html5
Slide 31 of Html5
Slide 32 of Html5
Slide 33 of Html5
Slide 34 of Html5
Slide 35 of Html5
Slide 36 of Html5
Slide 37 of Html5
Slide 38 of Html5
Slide 39 of Html5
Slide 40 of Html5
Slide 41 of Html5
Slide 42 of Html5
Slide 43 of Html5
Slide 44 of Html5
Slide 45 of Html5
Slide 46 of Html5
Slide 47 of Html5
Slide 48 of Html5
Slide 49 of Html5
Slide 50 of Html5
Slide 51 of Html5
Slide 52 of Html5
Slide 53 of Html5
Slide 54 of Html5
Slide 55 of Html5
Slide 56 of Html5
Slide 57 of Html5
Slide 58 of Html5
Slide 59 of Html5
Slide 60 of Html5
Slide 61 of Html5
Slide 62 of Html5
Slide 63 of Html5
Slide 64 of Html5
Slide 65 of Html5
Slide 66 of Html5
Slide 67 of Html5
Slide 68 of Html5
Slide 69 of Html5
Slide 70 of Html5
Slide 71 of Html5
Slide 72 of Html5
Slide 73 of Html5
Slide 74 of Html5
Slide 75 of Html5
Slide 76 of Html5
Slide 77 of Html5
Slide 78 of Html5
Slide 79 of Html5
Slide 80 of Html5
Slide 81 of Html5

Abstract

A two-day training covering HTML5 security from both development and attack perspectives, including CORS, local storage, WebSockets, iframe sandboxing, and DOM-based XSS exploitation.

AI Generated Summary

AI Generated Content Disclaimer

Note: This summary is AI-generated and may contain inaccuracies, errors, or omissions. If you spot any issues, please contact the site owner for corrections. Errors or omissions are unintended.

This two-day application security testing course on HTML5 teaches HTML5 security from both the development and attack sides. Day 1 builds understanding of the latest HTML5 buzzwords, CORS, JSON, new tags, local storage, DOM, web workers, Web APIs, WebSockets, and iframe sandboxing, with hands-on app writing, while Day 2 turns offensive, attacking CORS and XHR and exploiting the DOM through DOM-based XSS.

Summary

Day 1 opens with basics: HTML5, created by WHATWG and W3C and released as a stable W3C Recommendation on October 28, 2014, is pitched as able to eliminate Flash from the web. Syntax simplification is shown: the verbose XHTML DOCTYPE collapses to , stylesheets and scripts lose their type attributes, and semantic elements like header, footer, and article arrive as mainly cosmetic or flow elements.

Local storage stores key/value data locally in the browser, more securely and faster than the cookies it replaces, sent only when asked for, with 5 to 10 MB offered per domain, and sessionStorage as the session-scoped sibling. Application cache uses a manifest served as text/cache-manifest with CACHE, NETWORK, and FALLBACK sections for offline browsing, caching fonts, splash images, app icons, and entry pages, never CSS, HTML, or JavaScript.

The remaining Day 1 technologies are surveyed: WebSockets upgrade HTTP connections through the Sec-WebSocket-Key and Sec-WebSocket-Accept handshake; web workers run JavaScript in the background so the page stays responsive; server-sent events push social updates, stock prices, news feeds, and sport results automatically. Iframe sandboxing demonstrates a frame-busting bypass: a page protected by if(self == top) JavaScript is framed anyway using an iframe with the sandbox attribute.

Day 2 attacks. XHR is introduced with the verdict that it is not a silver bullet: XHR lets you fetch content and read responses, but the same origin policy blocks cross-origin reads until CORS relaxes the policy. Interactions split into writes (redirects, links, forms), embedding (script, CSS, img, video), and reads, which are not allowed without CORS. Simple requests (HEAD, GET, or POST, no custom headers, text/plain body, no cookies) skip preflight; anything else triggers an OPTIONS preflight, with * flagged as a bad practice that makes resources public.

Four CORS insecurities follow: universal allow turns content into a public resource; the spoofable Origin header defeats origin-based access control; preflight caching keeps an outdated policy alive through a high Max-Age; misplaced trust means compromising either site yields XSS against the other. CSRF with CORS closes the list: .withCredentials = true replays the victim’s cookies, enabling non-idempotent requests such as creating a user account at site B. Prevention: one non-empty Origin and Host header against an internal whitelist, sender IP caching with 403 after one bad origin, and per-origin permission sets.

The DOM section covers programmatically manipulating page contents as a node hierarchy. Sources include document.cookie, window.name, the URL and location variants, and the referrer; sinks include innerHTML, outerHTML, document.write, eval, execScript, setTimeout, setInterval, script.src, iframe.src, and location.replace or location.assign. Regex patterns find sources, sinks, and jQuery sinks; the tools are andlabs.org, DOMSnitch, RA2, and Dominator.

Key Themes

  • HTML5 as the new baseline: a stable W3C Recommendation since October 2014, able to eliminate Flash, with simplified syntax, semantic elements, new input types, placeholder, and contenteditable.
  • Client-side storage and offline apps: localStorage and sessionStorage offer 5 to 10 MB per domain of key/value data, and application cache manifests enable offline browsing without caching CSS, HTML, or JavaScript.
  • Real-time channels: WebSockets provide upgraded full-duplex connections, web workers move JavaScript off the UI thread, and server-sent events push updates automatically.
  • Sandbox versus frame-busting: the HTML5 iframe sandbox attribute defeats JavaScript frame-busting code that checks self against top.
  • XHR and CORS mechanics: simple requests skip preflight; custom headers, other methods, or other content types trigger an OPTIONS exchange to negotiate access.
  • CORS insecurities: universal allow, spoofable Origin headers, preflight result cache staleness, misplaced trust between domains, and CSRF via withCredentials.
  • CORS prevention: origin whitelists, single non-empty origin and host headers, sender IP caching with 403 responses, strict B2B IP filtering, and per-origin permission sets.
  • DOM-based XSS: sources from URL, cookie, window.name, and referrer flowing into sinks like innerHTML, eval, and document.write, found with regex patterns and tooling.

Notable Points

  • HTML5 was released as a stable W3C Recommendation on October 28, 2014.
  • Origin is defined by protocol, host, and port, so http://127.0.0.1, https://127.0.0.1, and http://127.0.0.1:8080 are all different origins.
  • All modern browsers offer 5 to 10 MB of local storage per domain.
  • Application cache manifests are served with Content-Type: text/cache-manifest; cache fonts, splash images, app icons, and entry pages, never CSS, HTML, or JavaScript.
  • The WebSocket handshake uses Upgrade: WebSocket with Sec-WebSocket-Key on the client and Sec-WebSocket-Accept in the HTTP 101 Switching Protocols response; the cleartext ws scheme and the TLS-protected wss scheme.
  • Frame-busting code like if(self == top) is bypassed with <iframe sandbox src="/examples/framebuster.html" />.
  • Simple CORS requests require HEAD/GET/POST via XHR, no custom headers, text/plain body, and no cookies in request or response; preflight triggers on methods like PUT or DELETE, custom headers, or content types other than application/x-www-form-urlencoded, multipart/form-data, or text/plain.
  • The example preflight exchange shows Access-Control-Allow-Origin listing http://www.example.com and https://login.example.com, with Access-Control-Max-Age: 86400.
  • Origin spoofing demo uses curl --header 'origin:http://someserver.com' against a target origin_spoof.php; the CSRF scenario has .withCredentials = "true" replay cookies so site B creates a user account without the victim’s knowledge.
  • Prevention: cache the sender IP for 1 hour, and one non-whitelisted origin makes all that sender’s requests return HTTP 403. DOM sources include document.cookie, window.name, document.URL, document.URLUnencoded, document.location variants, and document.referrer, flowing into sinks like innerHTML, outerHTML, document.write, eval, execScript, setTimeout, setInterval, script.src, iframe.src, and location.replace/assign; regex patterns find sources, sinks, and jQuery sinks, with andlabs.org, DOMSnitch, RA2, and Dominator as tools.

Notable Quotes

“Next generation of HTML (now current generation)”

“Limelight Point: Can eliminate flash from web”

“Web Storage is more secure and faster.”

“XHR NOT A SILVER BULLET”

“Relax same origin policy and allow third party read”

“Can be set to * to make resources public (bad practice!)”

“I can never be framed”

Resources

Embed This Presentation

See Also