New issue
Advanced search Search tips

Issue 840161 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug-Security



Sign in to add a comment

Security: use-after-free or double-free in Virtio Wayland ChromiumOS code

Reported by alex.gay...@gmail.com, May 6 2018

Issue description

VULNERABILITY DETAILS

(This was found with code inspection, no PoC available)

Code in question is found here: https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.4/drivers/virtio/virtio_wl.c (blob: f8a35c8ea12e4261e2b9fdcc399ddc7e573ba2be)

The bug is in virtwl_ioctl_recv:

When an error is encountered at https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.4/drivers/virtio/virtio_wl.c#927 do_vfd_close(vfds[i]) is called, and then free_vfds is jumped to (https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.4/drivers/virtio/virtio_wl.c#945). It then loops over all vfds and calls free_vfds on them. Because the value was never nulled out, do_vfd_close will be called twice on the same value.

do_vfd_close (https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.4/drivers/virtio/virtio_wl.c#528) will call virtwl_vfd_remove (https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.4/drivers/virtio/virtio_wl.c#396) which calls virtwl_vfd_free (https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.4/drivers/virtio/virtio_wl.c#388) which frees the vfd. Thus the first call to do_vfd_close frees the structure, the reads from it in the subsequent call are all uses-after-free.


VERSION
HEAD

 
Labels: OS-Chrome
Cc: jorgelo@chromium.org
Labels: Security_Severity-High
Owner: za...@chromium.org
Status: Assigned (was: Unconfirmed)
zachr@ - please take a look.
jorgelo@ - is this shipping yet? could you set sec-impact accordingly?
Components: OS>Kernel

Comment 5 by za...@chromium.org, May 7 2018

No version of this driver is shipped on a chromebook. Only the 4.14 version is shipped in termina guest kernels.

Comment 6 by za...@chromium.org, May 7 2018

Cc: mnissler@chromium.org
Also jorgelo@ is OOO this week. mnissler@, could you fill in?
Components: OS>Systems>Containers
Labels: -Security_Severity-High Security_Severity-Medium Security_Impact-Beta
Since this doesn't affect the host kernel (I've double-checked kernel config just in case), this certainly isn't severity high. However, it might be useful in an exploit chain that escalates from guest to host via guest kernel compromise, so I think severity medium looks right for this. Setting Impact-Beta as crosvm/termina isn't launched to stable yet. Zach, please correct me if I'm wrong here.

Might make sense to consider fuzzing this interface using syzkaller?
Project Member

Comment 8 by sheriffbot@chromium.org, May 8 2018

Labels: M-67
Project Member

Comment 9 by sheriffbot@chromium.org, May 8 2018

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 10 by sheriffbot@chromium.org, May 8 2018

Labels: Pri-1
Does the patch I proposed in comment #2 sound correct? And if yes, would it be helpful to send a CL for it?

Comment 12 by za...@chromium.org, May 11 2018

Status: Started (was: Assigned)
That sounds correct. I'll push the suggested change.
Project Member

Comment 13 by bugdroid1@chromium.org, May 17 2018

Labels: merge-merged-chromeos-4.14
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/kernel/+/a1996093581e48ece5a5222b3f02a6d47a566e57

commit a1996093581e48ece5a5222b3f02a6d47a566e57
Author: Zach Reizner <zachr@google.com>
Date: Thu May 17 10:24:30 2018

CHROMIUM: virtwl: fix double free in error path for virtwl_ioctl_recv

BUG= chromium:840161 
TEST=None

Change-Id: I18981885db705862d34e91b695f7323a1d52e3dd
Signed-off-by: Zach Reizner <zachr@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1056146
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Alex Gaynor <alex.gaynor@gmail.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>

[modify] https://crrev.com/a1996093581e48ece5a5222b3f02a6d47a566e57/drivers/virtio/virtio_wl.c

Comment 14 by za...@chromium.org, May 17 2018

Status: Fixed (was: Started)
Project Member

Comment 15 by sheriffbot@chromium.org, May 18 2018

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Labels: reward-topanel
Labels: -reward-topanel reward-unpaid reward-1500
*** 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.
*********************************
Nice one alex.gaynor@, the Chrome VRP panel decided to award $1,000 for this report, and $500 for suppling the fix. A member of our finance team will be in touch to arrange payment. Also, how would you like to be credited in our release notes?
Labels: -reward-unpaid reward-inprocess
Please credit me as: Alex Gaynor, Fish in a Barrel. Thanks!

I imagine the member of the finance team will also be the correct person to work with on donating the payment?
Labels: -reward-inprocess reward-decline
Project Member

Comment 22 by sheriffbot@chromium.org, Aug 24

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