New issue
Advanced search Search tips

Issue 799395 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 75070
Owner: ----
Closed: Jan 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: ----
Type: Bug-Security



Sign in to add a comment

Security: <embed> element doesn't enforce MIME type matching, which may allow CSRF

Reported by xiaoyi...@outlook.com, Jan 5 2018

Issue description

VULNERABILITY DETAILS
I find that Chrome doesn't check if the "type" specified on <embed> tag matches the Content-Type specified in the HTTP response header. Especially unlike <object> element, <embed> doesn't have a "typemustmatch" attribute. The spec states: "If both the type attribute and the src attribute are present, then the type attribute must specify the same type as the explicit Content-Type metadata of the resource given by the src attribute."[1] Thus, I think websites do expect browsers to enforce this requirement. It's worth to mention that the <embed> element setup Step 3.2 seems to contradict with the above statement by saying that:
>    2. Determine the type of the content being embedded, as follows (stopping at the first substep that determines the type):
>     1. If the element has a type attribute, and that attribute's value is a type that a plugin supports, then the value of the type attribute is the content's type.

An attack scenario is: An online forum website allows users to upload arbitrary pictures as avatars to the server, and to embed arbitrary Flash media in their posts by providing external URLs. An attacker can create a malicious Flash media, change its filename extension to ".png", and upload it to the website. Provided he also knows the URL on which this "flash-as-a-picture" resides, he then embeds this URL as a Flash media in a post. Whenever a user visits this post, Chrome will run the Flash when he clicks "Allow". If this file is located on the domain as the HTML (not best practice, but common for small websites), and crossdomain.xml allows this domain, this malicious Flash can easily bypass CSRF.

PoC: https://xiaoyinl.github.io/kkp452w/ (not public)

[1] https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-embed-type

VERSION
Chrome Version: [63.0.3239.132] + [stable]
Operating System: Windows 10 x64 Version 1709

REPRODUCTION CASE
1. Navigate to https://xiaoyinl.github.io/kkp452w/
2. Click to enable Adobe Flash Player


 
IE, Firefox, and Chrome all have the same behavior on this issue (with the exception that Edge blocks the Flash to run), which makes me wonder if this is intentional. But unless I miss something, I still feel this behavior is quite unsafe.
Components: Blink>HTML>Embed
Labels: OS-Android OS-Chrome OS-Linux OS-Mac OS-Windows
Interesting. Can SVG also be hosted in an embed?
Cool report and POC.

However, I'm not sure this needs to be view restricted. I think the same issue was described here in 2011 https://lcamtuf.blogspot.com/2011/03/warning-object-and-embed-are-inherently.html I think this is more of a feature request.

We can see what some of the blink folks think about this.
Mergedinto: 75070
Status: Duplicate (was: Unconfirmed)
Also worth quoting this from  issue 75070  which reports the same issue as the blog post:

"(And in a perfect world, Content-Type and type= should be required to match, but that's not going to happen.)"

I agree since I imagine enforcing this would break too much of the web.

I'm marking this as duplicate because the issue was discussed already.

elawrence@ it seems that SVG can be hosted in an embed:
Step 3 in the spec implies it, and it is discussed here.
https://stackoverflow.com/questions/4476526/do-i-use-img-object-or-embed-for-svg-files
Project Member

Comment 5 by sheriffbot@chromium.org, Apr 14 2018

Labels: -Restrict-View-SecurityTeam allpublic
This bug has been closed for more than 14 weeks. Removing security view restrictions.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Perhaps confusingly, this issue was resolved DUPLICATE to a bug marked FIXED, while the actual outcome here is WONTFIX. 

Sign in to add a comment