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

Issue 867370 link

Starred by 3 users

Issue metadata

Status: Verified
Owner:
please use my google.com address
Closed: Aug 9
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac , Fuchsia
Pri: 1
Type: Bug-Security



Sign in to add a comment

use-after-poison in mojo::InterfaceEndpointClient::HandleValidatedMessage)

Reported by cloudfuz...@gmail.com, Jul 25

Issue description

VULNERABILITY DETAILS
The following testcase crashes the latest Chromium ASAN build when loaded from a HTTP server.

VERSION
Chrome Version: asan-linux-release-577824
Operating System: Linux 64-bit

REPRODUCTION CASE

<script>
function start() {
        o178=window.top;
        o833=new XMLHttpRequest();
        o833.open('PUT','/',true);
        o833.responseType='blob';
        o833.send(undefined);
        o3956=document.createElementNS('http://www.w3.org/1999/xhtml','canvas');
        o4420=o3956.getContext('2d',{willReadFrequently: true,storage: false,});
        o3956.offsetHeight;
        window.setTimeout(fun0, 4);
}
function fun0() {
        o4420.getImageData(4,1,-20480,-14336);
        o178.close();
}
</script>
<body onload="start()"></body>

FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION

Crash State: 
=================================================================
==11918==ERROR: AddressSanitizer: use-after-poison on address 0x7eda44ef1538 at pc 0x55d01cdfce52 bp 0x7ffddb3d5450 sp 0x7ffddb3d5448
READ of size 8 at 0x7eda44ef1538 thread T0 (chrome)
    #0 0x55d01cdfce51 in mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message*) mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:423:32
    #1 0x55d01ce11048 in mojo::internal::MultiplexRouter::ProcessIncomingMessage(mojo::internal::MultiplexRouter::MessageWrapper*, mojo::internal::MultiplexRouter::ClientCallBehavior, base::SequencedTaskRunner*) mojo/public/cpp/bindings/lib/multiplex_router.cc:869:42
    #2 0x55d01ce0f0f1 in mojo::internal::MultiplexRouter::Accept(mojo::Message*) mojo/public/cpp/bindings/lib/multiplex_router.cc:590:38
    #3 0x55d01cdf5608 in mojo::Connector::ReadSingleMessage(unsigned int*) mojo/public/cpp/bindings/lib/connector.cc:457:51
    #4 0x55d01cdf73af in mojo::Connector::ReadAllAvailableMessages() mojo/public/cpp/bindings/lib/connector.cc:486:10
    #5 0x55d01cddca84 in Run base/callback.h:129:12
    #6 0x55d01cddca84 in mojo::SimpleWatcher::OnHandleReady(int, unsigned int, mojo::HandleSignalsState const&) mojo/public/cpp/system/simple_watcher.cc:273
    #7 0x55d01b46e57c in Run base/callback.h:99:12
    #8 0x55d01b46e57c in base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*) base/debug/task_annotator.cc:101
    #9 0x55d01b576025 in base::sequence_manager::internal::ThreadControllerImpl::DoWork(base::sequence_manager::internal::ThreadControllerImpl::WorkType) base/task/sequence_manager/thread_controller_impl.cc:166:21
    #10 0x55d01b46e57c in Run base/callback.h:99:12
    #11 0x55d01b46e57c in base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*) base/debug/task_annotator.cc:101
    #12 0x55d01b4688d4 in base::MessageLoop::RunTask(base::PendingTask*) base/message_loop/message_loop.cc:421:46
    #13 0x55d01b469d2f in DeferOrRunPendingTask base/message_loop/message_loop.cc:432:5
    #14 0x55d01b469d2f in base::MessageLoop::DoWork() base/message_loop/message_loop.cc:480
    #15 0x55d01b4758df in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_default.cc:37:31
    #16 0x55d01b4f822b in base::RunLoop::Run() base/run_loop.cc:102:14
    #17 0x55d02cdc1e3a in content::RendererMain(content::MainFunctionParams const&) content/renderer/renderer_main.cc:200:23
    #18 0x55d01a77766d in content::RunZygote(content::ContentMainDelegate*) content/app/content_main_runner_impl.cc:554:14
    #19 0x55d01a77b93a in content::ContentMainRunnerImpl::Run(bool) content/app/content_main_runner_impl.cc:951:10
    #20 0x55d01a799cae in service_manager::Main(service_manager::MainParams const&) services/service_manager/embedder/main.cc:472:29
    #21 0x55d01a7757de in content::ContentMain(content::ContentMainParams const&) content/app/content_main.cc:19:10
    #22 0x55d0127ef493 in ChromeMain chrome/app/chrome_main.cc:101:12
    #23 0x7f568cbc32e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)

Address 0x7eda44ef1538 is a wild pointer.
SUMMARY: AddressSanitizer: use-after-poison mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:423:32 in mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message*)
Shadow bytes around the buggy address:
  0x0fdbc89d6250: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0fdbc89d6260: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0fdbc89d6270: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0fdbc89d6280: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0fdbc89d6290: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
=>0x0fdbc89d62a0: f7 f7 f7 f7 f7 f7 f7[f7]f7 f7 f7 f7 f7 f7 f7 f7
  0x0fdbc89d62b0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 00 00 00 00 00
  0x0fdbc89d62c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fdbc89d62d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fdbc89d62e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0fdbc89d62f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==11918==ABORTING

 
Project Member

Comment 1 by ClusterFuzz, Jul 25

ClusterFuzz is analyzing your testcase. Developers can follow the progress at https://clusterfuzz.com/testcase?key=6502394742177792.
Project Member

Comment 2 by ClusterFuzz, Jul 25

ClusterFuzz is analyzing your testcase. Developers can follow the progress at https://clusterfuzz.com/testcase?key=6217234012438528.
Components: Internals>Mojo
Labels: Security_Severity-High Security_Impact-Head OS-Android OS-Chrome OS-Fuchsia OS-Linux OS-Mac OS-Windows
Owner: roc...@chromium.org
Status: Assigned (was: Unconfirmed)
I'm having a bit of trouble reproducing this one, even using an HTTP server.

rockot: Any chance that this could be related to https://chromium-review.googlesource.com/c/chromium/src/+/1141078? Since I can't repro it's a bit of a shot in the dark, so feel free to pass it back to me for retriage if not.
Project Member

Comment 4 by sheriffbot@chromium.org, Jul 27

Labels: M-69 Target-69
Project Member

Comment 5 by sheriffbot@chromium.org, Jul 27

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

If this doesn't affect a release branch, or has not been properly classified for severity, please update the Security_Impact or Security_Severity labels, and remove the ReleaseBlock label. To disable this altogether, apply ReleaseBlock-NA.

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

Comment 6 by sheriffbot@chromium.org, Jul 27

Labels: Pri-1
Project Member

Comment 7 by sheriffbot@chromium.org, Jul 28

Labels: -Security_Impact-Head Security_Impact-Beta
Cc: mbarbe...@chromium.org
 Issue 868724  has been merged into this issue.
Project Member

Comment 9 by ClusterFuzz, Jul 30

Labels: -Security_Impact-Beta Security_Impact-Head
Summary: <no crash state available> (was: Security: use-after-poison in mojo::InterfaceEndpointClient::HandleValidatedMessage)
Testcase 6217234012438528 failed to reproduce the crash. Please inspect the program output at https://clusterfuzz.com/testcase?key=6217234012438528.
Project Member

Comment 10 by ClusterFuzz, Jul 30

Testcase 6502394742177792 failed to reproduce the crash. Please inspect the program output at https://clusterfuzz.com/testcase?key=6502394742177792.
Summary: use-after-poison in mojo::InterfaceEndpointClient::HandleValidatedMessage) (was: <no crash state available>)
It is conceivable that the CL you suggest is at fault, though it would be quite surprising to me. I have also been unable to repro, but I will keep digging.
Can you help me understand the nature of use-after-poison errors? Is this a matter of memory being accessed after it's been deinitialized but not yet freed? i.e. use during partial destruction? If so, any insight onto how asan hooks in and poisons things when appropriate?
Project Member

Comment 14 by sheriffbot@chromium.org, Jul 31

Labels: -Security_Impact-Head Security_Impact-Beta
rockot@, your understanding of use-after-poison is correct.

Here is some additional information:
- https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm
- https://github.com/google/sanitizers/issues/73
M69 Stable promotion is coming VERY soon. Your bug is labelled as Stable ReleaseBlock, pls make sure to land the fix and request a merge into the release branch ASAP. Thank you.
Still cannot repro. I have no idea.
Oooh. Managed to get a pretty consistent repro by having a tab open the testcase in a new window. Digging more...
Cc: mek@chromium.org
OK, so I have narrowed it down specifically to the blink.mojom.ProgressClient interface, and it's always a binding endpoint in a render process that is at fault. This narrows the issue down to exactly one place, blink::ResourceLoader[1].

I haven't done any further analysis yet. My guess would be that it must be possible for a ResourceLoader to be destroyed from a thread other than the main thread, but that's only a guess. This would be able to explain raciness between destruction and OnProgress message dispatch, and I'm really not sure what else could.

[1] https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/loader/fetch/resource_loader.h?rcl=eabf9ad0429004d92823c7594d0b141f97cdead8&l=193
Components: -Internals>Mojo Blink>Storage
Components: Blink>Loader
Not sure about the threading behavior of ResourceLoader. But maybe there are potential issues because ResourceLoader is garbage collected, and thus can be in a finalized-but-not-yet-destroyed state? In which case perhaps closing the binding in its Dispose method might be enough.
Aha. Yes, that would perfectly explain what's happening here, and closing the binding sounds like the right thing to do. Thanks for the insight, I'll give that a stab.
Project Member

Comment 23 by bugdroid1@chromium.org, Aug 9

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

commit 0cc45e354863b2aa4d676335bd9aab4ecd50fe2c
Author: Ken Rockot <rockot@chromium.org>
Date: Thu Aug 09 04:06:51 2018

Fix blink::ResourceLoader finalization

This causes blink::ResourceLoader::Dispose() to close the object's
blink.mojom.ProgressClient binding, preventing incoming IPCs from
being dispatched to the finalized object in the interim between
finalization and actual destruction.

Bug:  867370 
Change-Id: I9a14c51cb5d75e11b211006d094d73beafab8922
Reviewed-on: https://chromium-review.googlesource.com/1168289
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581779}
[modify] https://crrev.com/0cc45e354863b2aa4d676335bd9aab4ecd50fe2c/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc

Labels: Merge-Request-69
Status: Verified (was: Assigned)
Project Member

Comment 25 by sheriffbot@chromium.org, Aug 9

Labels: -Merge-Request-69 Merge-Review-69 Hotlist-Merge-Review
This bug requires manual review: M69 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), kariahda@(iOS), cindyb@(ChromeOS), govind@(Desktop)

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

Comment 26 by sheriffbot@chromium.org, Aug 9

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Cc: awhalley@chromium.org
+awhalley@ (Security TPM) for M69 merge review.
Labels: reward-topanel
govind@ - good for 69
Labels: -Merge-Review-69 Merge-Approved-69
Approving merge to M69 branch 3497 based on comment #29. Please merge.
Project Member

Comment 31 by bugdroid1@chromium.org, Aug 14

Labels: -merge-approved-69 merge-merged-3497
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e030fadca784f022be51ca276b4f8e3256bcc3da

commit e030fadca784f022be51ca276b4f8e3256bcc3da
Author: Ken Rockot <rockot@chromium.org>
Date: Tue Aug 14 20:36:57 2018

Fix blink::ResourceLoader finalization

This causes blink::ResourceLoader::Dispose() to close the object's
blink.mojom.ProgressClient binding, preventing incoming IPCs from
being dispatched to the finalized object in the interim between
finalization and actual destruction.

TBR=rockot@chromium.org

(cherry picked from commit 0cc45e354863b2aa4d676335bd9aab4ecd50fe2c)

Bug:  867370 
Change-Id: I9a14c51cb5d75e11b211006d094d73beafab8922
Reviewed-on: https://chromium-review.googlesource.com/1168289
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: Ken Rockot <rockot@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#581779}
Reviewed-on: https://chromium-review.googlesource.com/1175083
Reviewed-by: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/branch-heads/3497@{#629}
Cr-Branched-From: 271eaf50594eb818c9295dc78d364aea18c82ea8-refs/heads/master@{#576753}
[modify] https://crrev.com/e030fadca784f022be51ca276b4f8e3256bcc3da/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc

Labels: -ReleaseBlock-Stable
Labels: -reward-topanel reward-unpaid reward-3000
*** Boilerplate reminders! ***
Please do NOT publicly disclose details until a fix has been released to all our users. Early public disclosure may cancel the provisional reward. Also, please be considerate about disclosure when the bug affects a core library that may be used by other products. Please do NOT share this information with third parties who are not directly involved in fixing the bug. Doing so may cancel the provisional reward. Please be honest if you have already disclosed anything publicly or to third parties. Lastly, we understand that some of you are not interested in money. We offer the option to donate your reward to an eligible charity. If you prefer this option, let us know and we will also match your donation - subject to our discretion. Any rewards that are unclaimed after 12 months will be donated to a charity of our choosing.
*********************************
$3,000 for this report, many thanks!
Labels: -reward-unpaid reward-inprocess
Project Member

Comment 36 by sheriffbot@chromium.org, Nov 15

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