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

Issue 772848 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 1
Type: Bug-Security



Sign in to add a comment

CVE-2017-5123: Chrome Sandbox escape through linux kernel vulnerability introduced in 4.13 in waitid

Reported by chrissal...@gmail.com, Oct 9 2017

Issue description

A linux kernel vulnerability introduced in 4.13 can be used to escape the chrome sandbox. 4.13 is a stable release and is included in Ubuntu 17.10 which is set to be released on October 19th. 

Vulnerability Details:
In the linux kernel, inside the waitid syscall, unsafe_put_user is used to copy the results to usermode. However, access_ok is not checked on the pointer, allowing a kernel address to be given, and overwrite arbitrary kernel memory.
https://github.com/torvalds/linux/blob/master/kernel/exit.c#L1614

Exploit:
It is quite easy to exploit the bug without SMAP. Simply write over the upper bytes of a structure pointer, such as the cgroup structures to point it at userland and control function pointers. Then rop to gain privileges and escape the sandbox.

I've included 2 different exploits. One is reliable and does not bypass SMAP. One is very unreliable, but includes a working SMAP bypass.
As it is a sandbox bypass and not a full RCE exploit they need to start with code execution inside the sandbox.
To test these proof of concepts, I modified the v8 code to compile in my sandbox escape and trigger it with javascript from the renderer.

These exploits are tested and working on ubuntu-17.10-beta2.
This is the right version:
md5sum ubuntu-17.10-beta2-desktop-amd64.iso is e47df00b078b5f9daed0871f0e90d33f
http://releases.ubuntu.com/17.10/ubuntu-17.10-beta2-desktop-amd64.iso

I've also included 2 standalone pocs which exploit the bug with and without SMAP by emulating the chrome sandbox.

The files include notes describing the exploit at the top.

Files included:
exploit_no_smap.c - reliable exploit from chrome assuming no smap
exploit_smap_bypass.c - unreliable exploit from chrome, bypassing smap
standalone_poc_no_smap.c - reliable standalone poc, which emulates the chrome sandbox and does not bypass smap
standalone_poc_smap_bypass.c - unreliable standalone poc, which emulates the chrome sandbox and bypasses smap
chrome_seccomp_filter - seccomp filter installed in standalone proof of concepts

 
exploit_no_smap.c
10.3 KB View Download
exploit_smap_bypass.c
25.4 KB View Download
standalone_poc_no_smap.c
12.8 KB View Download
standalone_poc_smap_bypass.c
28.3 KB View Download
chrome_seccomp_filter
3.6 KB View Download
Labels: OS-Linux
Cc: groeck@chromium.org
Thanks for the report. Has this been reported upstream?

groeck, could you please take a look to see if this affects ChromeOS?
Cc: keescook@chromium.org
Labels: Security_Severity-Critical Security_Impact-None Pri-1
Owner: groeck@chromium.org
Status: Assigned (was: Unconfirmed)
It doesn't immediately affect ChromeOS since we don't ship anything above chromeos-4.4 at this time. Our latest development version is chromeos-4.12 which is not affected either. It _will_ affect chromeos-4.14 unless fixed.

However, unless I am really missing something, the bug is absolutely valid, critical, and does affect v4.13 and later kernels. I set severity and impact fields accordingly.

Kees, are you aware of this problem ? Do you know if it is already being worked on, and if there is a CVE ?

[ I assigned the bug to myself, primarily for tracking. Strictly speaking this would be a WontFix, since it doesn't apply to existing ChromeOS versions, but it is too critical to ignore. ]

This is the first I've seen the issue. Introduced upstream in commit 4c48abe91be03d191d0c20cc755877da2cb35622. Assigned as CVE-2017-5123.
Summary: CVE-2017-5123: Chrome Sandbox escape through linux kernel vulnerability introduced in 4.13 in waitid (was: Chrome Sandbox escape through linux kernel vulnerability introduced in 4.13 in waitid)
Labels: -Security_Severity-Critical -Security_Impact-None Security_Severity-High
Status: ExternalDependency (was: Assigned)
Thanks for investigating.

Removing Security-Impact-None since users using Linux would be impacted too. 

Severity-High for sandbox escape, since Critical is reserved for full chain exploits.

I think ExternalDependency is the right status here since there's nothing actionable for us right now.
Cc: jeffv@google.com

Comment 8 by groeck@chromium.org, Oct 10 2017

Cc: dtor@chromium.org
Thanks for the quick response. Has this been reported upstream or to someone who
 will fix it? Or is that something I need to do?
Fix should be straightforward and a two-liner. I'll be happy to do it unless someone else wants to pick it up. Kees - is it ok to submit a patch upstream ? If so, anything to watch out for ?

... and if I submit a patch, can/should I add the submitter of this bug as Reported-by: ?

Of course I'd like to be acknowledged in the "reported by" field if possible :)
I've reported this upstream (with credit to Chris), it should be publish on the 12th. (Technically a 4 line change, since it's needed in two places, but yes.) :)
#13: I assume that means that someone else (Al Viro ?) will submit a patch ?

I submitted the patch already, but tried to open discussion about just doing a revert. I think they're going to just go with the patch instead.
Great, thanks!

Status: WontFix (was: ExternalDependency)
Fixed upstream with commit 96ca579a1ecc ("waitid(): Add missing access_ok() checks"). Fixed in v4.13.7 with commit sha 3da54587cf4c. Marking as WontFix (not applicable to any chromeos kernels, and fixed in all affected upstream kernels).

Status: Available (was: WontFix)
Doesn't this qualify for the Vulnerability Rewards Program?
Labels: reward-topanel
Status: Fixed (was: Available)
Project Member

Comment 20 by sheriffbot@chromium.org, Oct 18 2017

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Labels: -reward-topanel reward-unpaid reward-15000
*** 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.
*********************************
Congratulations chrissalls5@! The VRP panel decided to award $15,000 for this bug!  A member of our finance team will be in touch to arrange for payment.
Labels: -reward-unpaid reward-inprocess
Wow. Thank you very much!!
Project Member

Comment 25 by sheriffbot@chromium.org, Jan 24 2018

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