Closed
Bug 1316826
Opened 9 years ago
Closed 9 years ago
CSP bypass with DOM events and 'strict-dynamic'
Categories
(Core :: DOM: Security, defect, P1)
Tracking
()
VERIFIED
FIXED
mozilla53
Tracking | Status | |
---|---|---|
firefox49 | --- | unaffected |
firefox-esr45 | --- | unaffected |
firefox50 | --- | unaffected |
firefox51 | --- | unaffected |
firefox52 | + | verified |
firefox53 | --- | verified |
People
(Reporter: buglloc, Assigned: freddy)
References
Details
(4 keywords, Whiteboard: [post-critsmash-triage][domsecurity-active])
Attachments
(4 files, 1 obsolete file)
3.33 KB,
patch
|
dveditz
:
review+
|
Details | Diff | Splinter Review |
2.71 KB,
patch
|
dveditz
:
review+
dveditz
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
2.34 KB,
patch
|
dveditz
:
review+
|
Details | Diff | Splinter Review |
1.09 KB,
patch
|
dveditz
:
review+
dveditz
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20161110030211
Steps to reproduce:
- Enable 'strict-dynamic' if needed ("security.csp.enableStrictDynamic")
- Open the following URL: data:text/html,<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-123' 'strict-dynamic'"><marquee onstart="alert('test')"></marquee>
Actual results:
JavaScript code "alert('test')" will be executed due to 'strict-dynamic
Expected results:
_inline_ javascript code not executed.
Assignee | ||
Comment 1•9 years ago
|
||
Confirmed. This isn't even marquee specific. It fires for img onerror and input onkeyup just as well.
Group: firefox-core-security → core-security
Status: UNCONFIRMED → NEW
status-firefox49:
--- → unaffected
status-firefox50:
--- → unaffected
status-firefox51:
--- → unaffected
status-firefox52:
--- → affected
status-firefox-esr45:
--- → unaffected
Component: Untriaged → DOM: Security
Ever confirmed: true
Flags: sec-bounty?
Product: Firefox → Core
Summary: CSP bypass with "marquee" html events and 'strict-dynamic' → CSP bypass with DOM events and 'strict-dynamic'
Assignee | ||
Comment 2•9 years ago
|
||
Well, what I did was not a great way to test, actually. We'd need something to compare parser inserted versus non-parser inserted. In any case, the marquee tag in comment 0 should not work. Investigating.
Updated•9 years ago
|
Group: core-security → dom-core-security
Comment 3•9 years ago
|
||
Freddy: assigning this to ckerschb, but based on your interest if you want to take it feel free.
We need to uplift this to Fx52 when we've fixed it.
Assignee: nobody → ckerschb
tracking-firefox52:
--- → +
Keywords: csectype-other,
sec-moderate
Priority: -- → P1
Whiteboard: [domsecurity-active]
Assignee | ||
Comment 4•9 years ago
|
||
I've added two test cases, care to take a look, Dan?
Attachment #8811218 -
Flags: review?(dveditz)
Comment 5•9 years ago
|
||
Comment on attachment 8811218 [details] [diff] [review]
0001-Bug-1316826-test-case-strict-dynamic-blocks-inline-e.patch
Review of attachment 8811218 [details] [diff] [review]:
-----------------------------------------------------------------
r=dveditz
The marquee test is only valid when bug 1312272 is fixed (which it is on beta and below)
Attachment #8811218 -
Flags: review?(dveditz) → review+
Assignee | ||
Comment 6•9 years ago
|
||
Approval Request Comment
[Feature/regressing bug #]:
bug 1299483 introduced strict-dynamic, which was implemented incorrectly (causing CSP bypasses). It is already in Aurora, so we'd want this uplifted
[User impact if declined]:
CSP is broken for websites using strict-dynamic. If we do not take this bug, we'd need to uplift a patch that disables the feature (it's behidn a pref)
[Describe test coverage new/current, TreeHerder]:
strict-dynamic has good test coverage, I've added tests for this specific bug in another patch set.
[Risks and why]:
risk seems very low, I'm changing two "false" literals into "true".
[String/UUID change made/needed]:
No string/uuid changes.
Assignee: ckerschb → fbraun
Status: NEW → ASSIGNED
Attachment #8812707 -
Flags: review?(dveditz)
Attachment #8812707 -
Flags: approval-mozilla-aurora?
Assignee | ||
Comment 7•9 years ago
|
||
Comment for the bounty team: This bug was filed against <marquee> elements (XBL code). Investigating this it turned out to be more problematic as it affects all attribute event handlers. I want to highlight this as a useful submission :-)
Assignee | ||
Comment 8•9 years ago
|
||
Successful try run with a minimized version of the patch: https://treeherder.mozilla.org/#/jobs?repo=try&revision=aa5778206a5b7118d084c1c629f8072300ffd3c5
Updated•9 years ago
|
Blocks: 1299483
Keywords: regression
Comment 9•9 years ago
|
||
Comment on attachment 8812707 [details] [diff] [review]
0001-Bug-1316826-parserCreated-should-be-false-for-inline.patch
Review of attachment 8812707 [details] [diff] [review]:
-----------------------------------------------------------------
r=dveditz
a=dveditz
Attachment #8812707 -
Flags: review?(dveditz)
Attachment #8812707 -
Flags: review+
Attachment #8812707 -
Flags: approval-mozilla-aurora?
Attachment #8812707 -
Flags: approval-mozilla-aurora+
Assignee | ||
Comment 10•9 years ago
|
||
Please check in.
Landing the test means telling everyone about the exploit. But this isn't in release yet.
AFAIU it's fine to land as long as we land in aurora and central at the same time.
Keywords: checkin-needed
Comment 11•9 years ago
|
||
Reporter | ||
Comment 12•9 years ago
|
||
Frederik: the "aParserCreated" must be set for javascript: URIs [1] ?
I didn't check with your fix, but I assume that cases are still bypasses CSP with 'strict-dynamic' policy:
- data:text/html,<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-123' 'strict-dynamic'"><iframe src="javascript:alert('test')"></iframe>
- data:text/html,<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-123' 'strict-dynamic'"><a href="javascript:alert('test')">Click me</a>
Can you check it?
[1] http://searchfox.org/mozilla-central/source/dom/jsurl/nsJSProtocolHandler.cpp#186
Assignee | ||
Comment 14•9 years ago
|
||
Ugh, thank you Andrew!
I'll create a follow-up patch first thing tomorrow. Should be another simple true/false change.
Assignee | ||
Comment 15•9 years ago
|
||
Tanvi, can you take a look? It's a simple change that was missing from the previously landed patches.
Attachment #8813054 -
Flags: review?(tanvi)
Assignee | ||
Comment 17•9 years ago
|
||
Comment on attachment 8813054 [details] [diff] [review]
0001-Bug-1316826-fix-up-for-JS-URLs-r-tanvi.patch
Approval Request Comment (see comment 6, this is a fixup :/)
[Feature/regressing bug #]:
bug 1299483 introduced strict-dynamic, which was implemented incorrectly (causing CSP bypasses). It is already in Aurora, so we'd want this uplifted
[User impact if declined]:
the fix that we landed previously would be incomplete (CSP bypassable when using strict-dynamic)
[Describe test coverage new/current, TreeHerder]:
test included
[Risks and why]:
risk seems very low, I'm changing a "false" literal into "true".
[String/UUID change made/needed]: none
Attachment #8813054 -
Flags: approval-mozilla-aurora?
![]() |
||
Comment 18•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2fee4cc0f780
https://hg.mozilla.org/mozilla-central/rev/cfff89d0d8c9
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Comment 19•9 years ago
|
||
(In reply to Frederik Braun [:freddyb] from comment #15)
> Created attachment 8813054 [details] [diff] [review]
> 0001-Bug-1316826-fix-up-for-JS-URLs-r-tanvi.patch
>
> Tanvi, can you take a look? It's a simple change that was missing from the
> previously landed patches.
There are a bunch of whitespace changes here. I'm not familiar with this code and am swamped with another bug, so perhaps it is better to flag Dan here.
Updated•9 years ago
|
Attachment #8813054 -
Flags: review?(tanvi) → review?(dveditz)
Updated•9 years ago
|
Attachment #8813056 -
Flags: review?(tanvi) → review?(dveditz)
Assignee | ||
Comment 20•9 years ago
|
||
(In reply to Tanvi Vyas [:tanvi] from comment #19)
> There are a bunch of whitespace changes here.
Oops. Removing.
Assignee | ||
Comment 21•9 years ago
|
||
Approval Request see comment 6 and comment 17.
Attachment #8813054 -
Attachment is obsolete: true
Attachment #8813054 -
Flags: review?(dveditz)
Attachment #8813054 -
Flags: approval-mozilla-aurora?
Attachment #8813560 -
Flags: review?(dveditz)
Attachment #8813560 -
Flags: approval-mozilla-aurora?
Updated•9 years ago
|
Group: dom-core-security → core-security-release
Assignee | ||
Updated•9 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Updated•9 years ago
|
Attachment #8813056 -
Flags: review?(dveditz) → review+
Comment 22•9 years ago
|
||
Comment on attachment 8813560 [details] [diff] [review]
0001-Bug-1316826-fix-up-for-JS-URLs-r-dveditz.patch
Review of attachment 8813560 [details] [diff] [review]:
-----------------------------------------------------------------
crap, sorry for the bad review in bug 1299483
r=dveditz
a=dveditz
Attachment #8813560 -
Flags: review?(dveditz)
Attachment #8813560 -
Flags: review+
Attachment #8813560 -
Flags: approval-mozilla-aurora?
Attachment #8813560 -
Flags: approval-mozilla-aurora+
Updated•9 years ago
|
Comment 24•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/011a51e21bbbb73b83918c798756376cd62601e7
https://hg.mozilla.org/integration/mozilla-inbound/rev/df24b83fca7a5771149f46711841abeaff34adb7
To whoever ends up doing the Aurora uplifts, only these two new patches need uplifting as the original two were uplifted in comment 13. Hopefully we'll use new bugs to track any further issues to avoid over-complicating things.
Keywords: checkin-needed
![]() |
||
Comment 25•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/011a51e21bbb
https://hg.mozilla.org/mozilla-central/rev/df24b83fca7a
Status: REOPENED → RESOLVED
Closed: 9 years ago → 9 years ago
Resolution: --- → FIXED
![]() |
||
Comment 26•9 years ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM] from comment #24)
> To whoever ends up doing the Aurora uplifts, only these two new patches need
> uplifting as the original two were uplifted in comment 13. Hopefully we'll
> use new bugs to track any further issues to avoid over-complicating things.
thanks Ryan :)
uplifted
https://hg.mozilla.org/releases/mozilla-aurora/rev/42a574257cf3
https://hg.mozilla.org/releases/mozilla-aurora/rev/e3e01366879b
Updated•9 years ago
|
Flags: sec-bounty? → sec-bounty+
Updated•9 years ago
|
Flags: qe-verify+
Whiteboard: [domsecurity-active] → [post-critsmash-triage][domsecurity-active]
Comment 27•9 years ago
|
||
Reproduced the original issue using the POC from comment#0 and comment#12 using the following build:
* fx52.0a1, buildid: 20161111030203, changeset: d38d06f85ef5
** https://archive.mozilla.org/pub/firefox/nightly/2016/11/2016-11-11-03-02-03-mozilla-central/
Went through verification using the following builds:
======================================================
* fx54.0a1, buildid: 20170302030206, changeset: e91de6fb2b3d
** https://archive.mozilla.org/pub/firefox/nightly/2017/03/2017-03-02-03-02-06-mozilla-central/
* fx53.0a2, buildid: 20170302004002, changeset: a89019f9eec3
** https://archive.mozilla.org/pub/firefox/nightly/2017/03/2017-03-02-00-40-02-mozilla-aurora/
* fx52.0, buildid: 20170227080736, changeset: 2183f7cb4f88
** https://archive.mozilla.org/pub/firefox/candidates/52.0-candidates/build1/
Platforms Used:
===============
* macOS 10.12.3 x64 - PASSED
* Win 10 Pro x64 - PASSED
* Ubuntu 16.04.2 LTS x64 - PASSED
Test Cases Used:
================
* ensured the issue isn't reproducible under e10s tabs
* ensured the issue isn't reproducible under non-e10s tabs
* ensured the issue isn't reproducible under private tabs
* ensured the issue isn't reproducible under container tabs
Ensured that following error message is displayed under the browser console:
* Content Security Policy: The page’s settings blocked the loading of a resource at self (“script-src 'nonce-123' 'strict-dynamic'”).
Updated•8 years ago
|
Group: core-security-release
Updated•1 year ago
|
Keywords: reporter-external
Updated•3 months ago
|
Keywords: csectype-other → csectype-mitigation-bypass
You need to log in
before you can comment on or make changes to this bug.
Description
•