Skip to content

Using predefined Finite field groups for DHE. (rfc7919) #97

@RoelSG

Description

@RoelSG

linuxserver.io


Desired Behavior

100% Compliance on internet.nl

Current Behavior

I thought it was time again to make sure my webserver's security is up-to-snuff, so I checked it at a few sites. SLL-labs seems fine, A+, but internet.nl just implemented new guidelines from the Dutch government and has three (actually two) remarks.

  • Your web server supports 0-RTT, which is not secure.
    Okay, seems easy enough to turn off, but it supposedly comes with a latency penalty. Also unclear how "unsecure" this really is.
    I think it's the following line in ssl.conf:
# Enable TLS 1.3 early data
ssl_early_data on;

Edit: Found an older blog entry about 0-RTT https://blog.trailofbits.com/2019/03/25/what-application-developers-need-to-know-about-tls-early-data-0rtt/ which explains some of the problems with it. Is this a sane default for SWAG? It is meant as a reverse proxy for almost anything, which in turn might not implement their own protection.

  • Your web server does not enforce its own cipher preference
    It ignores this one if you only support "good ciphers", which I do, except:
  • Your web server supports insufficiently secure parameters for Diffie-Hellman key exchange. We test if your DHE public key material uses one of the predefined finite field groups that are specified in RFC 7919. Self-generated groups are 'Insufficient'.

Per the SWAG docs:
The container provides a pre-generated 4096-bit dhparams.pem (rotated weekly via Jenkins job) for new instances, however you may generate your own by running docker exec swag openssl dhparam -out /config/nginx/dhparams.pem 4096 WARNING: This takes a very long time

Not sure I totally agree with the score, length-wise the key is totally fine, but Mozilla also seems to agree that you should use predefined Finite field groups for DHE.

Explanation from the Dutch NCSC Guidelines:

The complexity associated with free choice of finite field groups has been a source of vulnerabilities in the past. The TLS 1.3 specification only includes a limited number of finite field groups for DHE to reduce this complexity. These guidelines limit Sufficient groups for TLS to those used in TLS 1.3 (and specified in RFC 7919).
ffdhe4096 (RFC 7919) Sufficient
39ffdhe3072 (RFC 7919) Sufficient
ffdhe2048 (RFC 7919) Phase out
Other groups Insufficient

These guidelines advise the use of standardized groups. Larger groups are chosen to mitigate against the risk of precomputation by attackers. This conservative approach enlarges the performance penalty that comes with the use of DHE. Carefully evaluate and use ECDHE instead of DHE if you can.

Alternatives Considered

Changing the .pem in ssl.conf:

# Diffie-Hellman parameter for DHE cipher suites
ssl_dhparam /config/nginx/dhparams.pem;

To a predefined one:

ffdhe4096 (RFC 7919)
sha256 checksum: 64852d6890ff9e62eecd1ee89c72af9af244dfef5b853bcedea3dfd7aade22b3

ffdhe3072 (RFC 7919)
sha256 checksum: c410cc9c4fd85d2c109f7ebe5930ca5304a52927c0ebcb1a11c5cf6b2386bbab

Or,
Removing DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; from ssl.conf
This works at least, but removes support for some older clients. It also makes the pre-generated 4096-bit dhparams.pem redundant.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions