[Bimi] No cryptographic connection between VMC and DKIM key

Hanno Böck <hanno@hboeck.de> Sun, 12 May 2024 08:21 UTC

Return-Path: <hanno@hboeck.de>
X-Original-To: bimi@ietfa.amsl.com
Delivered-To: bimi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 38906C14F6B1 for <bimi@ietfa.amsl.com>; Sun, 12 May 2024 01:21:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Level:
X-Spam-Status: No, score=-2.097 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=hboeck.de
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TjsYT_-QW4zg for <bimi@ietfa.amsl.com>; Sun, 12 May 2024 01:21:31 -0700 (PDT)
Received: from zucker.schokokeks.org (zucker.schokokeks.org [IPv6:2a01:4f8:121:1ffe:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E6DD6C14F602 for <bimi@ietf.org>; Sun, 12 May 2024 01:21:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hboeck.de; s=key1; t=1715502085; bh=9nyoanBCY8qZrpZpy1zlMIZd6bT12oQsZO9VaFxr+mQ=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding; b=B3myXtM/GsCNiVMhWUyGHldXUO2M2LG+gf1Wl8WMI8mE6tBvCj8gqGYzEDMqhBxz9 +TFifXnFC9mPaFuOLg4adDbaYHsw6cQyar9uShEKdSy00Kfu/k7Hx4SutSKxuuINdv XAba3mYpNzZ3Z+QsmORLXM2zJU2Ce54ICZN96V2pqtKVhCPw+iHHkGVYsH/mO1GY08 gSBN4EdBZB1MkmTj0BF268B5Sd1TxPrGFRxjKE6Pj6cDvaplLEr9s64HAO0jHVfPVL AfWDSsCriKkisJPMgm2osJwOBHCkoFqn6o4Mun3QLRCn0PPQ+D01ltQhOPE5ML/L5X zkp/rhP0CMu6Q==
Original-Subject: No cryptographic connection between VMC and DKIM key
Author: Hanno Böck <hanno@hboeck.de>
Date: Sun, 12 May 2024 10:21:23 +0200
From: Hanno Böck <hanno@hboeck.de>
To: bimi@ietf.org
Message-ID: <20240512102123.5279f4ef@computer>
X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Message-ID-Hash: VJHSG4TML73ZK3DOXSSM4NYQZ7ISYHGX
X-Message-ID-Hash: VJHSG4TML73ZK3DOXSSM4NYQZ7ISYHGX
X-MailFrom: hanno@hboeck.de
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [Bimi] No cryptographic connection between VMC and DKIM key
List-Id: Brand Indicators for Message Identification <bimi.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/bimi/Ba3jFfJ8K6ic7qg4DzPsIsGW5UY>
List-Archive: <https://mailarchive.ietf.org/arch/browse/bimi>
List-Help: <mailto:bimi-request@ietf.org?subject=help>
List-Owner: <mailto:bimi-owner@ietf.org>
List-Post: <mailto:bimi@ietf.org>
List-Subscribe: <mailto:bimi-join@ietf.org>
List-Unsubscribe: <mailto:bimi-leave@ietf.org>

Hello,

I wanted to share an observation about the BIMI specification.
While I would like to say that this is not directly a security
vulnerability, it is in my view an extremely surprising design decision
that makes other vulnerabilities more likely to have a higher impact.

BIMI introduces the concept of a "Verified Mark Certificate". This
means involving a certificate authority, and having an X.509
certificate with a cryptographic key.

On the other hand, BIMI relies on DMARC and by extension DKIM, and once
a mail has a DMARC policy with either reject or quarantine and a valid
DKIM signature, that mail passes BIMI's requirements.

To my surprise, there is no cryptographic connection between the two.
The cryptographic key in the certificate is not used at all. The only
cryptographic key that matters is the DKIM key. If an attacker gets
access to the DKIM private key, messages can be forged, and they will
not just pass DKIM and DMARC, but als BIMI validation.

This has some consequences. In other areas where certifiate authorites
are involved - like the WebPKI - it is expected that CAs do basic
checking of cryptographic keys and enforce minimum security standards.
E.g., it has long been the case that certificate authorities would not
issue certificates for RSA keys shorter than 2048 bit. CAs are also
expected to not issue certificates for known-compromised keys, or
revoke them if they are made aware of a compromise.

I can personally say from my own research that this approach has a
notable effect: Finding compromised keys within the WebPKI ecosystem is
relatively rare.

None of that is true for DKIM. One can even find hosts with DKIM keys
configured with 512 bit RSA keys and a corresponding BIMI record. 512
bit RSA can be broken on consumer hardware within days with freely
available software. The majority of DKIM RSA keys are 1024 bit, which
is considered to be breakable by powerful attackers, although it has
not been publicly shown.

In essence, while BIMI introduces the complexity of having another
certificate authority ecosystem, it does not introduce the security
that should come with that. It would've easily been possible to design
it in a different way. One could, e.g., imagine that the DKIM key would
have to match the key in the VMC, or that mails get an additional
DKIM-alike signature with the VMC key.

One wonders whether the certificate authorities selling BIMI
certificates for thousands of dollars at least try to educate their
customers about cryptographic security. They could, for example,
monitor the DKIM keys their customers use on common selectors and warn
them if they use substandard cryptography. Based on my observations, I
do not think that CAs do that.


I guess some may consider what I just said as an unimportant or a
merely theoretical issue, so I would like to illustrate it with an
example. Let's take the domain entrust.com. It has a DKIM key
configured at "dkim._domainkey.entrust.com". The TXT record is the
following:

"v=DKIM1; k=rsa;
p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyGF0xzO7Eig1H8QdIErjEKOGnIVvoLU5VjcMRBRWZK65NinL+gVnjuMD2mYdjC3f+7sQCWxGDSKIFn/bB+iXxO2x1/ktkwXHQfQ/9FcFuy+LE0Snsm0SwXN/2l1m5f9e1xdswC+dzHt6DIpDSDENsRal019YKQTqwVyB++7QORwIDAQAB"

This is a 1024 bit RSA key, which is not up to modern standards. But
breaking 1024 bit RSA is still only feasible for very powerful
attackers. However, this key has another problem: it is vulnerable to
the Debian OpenSSL bug (CVE-2008-0166). It is trivially possible to
find the private key (you can use my tool badkeys -
https://badkeys.info/ - to do that):

https://github.com/badkeys/debianopenssl/blob/main/rsa1024/ssl/le32/25731-rnd.key

-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQCyGF0xzO7Eig1H8QdIErjEKOGnIVvoLU5VjcMRBRWZK65NinL+
gVnjuMD2mYdjC3f+7sQCWxGDSKIFn/bB+iXxO2x1/ktkwXHQfQ/9FcFuy+LE0Sns
m0SwXN/2l1m5f9e1xdswC+dzHt6DIpDSDENsRal019YKQTqwVyB++7QORwIDAQAB
AoGAH7zFxt0tY6ryaPKkCI0Fjjd21xDTzxFb11U3AO52BeDJ5BmbGo20lidTg96i
SN0/Whf0qDLQcSPdc8Eo+TJ51jIbLPdy16Rn7cPPJzUDIzJPas4ewkI7lsU37hlC
cr7T521l8g6w/mS2TtTZykpsHvb0tztjQuElS7TxWUuVuskCQQDmrvjJU3u9CMkb
3avhUAXlsK4nboo8GTPt4Ss9O2/ipTx3K+qtAfHM7HiZie3iYwxCKQQ3MdMlmh/N
fPR/rTS9AkEAxaPt3EN8wB4w95FAQd9J338n1hXF0lE7UH1aBemuIbWXgY1UTlL4
X1Kx7rLeuQv8mzFkuQyXSFbq7eBXSBOZUwJACKxLbkZVQKYz6XhMHgyELD6YTaM6
T0gjS65LkeHKMxtDSre7+wU3shyx7BPjfb97loE0R174MVG6IF+yUZqRgQJALhtt
LTqNSuCAOfEn1XY67KnkaDxSFxueQ8vKiaCXYAPWIYIQDemrScmn+vC9ptvWBXqD
bewzCsxEKFRy6DyyQwJAGVyC2vMIL7aeMhB+V9YVDZJlV3MEGCYmbF84ZtLhSWTX
QfUe81qGdL3IBMRqz2GnSS0y7qPN/8CP5W9cKy8aDg==
-----END RSA PRIVATE KEY-----

You can then use a command like dkimsign (part of dkimpy) to create a
signed mail:

dkimsign dkim entrust.com 25731-rnd.key < unsigned.txt > signed.txt

You can find a signed test mail here:
https://16years.secvuln.info/testmail.msg

Given that this host has a default BIMI record, those signed mails will
automatically pass BIMI validation.

For more information, you may also want to check out:
https://16years.secvuln.info/


-- 
Hanno Böck - Independent security researcher
https://itsec.hboeck.de/