Re: [Trans] Mutability of Certificate Signatures

Eran Messeri <eranm@google.com> Tue, 06 June 2017 17:28 UTC

Return-Path: <eranm@google.com>
X-Original-To: trans@ietfa.amsl.com
Delivered-To: trans@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 71B271200CF for <trans@ietfa.amsl.com>; Tue, 6 Jun 2017 10:28:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.701
X-Spam-Level:
X-Spam-Status: No, score=-2.701 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=google.com
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 iIyysduyiwka for <trans@ietfa.amsl.com>; Tue, 6 Jun 2017 10:28:23 -0700 (PDT)
Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (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 44150129AF4 for <trans@ietf.org>; Tue, 6 Jun 2017 10:28:23 -0700 (PDT)
Received: by mail-it0-x230.google.com with SMTP id m47so113981030iti.0 for <trans@ietf.org>; Tue, 06 Jun 2017 10:28:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=EUq97YxSNsVTh9XTHhsQ05aLYlm4OFx4Ggpf4gBEPjo=; b=nnCFnJ0ME4E6aC0A9oE8nq3TZFs0ysRR9JBMflOAdlwT1QbOf/uZfF8PzgGGXbjAE2 6MHBHeAzGl8kx+rz0Ux/Q3MLcWMMY04xqePywzfI5QIGGLH3e78f2whNnjtP+NjXX8cZ ZEfjJZ7PkLOv+zY/2UB3vPkW9AlCmBMA1dFGKHFKEXJTAqMVjmpKAnAqbQfNc7vzYEBe zvRAjJDiWOCbWzBIjl5BZ7+znY5PilefyVHExaRIRmhzkLl4HaX17RfsFtyiFiyro6wh pAw9dZ8hdR5KvuQkawRdmdNWkRe9lwJM09UuLob7q+Y7+rWGD7XLG7I0Ggl2+HfewLZM zBTQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=EUq97YxSNsVTh9XTHhsQ05aLYlm4OFx4Ggpf4gBEPjo=; b=BdTCNNIGLH6ym2dIAkOFs+oowf+pQpSUZbenfq9XMRBkrkZoXzTL88Mkrh1cVGPgJP wQ2CL5FQrF/F1PZAQMZ9YI4jQS5tV1MPEPc9EQ0p8/auwx1qlWQLM58otm0jGK2M5lud YmyXmFH3Q5mmbXAb/eyPKmasRR6+1oAfKBcIgPsP7BC/2GFXtHg5StG0oo84q30ptGr8 j7zmEW5g6MA0bbaEuKKEIgSVcId5W9nFqewC9u4ZIO9Ykib5mfuBfwbNepMeIM0lSqHk bL/uHMAL/27L7F4GCS1gkEVtpoSyiCQc6v9bHs6jRtaOb3WETdFM1rJwMiGMidQnaxos 6irA==
X-Gm-Message-State: AODbwcDZy7+k0fMh+hjhDo7kdln/YGMbac92DKhQ7fiUAci8Fdo+zCmD gxbNEzxY4zbGTcbY4atXeQZiB/CzRgCOF+M=
X-Received: by 10.36.131.139 with SMTP id d133mr17967846ite.112.1496770102471; Tue, 06 Jun 2017 10:28:22 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.107.168.204 with HTTP; Tue, 6 Jun 2017 10:27:51 -0700 (PDT)
In-Reply-To: <20170606100022.581f35cc2775fcc3abdfcfa2@andrewayer.name>
References: <20170528191028.20f285073eea33a3f23b6b5a@andrewayer.name> <CALzYgEc6fV7n3mDFfDP9gktA7igghVA7duRWYMytzKAZ51O3sQ@mail.gmail.com> <20170606100022.581f35cc2775fcc3abdfcfa2@andrewayer.name>
From: Eran Messeri <eranm@google.com>
Date: Tue, 06 Jun 2017 18:27:51 +0100
Message-ID: <CALzYgEdCyaGWcprvPjdfj1Z2c5bVnHQ13PZ6aEU3PSMBjfUYBg@mail.gmail.com>
To: Andrew Ayer <agwa@andrewayer.name>
Cc: "trans@ietf.org" <trans@ietf.org>
Content-Type: multipart/alternative; boundary="94eb2c11885e454f0d05514df2f4"
Archived-At: <https://mailarchive.ietf.org/arch/msg/trans/R-NukXZzRJWO0yyE5yEfLIdkiFI>
Subject: Re: [Trans] Mutability of Certificate Signatures
X-BeenThere: trans@ietf.org
X-Mailman-Version: 2.1.22
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: <https://mailarchive.ietf.org/arch/browse/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: Tue, 06 Jun 2017 17:28:25 -0000

On Tue, Jun 6, 2017 at 6:00 PM, Andrew Ayer <agwa@andrewayer.name> wrote:

> On Mon, 5 Jun 2017 22:42:08 +0300
> Eran Messeri <eranm@google.com> wrote:
>
> > I think that the suggestion to fix this by defining as misbehaviour
> > the presentation of an incorrectly-signed certificate chain in
> > get-entries is the right one.
> > Reasoning:
> > - An SCT is useless to an attacker without a valid signature over the
> > certificate/precertificate: The collusion described above is only
> > harmful if a CA an a log are compromised, and even then, all it
> > enables is for the CA to wash its hands of a particular certificate
> > (which wouldn't be accepted by TLS clients without a valid signature).
> > - It is pretty straightforward for a monitor to validate that all
> > chains presented in get-entries are valid chains.
> > - If we can't solve it properly for precertificates, then having
> > different security guarantees for different kinds of entries  would
> > be confusing, at best.
> >
> > The upside of the change to only use the TBSCertificate + Issuer key
> > hash in the log entry is that it's much easier to reconstruct the
> > input for SCT signature validation: The same code is used for certs
> > and precertificates.
>
> You raise a good point: since there are far more TLS clients than
> monitors, it makes more sense to fix this problem by adding complexity
> to monitors than to TLS clients.  So I agree that defining this as
> misbehavior and having monitors check is the right solution.
>
> Let's make sure we agree what monitors need to check for certificates
> (mutatis mutandis for precertificates):
>
> 1. The tbs_certificate in the x509_entry_v2 TransItem structure returned
> by get-entries must be byte-for-byte identical to the TBSCertificate
> portion of the leaf_certificate in the corresponding X509ChainEntry
> structure returned by get-entries.
>
Correct.

>
> 2. The issuer_key_hash in the x509_entry_v2 TransItem structure returned
> by get-entries must correspond to the public key of the issuer of the
> leaf_certificate in the corresponding X509ChainEntry structure returned
> by get-entries.
>
Correct.

>
> 3. The signature of the leaf_certificate in the X509ChainEntry
> structure returned by get-entries must be a valid signature from the
> key of its issuer.
>
Correct.

>
> How should a monitor get the issuer public key to perform checks 2 and
> 3? The obvious way is to look at the first item in the X509ChainEntry's
> certificate_chain if the certificate is not self-signed, and at the
> certificate itself if it is self-signed.
>
Yes, the chain must be valid, so the first item in the chain (after the
logged leaf) should be the issuer certificate.

>
> Unfortunately, if the logged certificate is a non-self-signed trust
> anchor accepted by the log, then certificate_chain is empty and there
> is no way to get the issuer public key.  So a log could evade
> responsibility by making the certificate with a mutated signature a
> trust anchor.
>
Correct - but then the monitor should be able to verify it was a trust
anchor at the point it was logged (maybe the output of get-trust-anchors
should  be signed?).

>
> The inability to always get the issuer public key has been an
> inconvenience for me when monitoring RFC6962 logs. Sometimes I end up
> with a certificate and all I know about its issuer is its subject, when
> ideally I would like to know its public key as well (since a CA is
> uniquely identified by its subject and public key).  (I suspect crt.sh
> has the same problem, based on some weird things I've observed there.)
> I previously considered this a mere inconvenience, but now I see it as a
> security problem.
>
Could you elaborate? Is that a security problem from a CT perspective - as
in, could enable a log to avoid responsibility for something it logged, or
from a WebPKI perspective, where some certificates can be in circulation
but their issuer unknown?
I'm trying to better understand under which circumstances such certificates
would end up in the log - when would a log add a non-self-signed
certificate as a trust anchor?

>
> I think that the TimestampedCertificateEntryDataV2 structure should
> contain the full public key of the issuer instead of just its hash.
> That way, monitors are guaranteed access to the issuer public key, and
> it's easy to get.  Step 2 above could be eliminated, and step 3 becomes
> simpler (no need to parse the issuer certificate to extract the public
> key).
>
> Thoughts?
>
> Regards,
> Andrew
>