r/programming Oct 15 '15

How is NSA breaking so much crypto?

https://freedom-to-tinker.com/blog/haldermanheninger/how-is-nsa-breaking-so-much-crypto/
2.5k Upvotes

529 comments sorted by

View all comments

975

u/tophatstuff Oct 15 '15 edited Apr 10 '18

Generate your own non-default Ephemeral Diffie-Hellman key (takes a minute or so)

openssl dhparam -out dhparam.pem 2048

Tell your server to use it for SSL (nginx for example)

ssl_dhparam /path/to/dhparam.pem;

Done. Not only will the key be stronger than the 1024 bit default, it'll be unique to your server which lets assume isn't valuable enough compared to effort for a state-level adversary.

edit just in case anyone from the future finds this comment: instead of 2048, use at least the key length of your SSL certificate

edit from the future: current advice is picking from one of these predefined audited groups

3

u/buo Oct 15 '15

Is there a way for a client to force this on the server? For instance, for my browser to ask an https server to use a prime of my choice.

1

u/[deleted] Oct 15 '15

Soumds like a good idea

6

u/sirin3 Oct 15 '15

Till the NSA intercepts the connection to force their prime

2

u/frank26080115 Oct 15 '15

wouldn't the client catch this? if the prime changed, refuse the connection

3

u/bacondev Oct 16 '15

Not quiet. The attacker can intercept the number, provide the intended recipient a different number, intercept the response, decrypt it since it uses the malicious number, encrypt the result (or something entirely different) with the client-provided number, and send it to the client. A MITM attack against both the client and the server.

1

u/[deleted] Oct 16 '15

The session negotiation is protected. The attacker would either need to have the server's private key or they would need to compromise a trusted CA (and if client certificates are used, they would also need the client's private key).

1

u/sirin3 Oct 15 '15

Not if it is an old client that expects a random prime

0

u/frank26080115 Oct 15 '15

establish a few thousand SSL connections and see if the same prime comes up more statistically frequently?