New issue
Advanced search Search tips

Issue 656274 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug-Security



Sign in to add a comment

Security: Cross-origin object leak via fetch

Reported by pim...@live.nl, Oct 15 2016

Issue description

VULNERABILITY DETAILS
The promise returned by `fetch.call(crossOriginWindow)` is created in the cross-origin context. Direct cross-origin scripting is not possible because cross-origin function constructors don't work anymore ( issue 541703 ). But the attacker can e.g. call other functions of the cross-origin page.

VERSION
Chrome Version: 56.0.2891.0 canary (64-bit). Does not reproduce in stable; the promise is generated in the correct context there. Possibly commit [1] might be the cause, but I'm not sure.
Operating System: Windows 10

REPRODUCTION CASE
See attachments. Save in the same directory, then open parent.html. The sandboxed child is able to call `Function.foo` of the parent page.

 [1] https://chromium.googlesource.com/chromium/src/+/afb9da1a91b0d1742a765b7a35f27e1be6645596

 
parent.html
206 bytes View Download
child.html
173 bytes View Download

Comment 1 by pim...@live.nl, Oct 16 2016

In fact, I found a way to bypass the function constructor restrictions. That is, UXSS is possible. The trick is to create and resolve a promise, and call the function constructor in the `then` callback:

  var parent_Promise = fetch.call(parent).constructor;
  var parent_Function = parent_Promise.constructor;
  new parent_Promise(function(resolve) {
    resolve();
  }).then(function() {
    var f = new parent_Function("document.body.style.backgroundColor = 'red';");
    f();
  });
parent.html
77 bytes View Download
child.html
448 bytes View Download

Comment 2 by mmoroz@chromium.org, Oct 17 2016

Cc: mmoroz@chromium.org
Owner: dcheng@chromium.org
Thanks for your report!

dcheng@, would you mind helping to triage this?

Comment 3 by dcheng@chromium.org, Oct 17 2016

Cc: haraken@chromium.org jochen@chromium.org dcheng@chromium.org
Owner: yukishiino@chromium.org

Comment 4 by dcheng@chromium.org, Oct 17 2016

Cc: -jochen@chromium.org yukishiino@chromium.org
Owner: jochen@chromium.org
Actually hmm, bisect-builds.py narrows this down to https://chromium.googlesource.com/chromium/src/+log/2ba53c9cf88833aabbb642e53de195fb150e28f0..d14e966090ffb39319f6baeb364426a00b5ede7b

There's a v8 roll which has https://chromium.googlesource.com/v8/v8/+/d008b9efcbddf299feefe7b420fd7e1601512ba5, so maybe jochen@ should be looking at this one.

Comment 5 by mmoroz@chromium.org, Oct 18 2016

Components: Blink>JavaScript
Labels: Security_Severity-High Security_Impact-Head OS-Windows Pri-1
Status: Available (was: Unconfirmed)
Thanks dcheng@!

Comment 6 by jochen@chromium.org, Oct 18 2016

Owner: yukishiino@chromium.org
Thx for the report, the work-around for the function constructor check looks interesting, I'll investigate how to fix this.

Assigning back to yukishiino@ for using the wrong context in fetch

Comment 7 by jochen@chromium.org, Oct 18 2016

Components: -Blink>JavaScript Blink>Bindings Blink>Network>FetchAPI
Components: -Blink>Network>FetchAPI
Status: Started (was: Available)
I've found that my CL mentioned caused this regression.  This is purely a binding issue, not related to Fetch API.
Project Member

Comment 9 by sheriffbot@chromium.org, Oct 18 2016

Labels: M-55
Project Member

Comment 10 by sheriffbot@chromium.org, Oct 18 2016

Labels: ReleaseBlock-Beta
This issue is a security regression. If you are not able to fix this quickly, please revert the change that introduced it.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -OS-Windows OS-All
Just FYI, I sent out a CL: http://crrev.com/2418413004
Project Member

Comment 12 by sheriffbot@chromium.org, Oct 19 2016

Labels: -Security_Impact-Head Security_Impact-Beta
Project Member

Comment 13 by bugdroid1@chromium.org, Oct 19 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9e04d69152b9c2ac7b4e395213c0e19c52e69bcc

commit 9e04d69152b9c2ac7b4e395213c0e19c52e69bcc
Author: yukishiino <yukishiino@chromium.org>
Date: Wed Oct 19 13:19:13 2016

binding: Creates a reject promise always in the current realm.

Regular promises are created in the relevant real of the context
object.  However, reject promises are special, they must be
created in the current realm as same as exceptions must be
created in the current realm.

BUG= 656274 

Review-Url: https://chromiumcodereview.appspot.com/2418413004
Cr-Commit-Position: refs/heads/master@{#426171}

[add] https://crrev.com/9e04d69152b9c2ac7b4e395213c0e19c52e69bcc/third_party/WebKit/LayoutTests/http/tests/security/promise-realm.html
[modify] https://crrev.com/9e04d69152b9c2ac7b4e395213c0e19c52e69bcc/third_party/WebKit/Source/bindings/core/v8/GeneratedCodeHelper.h
[modify] https://crrev.com/9e04d69152b9c2ac7b4e395213c0e19c52e69bcc/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl

Status: Fixed (was: Started)

Comment 15 Deleted

Labels: -reward-panel reward-topanel
Project Member

Comment 17 by sheriffbot@chromium.org, Oct 20 2016

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Labels: Merge-Request-55
I confirmed that the fix is working fine with Canary(precise64) Version 56.0.2896.3 unknown (64-bit).
Request a merge to M55.

Comment 19 by dimu@chromium.org, Oct 21 2016

Labels: -Merge-Request-55 Merge-Approved-55 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M55 (branch: 2883)
Project Member

Comment 20 by bugdroid1@chromium.org, Oct 21 2016

Labels: -merge-approved-55 merge-merged-2883
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4152354ad141e5f759ee0d80a95b1a8bb49143e7

commit 4152354ad141e5f759ee0d80a95b1a8bb49143e7
Author: Yuki Shiino <yukishiino@chromium.org>
Date: Fri Oct 21 07:07:09 2016

binding: Creates a reject promise always in the current realm.

Regular promises are created in the relevant real of the context
object.  However, reject promises are special, they must be
created in the current realm as same as exceptions must be
created in the current realm.

BUG= 656274 

Review-Url: https://chromiumcodereview.appspot.com/2418413004
Cr-Commit-Position: refs/heads/master@{#426171}
(cherry picked from commit 9e04d69152b9c2ac7b4e395213c0e19c52e69bcc)

Review URL: https://codereview.chromium.org/2438253002 .

Cr-Commit-Position: refs/branch-heads/2883@{#227}
Cr-Branched-From: 614d31daee2f61b0180df403a8ad43f20b9f6dd7-refs/heads/master@{#423768}

[add] https://crrev.com/4152354ad141e5f759ee0d80a95b1a8bb49143e7/third_party/WebKit/LayoutTests/http/tests/security/promise-realm.html
[modify] https://crrev.com/4152354ad141e5f759ee0d80a95b1a8bb49143e7/third_party/WebKit/Source/bindings/core/v8/GeneratedCodeHelper.h
[modify] https://crrev.com/4152354ad141e5f759ee0d80a95b1a8bb49143e7/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl

Labels: -ReleaseBlock-Beta
Labels: -reward-topanel reward-unpaid reward-5000
Congratulations, the panel has awarded $5,000 for this report.  Many thanks!
Project Member

Comment 24 by bugdroid1@chromium.org, Oct 27 2016

Labels: merge-merged-2840
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4152354ad141e5f759ee0d80a95b1a8bb49143e7

commit 4152354ad141e5f759ee0d80a95b1a8bb49143e7
Author: Yuki Shiino <yukishiino@chromium.org>
Date: Fri Oct 21 07:07:09 2016

binding: Creates a reject promise always in the current realm.

Regular promises are created in the relevant real of the context
object.  However, reject promises are special, they must be
created in the current realm as same as exceptions must be
created in the current realm.

BUG= 656274 

Review-Url: https://chromiumcodereview.appspot.com/2418413004
Cr-Commit-Position: refs/heads/master@{#426171}
(cherry picked from commit 9e04d69152b9c2ac7b4e395213c0e19c52e69bcc)

Review URL: https://codereview.chromium.org/2438253002 .

Cr-Commit-Position: refs/branch-heads/2883@{#227}
Cr-Branched-From: 614d31daee2f61b0180df403a8ad43f20b9f6dd7-refs/heads/master@{#423768}

[add] https://crrev.com/4152354ad141e5f759ee0d80a95b1a8bb49143e7/third_party/WebKit/LayoutTests/http/tests/security/promise-realm.html
[modify] https://crrev.com/4152354ad141e5f759ee0d80a95b1a8bb49143e7/third_party/WebKit/Source/bindings/core/v8/GeneratedCodeHelper.h
[modify] https://crrev.com/4152354ad141e5f759ee0d80a95b1a8bb49143e7/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl

Labels: -reward-unpaid reward-inprocess

Comment 26 by dimu@google.com, Nov 4 2016

[Automated comment] removing mislabelled merge-merged-2840

Comment 27 by dimu@google.com, Nov 4 2016

Labels: -merge-merged-2840
[Automated comment] removing mislabelled merge-merged-2840
Project Member

Comment 28 by sheriffbot@chromium.org, Jan 25 2017

Labels: -Restrict-View-SecurityNotify 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

Sign in to add a comment