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

Issue 682707 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: 2017-09-25
OS: Linux , Android , Windows , Chrome , Mac
Pri: 1
Type: Bug-Security



Sign in to add a comment

Security: DCHECK failure in MessagePort destructor in Blink

Reported by n...@tresorit.com, Jan 19 2017

Issue description

VULNERABILITY DETAILS

I am not sure if this is really a security issue or if it is exploitable,
but I'm not familiar with Blink internals and this can probably lead to a UAF.

MessagePort::~MessagePort() assumes (with a DCHECK) that close() has been called if the port had been previously started.
close() is called via a LifecycleNotifier and if it is owned in a worker then it will only be called when terminating the WorkerGlobalScope.
It is possible that the destructor is called before from the GC, this currently causes a crash in debug versions.
It seems to me that the DCHECK is there to avoid a potential UAF,
but I could not trigger that.

I have attached a reproduction case.
Creating the Blob is not necessary for the bug, it's only to comply with Same Origin Policy, the worker could be loaded from another js file too.

Possible fixes:
1. Call close() from the destructor to ensure there will be no UAF.
2. If this cannot be exploited then simply remove the DCHECK.

I could try it only on version 57, because currently if I checkout an older version then "gclient sync" fails with a git error for webrtc, so I couldn't compile a debug version.

VERSION

Chrome Version: Reproduced on 57 but it probably affects older versions too
Operating System: Reproduced on Linux x64 but all OS versions should be affected

REPRODUCTION CASE

0. Use a debug version of Chrome to have DCHECKs enabled.
1. Load the attached html page.
2. Trigger a GC sweep (DevConsole -> Timeline/Memory -> Trash icon)
3. Aw, Snap!

FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION

Type of crash: tab
Crash State: DCHECK failure

 
dcheck.html
186 bytes View Download
Labels: Needs-Feedback
Thanks for the report. Can you create a PoC that triggers the GC sweep automatically? That will allow our automated tools to run it directly.

Comment 2 by n...@tresorit.com, Jan 23 2017

Does your automated tools run with gc exposed? content_shell seems to run like that. (From a worker can I call "self.gc();"?)

Comment 3 by n...@tresorit.com, Jan 23 2017

I can reproduce with forced gc with this new attached file. (I've tried it on the latest tag 58.0.2990.2 compiled with is_debug=true)
Run with: ./chrome --js-flags=--expose-gc ./dcheckgc.html
dcheckgc.html
197 bytes View Download
Components: Blink>JavaScript>GC
Labels: Security_Severity-Low Security_Impact-Stable OS-Android OS-Chrome OS-Linux OS-Mac OS-Windows
Owner: haraken@chromium.org
Status: Assigned (was: Unconfirmed)
Thanks for the report. I'm not sure if ClusterFuzz has any builds with debug enabled, but I think we can manually look at this. Over to the Blink GC team - haraken@, can you please take a look and triage? I'm tentatively assigning a low impact, but if there's a potential UAF that will need to be escalated.
Project Member

Comment 5 by sheriffbot@chromium.org, Jan 30 2017

Labels: Pri-2

Comment 6 by aarya@google.com, May 25 2017

Cc: mstarzinger@chromium.org
Labels: -Security_Severity-Low Security_Severity-High
THis heaf uaf looks high severity, looks like it was triaged incorrectly. haraken@, can you please take a look.
Project Member

Comment 8 by ClusterFuzz, Jul 24 2017

ClusterFuzz is analyzing your testcase. Developers can follow the progress at https://clusterfuzz.com/testcase?key=6752495685861376.
Cc: haraken@chromium.org
Owner: nhiroki@chromium.org
nhiroki: Would you mind taking a look at this? This crash seems related to the timing when MessagePort::close() is called on workers.


Components: Blink>Messaging
> Run with: ./chrome --js-flags=--expose-gc ./dcheckgc.html

I tried this on Linux debug build (62.0.3167.0, master@{#489216}), but couldn't reproduce.
ngg@tresorit.com: Thank you for the detailed report and sorry for our late action. Are you still able to reproduce this?
Project Member

Comment 12 by sheriffbot@chromium.org, Jul 25 2017

Labels: M-59
Project Member

Comment 13 by sheriffbot@chromium.org, Jul 25 2017

Labels: -Pri-2 Pri-1
Project Member

Comment 14 by sheriffbot@chromium.org, Jul 25 2017

Labels: Deadline-Exceeded
We commit ourselves to a 60 day deadline for fixing for high severity vulnerabilities, and have exceeded it here. If you're unable to look into this soon, could you please find another owner or remove yourself so that this gets back into the security triage queue?

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 15 by sheriffbot@chromium.org, Jul 26 2017

Labels: -M-59 M-60

Comment 16 by n...@tresorit.com, Aug 5 2017

Sorry I didn't reply, I was on vacation. I'll be able to check this on Monday.
Project Member

Comment 17 by sheriffbot@chromium.org, Aug 8 2017

nhiroki: Uh oh! This issue still open and hasn't been updated in the last 14 days. This is a serious vulnerability, and we want to ensure that there's progress. Could you please leave an update with the current status and any potential blockers?

If you're not the right owner for this issue, could you please remove yourself as soon as possible or help us find the right one?

If the issue is fixed or you can't reproduce it, please close the bug. If you've started working on a fix, please set the status to Started.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 18 by n...@tresorit.com, Aug 10 2017

I couldn't reproduce the issue now, but I don't know if the bug was really fixed or just my repro test case is not good enough now.
I tried to git bisect, but I couldn't compile chrome versions before http://crrev.com/d3b69783

Project Member

Comment 19 by sheriffbot@chromium.org, Aug 22 2017

nhiroki: Uh oh! This issue still open and hasn't been updated in the last 28 days. This is a serious vulnerability, and we want to ensure that there's progress. Could you please leave an update with the current status and any potential blockers?

If you're not the right owner for this issue, could you please remove yourself as soon as possible or help us find the right one?

If the issue is fixed or you can't reproduce it, please close the bug. If you've started working on a fix, please set the status to Started.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Friendly security sheriff ping: if you're not able to reproduce now, can we mark this as fixed? If so, it would be good to identify an exact rev where it was fixed.
Project Member

Comment 21 by sheriffbot@chromium.org, Sep 6 2017

Labels: -M-60 M-61
nhiroki/haraken: could you ptal at the comment in #20? Thanks!
NextAction: 2017-09-25
Status: Fixed (was: Assigned)
Sorry for my delayed reply. I'll do the bisect and share the update later (maybe next week because of BlinkOn).
(I'd really appreciate it if someone could do the bisect on behalf of me)
Project Member

Comment 25 by sheriffbot@chromium.org, Sep 19 2017

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Project Member

Comment 26 by sheriffbot@chromium.org, Sep 21 2017

Labels: Merge-Request-62
Project Member

Comment 27 by sheriffbot@chromium.org, Sep 21 2017

Labels: -Merge-Request-62 Merge-Review-62 Hotlist-Merge-Review
This bug requires manual review: M62 has already been promoted to the beta branch, so this requires manual review
Please contact the milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), bhthompson@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Hotlist-Merge-Review -Merge-Review-62
Merge is not necessary.
The NextAction date has arrived: 2017-09-25
Labels: reward-topanel

Comment 31 by wfh@chromium.org, Oct 4 2017

Labels: Needs-Bisect
Owner: wfh@chromium.org
I'll do a manual bisect to find how/when this was fixed. Assigning to me so I don't forget.

Comment 32 by mek@chromium.org, Oct 4 2017

FWIW the original bug report sounds weird to me. MessagePort implements HasPendingActivity, which as far as I understand it should ensure it doesn't get garbage collected as long as that method returns true. And the logic in that method is identical to the DCHECK in the destructor. So not sure how (modulo garbage collection bugs) the garbage collector could call the destructor in a way to trigger that DCHECK...

Comment 33 by n...@tresorit.com, Oct 5 2017

There was an issue with pending activities in workers (see my other already fixed bugreport here: https://bugs.chromium.org/p/chromium/issues/detail?id=683406). It's possible the fix for that fixed this as well.

Comment 34 by wfh@chromium.org, Oct 12 2017

Cc: mlippautz@chromium.org
The fix to this bisected to https://codereview.chromium.org/2665733002 which is  issue 686563  - I think this can be duped into that, perhaps?
Lacking exact context here but M57 launched the wrapper tracing GC infrastructure which has been hardened over the last couple of months including fixing issues with HasPendingActivity.

Long story short, it could be this CL :)

Comment 36 by n...@tresorit.com, Oct 12 2017

Yeah, so this was caused by the same issue as my other bug. Thanks for clarifying.

Comment 37 by wfh@chromium.org, Oct 12 2017

Yup I think this is the same issue as  issue 683406  which we've already rewarded on. We'll discuss this at the next VRP panel but I would guess it will be considered already rewarded, as it's the same root cause.
Labels: -reward-topanel reward-0
(marking this as reward-0 since we already the other bug)
Project Member

Comment 39 by sheriffbot@chromium.org, Dec 26 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