Re: [certid] CN-ID and name constraints

Matt McCutchen <matt@mattmccutchen.net> Sat, 25 September 2010 21:31 UTC

Return-Path: <matt@mattmccutchen.net>
X-Original-To: certid@core3.amsl.com
Delivered-To: certid@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id E15823A6AE7 for <certid@core3.amsl.com>; Sat, 25 Sep 2010 14:31:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.261
X-Spam-Level:
X-Spam-Status: No, score=-2.261 tagged_above=-999 required=5 tests=[AWL=-0.262, BAYES_00=-2.599, J_CHICKENPOX_34=0.6]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HjP4PDFjkI21 for <certid@core3.amsl.com>; Sat, 25 Sep 2010 14:31:48 -0700 (PDT)
Received: from homiemail-a1.g.dreamhost.com (caiajhbdccah.dreamhost.com [208.97.132.207]) by core3.amsl.com (Postfix) with ESMTP id 6A49F3A69FB for <certid@ietf.org>; Sat, 25 Sep 2010 14:31:47 -0700 (PDT)
Received: from homiemail-a1.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a1.g.dreamhost.com (Postfix) with ESMTP id 3E72334806A; Sat, 25 Sep 2010 14:32:22 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; c=nofws; d=mattmccutchen.net; h=subject:from :to:cc:in-reply-to:references:content-type:date:message-id :mime-version:content-transfer-encoding; q=dns; s= mattmccutchen.net; b=dn5N1z30dyQOXsuk2tjlCuGv6f1zxPSEUfc8FsIi0q3 0J0RBt2Q8MxOYI/Sev148Y4e1V/EvHxXlE3ZdiHArWg1jPi+jQyRbTKLG47BFUJS PZCkELrWZEW2Wt+hoDYgjUmBm7DhnFGvDrx6Wn5+4TUPXqh4vnzI+XbHGW1vVszA =
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=mattmccutchen.net; h= subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:content-transfer-encoding; s= mattmccutchen.net; bh=NQCea66xvpOUZvJu3HVun6/Uwr4=; b=FcN4MlXKLi BkdkwIh9ChMO5w7y1grZ1OUdf2GYKyz/mA/XcK6ix9yk4gkNqaFe7X4jDEzDdIpJ Nldcof4fQ/BQXOAGLDWU7Nhddmf+hzGH+6J8FBaOd0hyAN2fYOOPcgmCnUT7LN+j YYc7FuXfR0EcHn86LdgslHwHhmIgOP6Io=
Received: from [129.2.249.209] (ml2.student.umd.edu [129.2.249.209]) (Authenticated sender: matt@mattmccutchen.net) by homiemail-a1.g.dreamhost.com (Postfix) with ESMTPA id EFE2E348060; Sat, 25 Sep 2010 14:32:21 -0700 (PDT)
From: Matt McCutchen <matt@mattmccutchen.net>
To: mrex@sap.com
In-Reply-To: <201009250309.o8P39Sc7016343@fs4113.wdf.sap.corp>
References: <201009250309.o8P39Sc7016343@fs4113.wdf.sap.corp>
Content-Type: text/plain; charset="UTF-8"
Date: Sat, 25 Sep 2010 17:32:21 -0400
Message-ID: <1285450341.1940.79.camel@mattlaptop2.local>
Mime-Version: 1.0
X-Mailer: Evolution 2.30.4
Content-Transfer-Encoding: 7bit
Cc: certid@ietf.org
Subject: Re: [certid] CN-ID and name constraints
X-BeenThere: certid@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Representation and verification of identity in certificates <certid.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/certid>, <mailto:certid-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/certid>
List-Post: <mailto:certid@ietf.org>
List-Help: <mailto:certid-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/certid>, <mailto:certid-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 25 Sep 2010 21:31:53 -0000

On Sat, 2010-09-25 at 05:09 +0200, Martin Rex wrote: 
> Matt McCutchen wrote:
> > Matching a reference server name against a CN-ID that violates a dNSName
> > constraint defeats the purpose of name constraints.  With respect to
> > clients willing to do this, a name constraint is a security no-op.
> 
> No, it is not.  If there is anything wrong, then it is the
> server endpoint identification algorithm that is abusing X.509.
> 
> Name Constraints processing, as specified by PKIX, is NONE of the
> apps business.  Processing of name constraints is exclusively
> the task of the certificate path validation implementation
> within the PKI software, and the app doesn't need to know or
> care whether and which subtrees were collected while
> building the certification path and later processed during
> certificate path validation.

I was making an observation, not discussing blame or design.  Do you
deny the truth of the observation?

> 10 years ago, the use of CN-ID has been deprecated by rfc-2818 and
> been specified to not be used when DNSName SAN is present.

Unfortunately, CN-IDs are still widely used, and the browser vendors
have little power to push for their eradication.  See
https://bugzilla.mozilla.org/show_bug.cgi?id=552346 .

> It seems like a bad idea to massively increase the complexity
> of a long deprecated server identification scheme, and in a
> fashion that is not only a magnitude more complex, but
> also amounts to a gruesome breach of the PKIX architecture.

Yes, this is a really ugly situation, but I think making name
constraints secure should be the first priority.

> I'm sorry for having totally missed the TLS&IETF consenus to abandon
> subjectAltNames for server-id-check and to resurrect CN-IDs.

That is not what is happening.  SANs have not been abandoned, and CN-IDs
have not been resurrected (they have been carried over from RFC 2818).

> There may not be an API in the PKI software for returning to
> the app the hierarchy of dNSName name constraints collected while
> composing the cert path and processed during cert path validation,
> which the app would need for a seconds constraints check
> when it decides to try a CN-ID matching fallback.
> 
> If doing DNSName constraints checking proactively during cert path
> validation should be allowed, then a REALLY big warning label
> would be necessary that CN AVAs must either contain a valid f.q.d.n
> or be ABSENT from the server cert subject DName to prevent false
> negatives (i.e. name constraints violation errors) in those
> new TLS implementations that adopt this fancy logic.

Or the server cert can include a dNSName SAN.  In that case, the CN is
not constrained because it is not used for matching anyway.

> > > NSS now enforces name constraints on the CN-ID
> > > (https://bugzilla.mozilla.org/show_bug.cgi?id=394919) and remains
> > > backward compatible with the web by virtue of the fact that the public
> > > CAs aren't using name constraints yet.  If the CAs start doing so, all
> > > an inferior CA has to do for things to work is to include a dNSName SAN,
> > > which is a SHOULD anyway.
> 
> I think it would be more sensible to let CN-IDs rest in peace and
> simply skip the CN-ID matching fallback entirely if the CA cert,
> which signed the server cert, contains a name constraints extension.

That's another fine approach, though the NSS behavior has the advantage
of making it possible to cross-certify an existing CA that uses CN-IDs
and apply name constraints, which is a huge win for me.  I deal with
several organizational CAs that I don't want to trust for the entire web
but would gladly cross-certify for their own domains, and currently I am
adding a certificate exception for each server after manual
verification, which is a huge PITA.

So there are four viable approaches:

0. Don't use the CN-ID.
1. Use the CN-ID only if there are no name constraints.
2. Use the CN-ID only if it satisfies the name constraints (if any).
3. Have certificate validation apply name constraints to the CN unless
there are dNSName SANs or it has some other reason to believe that the
CN will not be used as a CN-ID.  (Implemented in NSS.)

#0 is incompatible with much of today's web.  #1 and #2 require the
server ID check to know about name constraints.  #3 risks rejecting
certificates that contain no dNSName SAN and a CN that was not intended
as a CN-ID.

I propose that section 4.4.4 be changed as follows:

Old: "...the client MAY as a fallback check for a string whose form
matches that of a fully-qualified DNS domain name in the CN-ID."

New: "...the client MAY as a fallback check for a string whose form
matches that of a fully-qualified DNS domain name in the CN-ID, provided
that this domain name satisfies any name constraints on the
certification path as defined by [PKIX] section 4.2.1.10."

On a tangent, I'm unhappy with the idea that the server ID check should
be separate from certificate validation, or even implemented in the
application rather than the TLS library.  Applications will screw it up;
I'd rather the TLS library get it right once and provide an API that
accepts the list of reference identifiers and any other flags necessary
to address the needs of applications.  And combining the server ID check
with certificate validation makes it possible (if desired) to apply name
constraints only to the presented identifier that is actually used,
which could be useful in some cross-certification scenarios.

-- 
Matt