Unexpected URL can be loaded via embed/object elements due to non-strict YouTube URL replacement
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: masatokinugawa, Assigned: emk)
Details
(4 keywords, Whiteboard: [client-bounty-form][adv-main140+][adv-esr128.12+])
Attachments
(6 files, 3 obsolete files)
|
799 bytes,
text/html
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr128+
|
Details | Review |
|
346 bytes,
text/plain
|
Details |
When loading a YouTube URL of a particular format via an <embed> or <object> element, Firefox replaces the specified URL. It is done in nsObjectLoadingContent::MaybeRewriteYoutubeEmbed : https:// github.com/mozilla-firefox/firefox/blob/4b584585f7b4ed77738aa20a2d1bc2ba9e8a464f/dom/base/nsObjectLoadingContent.cpp#L508-L603
Here, the first & string contained in the specified URL is replaced with ?: https://github.com/mozilla-firefox/firefox/blob/4b584585f7b4ed77738aa20a2d1bc2ba9e8a464f/dom/base/nsObjectLoadingContent.cpp#L578
However this replacement is not strct and allows fetching unexpected hosts.
The issue can be reproduced via the following HTML. If the PoC works correctly, example.com host instead of the expected YouTube host will be embedded in the subframe.
<embed src="https://example.com&@www.youtube.com/v/lG7U3fuNw3A"></embed>
or
<object data="https://example.com&@www.youtube.com/v/lG7U3fuNw3A"></object>
This can result in embedding unexpected hosts, even if the application embeds the URL from the embed/object tag after validating user-specified URL correctly.
The following is an example of content being loaded from an unexpected host even though the client-side JavaScript validates the specified host and protocol properly.
https://vulnerabledoma.in/fx_wrong_url_loaded_via_embed.html
Comment 1•1 year ago
|
||
The URI/URL seems to be parsed correctly, so this may be a bug in DOM.
Updated•1 year ago
|
Comment 2•1 year ago
|
||
From reading bug 1258053, it looks like this was related to the Flash plugin so maybe we can remove it? I'm not entirely sure of what the security implications are.
Updated•1 year ago
|
Comment 3•1 year ago
|
||
Interestingly, this rewriting is controlled by a pref and even has a use counter. The use counter only records if a URL could be rewritten, not that there was actually any change from it, but we're getting like 100k hits per day. I haven't looked at use counters before, but that sounds like a lot.
| Assignee | ||
Comment 4•1 year ago
|
||
We should use pathQueryRef instead of the entire spec.
| Assignee | ||
Comment 5•1 year ago
|
||
Updated•1 year ago
|
| Assignee | ||
Comment 6•1 year ago
|
||
Comment 7•1 year ago
|
||
I'll mark this as sec-moderate, as it sounds like the exploit scenario here is that you are bypassing a site restriction for validating a user-supplied URL, and I think that's what we tend to use for things in that category, like CSP bypasses. I don't think we have a specific csectype for that, however.
Updated•1 year ago
|
Comment 9•11 months ago
|
||
| Assignee | ||
Comment 10•11 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D252841
Updated•11 months ago
|
Updated•11 months ago
|
Comment 11•11 months ago
|
||
:emk, could you complete the uplift request form on the beta uplift request?
It grafts cleanly to ESR128, looks like it's needed there also?
Comment 12•11 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined: Attackers can load a malicios website in a subframe bypassing site filters
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: N/A
- Risk associated with taking this patch: Low
- Explanation of risk level: Only reduced a range of string replacement, automated test is works loccally (not landing yet because this is a security sensitive bug and the test contains a PoC)
- String changes made/needed: No
- Is Android affected?: yes
| Assignee | ||
Comment 13•11 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D252841
Updated•11 months ago
|
Comment 14•11 months ago
|
||
firefox-esr128 Uplift Approval Request
- User impact if declined: Attackers can load a malicios website in a subframe bypassing site filters
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: N/A
- Risk associated with taking this patch: low
- Explanation of risk level: Only reduced a range of string replacement, automated test is works loccally (not landing yet because this is a security sensitive bug and the test contains a PoC)
- String changes made/needed: no
- Is Android affected?: yes
| Assignee | ||
Comment 15•11 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D252841
Updated•11 months ago
|
Comment 16•11 months ago
|
||
firefox-esr115 Uplift Approval Request
- User impact if declined: Attackers can load a malicios website in a subframe bypassing site filters
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: N/A
- Risk associated with taking this patch: low
- Explanation of risk level: Only reduced a range of string replacement, automated test is works loccally (not landing yet because this is a security sensitive bug and the test contains a PoC)
- String changes made/needed: no
- Is Android affected?: yes
| Assignee | ||
Comment 17•11 months ago
|
||
(In reply to Donal Meehan [:dmeehan] from comment #11)
:emk, could you complete the uplift request form on the beta uplift request?
It grafts cleanly to ESR128, looks like it's needed there also?
Sorry, I didn't find the upload request form. I have filled the form now.
Updated•11 months ago
|
Updated•11 months ago
|
Comment 18•11 months ago
|
||
| uplift | ||
Updated•11 months ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Comment 19•11 months ago
|
||
| uplift | ||
Updated•11 months ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Comment 20•11 months ago
|
||
Updated•11 months ago
|
Comment 21•11 months ago
|
||
Updated•11 months ago
|
| Reporter | ||
Comment 22•11 months ago
|
||
I think the advisory is wrong. This bug rewrites a YouTube URL to a different host (e.g. from www.youtube.com to attacker.example.com).
This bug is problematic when YouTube embeds are expected.
Comment 23•11 months ago
|
||
Updated•11 months ago
|
Comment 24•11 months ago
|
||
(In reply to Pulsebot from comment #8)
Pushed by VYV03354@nifty.ne.jp:
https://github.com/mozilla-firefox/firefox/commit/7ef2c4c3642a
https://hg.mozilla.org/integration/autoland/rev/cf4ccb536244
Apply YouTube embed URL replacement to the path component. r=dom-core,farre
Perfherder has detected a devtools performance change from push cf4ccb5362445e499d5f219d115333d85a4c4edf.
If you have any questions, please reach out to a performance sheriff. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.
Improvements:
| Ratio | Test | Platform | Options | Absolute values (old vs new) |
|---|---|---|---|---|
| 3% | damp custom.netmonitor.requestsFinished.DAMP | linux1804-64-shippable-qr | e10s fission stylo webrender | 2,577.99 -> 2,502.55 |
Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.
If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a performance sheriff to do that for you.
You can run all of these tests on try with ./mach try perf --alert 45690
The following documentation link provides more information about this command.
Updated•5 months ago
|
Comment 25•5 months ago
|
||
Comment 26•5 months ago
|
||
| bugherder | ||
Description
•