<div dir="ltr"><div style="font-size:12.8000001907349px">The current example value for ssl_ciphers in nginx (HIGH:!aNULL:!MD5) has a number of security issues, including:</div><div style="font-size:12.8000001907349px"><div><br></div><div>    - Weak DH key exchange / vulnerability to logjam attack</div><div><br></div><div>    - Preferring AES-CBC instead of GCM, which causes an 'obsolete cipher suite' message in recent versions of Chrome</div><div><br></div><div>    - 128 bit AES should be preferred over 192 and 256 bit AES considering attacks that specifically affect the larger key sizes but do not affect AES 128</div></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Users who are aware that the values presented are an issue may typically use tools like Mozilla's SSL Config Generator <a href="https://mozilla.github.io/server-side-tls/ssl-config-generator" target="_blank">https://mozilla.github.io/server-side-tls/ssl-config-generator</a>, <a href="https://cipherli.st/" target="_blank">https://cipherli.st</a>, or various blogs that are hopefully up to date. <br></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">However:</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"> - Many users will not be aware this is an issue, and may simply uncomment the example ssl config provided. <br></div><div style="font-size:12.8000001907349px"> - The official nginx docs at <a href="http://nginx.org/en/docs/http/configuring_https_servers.html#compatibility" target="_blank">http://nginx.org/en/docs/http/configuring_https_servers.html#compatibility</a> state 'configuring (ssl_ciphers) explicitly is generally not needed' which is incorrect.</div><div style="font-size:12.8000001907349px"> - nginx has fixed this in the past multiple times, most recently in 1.0.5, see<a href="http://nginx.org/en/docs/http/configuring_https_servers.html#compatibility" target="_blank">http://nginx.org/en/docs/http/configuring_https_servers.html#compatibility</a> : </div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">    Version 1.0.5 and later: the default SSL ciphers are “HIGH:!aNULL:!MD5”.</div><div style="font-size:12.8000001907349px">    Version 0.7.65, 0.8.20 and later: the default SSL ciphers are “HIGH:!ADH:!MD5”.</div><div style="font-size:12.8000001907349px">    Version 0.8.19: the default SSL ciphers are “ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM”.</div><div style="font-size:12.8000001907349px">    Version 0.7.64, 0.8.18 and earlier: the default SSL ciphers are</div><div style="font-size:12.8000001907349px">    “ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP”.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"> - nginx, like all software, should use secure examples<br></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">The following patch matches the 'intermediate' settings in Mozilla's TLS Configurator, including IE7 upwards for wide compatibility. Note: I've used a maximum text width of 80 characters for code, per <a href="http://nginx.org/en/docs/contributing_changes.html" target="_blank">http://nginx.org/en/docs/contributing_changes.html</a>, however it seems there is no way to keep this line short in the config file.<br></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><div># HG changeset patch</div><div># User Mike MacCana <<a href="mailto:mike.maccana@gmail.com" target="_blank">mike.maccana@gmail.com</a>></div><div># Date 1438616573 -3600</div><div>#      Mon Aug 03 16:42:53 2015 +0100</div><div># Node ID 9d055a8eba96c1e49e970770a37f742744db083c</div><div># Parent  b544f8e0d9214560a6acddbb0f40db5146e9463d</div><div>Update SSL cipher list</div><div><br></div><div>diff -r b544f8e0d921 -r 9d055a8eba96 conf/nginx.conf</div><div>--- a/conf/nginx.conf<span style="white-space:pre-wrap">  </span>Thu Jul 30 16:43:48 2015 -0700</div><div>+++ b/conf/nginx.conf<span style="white-space:pre-wrap">      </span>Mon Aug 03 16:42:53 2015 +0100</div><div>@@ -105,7 +105,7 @@</div><div>     #    ssl_session_cache    shared:SSL:1m;</div><div>     #    ssl_session_timeout  5m;</div><div><br></div><div>-    #    ssl_ciphers  HIGH:!aNULL:!MD5;</div><div>+    #    ssl_ciphers  ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA</div><div>     #    ssl_prefer_server_ciphers  on;</div><div><br></div><div>     #    location / {</div><div>diff -r b544f8e0d921 -r 9d055a8eba96 src/http/modules/ngx_http_ssl_module.c</div><div>--- a/src/http/modules/ngx_http_ssl_module.c<span style="white-space:pre-wrap">    </span>Thu Jul 30 16:43:48 2015 -0700</div><div>+++ b/src/http/modules/ngx_http_ssl_module.c<span style="white-space:pre-wrap">       </span>Mon Aug 03 16:42:53 2015 +0100</div><div>@@ -13,8 +13,28 @@</div><div> typedef ngx_int_t (*ngx_ssl_variable_handler_pt)(ngx_connection_t *c,</div><div>     ngx_pool_t *pool, ngx_str_t *s);</div><div><br></div><div>+#define NGX_DEFAULT_CIPHERS    "ECDHE-RSA-AES128-GCM-SHA256\</div><div>+:ECDHE-ECDSA-AES128-GCM-SHA256\</div><div>+:ECDHE-RSA-AES256-GCM-SHA384\</div><div>+:ECDHE-ECDSA-AES256-GCM-SHA384\</div><div>+:DHE-RSA-AES128-GCM-SHA256\</div><div>+:ECDHE-RSA-AES128-SHA256\</div><div>+:DHE-RSA-AES128-SHA256\</div><div>+:ECDHE-RSA-AES256-SHA384\</div><div>+:DHE-RSA-AES256-SHA384\</div><div>+:ECDHE-RSA-AES256-SHA256\</div><div>+:DHE-RSA-AES256-SHA256\</div><div>+:HIGH\</div><div>+:!aNULL\</div><div>+:!eNULL\</div><div>+:!EXPORT\</div><div>+:!DES\</div><div>+:!RC4\</div><div>+:!MD5\</div><div>+:!PSK\</div><div>+:!SRP\</div><div>+:!CAMELLIA"</div><div><br></div><div>-#define NGX_DEFAULT_CIPHERS     "HIGH:!aNULL:!MD5"</div><div> #define NGX_DEFAULT_ECDH_CURVE  "prime256v1"</div><div><br></div><div> #define NGX_HTTP_NPN_ADVERTISE  "\x08http/1.1"</div></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">If this patch is accepted I will also update the documentation accordingly. </div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">SSL Labs handshake test results</div><div style="font-size:12.8000001907349px">Before:<br></div><div style="font-size:12.8000001907349px">  <a href="https://archive.is/PfOGL" target="_blank">https://archive.is/PfOGL</a><br></div><div style="font-size:12.8000001907349px">After: <br></div><div style="font-size:12.8000001907349px">  <a href="https://archive.is/JccUh" target="_blank">https://archive.is/JccUh</a></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">The changes in the patch above are already widely used by Mozilla Server Side TLS users, but if further discussion is needed on prioritisation logic then the following may be  helpful:</div><div style="font-size:12.8000001907349px"> - <a href="https://wiki.mozilla.org/Security/Server_Side_TLS#Prioritization_logic" target="_blank">https://wiki.mozilla.org/Security/Server_Side_TLS#Prioritization_logic</a> (used for this patch)<br></div><div style="font-size:12.8000001907349px"> - <a href="https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html" target="_blank">https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html</a> (used for <a href="http://cipherli.st/" target="_blank">cipherli.st</a>)<br></div><div style="font-size:12.8000001907349px"> - <a href="https://github.com/nodejs/node/commit/5755fc099f883293530406c423bda47414834057" target="_blank">https://github.com/nodejs/node/commit/5755fc099f883293530406c423bda47414834057</a> (node doing the same thing recently)<br></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Thanks,</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Mike</div></div>