Re: [Trans] [trans] #79 (rfc6962-bis): Precertificate signaturemust be over something other than just the TBSCertificate

Erwann Abalea <eabalea@gmail.com> Fri, 12 June 2015 15:28 UTC

Return-Path: <eabalea@gmail.com>
X-Original-To: trans@ietfa.amsl.com
Delivered-To: trans@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D91BC1A0395 for <trans@ietfa.amsl.com>; Fri, 12 Jun 2015 08:28:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_PASS=-0.001] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mrmmJEyF-7fB for <trans@ietfa.amsl.com>; Fri, 12 Jun 2015 08:27:58 -0700 (PDT)
Received: from mail-vn0-x244.google.com (mail-vn0-x244.google.com [IPv6:2607:f8b0:400c:c0f::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id BCAF01A020B for <trans@ietf.org>; Fri, 12 Jun 2015 08:27:58 -0700 (PDT)
Received: by vnbf190 with SMTP id f190so5463664vnb.3 for <trans@ietf.org>; Fri, 12 Jun 2015 08:27:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SOMCoqEfZ3553Lo1jBEbpHCkvAZwjKHZANTQRqNuV+I=; b=slZuLfVdRETxbNRGJGb4KtepUmbojeDlnLFN1Su/KOGxx3CJjUzD7VpXvLBKYzgbYj Ru8QeFHVtGfqACz0SMsb9LhikfUKssBC7qgqKGgFrxM8UxK6P/Czh6NvbiWNVMV9qHoa JPCF4qIM5XFhjg1kefeKPIWk35FMxMe7178aSlL12tYi42huheQZkRTsed06HzWmg7Qk Z1H6iXdiC2C+kzS5C4sswO7iw0kUy+oTAmDzut3aYajwAEoz0LqcHrmzVZa36ESCwUDV O/A9X4seGaFdPctmrqQzGUtCMn7GAlAQSp7Z11rbfuw6HidUetyrOVUK+Yj59UPYtZOt 3Baw==
MIME-Version: 1.0
X-Received: by 10.52.35.107 with SMTP id g11mr26600279vdj.37.1434122877820; Fri, 12 Jun 2015 08:27:57 -0700 (PDT)
Received: by 10.52.110.2 with HTTP; Fri, 12 Jun 2015 08:27:57 -0700 (PDT)
In-Reply-To: <557ADF0D.4060801@comodo.com>
References: <064.abd6b6595a6018105f8527089cb573db@tools.ietf.org> <079.727c660183267c66b37706330f6dc562@tools.ietf.org> <557A00A9.5010906@bbn.com> <557ADF0D.4060801@comodo.com>
Date: Fri, 12 Jun 2015 17:27:57 +0200
Message-ID: <CA+i=0E4dfmR9xf046T1MPePwi=b9n_qjYgv3MtwkGU=U7oO0jQ@mail.gmail.com>
From: Erwann Abalea <eabalea@gmail.com>
To: Rob Stradling <rob.stradling@comodo.com>
Content-Type: multipart/alternative; boundary="20cf3079c0a4b262ff051853c09e"
Archived-At: <http://mailarchive.ietf.org/arch/msg/trans/WucDAqzOgEvE0aDr1nNrA5K_6_Q>
Cc: "trans@ietf.org" <trans@ietf.org>, Stephen Kent <kent@bbn.com>
Subject: Re: [Trans] [trans] #79 (rfc6962-bis): Precertificate signaturemust be over something other than just the TBSCertificate
X-BeenThere: trans@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Public Notary Transparency working group discussion list <trans.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/trans>, <mailto:trans-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/trans/>
List-Post: <mailto:trans@ietf.org>
List-Help: <mailto:trans-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/trans>, <mailto:trans-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 12 Jun 2015 15:28:01 -0000

Bonjour,

2015-06-12 15:30 GMT+02:00 Rob Stradling <rob.stradling@comodo.com>:

> On 11/06/15 22:42, Stephen Kent wrote:
>
>> what does it mean to not be "an X509 signature"?
>>
>> I thought the intent was to use a CMS object, and thus the signature
>> would be defined by that (profiled) CMS object.
>>
>
> Hi Steve.  That's correct.
>
> At the top of ticket #79 I wrote:
> "If I understand the CMS spec correctly, then we're currently defining a
> Precertificate to be a CMS structure that contains a TBSCertificate and a
> signature over just that TBSCertificate.
> That means that the components of a Precertificate can be trivially
> rearranged into an X.509 certificate with a valid signature!"
>
> It turns out that I didn't understand correctly.  :-)
>
> Ben added some text to help clarify the situation:
> "Note that, because of the structure of CMS, the signature on the CMS
> object will not be a valid X.509v3 signature and so cannot be used to
> construct a certificate from the precertificate."
>

And this is true if and only if the
SignedData.encapContentInfo.eContentType field is set to a value different
from id-data (id-data is the OID { iso(1) member-body(2) us(840)
rsadsi(113549) pkcs(1) pkcs7(7) 1 }).

If the eContentType is set to id-data, the CMS producer can omit the
SignedAttributes, the signature is performed over the eContent (which
contains the TBSCertificate), and the resulting signed precertificate can
be manipulated to become a valid certificate:
  - take the TBSCertificate and the signature from the CMS/precertificate,
  - build a SEQUENCE containing the TBSCertificate, a properly formatted
SignatureAlgorithm, and the signature (reencode it from OCTET STRING to BIT
STRING)
  - you have a valid certificate

To avoid this, just make sure that the TBD in the current rfc6962-bis is
NOT id-data. Or require the presence of the SignedAttributes.

 #79: Precertificate signature must be over something other than just the
>>> TBSCertificate
>>>
>>> Changes (by benl@google.com):
>>>
>>>   * milestone:   => review
>>>
>>>
>>> Comment:
>>>
>>>   After discussion with Rob, core point is that the CMS signature is
>>> not an X509 signature.
>>>
>>>   Fixed at https://github.com/google/certificate-transparency-
>>>   rfcs/commit/546e6e9451186e96ddd7b54ca02f17c8d86f951e.
>>>
>>
This commit has nothing to do with the ticket ;)