New issue
Advanced search Search tips

Issue 627457 link

Starred by 2 users

Issue metadata

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



Sign in to add a comment

Use-after-poison in content::WebMessagePortChannelImpl::OnMessage

Project Member Reported by ClusterFuzz, Jul 12 2016

Issue description

Detailed report: https://cluster-fuzz.appspot.com/testcase?key=5079226818756608

Fuzzer: attekett_dom_fuzzer
Job Type: mac_asan_chrome
Platform Id: mac

Crash Type: Use-after-poison READ 8
Crash Address: 0x7ee7424e1d68
Crash State:
  content::WebMessagePortChannelImpl::OnMessage
  bool IPC::MessageT<MessagePortMsg_Message_Meta, std::__1::tuple<std::__1::basic_
  content::WebMessagePortChannelImpl::OnMessageReceived
  
Recommended Security Severity: High

Regressed: https://cluster-fuzz.appspot.com/revisions?job=mac_asan_chrome&range=392926:392933

Unminimized Testcase: https://cluster-fuzz.appspot.com/download/AMIfv96jrf3RIR9LqAc_J9K8VSb1ybgozqvCm3hSn2HHg4ojZgGVcxJAqrtrooRfzS5yYtKRXbmKa9Ug5Uy_ChkY6YO5Xfv7yv-Ikmk2WsVx7sMoL4wWwH33Ki3Fx7vNZKRM17uOX7s9heLNMH750a3B8SJDV1u3E_h7YEo1n1ELPv4TiugMEx4?testcase_id=5079226818756608


Filer: mmoroz

See https://dev.chromium.org/Home/chromium-security/bugs/reproducing-clusterfuzz-bugs for more information.
 

Comment 1 by mmoroz@chromium.org, Jul 12 2016

Cc: mmoroz@chromium.org
Components: Internals>Core
Labels: Pri-1
Owner: tzik@chromium.org
tzik@, could you please take a look or suggest another owner?
Project Member

Comment 2 by sheriffbot@chromium.org, Jul 13 2016

Labels: M-52
Project Member

Comment 3 by sheriffbot@chromium.org, Jul 13 2016

Labels: ReleaseBlock-Stable
Project Member

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

Status: Assigned (was: Available)

Comment 5 Deleted

Comment 6 by gov...@chromium.org, Jul 14 2016

A friendly reminder that M52 Stable is launching soon! Your bug is labelled as Stable ReleaseBlock, pls make sure to land the fix and get it merged into the release branch by July 15, 5:00 PM PST in order to make into the desktop Stable final build cut. Thank you!

Comment 7 by gov...@chromium.org, Jul 14 2016

Cc: awhalley@chromium.org
Project Member

Comment 8 by bugdroid1@chromium.org, Jul 14 2016

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

commit f7dbf39be31d8aa9214d5d84da613508d4e06491
Author: tzik <tzik@chromium.org>
Date: Thu Jul 14 08:23:49 2016

Delay client registration of MessagePort to MessagePortChannel

MessagePort used to be registered to MessagePortChannel on entangle(),
and be unregisted when the ExecutionContext is stopped or MessagePort
is swept by GC. Once its start() is called, its hasPendingActivity()
will be true and that extends the MessagePort lifetime to stop() or close() call.

However, there's a time gap between the MessagePort instance is marked
as unreachable, and swept by GC system. If MessagePortChannel accesses
the MessagePort in this period, that causes use-after-poison crash.

I.e. there are two pattern of the life of MessagePort.
 1. entangle() + register -> gets unreachable -(poisoned period)-> swept + unregister
 2. entangle() + register -> start() -> stop() + unregister
 3. entangle() + register -> start() -> close() + unregister

(2) and (3) cases are OK, while (1) has a dangerous period.
This CL delays the registration from entangle() to start(), so that
the case (1) doesn't register the MessagePort to MessagePortChannel at all.

BUG= 627457 

Review-Url: https://codereview.chromium.org/2143003003
Cr-Commit-Position: refs/heads/master@{#405450}

[modify] https://crrev.com/f7dbf39be31d8aa9214d5d84da613508d4e06491/third_party/WebKit/Source/core/dom/MessagePort.cpp

Comment 9 by tzik@chromium.org, Jul 14 2016

Labels: Merge-Request-52
Project Member

Comment 10 by sheriffbot@chromium.org, Jul 14 2016

Status: Fixed (was: Assigned)
Please mark security bugs as fixed as soon as the fix lands, and before requesting merges.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Before we approve merge to M52, Could you please confirm whether this change is baked/verified in Canary and safe to merge?
Project Member

Comment 12 by ClusterFuzz, Jul 14 2016

ClusterFuzz has detected this issue as fixed in range 405185:405467.

Detailed report: https://cluster-fuzz.appspot.com/testcase?key=5079226818756608

Fuzzer: attekett_dom_fuzzer
Job Type: mac_asan_chrome
Platform Id: mac

Crash Type: Use-after-poison READ 8
Crash Address: 0x7ee7424e1d68
Crash State:
  content::WebMessagePortChannelImpl::OnMessage
  bool IPC::MessageT<MessagePortMsg_Message_Meta, std::__1::tuple<std::__1::basic_
  content::WebMessagePortChannelImpl::OnMessageReceived
  
Recommended Security Severity: High

Regressed: https://cluster-fuzz.appspot.com/revisions?job=mac_asan_chrome&range=392926:392933
Fixed: https://cluster-fuzz.appspot.com/revisions?job=mac_asan_chrome&range=405185:405467

Unminimized Testcase: https://cluster-fuzz.appspot.com/download/AMIfv96jrf3RIR9LqAc_J9K8VSb1ybgozqvCm3hSn2HHg4ojZgGVcxJAqrtrooRfzS5yYtKRXbmKa9Ug5Uy_ChkY6YO5Xfv7yv-Ikmk2WsVx7sMoL4wWwH33Ki3Fx7vNZKRM17uOX7s9heLNMH750a3B8SJDV1u3E_h7YEo1n1ELPv4TiugMEx4?testcase_id=5079226818756608


See https://dev.chromium.org/Home/chromium-security/bugs/reproducing-clusterfuzz-bugs for more information.

If you suspect that the result above is incorrect, try re-doing that job on the test case report page.
Project Member

Comment 13 by sheriffbot@chromium.org, Jul 15 2016

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
+ awhalley@ to confirm once it is baked in canary whether it is ok to take this merge in for M52 stable release next week or wait until next stable release  (This is M52 stable blocker bug).
Looks good to merge to M52.
Labels: -Merge-Request-52 Merge-Approved-52
Approving merge to M52 branch 2743 based on comment #15. Please merge ASAP before 5:00 PM PST today (Monday) as we're cutting M52 Stable RC today and this bug is marked as M52 Stable blocker. Thank you.

Also does this require a merge to M53?
Project Member

Comment 17 by bugdroid1@chromium.org, Jul 18 2016

Labels: -merge-approved-52 merge-merged-2743
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/575679ba79b22c21a6b2d58c42b1412cbf58e481

commit 575679ba79b22c21a6b2d58c42b1412cbf58e481
Author: Taiju Tsuiki <tzik@google.com>
Date: Mon Jul 18 17:56:43 2016

Delay client registration of MessagePort to MessagePortChannel

MessagePort used to be registered to MessagePortChannel on entangle(),
and be unregisted when the ExecutionContext is stopped or MessagePort
is swept by GC. Once its start() is called, its hasPendingActivity()
will be true and that extends the MessagePort lifetime to stop() or close() call.

However, there's a time gap between the MessagePort instance is marked
as unreachable, and swept by GC system. If MessagePortChannel accesses
the MessagePort in this period, that causes use-after-poison crash.

I.e. there are two pattern of the life of MessagePort.
 1. entangle() + register -> gets unreachable -(poisoned period)-> swept + unregister
 2. entangle() + register -> start() -> stop() + unregister
 3. entangle() + register -> start() -> close() + unregister

(2) and (3) cases are OK, while (1) has a dangerous period.
This CL delays the registration from entangle() to start(), so that
the case (1) doesn't register the MessagePort to MessagePortChannel at all.

BUG= 627457 

Review-Url: https://codereview.chromium.org/2143003003
Cr-Commit-Position: refs/heads/master@{#405450}
(cherry picked from commit f7dbf39be31d8aa9214d5d84da613508d4e06491)

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

Cr-Commit-Position: refs/branch-heads/2743@{#663}
Cr-Branched-From: 2b3ae3b8090361f8af5a611712fc1a5ab2de53cb-refs/heads/master@{#394939}

[modify] https://crrev.com/575679ba79b22c21a6b2d58c42b1412cbf58e481/third_party/WebKit/Source/core/dom/MessagePort.cpp

Comment 18 by tzik@chromium.org, Jul 18 2016

Labels: Merge-Request-53
Yes, M53 requires this fix too.
Labels: -Merge-Request-53 Merge-Approved-53
Approving merge to M53 branch 2785 based on comment #15. Please try to merge this before 5:00 PM PST today in order to make it to tomorrow's M53 Dev release. Thank you.
Project Member

Comment 20 by bugdroid1@chromium.org, Jul 18 2016

Labels: -merge-approved-53 merge-merged-2785
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7b600704b01eb15d7cce4e30a6c8d4c2a1645673

commit 7b600704b01eb15d7cce4e30a6c8d4c2a1645673
Author: Taiju Tsuiki <tzik@google.com>
Date: Mon Jul 18 18:14:03 2016

Delay client registration of MessagePort to MessagePortChannel

MessagePort used to be registered to MessagePortChannel on entangle(),
and be unregisted when the ExecutionContext is stopped or MessagePort
is swept by GC. Once its start() is called, its hasPendingActivity()
will be true and that extends the MessagePort lifetime to stop() or close() call.

However, there's a time gap between the MessagePort instance is marked
as unreachable, and swept by GC system. If MessagePortChannel accesses
the MessagePort in this period, that causes use-after-poison crash.

I.e. there are two pattern of the life of MessagePort.
 1. entangle() + register -> gets unreachable -(poisoned period)-> swept + unregister
 2. entangle() + register -> start() -> stop() + unregister
 3. entangle() + register -> start() -> close() + unregister

(2) and (3) cases are OK, while (1) has a dangerous period.
This CL delays the registration from entangle() to start(), so that
the case (1) doesn't register the MessagePort to MessagePortChannel at all.

BUG= 627457 

Review-Url: https://codereview.chromium.org/2143003003
Cr-Commit-Position: refs/heads/master@{#405450}
(cherry picked from commit f7dbf39be31d8aa9214d5d84da613508d4e06491)

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

Cr-Commit-Position: refs/branch-heads/2785@{#186}
Cr-Branched-From: 68623971be0cfc492a2cb0427d7f478e7b214c24-refs/heads/master@{#403382}

[modify] https://crrev.com/7b600704b01eb15d7cce4e30a6c8d4c2a1645673/third_party/WebKit/Source/core/dom/MessagePort.cpp

Labels: -reward-topanel reward-unpaid reward-3500
And $3,500 for this one.  Thanks as ever for a great fuzzer!
Labels: reward_to-attekett_at_gmail.com
Labels: reward-inprocess
Labels: -reward-unpaid
Project Member

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

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