New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 630753 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Content of MHTML file not shown when open from Drive

Project Member Reported by weiran@google.com, Jul 22 2016

Issue description

OS: <Android L>

What steps will reproduce the problem?
(1)Save a mhtml file in Google Drive.
(2)Open Drive on Android device.
(3)Tap on the mhtml file.

What is the expected output?
Mhtml file is opened in Chrome, showing the content.

What do you see instead?
No content shows. Page is blank.

This issue is caused by security check in MHTMLArchive::create. Content uri is not considered as an local scheme.

There are two proposed solution:
1. Removed the security check.
2. Add content as local schemes.
 
Seems to me that the check is obsolete now that scripts are disabled in MHTML.  Ɓukasz, what do you think?

Comment 2 by weiran@google.com, Jul 22 2016

There are some related discussion in bug https://bugs.chromium.org/p/chromium/issues/detail?id=126955

Cc: jcivelli@chromium.org dcheng@chromium.org
Components: Blink>SavePage
+jcivelli@ as he is the author of the "For security reasons we only load MHTML pages from the local file system" check

+dcheng@ as he has more experience than me on the security team and might hopefully help with the discussion of XSS risks associated with allowing opening MHTML from the web (rather than only from local files)


I don't understand what is meant by "now that scripts are disabled in MHTML" :-(  When saving HTML into MHTML, scripts (i.e. contents of body.onload or span.onclick attribute) are preserved (I've just checked on ToT).  OTOH, when opening the saved MHTML file I indeed didn't see the alert / the effects of script execution.  I don't understand why this happened / why javascript didn't get executed.  Could you help me find code that vets javascript in MHTML files?


In parallel I tried to understand what security-sensitive scenarios we were concerned above when we introduced the check in MHTMLArchive::create.  Unfortunately I was only able to find the following:

- The check for only loading MHTML from "local" URIs has been present in MHTMLAchive.cpp since the first commit - https://chromium.googlesource.com/chromium/src/+/c780cb02dc1cd621d0777e0bfca53ebd5a74286d

- Some questions have been asked about the security check during code review at https://bugs.webkit.org/show_bug.cgi?id=7168 ("Interesting.  Is that true for the other archive formats?"), but they haven't been answered.  


Without understanding scenarios the check protects against, I am not sure if I can confidently say that without javascript execution we are safe (despite MHTML's ability to present arbitrary content as originating from a given site/domain).  There might be other, non-javascript-related ways for unexpected content to be harmful (i.e. if javascript from main frame trusts dom contents of subframes, then if one subframe can influence content of other, cross-origin subframes maybe bad things can happen).
Project Member

Comment 4 by sheriffbot@chromium.org, Jul 23 2016

Labels: Hotlist-Google

Comment 5 by dcheng@chromium.org, Jul 25 2016

Cc: mkwst@chromium.org palmer@chromium.org
Re scripting: we don't allow scripts to run in MHTML pages, because the MHTML format allows a resource to specify its origin. A malicious MHTML file could abuse this to steal local storage, etc.

I'm not really familiar with Android's content URIs, so I'm not sure how safe it is to always consider them as local resources. CCing some people who might know more...

Comment 6 by dcheng@chromium.org, Jul 25 2016

I also did some code archaeology: it looks like this check landed with the original patch for MTHML support: https://bugs.webkit.org/show_bug.cgi?id=7168

and was tweaked in https://bugs.webkit.org/show_bug.cgi?id=86540 to use SchemeRegistry.

Comment 7 by mkwst@chromium.org, Jul 25 2016

1. As dcheng@ alludes to, MHTML has some interesting properties that make it dangerous. Without a more thorough audit of the system, I'm reluctant to consider MHTML URLs as anything other than malicious and dangerous. So, I'd like to keep the check.

2. Setting Android's content URLs as local would have a number of side effects. It would be good to run through the callsites of `SecurityOrigin::isLocal()` (which would start returning `true`) and `SecurityOrigin::canDisplay()` (which would start returning `false` pretty often).

Comment 8 by weiran@google.com, Jul 27 2016

Cc: fgor...@chromium.org

Comment 9 by weiran@google.com, Jul 27 2016

Components: UI>Browser>Offline

Comment 10 by weiran@google.com, Aug 11 2016

Cc: dim...@chromium.org jianli@chromium.org
Status: Fixed (was: Untriaged)

Sign in to add a comment