On Mon, Apr 29, 2013 at 1:24 PM, Ian Melven <
ime...@mozilla.com> wrote:
>
> Hi,
>
> style-src: unsafe-inline to be pedantic ;)
Yes, thanks.
> which innerHTML threats are we particularly worried about ? arbitrary element injection ? inline scripts via injecting <script> tags, setting event handlers, etc.
> _should_ still be blocked by a CSP that prevents inline scripting. Restricting use of <base> has also been brought up as
> something CSP 1.1 should do.
Oooh, base is a really good point. I wonder if that should be disabled
by default even. It seems very scary. Especially considering how
rarely it is used on modern web pages, the reward/risk ratio of
disabling it by default seems very good.
> i do think your 'block innerHTML' CSP directive idea is worth exploring though - that's why i want to understand exactly what we'd be
> addressing via it.
Mostly as a defense-in-depth mechanism. Basically it seems like using
innerHTML to inject content into a page will commonly be part of an
attack that uses multiple weaknesses or bugs in order to cause XSS or
other privilege escalation.
I.e. if we have a bug in our script blocking code, or in our CSS
src-limiting code, then it seems like using innerHTML would be a good
way to exploit that.
Another scenario could be a DoS because an injected <div
class="submitButton"> lays out on top of the real submit button
because there's a CSS rule om a stylesheet that uses a .submitButton
selector to position elements.
And even something trivial as making the SMS app look ugly by sending
a text message with "<b>text here</b>".
During gaia development we found several accidental uses of .innerHTML
which resulted in various degrees of harm to the user. But no (or
almost no) "correct" uses of .innerHTML. So the risk of having the
feature enabled very heavily outweighed the value we got out of it.
/ Jonas