New issue
Advanced search Search tips

Issue 905994 link

Starred by 2 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 2
Type: Feature



Sign in to add a comment

"AutoSelectCertificateForUrls" configuration does not work when there are 2 certificates with the same CN

Reported by daktylo...@gmail.com, Nov 16

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36

Steps to reproduce the problem:
1. Install 2 certificates with similar CN path
a) 
CN = TEST Company x
CN = AIA
CN = Public Key Services
CN = Services
CN = Configuration
DC = auredi
DC = etit

b) 
CN = Company x
CN = AIA
CN = Public Key Services
CN = Services
CN = Configuration
DC = auredi
DC = net

2. configure register to setup autoselect for the URL
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\AutoSelectCertificateForUrls]
"1"="{"pattern": "MY_URL", "filter" : {"ISSUER": {"CN":"Configuration"} } }"

3. start chrome and go to MY_URL

What is the expected behavior?
I need to know how can I setup additional filters to indicate "CN = Company x" not "CN = TEST Company x".
It only works when I setup CN = Configuration. 
It causes the wrong cert is chosen and I cannot connect.

What went wrong?
Wrong certificate in chosen as there exists 2 with teh same CN

Did this work before? N/A 

Chrome version: 67.0.3396.62  Channel: stable
OS Version: Windows 7 Enterprise
Flash Version:
 
Components: Internals>Network>Certificate
Cc: davidben@chromium.org mattm@chromium.org
Labels: -Type-Bug-Security -Restrict-View-SecurityTeam OS-Chrome OS-Linux OS-Mac Type-Bug
This does not sound like a security bug, but rather a feature request for AutoSelectCertificateForUrls. Derestricting the view and cc-ing davidben@ and mattm@ for triage.
Cc: pmarko@chromium.org
Components: Enterprise
Redirecting to Enterprise
Cc: hendrich@chromium.org
We currently only support matching by Issuer CommonName[1].

I do think it makes sesne to add more matching criteria.
Ideally, we'd be on-par with ONC[2], which supports
Issuer CommonName
Issuer Locality
Issuer Organization
Issuer OrganizationalUnit

Subject CommonName
Subject Locality
Subject Organization
Subject OrganizationalUnit

To adhere to the existing style of the AutoSelectCertificateForUrls policy, we could call these:
top-level: ISSUER and SUBJECT
second level: CN, L, O, OU. 

[1] https://cs.chromium.org/chromium/src/chrome/browser/chrome_content_browser_client.cc?type=cs&sq=package:chromium&g=0&l=703
[2] https://chromium.googlesource.com/chromium/src/+/master/components/onc/docs/onc_spec.md#CertificatePattern-type
Labels: -Type-Bug Type-Feature
If possible we should reuse the matching code - however it currently is in //chromeos/network, while this matching is in //chrome/browser, so we'd have to move that code to a place usable from both.
Maybe //component/certificate_principal_matcher ? Discussing if that is overkill.
Labels: M-74
Owner: pmarko@chromium.org
Targeting M-74 at the moment.
I've received pushback in the past (regarding https://chromium.googlesource.com/chromium/src/+/HEAD/components/README ), as these aren't about iOS, Android, or "embedders" of Chrome. That said, perhaps the definition has changed regarding ChromeOS, as evidenced by ONC, in which case, //components/ would be the right place. To pre-emptively head it off, I don't think //net is a good place :)
Would this common code include stuff like  CertificatePattern::ReadFromONCDictionary, which seems to pull in, e.g., onc::client_cert::kIssuer?

I wonder if it should just be in components/onc then, considering these patterns are defined in ONC to begin with. A little bit of silliness with having that pattern format be used outside CrOS too, but having a common certificate pattern throughout seems sensible.
Yeah I thought about having the shared code only define
- a CertificatePattern::PrincipalPattern class which would take 4 strings in its ctor (for CN,L,O,OU)
- a CertificatePattern class which would have a ctor that takes two PrinipalPatterns (for subject and issuer).
(we could add things like SANs later if we want).
  CertificatePattern would have a virtual bool Match(const X509Certificate&) method.

The AutoSelectCertificateForUrls policy code would create these from the JSON there.
The ONC code would also depend on it and would subclass CertificatePattern -> OncCertificatePattern (which holds stuff such as enrollment_uri) and would contain parsing logic there I guess.

So yeah, it is probably not enough code to justify a component w/ OWNERS,README,BUILD :-) OTOH I don't think there's any other sensible place to put this. We may just end up duplicating the code.
Status: Assigned (was: Unconfirmed)
New idea: I'll try to move the common code to //components/policy as the patterns are fundamentally a policy feature and that code can be used from both //chrome/browser and //chromeos. Yay!

Comment 12 by pmarko@chromium.org, Jan 17 (5 days ago)

Status: Started (was: Assigned)
WIP: https://chromium-review.googlesource.com/c/chromium/src/+/1405011

Sign in to add a comment