34
David Ross Principal Software Security Engineer Trustworthy Computing Security Microsoft

Insane in the IFRAME -- The case for client-side HTML sanitization

Embed Size (px)

DESCRIPTION

Server-side HTML sanitization is a familiar web application building block, yet despite years of offensive security research, defensive “sanitizer science” is still a kind of voodoo magic. This talk will make the case that as server-side HTML sanitizers lack the ability to effectively simulate every potential user agent, the client itself is the only party empowered to perform accurate sanitization. We will examine the DOM API primitives required to perform such client-side sanitization and review results and learning from a prototype implementation.

Citation preview

Page 1: Insane in the IFRAME -- The case for client-side HTML sanitization

David RossPrincipal Software Security EngineerTrustworthy Computing SecurityMicrosoft

Page 3: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 4: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 7: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 10: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 11: Insane in the IFRAME -- The case for client-side HTML sanitization

difficult

Page 12: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 13: Insane in the IFRAME -- The case for client-side HTML sanitization

• No independent parsing / context handling

Page 15: Insane in the IFRAME -- The case for client-side HTML sanitization

document.implementation.createHTMLDocument

Page 17: Insane in the IFRAME -- The case for client-side HTML sanitization

3. Remove elements / attributes / etc. not explicitly allowed*

* Old (less-performant) approach:Build yet another DOM by copying safe elements / attributes / etc. to a new DOM during tree walk

Page 18: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 19: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 21: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 23: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 25: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 26: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 27: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 28: Insane in the IFRAME -- The case for client-side HTML sanitization

[Demo] [Benchmark]

Options precedence / inheritance rules: (Options specified on target element) > (options specified on sanitize() call) > (default options)

Page 29: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 30: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 31: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 33: Insane in the IFRAME -- The case for client-side HTML sanitization
Page 34: Insane in the IFRAME -- The case for client-side HTML sanitization

I just presented on HTML sanitization at OWASP AppSec EU 2013. AMA! (self.AMA)

1 Submitted 1 second ago by randomdross

0 comments share