New issue
Advanced search Search tips

Issue 721833 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 15
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug-Security



Sign in to add a comment

Security: %2e in Set-Cookie domain attribute treated as equivalent to "."

Reported by yakovchu...@kpnu.edu.ua, May 12 2017

Issue description

VULNERABILITY DETAILS
Hello. I noticed, that the %2e representation of the "." in the Set-Cookie header accepted by browser as valid.
Example:
Set-Cookie:test=test;domain=%2etest%2ecom
considered by Chrome as equals
Set-Cookie:test=test;domain=.test.com
and lead to the setting cookie to the *.test.com

Impact

Other browsers:
This bug not reproducing in the IE and Firefox.
Security impact: this bug can be used with combination of others, for example - CRLF injection (when the WAF filter the "." symbol, bypass with "%2e" is possible in the Google Chrome)

VERSION
Chrome Version: 58.0.3029.96 + stable
Operating System: Windows 7 x64 SP1

REPRODUCTION CASE
1. Configure some test domain test.com with some test content, and create the subdomain subd.test.com with some content
2. Configure the subdomain for setting the cookies with percent-encoded ".":
Set-Cookie:test=test;domain=%2etest%2ecom
3. Visit subd.test.com
4. Visit the test.com. The cookies will be present inside the request.

Or
1. Find some resource vulnerable to CRLF injection
2. Exploit it using double-encoded "."
http[s]://vulnerable.com/%0d%0aSet-Cookie:test=test2;domain=%25%32%65vulnerable%25%32%65com%0d%0a
3. Chrome will accept Set-Cookie header. Other browsers do not.



 
Components: Internals>Network>Cookies
This is another instance where a web application with a vulnerability that allows injection into the response Cookie header can get cookies to be sent more broadly than they might be otherwise. Like  Issue 711505 , it presupposes an attacker with such permissions can write a value into a cookie that it cannot otherwise read and that there are /some/ constraints on what it can write. 

As such, the exploitability seems extremely limited, especially considering that a site with such a vulnerability is likely to have problems anyway (e.g. Edge and IE don't care if you set a DOMAIN attribute and will send cookies to all subdomains).
Status: Untriaged (was: Unconfirmed)
Summary: Security: %2e in Set-Cookie domain attribute treated as equivalent to "." (was: Security: percent-encoded delimiter "." in the Set-Cookie header considered as valid by Chrome.)
Repro page: http://debugtheweb.com/test/cookie/domainescaped.aspx
Inside the GetCookieDomainWithString function,

  // Get the normalized domain specified in cookie line.
  url::CanonHostInfo ignored;
  std::string cookie_domain(CanonicalizeHost(domain_string, &ignored));

The CanonicalizeHost function converts the %2e to .
Labels: Security_Severity-Low Security_Impact-Stable Pri-2
Owner: mkwst@chromium.org
Status: Assigned (was: Untriaged)
Assigning similar labels as 711505

Comment 5 by wfh@chromium.org, May 16 2017

Labels: OS-All
Cc: chlily@chromium.org mef@chromium.org mmenke@chromium.org morlovich@chromium.org
Labels: Hotlist-Cookies
Owner: ----
Status: Untriaged (was: Assigned)
(Unassigning myself, marking untriaged in preparation to retriage with folks who will do a better job taking care of cookies than I've been able to)
[mkwst]:  I don't suppose you know if we need to support escape sequences in set-cookie domain names in general (for IDNs, especially)?  The Set-Cookie spec looks to only support punycoded domain names, but I'm reluctant to trust the spec, if browsers all allow percent-encoding here.
Cc: -chlily@chromium.org
Owner: chlily@chromium.org
Status: Assigned (was: Untriaged)
Looks like FireFox, at least, doesn't unescape characters in document.cookie=... calls (Testing the Set-Cookie lines of network requests is more involved, and should use the same parser, anyways...), so we'll try following suit.
Project Member

Comment 9 by bugdroid1@chromium.org, Oct 15

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

commit 31feac996c68b8024000bdad91de45536fd33bcb
Author: Lily Chen <chlily@chromium.org>
Date: Mon Oct 15 15:45:52 2018

Disallow %-escaped characters in cookie domains

Previously, any %-escaped characters would be unescaped when parsing
a cookie's domain attribute, leading to a potential security
vulnerability. This change disallows % characters in the cookie domain
by failing to get the cookie domain if the domain string contains a %
character.

Bug:  721833 
Change-Id: Ie55d5228eea33920cfa3792c5bf63989498e769d
Reviewed-on: https://chromium-review.googlesource.com/c/1277583
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Commit-Queue: Lily Chen <chlily@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599644}
[modify] https://crrev.com/31feac996c68b8024000bdad91de45536fd33bcb/net/cookies/canonical_cookie_unittest.cc
[modify] https://crrev.com/31feac996c68b8024000bdad91de45536fd33bcb/net/cookies/cookie_util.cc

Status: Fixed (was: Assigned)
Labels: reward-topanel
Project Member

Comment 12 by sheriffbot@chromium.org, Oct 16

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Labels: -reward-topanel reward-0
I'm afraid the VRP panel declined to reward (as is often the case for low severity bugs), but also couldn't detmain how this could be used in an attack.

But many thanks for the report, nevertheless!
Project Member

Comment 14 by sheriffbot@chromium.org, Yesterday (32 hours ago)

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