Bug 575281 (CVE-2021-34433) - 2.0 - 2.6 : DTLS vulnerability not verifying the server certificate, when ServerKeyExchange is not signed
Summary: 2.0 - 2.6 : DTLS vulnerability not verifying the server certificate, when Ser...
Status: RESOLVED FIXED
Alias: CVE-2021-34433
Product: Californium
Classification: IoT
Component: Californium (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: security
Depends on:
Blocks:
 
Reported: 2021-08-06 10:06 EDT by Achim Kraus CLA
Modified: 2021-08-24 12:01 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Achim Kraus CLA 2021-08-06 10:06:58 EDT
According RFC5246, the ServerKeyExchange may have no "signed_params" for 
anonymous key exchanges. Unfortunately the "signed_params" may be simply left out by an attacker also in non-anonymous key exchanges in order to bypass the signature verification. Californium doesn't check that, it only ignores the verification, if the signature is missing.

Proposed behavior:
- fail, when no signature is provided in the ServerKeyExchange

FMPOV, this bug requires a CVE.
Comment 1 Achim Kraus CLA 2021-08-06 10:15:53 EDT
All versions 2.0-2.6.4 are affected and also all 3.0.0 milestones.
Version 1.0 are not affected, there a NullPointerException will fail the handshake.
Comment 2 Achim Kraus CLA 2021-08-06 10:18:13 EDT
FMPOV

http://cwe.mitre.org/data/definitions/322.html

describes the error.
Comment 4 Simon Bernard CLA 2021-08-06 10:52:37 EDT
Could you precise which of PSK, RPK or X509 mode is affected ?
Client, Server or both ?
Comment 5 Achim Kraus CLA 2021-08-06 11:01:20 EDT
DTLS client-side, RPK and X509 mode.

The client considers the Certificate to be verified by the signature, but an attacker (server-side) may send a certificate and no signature in the ServerKeyExchange, which bypasses that signature verification.  

I started to consider, if a role-exchange extends the scope. I didn't find, that this extends that attack.
Comment 6 Achim Kraus CLA 2021-08-09 10:42:18 EDT
Project name: Eclipse Californium

Versions affected: [2.0.0, 2.6.4] and [3.0.0-M1, 3.0.0-M3]

Common Weakness Enumeration:

- CWE-322: Key Exchange without Entity Authentication

Summary:

In Eclipse Californium version 2.0.0 to 2.6.4 and 3.0.0-M1 to 3.0.0-M3, the certificate based (x509 and RPK) DTLS handshakes accidentally succeeds without verifying the server side's signature on the client side, if that signature is not included in the server's ServerKeyExchange.

Links:

- https://bugs.eclipse.org/575281
Comment 7 Achim Kraus CLA 2021-08-09 10:43:16 EDT
@Simon
@Kai

please check, if that description is OK for you.
Comment 8 Kai Hudalla CLA 2021-08-10 01:58:26 EDT
(In reply to Achim Kraus from comment #0)
> According RFC5246, the ServerKeyExchange may have no "signed_params" for 
> anonymous key exchanges. Unfortunately the "signed_params" may be simply
> left out by an attacker also in non-anonymous key exchanges in order to
> bypass the signature verification. Californium doesn't check that, it only
> ignores the verification, if the signature is missing.
> 
> Proposed behavior:
> - fail, when no signature is provided in the ServerKeyExchange
> 

Since we do not support anonymous key exchanges at all, I also think that this is the way to go.

> FMPOV, this bug requires a CVE.

I agree
Comment 9 Kai Hudalla CLA 2021-08-10 02:00:10 EDT
(In reply to Achim Kraus from comment #5)
> DTLS client-side, RPK and X509 mode.
> 
> The client considers the Certificate to be verified by the signature, but an
> attacker (server-side) may send a certificate and no signature in the
> ServerKeyExchange, which bypasses that signature verification.  
> 
> I started to consider, if a role-exchange extends the scope. I didn't find,
> that this extends that attack.

Does this mean that a client that wants to authenticate using a certificate or RPK cannot simply omit the signed_params in order to bypass the server's verification?
Comment 10 Kai Hudalla CLA 2021-08-10 02:03:51 EDT
(In reply to Achim Kraus from comment #6)
> Project name: Eclipse Californium
> 
> Versions affected: [2.0.0, 2.6.4] and [3.0.0-M1, 3.0.0-M3]
> 
> Common Weakness Enumeration:
> 
> - CWE-322: Key Exchange without Entity Authentication
> 
> Summary:
> 
> In Eclipse Californium version 2.0.0 to 2.6.4 and 3.0.0-M1 to 3.0.0-M3, the
> certificate based (x509 and RPK) DTLS handshakes accidentally succeeds
> without verifying the server side's signature on the client side, if that
> signature is not included in the server's ServerKeyExchange.
> 
> Links:
> 
> - https://bugs.eclipse.org/575281

That one is ok for me. Another one that seems appropriate would be http://cwe.mitre.org/data/definitions/347.html FMPOV
Comment 11 Achim Kraus CLA 2021-08-10 03:01:58 EDT
In reply to #9

> Does this mean that a client that wants to authenticate using a certificate or RPK cannot simply omit the signed_params in order to bypass the server's verification?

According RFC5246, the client has to use the CertificateVerify
https://datatracker.ietf.org/doc/html/rfc5246#section-7.4.8 for that.
That is checked and will fail the handshake. If a none empty client certificate is sent, the missing of that message will also fail the handshake. 

In RFC5246 that's the difference in the server and client certificate based authentication.
server: Certificate and signed ServerKeyExchange
client: Certificate and signed CertificateVerify. The ClientKeyExchange is not signed at all. 

A anonymous server will not sent a Certificate and doesn't include the signature in the ServerKeyExchange.

A anonymous client will send a empty certificate an no CertificateVerify. According the configured client authentication mode (none/wanted/needed), a empty certificate is refused or passes the check. 

I guess, that system reflects many cases, where only the server is authenticated and the client stay anonymous until some "token" or "username/password" authenticates it over the already encrypted connection.
Comment 12 Achim Kraus CLA 2021-08-10 03:07:51 EDT
In reply to #10

> http://cwe.mitre.org/data/definitions/347.html 

My interpretation of 347 is, that there is a signature, but that is not proper checked.

My interpretation of 322 is, that "without Entity Authentication" meana also without signature.

Sure, just interpretations.
Comment 13 Kai Hudalla CLA 2021-08-10 03:09:20 EDT
(In reply to Achim Kraus from comment #12)
> In reply to #10
> 
> > http://cwe.mitre.org/data/definitions/347.html 
> 
> My interpretation of 347 is, that there is a signature, but that is not
> proper checked.
> 
> My interpretation of 322 is, that "without Entity Authentication" meana also
> without signature.
> 
> Sure, just interpretations.

Then let's stick with 322.
Comment 14 Kai Hudalla CLA 2021-08-10 03:10:12 EDT
(In reply to Achim Kraus from comment #11)
> In reply to #9
> 
> > Does this mean that a client that wants to authenticate using a certificate or RPK cannot simply omit the signed_params in order to bypass the server's verification?
> 
> According RFC5246, the client has to use the CertificateVerify
> https://datatracker.ietf.org/doc/html/rfc5246#section-7.4.8 for that.
> That is checked and will fail the handshake. If a none empty client
> certificate is sent, the missing of that message will also fail the
> handshake. 
> 
> In RFC5246 that's the difference in the server and client certificate based
> authentication.
> server: Certificate and signed ServerKeyExchange
> client: Certificate and signed CertificateVerify. The ClientKeyExchange is
> not signed at all. 
> 
> A anonymous server will not sent a Certificate and doesn't include the
> signature in the ServerKeyExchange.
> 
> A anonymous client will send a empty certificate an no CertificateVerify.
> According the configured client authentication mode (none/wanted/needed), a
> empty certificate is refused or passes the check. 
> 
> I guess, that system reflects many cases, where only the server is
> authenticated and the client stay anonymous until some "token" or
> "username/password" authenticates it over the already encrypted connection.


Great, thanks for explaining
Comment 15 Simon Bernard CLA 2021-08-10 04:21:08 EDT
> if that description is OK for you.

That sounds good to me.

Thx for very clear explanation.

> FMPOV, this bug requires a CVE.

I agree.
Comment 16 Achim Kraus CLA 2021-08-10 04:28:39 EDT
@Wayne

Please check comment #6 if something is missing for you in order to assign a CVE.

If nothing is missing, please assign a CVE and create the mitre PR.

Thanks in advance!
Comment 17 Wayne Beaton CLA 2021-08-20 13:08:09 EDT
Sorry for the delay.

> Please check comment #6 if something is missing for you in order to assign a
> CVE.

I've assigned CVE-2021-34433 and have pushed the report to Mitre.

https://github.com/CVEProject/cvelist/pull/2615
Comment 18 Achim Kraus CLA 2021-08-21 08:03:48 EDT
Thanks a lot!
Comment 19 Wayne Beaton CLA 2021-08-24 12:01:45 EDT
Based on the discussion, I believe that we can reasonably mark this as FIXED. Reopen if I've made a horrible mistake.