Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Issue 2134083003: Reject line terminators in HttpUtil::IsValidHeaderValue() (Closed)

Created:
4 years, 5 months ago by Adam Rice
Modified:
4 years, 5 months ago
Reviewers:
hiroshige, mmenke
CC:
chromium-reviews, cbentzel+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Reject line terminators in HttpUtil::IsValidHeaderValue() IsValidHeaderValue() is used for validation of untrusted input in at least two places: https://cs.chromium.org/chromium/src/chrome/browser/extensions/api/downloads/downloads_api.cc?q=file:%5Esrc/chrome/browser/extensions/api/downloads/downloads_api.cc+IsValidHeaderName https://cs.chromium.org/chromium/src/content/browser/renderer_host/websocket_host.cc?q=file:%5Esrc/content/browser/renderer_host/websocket_host.cc+IsValidHeaderValue Currently this method only rejects an explicit CRNL in the header value. However, some web servers treat a single CR or NL as line terminators, even when other lines in the same request use CRNL. In particular, Apache 2.4.10 treats NL this way. This means that input validated by this function can still inject new headers, at least for some servers. This CL modifies the function to reject individual CR and NL in the header value. This is still not as strict as RFC 7230, but it is sufficient to prevent the potential privilege escalation. BUG=627394 Committed: https://crrev.com/b0723324a1ea7ee8b3fc71e61ed8767c045f9883 Cr-Commit-Position: refs/heads/master@{#404987}

Patch Set 1 #

Total comments: 7

Patch Set 2 : Changes from mmenke #

Unified diffs Side-by-side diffs Delta from patch set Stats (+27 lines, -3 lines) Patch
M net/http/http_util.cc View 1 chunk +2 lines, -3 lines 0 comments Download
M net/http/http_util_unittest.cc View 1 1 chunk +25 lines, -0 lines 0 comments Download

Messages

Total messages: 25 (9 generated)
Adam Rice
hiroshige, I am sending this to you since you were involved in the discussion at ...
4 years, 5 months ago (2016-07-12 02:27:27 UTC) #2
hiroshige
Looks basically good. This CL makes HttpUtil::IsValidHeaderValue() consistent with Blink's isValidHTTPHeaderValue(). HttpRequestHeaders::SetHeader() has DCHECK(HttpUtil::IsValidHeaderValue()). Does ...
4 years, 5 months ago (2016-07-12 09:17:57 UTC) #3
Adam Rice
On 2016/07/12 09:17:57, hiroshige wrote: > HttpRequestHeaders::SetHeader() has DCHECK(HttpUtil::IsValidHeaderValue()). > Does the callers of HttpRequestHeaders::SetHeader() ...
4 years, 5 months ago (2016-07-12 09:35:21 UTC) #4
hiroshige
non-owner lgtm. > We could temporarily change the DCHECK to a CHECK to try to ...
4 years, 5 months ago (2016-07-12 10:15:31 UTC) #6
Adam Rice
On 2016/07/12 10:15:31, hiroshige wrote: > > We could temporarily change the DCHECK to a ...
4 years, 5 months ago (2016-07-12 10:41:25 UTC) #9
Adam Rice
+mmenke for //net OWNERS. You seem to have done most recent reviews in this area, ...
4 years, 5 months ago (2016-07-12 10:42:10 UTC) #11
mmenke
On 2016/07/12 10:42:10, Adam Rice wrote: > +mmenke for //net OWNERS. > You seem to ...
4 years, 5 months ago (2016-07-12 18:21:26 UTC) #12
mmenke
https://codereview.chromium.org/2134083003/diff/1/net/http/http_util_unittest.cc File net/http/http_util_unittest.cc (right): https://codereview.chromium.org/2134083003/diff/1/net/http/http_util_unittest.cc#newcode1371 net/http/http_util_unittest.cc:1371: static const char* const invalid_values[] = { nit: Don't ...
4 years, 5 months ago (2016-07-12 18:24:49 UTC) #13
Adam Rice
On 2016/07/12 18:21:26, mmenke wrote: > LGTM. This seems reasonable, though I'm unsure about fallout. ...
4 years, 5 months ago (2016-07-13 01:46:00 UTC) #14
Adam Rice
https://codereview.chromium.org/2134083003/diff/1/net/http/http_util_unittest.cc File net/http/http_util_unittest.cc (right): https://codereview.chromium.org/2134083003/diff/1/net/http/http_util_unittest.cc#newcode1371 net/http/http_util_unittest.cc:1371: static const char* const invalid_values[] = { On 2016/07/12 ...
4 years, 5 months ago (2016-07-13 01:47:00 UTC) #15
mmenke
On 2016/07/13 01:46:00, Adam Rice wrote: > On 2016/07/12 18:21:26, mmenke wrote: > > LGTM. ...
4 years, 5 months ago (2016-07-13 01:52:23 UTC) #16
mmenke
On 2016/07/13 01:52:23, mmenke wrote: > On 2016/07/13 01:46:00, Adam Rice wrote: > > On ...
4 years, 5 months ago (2016-07-13 01:52:54 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2134083003/20001
4 years, 5 months ago (2016-07-13 02:02:45 UTC) #20
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 5 months ago (2016-07-13 03:53:58 UTC) #22
commit-bot: I haz the power
CQ bit was unchecked.
4 years, 5 months ago (2016-07-13 03:54:09 UTC) #23
commit-bot: I haz the power
4 years, 5 months ago (2016-07-13 03:56:51 UTC) #25
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/b0723324a1ea7ee8b3fc71e61ed8767c045f9883
Cr-Commit-Position: refs/heads/master@{#404987}

Powered by Google App Engine
This is Rietveld 408576698