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

Issue 718526 link

Starred by 2 users

Issue metadata

Status: Archived
Owner:
Last visit > 30 days ago
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: 2017-05-16
OS: Chrome
Pri: 2
Type: Bug-Security



Sign in to add a comment

Security: depthcharge write_sparse_image potential oob reads

Reported by derrek.h...@gmail.com, May 4 2017

Issue description

Dear Chromium Security Team,

Please have a look at the "write_sparse_image" function that implements sparse-image writing (which required by fastboot): https://chromium.googlesource.com/chromiumos/platform/depthcharge/+/firmware-smaug-7900.B/src/fastboot/backend.c#108
The important arguments are: "image_addr" - a ptr to the downloaded image data, and "image_size", which is the size of that image.
Now, when you look for references to this "image_size" variable you will notice that there aren't any. All the following code assumes that the supplied image is not malformed. Among other fields, no lengths from its headers/chunks are verified (e.g total_chunks, chunk_size_lba). It just makes sure that the chunk size does not exceed the partition size, but not whether it fits into the downloaded image. Thus, this could very likely go out of bounds.

Kind regards,
-derrek
 
Labels: OS-Chrome
Owner: jorgelo@chromium.org
Status: Assigned (was: Unconfirmed)
jorgelo, could you please take a look? Not familiar with this code.
NextAction: 2017-05-16
I can take a look but the week after next, since I'm OOO next week.
Labels: Security_Impact-None
Thanks! If there's someone else who can take a look too, please assign it to them :)

For now, Security_Impact-None to get this out of the queue since it's not obvious that this is a real vulnerability yet.
Cc: furquan@chromium.org
Components: OS>Firmware
furquan@, the commit logs suggest you wrote this code. Any comments on the absence of image_size checks? Where is the data processed by this function coming from? received via fastboot? If that's the case, it may allow someone to cause RAM contents to be written to a partition, which may or may not be a problem depending on memory contents.
Cc: -furquan@chromium.org jorgelo@chromium.org
Labels: -Security_Impact-None Security_Severity-Low Security_Impact-Stable
Owner: furquan@chromium.org
After looking a bit more at the code, I'm pretty sure the data is indeed an image received from fastboot. One would have to experiment with writing images with inconsistent sizes to see whether this can be exploited. One thing I'd try would be to write to a large partition but only provide a short image, then read back that partition and look at the returned data.

Anyhow, we definitely should get this addressed, so assigning to furquan@.

I'll set Impact-Stable and Severity-Low since for now given that this apparently affects production code, but we haven't come up with a plausible way to exploit this.
Project Member

Comment 6 by sheriffbot@chromium.org, May 8 2017

Labels: Pri-2
Yes, I will take a look.
Re#4: Yes the data is received via fastboot.

Re#5: It is not possible to read back partition from the device using fastboot. Fastboot only allows writing to partitions on the device, not reading them back.

I will push a change out to add checks for image_size.
Project Member

Comment 9 by bugdroid1@chromium.org, May 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/depthcharge/+/f24e564cef473cf9beae54963cb73147aaebfd53

commit f24e564cef473cf9beae54963cb73147aaebfd53
Author: Furquan Shaikh <furquan@chromium.org>
Date: Wed May 10 09:08:29 2017

fastboot/backend: Check image_size for overflow in sparse image write

Add proper checks in sparse image write to avoid image read beyond
image_size.

BUG= chromium:718526 
BRANCH=None
TEST=Compiles successfully.

Change-Id: I4c1d320ceaeb05cd366676123f0c67b4bb5f905f
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/499048
Reviewed-by: Aaron Durbin <adurbin@chromium.org>

[modify] https://crrev.com/f24e564cef473cf9beae54963cb73147aaebfd53/src/fastboot/backend.c
[modify] https://crrev.com/f24e564cef473cf9beae54963cb73147aaebfd53/src/fastboot/backend.h
[modify] https://crrev.com/f24e564cef473cf9beae54963cb73147aaebfd53/src/fastboot/fastboot.c

Can confirm the fix looks right.
Status: Fixed (was: Assigned)
Project Member

Comment 12 by sheriffbot@chromium.org, May 11 2017

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
The NextAction date has arrived: 2017-05-16
This looks like it should at least make it to the rewards panel?
Labels: reward-topanel
Sure, we'll take a look.
Labels: -reward-topanel reward-0
I'm afraid the VRP panel declined to reward for this bug, but did say they would reconsider if you describe how this could be exploitable. Thanks!
Labels: M-60
I guess the only ways to exploit this flaw is:
- dumping/tracing partition data using external hardware attached to the storage device's bus.
- getting access to the partition when the OS is running (another vuln might be required, I am not sure).
Project Member

Comment 19 by sheriffbot@chromium.org, Aug 17 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 20 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Sign in to add a comment