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

Issue 833729 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac , Fuchsia
Pri: 2
Type: Bug-Security



Sign in to add a comment

Improper Gzip Decompressing allows content to be added to the file

Reported by v3rm...@gmail.com, Apr 17 2018

Issue description

Chrome Version       : 65.0.3325.181 (Official Build) (64-bit) (cohort: Stable)
URLs (if applicable) : http://c4.rbxcdn.com/015da29735fee85337e16db7968e117b
Other browsers tested:
    Firefox: OK
    Google Chrome: FAIL
What steps will reproduce the problem?
(1) gzip the content preferably using the zlib gzip program
(2) Open the file in a hex editor and add content to the end
(3) raw upload the file to preferably a CDN with the Content-Encoding header set  to Gzip

What is the expected result?
The added content should be ignored when downloaded

What happens instead?
The added content to the end of the gzip when downloaded is added to the content of the file

Please provide any additional information below. Attach a screenshot if
possible.

I found this bug while doing a bug bounty search on a private program for another corporation and before we resolved it we found out it was actually a bug in Google Chrome, I am using a directly linked file on their cdn for the example, notice how the file is gzip encoded, but the "raspy was here" at the end of the raw gzip was added to the actual content, I haven't tested this far enough to know this, but I believe this may also bypass the download protection on chrome. I'll attach the actual gzip file used on the cdn in the report for your own testing. Also note I'm only 17 and have been doing this stuff for a couple years and I'm not fully familiar with professional stuff like this. If you need more info or have questions or need clarification please contact me on my gmail (v3rmies@gmail.com) or here if needed

 
test.txt.gz
47 bytes Download
Components: Internals>Network

Comment 2 by mmenke@chromium.org, Apr 17 2018

Cc: eroman@chromium.org xunji...@chromium.org
Owner: mmenke@chromium.org
Status: Assigned (was: Unconfirmed)
Thanks for the high quality bug report!

The behavior's weird, but we've mostly kept it because of inertia (And it's probably what FireFox used to do).  This sounds like a real potential attack vector to me - not one that's so important that we need to rush out a fix, but one that makes this weirdness definitely worth fixing, sooner rather than later.

Comment 3 by mmenke@chromium.org, Apr 17 2018

Components: -Internals>Network Internals>Network>Filters

Comment 4 by mmenke@chromium.org, Apr 17 2018

Also, this doesn't cause issues with Chrome's protection - safebrowsing checks are done at the URL layer, and basically all code in Chrome beyond the HTTP stack sees the actual response body, after decompression (Since that's built into the network layer).  When we trigger the OSes download checks, those either use the downloaded file path, or would be passed the extracted stream (Not sure which - not familiar with that code).

The main threat model here is that a server or proxy may have security-related checks that only inspect the gzipped data, ignoring any extra bits at the end of the file.

Comment 5 by v3rm...@gmail.com, Apr 17 2018

Ah I see, Thanks for addressing this though. Caused some confusion until we figured out it was chrome. Hope this gets updated and fixed up though.

Comment 6 by eroman@chromium.org, Apr 17 2018

Labels: -Type-Bug Security_Severity-Low Security_Impact-Stable Restrict-View-SecurityTeam OS-Android OS-Chrome OS-Fuchsia OS-Linux OS-Mac Type-Bug-Security
Tentatively assigning security labels.
This was done to match Mozilla's behavior at least according to the comment on the old code.

https://chromium.googlesource.com/chromium/src/+/fb4e32fc88050cd82bdb74edc90fb4fe3dfe56e7/net/filter/gzip_filter.cc

  if (decoding_status_ == DECODING_DONE) {
    if (GZIP_GET_INVALID_HEADER != gzip_header_status_)
      SkipGZipFooter();
    // Some server might send extra data after the gzip footer. We just copy
    // them out. Mozilla does this too.
    return CopyOut(dest_buffer, dest_len);
  }


GzipSourceStream (a replacement of GzipFilter) kept the (passing through data after EOF) behavior.

Comment 8 by mmenke@chromium.org, Apr 18 2018

Experimentally, FireFox no longer seems to do this, so we seem to be the only ones doing it.  Even if we weren't, it's weird enough behavior that it would probably be best to push on removing it.
SGTM. Thanks for taking this!
Project Member

Comment 10 by sheriffbot@chromium.org, Apr 18 2018

Labels: -Pri-3 Pri-2
Project Member

Comment 11 by bugdroid1@chromium.org, Apr 18 2018

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

commit 9cb5fa1df50d2ee343a40627d34a57f7486e6c1e
Author: Matt Menke <mmenke@chromium.org>
Date: Wed Apr 18 18:22:26 2018

If there are extra bytes at the end of a gzip response, ignore them.

Previously, they were passed through unaltered, which was rather
unexpected. We could error out requests instead, but erroring out after
successfully decoding the response body seems likely to lead to more
compatibility issues than fix anything.

Bug:  833729 
Change-Id: I7e0948aa4d3b963f27f4c954d9576b89e963fffb
Reviewed-on: https://chromium-review.googlesource.com/1015516
Reviewed-by: Helen Li <xunjieli@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551753}
[modify] https://crrev.com/9cb5fa1df50d2ee343a40627d34a57f7486e6c1e/net/filter/gzip_source_stream.cc
[modify] https://crrev.com/9cb5fa1df50d2ee343a40627d34a57f7486e6c1e/net/filter/gzip_source_stream.h
[modify] https://crrev.com/9cb5fa1df50d2ee343a40627d34a57f7486e6c1e/net/filter/gzip_source_stream_unittest.cc

Status: Fixed (was: Assigned)
I don't think this is worth a merge.  I would classify it as Sec-Severity-None, and think we should remove access restrictions, but I'll defer to others on that.
Project Member

Comment 13 by sheriffbot@chromium.org, Apr 19 2018

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Labels: reward-topanel
Hi v3rmies@ - I'm afraid the VRP panel declined to award for this, as we couldn't see how it could be exploited. Many thanks for the report though!
Labels: -reward-topanel reward-0
Project Member

Comment 17 by sheriffbot@chromium.org, Jul 26

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