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

Issue 722126 link

Starred by 2 users

Issue metadata

Status: Archived
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug-Security

Blocked on:
issue 722946
issue 723102



Sign in to add a comment

Security: Chrome ᴏꜱ buffer overflow in mount.exfat-fuse after a call to malloc(0)

Reported by lael.cel...@gmail.com, May 14 2017

Issue description

ATTACK SCENARIO
This kind of vulnerability is best suited for targeting a single person since an exploit can only work on a single vendor firmware, but here’s the steps :
An ꜱᴅ card is dropped on a car park. Preferably a large ꜱᴅ card (1Tb) in it’s vendor plastic and it’s several hundred dollars price on it.
The digitally illiterate user who don’t known what formatting a device or hidden files is, will just delete the family pictures and films he sees the disks that appear in the file manager of chrome ᴏꜱ. Then, the user will use the ꜱᴅ card for his own needs until the day one of the partition containing an exploit chain trigger the persistence exploit.

As chrome ᴏꜱ doesn’t offer partitioning tools, the user won’t delete the partitions that don’t appear (if mount.exfat-fuse crash on startup then the exfat partition doesn’t appear in the file manager but ccros-disk will always automatically mount all partition a device contains anyway, even if there’s more than one hundred)


VULNERABILITY DETAILS
mount.exfat-fuse before https://github.com/relan/exfat/commit/38d5c3a929124fd123675ac576401b7de3570b2f didn’t checked sector and cluster size in the correct order.
In some circumstances, 	ef->zero_cluster = malloc(CLUSTER_SIZE(*ef->sb)) in mount.c line 211 can turn into a call to malloc(0) while SECTOR_SIZE(*ef->sb) line 220 return a larger attacker controlled size.
Posix requires malloc(0) to create a unique pointer that can be passed to free() (http://www.unix.com/man-page/POSIX/3posix/malloc/). In practice glibc will create a unique pointer pointing to an allocated area of 12 bytes on 32 bits and 24 bytes on 64 bits.
It’s also worth noting such pointer isn’t randomized relative to the beginning of the heap.

The overwriting of dlmalloc data happens in verify_vbr_checksum() located in mount.c.
The attacker doesn’t have fine grained control over the exact size returned by SECTOR_SIZE(*ef->sb), but pread() can succeed while returning less bytes than requested and thus overwriting less dlmalloc data (mount.exfat-fuse doesn’t check the amount of data returned by pread). This can be achieved by reducing the size of the partition.
The attack in the libc begin when mount.exfat-fuse will complain and try to print an error message. This will call several glibc functions which will call vfprintf which will allocate data and read a damaged heap.

There’s 2 repeating factor that can overcome ᴀꜱʟʀ : the fact that cros-disk will automatically mount filesystems instead of doing it on request in the file manager and the exploits only takes bytes which allows to have more than one hundred partitions on the device which will be all mount attempted. As long as they crash mount.exfat-fuse, they won’t show up in the file manager and the user cannot format them without using command line (provided he/she even knows what command line interface is)


VERSION
I’m not aware of a version or device not affected above 25.0.1364.126 (https://chromium.googlesource.com/chromiumos/platform2/+/af455a08a8de7d88cd9550d2d63c865a7c3fc69f).


REPRODUCTION CASE
I repeatedly tried to run the real Chrome ᴏꜱ, but all my attempts failed. As the size of the libraries used determine partially the organization of the stack and the heap I can’t build successful exploit that would run outside my Debian Linux install. So the only thing I can provide is a ᴘᴏᴄ demontrating a partial or full pointer overwrite with attacker controlled data (it bypass glibc buffer detection algorithm see annotated attachment), so this allow writing to arbitrary address.
In order to run the ᴘᴏᴄ, you can use this command as root under developer mode :
mount.exfat-fuse "ᴀᴍᴅ⁶⁴ ᴘᴏᴄ for Chrome ᴏꜱ" /media/removable/archive

There’s three ways to launch a hidden file script as root which will perform a downgrade to a previously valid version allowing mitigated persistence exploits to work again (take a look at the attachments For obvious reason I can’t put a rootfs in those attachements) :
— The 1ˢᵗ is to call setreuid(0,0) as SECBIT_NOROOT is not set, next call to execve will allow to gain full superuser capabilities. Partitions are mounted with noexec : to overcome this, the executable that will be called is /bin/bash with the path to the downgrade script called .s as argument (it’s important for paths to take as less space as possible in the exploit)

— The 2ⁿd consists to call the mount() system call directly to mount a filesystem containing the binaries of /sbin but with a modified chromeos_shutdown script (since no execve system call is performed while the user is logged in) that will install the downgrade images located in the same directory (it requires the user to withdraw the ꜱᴅ card only after shutting down the computer). As I couldn’t ran Chrome ᴏꜱ, I couldn’t determine if /media/removable folder where unmounted on logoff. So the mount system call needs to use a block device, that is, a partition on the ꜱᴅ card with a filesystem that won’t be mounted by cros-disk. This require a file system type supported by the kernel but not by cros-disk which leave squashfs as the only option. Of course, in that case the file manager propose to erase the device but this can be mitigated by write protecting the partition through the controller located on the ꜱᴅ card.
 
ᴀᴍᴅ⁶⁴ ᴘᴏᴄ for Chrome ᴏꜱ
116 bytes View Download
annotated malloc for arbitrary address write by fetching partially corrupted pointer from heap.c
14.1 KB View Download
second partition containing script data in the case of setresuid(0,0) in the ʀᴏᴘ chain.vfat
64.0 KB Download
partition block device that should be mounted over sbin containing modified chromeos_shutdown script and old firmware.squashfs
2.8 MB Download
chromiumos-overlay.patch
3.8 KB Download
Components: OS>Systems
Labels: Pri-1
Owner: benchan@chromium.org
Status: Assigned (was: Unconfirmed)
benchan@, can you please help to triage.
Please note I won’t buy a Chromebook as I already have a more powerful netbook and there’s no rental service for that in my country.

Comment 3 Deleted

Cc: jorgelo@chromium.org vapier@chromium.org keescook@chromium.org mnissler@chromium.org
Status: Started (was: Assigned)
CVE-2015-8026 seems to be related
Yes but I studied exploitability and preve it is possilble to bypass glibc's bufer overflow detection mechanism. In both cases, things are fixed upstream for a long time.
re #6: Thanks for disclosing the issue and providing the detailed information. We're working on fixes to address the issue.
Labels: Security_Severity-High Security_Impact-Stable M-58 OS-Chrome
I am willing to write any fixes within hours. They were several ways to fix this so I could not write other things than the upgrade patch.
Blockedon: 722946
Blockedon: 722628
Would it be possible to get access to the blockedon bugs?
Blockedon: -722628
Blockedon: 723102
 issue 723102  is about updating fuse-exfat and exfat-utils
and 722946?
722946 is about further restricting the environment of the mount helpers.
I checked about seccomp and found the set of system calls in not fixed accross version. Anyway, as the reported, I would like to participate in fixing 722946

Comment 19 Deleted

Also, what about the automatic downgrade exploit ?
I fully detailed things line by line inside the scripts
Cc: baptiste...@gmail.com
He helped me on the idea to use squashfs

Comment 22 Deleted

Comment 23 Deleted

Project Member

Comment 24 by sheriffbot@chromium.org, Jun 6 2017

Labels: -M-58 M-59
Status: Fixed (was: Started)
Sorry, but does the bug is currently eligible for reward?
Labels: reward-topanel
We should send it to the panel.
Project Member

Comment 28 by sheriffbot@chromium.org, Jun 7 2017

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

Comment 29 by sheriffbot@chromium.org, Jun 9 2017

Labels: Merge-Request-60
Project Member

Comment 30 by sheriffbot@chromium.org, Jun 9 2017

Labels: -Merge-Request-60 Hotlist-Merge-Review Merge-Review-60
This bug requires manual review: M60 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), josafat@(ChromeOS), bustamante@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Please note this was just a question.
I do not want to be paid for what I have already found if it prevent me from getting $100,000 reward for the full exploit chain later (minus what I would have already earned for what I already found).
The answer is yes otherwise.
Labels: M-60
What is the CL that needs to be merged here?
ping for the CL?
Labels: -Merge-Review-60 Merge-Approved-60
ok, approving this one for m60 
Pretty sure the original CLs landed in time for M60.
Labels: -Merge-Approved-60 Merge-Merged
The CL landed in M60 and merged to M59.
Labels: -reward-topanel reward-unpaid reward-3000
Congratulations lael.cellier@ - the VRP panel has decided to award $3,000 for the report. A member of our finance team will be in touch to arrange payment.

*** 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 established 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.
*********************************

Also, how would you like to be credited if this bug is included in future Chrome release notes?
Just credit it to me : Laël Cellier.

But as stated, I don’t want reward if it further prevent me from getting the full reward (minus 3000 on full Attack chain later)
Is it the case ?
Oh, I forget, please also credit it to Baptiste Cellier
Andrew can confirm/correct me but I don't think we've ever blocked a full exploit chain on the grounds that a previous bug reported by the same person had already been rewarded. I don't recall if the reward amounts change, but we always try to reward good bugs.
Correct - we don't want to incentive people to hold on to bugs in hope of a larger payout if they delay reporting it to us.  We'd do the right thing.
Labels: -reward-unpaid reward-inprocess
Project Member

Comment 47 by sheriffbot@chromium.org, Sep 13 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

Comment 48 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Sign in to add a comment