Closed Bug 1617423 (CVE-2020-6818) Opened 6 years ago Closed 6 years ago

Accessing about:* internal pages via intent:// URIs

Categories

(Firefox for Android Graveyard :: General, defect, P1)

defect

Tracking

(firefox-esr6874+ verified, firefox73 unaffected, firefox74 unaffected, firefox75 unaffected, firefox76 unaffected)

VERIFIED FIXED
Tracking Status
firefox-esr68 74+ verified
firefox73 --- unaffected
firefox74 --- unaffected
firefox75 --- unaffected
firefox76 --- unaffected

People

(Reporter: danutzu7, Assigned: petru)

References

()

Details

(4 keywords, Whiteboard: [reporter-external] [client-bounty-form] [verif?])

Attachments

(2 files, 1 obsolete file)

Attached file console.html —

This issue affects Firefox for Android, tested on v68.5.0.

I noticed that intent:// URIs can be used for opening internal pages (such as about:config or about:accounts) in a new tab. Normally, websites are not allowed to open the internal pages (not in an iframe, new tab or new window), however it seems that the handle for intent:// URIs is missing this this check.

Let's consider the following intent URI:
intent://example.com#Intent;scheme=https;package=org.mozilla.firefox;end

While parsing this URI, Firefox for Android should create an intent that will be sent to "org.mozilla.firefox" (1) package in order to open the host "example.com" (2) using the protocol "https" (3) . In simpler terms, Firefox (1) will open https://example.com - (3)://(2) in a new tab.

Although there are a number of security checks in place (the intent URIs cannot be used with schemes starting with view-source: or javascript: or data: or file: etc), I noticed that it is possible to add an entire about:* internal URI to the "scheme" parameter:
intent://example.com#Intent;scheme=about:config?param=value&%23;package=org.mozilla.firefox;end

The above URI will trick the browser into opening the following URI in a new tab:
about:config?param=value&#://example.com

The above will open about:config page, will pass the param=value GET parameter and will ignore the host "example.com" (2) specified in the intent:// URI because of the hash (#) sign.


I consider this behavior to represent a security vulnerability because:
1. This does not look like intended behaviour:
   a) about:* internal pages cannot be normally opened via JavaScript, anchors or redirects;but can be opened via the above trick;
   b) the intent:// URIs are validated to not be able to access most of Firefox's sensitive schemes (data, javascript, file, view-source etc), but lacks the check for "about" scheme

 2. This can actually be abused by attackers in order to re-configure / modify some of Firefox's internal settings. the about:* pages are not protected against Click-Jacking (or Tap-Jacking?) types of attacks and are built for users who open them on purpose, "knowing what they are doing".

In the example with "about:config", potential attackers can also pass the "filter" get parameter while opening the URL, in order to only display specific settings. Since a number of the available settings are Boolean, their value can be toggled with a simple tap on the setting. This makes possible an attack scenario where an attacker would:

  1. Convince the victim user to tap repeatedly on the screen - let's say through a game - while they visit a website under the attacker's control;
  2. Open "about:config" and focus on a specific setting which will be specified via a GET filter: "scheme=about:config?filter=security.data_uri.unique_opaque_origin&%23"
  3. Since the victim user is tapping repeatedly, opening the new tab may come as a surprise and some of the taps could toggle the targeted setting;
  4. After a reasonable period of time (1-2-3 seconds) open a new tab, so that the user's focus will move from the about:config tab;

Of course, other attack vectors might be put in place for other about: pages:

  • tampering with a user's account via about:accounts
  • tampering with the browser's cache via about:cache

Demo: http://daniel-tomescu.com/console.php - JavaScript code that will open an intent URI, which will open about:config?filter=security.data_uri.unique_opaque_origin&%23, wait two secconds and open a new tab with https://www.mozilla.org/ to bring the user back to a calm environment.

Demo page is also attached.


I recommend fixing this vulnerability by:
- adding to the blacklist all intent schemes which start with "about:"
- validating the intent's scheme to only have alphanumerical characters (and maybe the minus sign might also be used);
- warning the user that an internal / sensitive page will open each time such a page is opened.
Flags: sec-bounty?

I will also attach a screen capture of how this plays out. Please do not hesitate to reach out to me if more details are needed.

Thank you!

I haven't verified that this works but if it does you also get a perfect DOS through about:crashparent I guess (I still don't understand how we can let that exist)

Snorp, can you take a look at this?

Group: firefox-core-security → mobile-core-security
Component: Security → General
Flags: needinfo?(snorp)
Product: Firefox → Firefox for Android

This is a Fennec bug, but will also affect Fenix once it gains this functionality. Stefan, can you work this in?

Flags: needinfo?(snorp) → needinfo?(sarentz)
Flags: needinfo?(sarentz) → needinfo?(petru.lingurar)

Petru, what do you think of this bug?

Thank you for your detailed report Daniel!

This has already been discussed in bug 1338867 (see dveditz concerns here - bug 1338867 comment 32)
and there is an open meta to "Limit intent filters and check incoming intents against whitelist" - bug 1357377
from which bug 1480806 already removed the javascript scheme.

Interestingly atm Chrome still allows both javascript and about schemes but giving that
the benefit of keeping the about scheme is not clear (we had it from the first Fennec version but the reasons and usages are unclear)
and the possible implications are quite dangerous
I think we can just remove this scheme from Fennec's manifest as a quick fix for Fennec but I don't know if there is still time to get this into a release train.
@Stefan

Fenix doesn't have declared an intent-filter for the "about" schema so it can't be requested from outside to open such Intents.

Flags: needinfo?(petru.lingurar)
Status: UNCONFIRMED → NEW
Ever confirmed: true

I think we can just remove this scheme from Fennec's manifest as a quick fix for Fennec but I don't know if there is still time to get this into a release train.

Kevin do you see any problems with this?

All I can think of is Leanplum deep links but I am pretty sure those do not go through about:.

Flags: needinfo?(kbrosnan)

Hi All,

I'm happy to see that this bug gets some traction and there is a will to fix it.

I think that there is a redirect from a Mozilla web page to about:accounts (I miss the exact details right now); this is used when you send a login link from the Desktop towards the mobile phone, via an SMS, so that you can login in Firefox for mobile easier. So blindly removing the about: scheme might cause some problems.

Thank you!

^ No, I was mistaken, it redirects to a deeplink using "firefox" scheme. Sorry about this.

At this point with Fennec being near complete changing this is a risk. Especially since we would be landing directly onto release. If we really want to do this do test build and send it through a smoketest around things like accounts, reader mode, logins and downloads as those all interact with about: pages. <about:accounts> <about:readermode> <about:logins> <about:downloads>, might be a few I am forgetting.

Flags: needinfo?(kbrosnan)

Thanks for raising that Kevin. So how hard would it be for and attacker to do this and what's the potential impact on users? Sounds like it could mean some of their settings get toggled. Is there any personal information in there that could be leaked?

On one hand, if we don't resolve it before Fenix comes out, then all users on older Android versions that can't upgrade to Fenix will be open to this risk. On the other, it does sound risky to land this straight to release version.

Flags: needinfo?(kbrosnan)

Denial of service is the most likely risk, as mentioned in comment 3 visiting about:crashparent will crash Firefox for Android. A malicious app or website could crash Firefox at will by sending that intent.

The other attack described in comment 0 makes sense but would need to be crafted per device or be well versed in css and mobile layouts to get users to repeatedly click in the same spot across a wide range of devices and screen sizes/densities. They would also need to choose what they wanted to get at carefully as they only get one or two times of doing this before it is suspicious behavior or breaks the enjoyment of the game.

  1. Convince the victim user to tap repeatedly on the screen - let's say through a game - while they visit a website under the attacker's control;
  2. Open "about:config" and focus on a specific setting which will be specified via a GET filter: "scheme=about:config?filter=security.data_uri.unique_opaque_origin&%23"
  3. Since the victim user is tapping repeatedly, opening the new tab may come as a surprise and some of the taps could toggle the targeted setting;
  4. After a reasonable period of time (1-2-3 seconds) open a new tab, so that the user's focus will move from the about:config tab;

The fact that this is web accessible makes me think we should consider fixing this.

Flags: needinfo?(kbrosnan)

we probably don't use it, but in order to not set a bad example for future GeckoView projects we should also remove "about" from https://searchfox.org/mozilla-esr68/source/mobile/android/geckoview_example/src/main/AndroidManifest.xml#43-44

Ryan: I only see "firefox" ESR tracking flags. If my setting needs to be moved to a different "fennec" flag please do so

Flags: needinfo?(ryanvm)

We will not open anymore implicit Android Intents for URIs using the "about"
scheme but we will continue to open such URLs from webpages.
(We have many of them in "about:about")

Trying to open in Firefox such Intents will either trigger the Android App
Chooser or crash the calling app - if it specified our package name.

Assignee: nobody → petru.lingurar
Status: NEW → ASSIGNED

Try build with the "about" scheme removed - to be used in a suite of smoke tests as per comment 10.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=a9dd7a309fe52dec49c9afec144b175869d53628

An important thing to note is that with the above modification in the case of the attack poc because we just ignore the Intent it will be picked up by the system which will open PlayStore to that package name listing.
On Fenix unknown protocols are blocked in GV but we (and Chrome, Brave etc also) are not doing this.
Video - https://drive.google.com/file/d/17pC_Z4Drty40PQPJbXi04OGvHXcP3fvW/view?usp=sharing

Please help smoke test the above TH build based on comment 10.

Flags: qe-verify+
Priority: -- → P1

Hi, we were able to reproduce the issue, with the script, on the following devices:

  • Samsung Galaxy Note9 (Android 9)
  • Samsung Galaxy S8 (Android 8.0.0)
  • Nexus 5 (Android 6.0.1)

Build: Firefox RC 68.6.0

We started testing on the try build from comment16 with the provided script. On the try build the user is redirected to the "Open with" window for Samsung and you able to choose between Google Play Store and Galaxy Store->To Firefox Nightly for developers, as they are both available on the device.
For Nexus 5, the user is redirected to Play Store -> Firefox nightly for developers.

Here are the proposed scenarios we plan to cover based on the details provided:

  1. Check the script from http://daniel-tomescu.com/console.php.(for about:config and cover a couple more through script)
  2. Verify the about pages through link and written directly in URL bar.
  3. The about:account works correctly from banner level - Top Sites panel, from Sign in.
  4. After adding the credentials for a site and saved in browser the user can access through app Menu/Tools/Logins.
  5. After adding an add-on the user can access Menu/Add-ons.
  6. After making a download the user can access the downloaded file from Menu/Tools/Downloads.
  7. about:crashcontent still forces the app to crash and the crash report is present in about:crashes.
  8. The pages can be added in reader mode-the functionality works alongside with the themes and fonts on the page.
    9 From about:support -> All crash reports link redirects correctly->to about:crashes.
  9. The About Nightly from Menu/Settings/Mozilla Nightly work correctly-> about:firefox.

@Kevin, Petru - could you have a look at the scenarios? It should cover most of the functionalities that are reliable on the about pages.

Note:

  • For first scenario changed the script, individually, for about:logins, about:reader?=url, about:downloads, about:addons, about:accounts:
    ("intent://google.com#Intent;scheme=about:config?filter=security.data_uri.unique_opaque_origin&%23;package=org.mozilla.firefox;end")
    to
    ("intent://google.com#Intent;scheme=about:logins%23;package=org.mozilla.firefox;end")
    for each mentioned about page.
Flags: needinfo?(petru.lingurar)
Flags: needinfo?(kbrosnan)

Thank you for testing this Diana!
The scenarios look good, as expected inside the application everything works as before
It just cannot be opened from an external implicit Intent anymore, case in which now the system will open an app store because the Intent targeted to a particular package name could not be opened.

Flags: needinfo?(petru.lingurar)

Yes, that looks great. Thank you Diana.

Flags: needinfo?(kbrosnan)

Hi, finished testing on the try build from comment16 - build Firefox Nightly 68.6a1(2020-02-28), all the proposed scenarios from Comment19. While testing, there hasn't been encountered any problems, no crashes (only the intended ones :), no blocking point at neither scenarios).
Devices:

  • Samsung Galaxy Note9(Android 9)
  • Samsung Galaxy S9(Android 8)
  • Nexus 5 (Android 6.0.1)

Note:

  • For Scenario 1 -Have been taken in consideration testing pages about:config, about:logins, about:accounts, about:reader, about:addons.
  • For Scenario 7 - Instead of about:crashcontent si about:crashparent, as it is in Fennec not Fenix.
  • I will remove the "qe-verify" flag until the est uplift.
Flags: qe-verify+

Our manifest publishes only "about" as a scheme--why is it matching the scheme=about:config; in the PoC? Does android itself do the scheme matching, figure the intent author was an idiot, and ignore everything after a colon? For matching at least; obviously it's sending the whole intent to us once it decides we'll take it.

(In reply to Daniel Veditz [:dveditz] from comment #23)

Our manifest publishes only "about" as a scheme--why is it matching the scheme=about:config; in the PoC? Does android itself do the scheme matching, figure the intent author was an idiot, and ignore everything after a colon? For matching at least; obviously it's sending the whole intent to us once it decides we'll take it.

This is how the intent looks for the application - debug screenshot after changing the script to just target my local build's package.

Not entirely sure how it all translates under the hood but it seems that Android forms an implicit Intent (not targeting a specific component) that:

  • will be sent to the indicated package -> firefox's
  • to be opened by any of it's components that has an intent filter for the part between "scheme=" and colon -> about
  • concatenates chars following "scheme=" and the uri path from between "intent://uri path#Intent" and puts the result in the Intent data as "uriString".
    If nothing would follow the "scheme=about" from the poc the uriString would be "about://google.com"
    Because it is followed by more text the actual uriString formed from the poc is about:config?filter=security.data_uri.unique_opaque_origin&#://google.com
    .. which we'll happily try to open.

The more I think about dveditz's question the more I believe what Android is doing makes sense to me. Apps register protocols which are identifiers that are to the left of the colon (:). Anything to the right of it is up to the app to handle correctly.

Hey,

Actually, I believe the problem is in the way Firefox parses intent:// URIs. The intent:// URI is parsed by Firefox in order to:

  1. Identify the receiving component -> org.mozilla.firefox
  2. Concatenate the URI that will be sent to the receiving component (scheme + "://" + host) -> about:config?filter=security.data_uri.unique_opaque_origin&#://google.com
  3. The intent is sent by Firefox (to org.mozilla.firefox) with scheme "about" (whatever is before the first occurrence of : ).

Please note that "intent://config?filter=security.data_uri.unique_opaque_origin&%23#Intent;scheme=about;package=org.mozilla.firefox;end" would be translated to "about://config?filter=security.data_uri.unique_opaque_origin&#" (please note the two slashes after about: ), which would not work.

Hope this helps.

Comment on attachment 9129735 [details]
Bug 1617423 - Remove the "about" scheme from Fennec's intent-filter; r?AndreiLazar

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: sec-moderate
  • User impact if declined: User could be tricked into enabling certain settings through "about:config"
    Other about pages could be opened without user interaction.
  • Fix Landed on Version:
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Small change, verified by QA
  • String or UUID changes made by this patch:
Attachment #9129735 - Flags: approval-mozilla-esr68?

Comment on attachment 9129735 [details]
Bug 1617423 - Remove the "about" scheme from Fennec's intent-filter; r?AndreiLazar

Fun fact, this line got removed by bug 1618941 already. This should already be fixed in Fennec 68.6 available on the Play Store.

Attachment #9129735 - Flags: approval-mozilla-esr68?
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Group: mobile-core-security → core-security-release
Type: task → defect
Flags: sec-bounty? → sec-bounty+

Hi, verified as fixed on Firefox Beta 68.7b1 and Firefox Release 68.6.0 - build 2, the issue does not reproduce with Samsung Galaxy Note 9 (Android 9) and Sony Xperia Z5 (Android 7)
The check was made with the scenarios from Comment19.
I will mark the issue as verified.

Status: RESOLVED → VERIFIED

Hi @dveditz,

Because this is a somehow atypical security issue, I would like to blog about it and publicly disclose the vulnerability. Am I allowed to do so? Is there any concern that this might negatively impact users?

If you are not OK with it, I will not proceed further. But if you agree, please lift the security restrictions of this bug, I would like to reference it in the article.

Kind Regards,
Daniel Tomescu

Flags: needinfo?(dveditz)

Because of the unusual path this bug took to getting fixed (via another unrelated fix) we missed including this one in our 68.6 ESR/Firefox for Android advisories last month. Adding a CVE now, and we have to fix the advisories.

Yes, please feel free to blog about this. If you do please add the link in a comment here

Alias: CVE-2020-6818
Flags: needinfo?(dveditz)

Tom, something to add to mfsa2020-09?

Flags: needinfo?(tom)

Yes, I can add it there. Daniel, have you blogged about this yet? Assuming so, but if not, let me know your timeline and I will try to do it in time for your publication.

Flags: needinfo?(tom) → needinfo?(danutzu7)

I did not publish anything yet and I do not have a deadline. I will only publish after you have finalized the CVE publication, I do not want to disclose anything sensible before you feel comfortable with me doing so.

Thank you,
Daniel Tomescu

Flags: needinfo?(danutzu7)
Group: core-security-release
Product: Firefox for Android → Firefox for Android Graveyard
Attachment #9129735 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: