[Pound Mailing List] Re: X-SSL-cipher header reports TLS connections as SSLv3

Tom Fitzhenry <[email protected]>
Newsgroups gmane.comp.web.pound.general
Message-ID <[email protected]>
Patch attached. Patch applied against Pound-2.6.tgz

-- 
Tom Fitzhenry

On Mon, Dec 1, 2014, at 02:23 PM, Tom Fitzhenry wrote:
> # Steps to reproduce
> 1. Copy the attached `pound.cfg` to `/etc/pound/`
> 2. Copy the attached `pound-test-cert.pem` to `/etc/ssl/private/`
> 3. Open a TCP port on port 8080: `netcat -t -l -p 8080`
> 4. `service pound start`
> 5. Make a TLS (not SSL!) request: `curl --tlsv1 --ciphers 'AES128-SHA'
> -k https://127.0.0.1:8443/`
> 6. Look at the stdout of netcat, and see the value of HTTP request
> header X-SSL-cipher that pound has injected into the request
> 
> ## Expected
> The connection is reported to be TLS
> 
> ## Actual
> The connection is reported to be SSLv3: "AES128-SHA SSLv3 Kx=RSA Au=RSA
> Enc=AES(128) Mac=SHA1"
> 
> Wireshark debugging confirms that the curl connection is indeed a TLS
> connection, rather than a SSLv3 connection.
> 
> # Impact
> When trying to determine the impact of disabling SSLv3 (re POODLE), we
> searched
> our logs for how many clients used SSLv3, and this bug caused us to
> believe we
> had more SSLv3 traffic than we actually did.
> 
> # Why this is reported to be SSLv3
> Looking into the pound code[0], X-SSL-cipher is populated with the
> result of SSL_CIPHER_description().
> In SSL_CIPHER_description() "The TLSv1.0 ciphers are flagged with
> SSLv3."[1].
> The AES ciphers are TLSv1 ciphers, and hence are reported as SSLv3 by
> pound/openssl.
> 
> # Proposed fix
> Add a X-SSL-version header, using SSL_get_version()[2]. I can produce a
> patch for this, if it is considered an acceptable change.
> 
> I originally raised this against Ubuntu's bug tracker[3], but have since
> found this mailing list, so am posting it here.
> 
> 0.
> https://github.com/mandiant/pound/blob/a3705bc06e44ec4a229fd38760d6c04c43ced6b6/http.c#L943
> 1. https://www.openssl.org/docs/ssl/SSL_CIPHER_get_name.html
> 2. https://www.openssl.org/docs/ssl/SSL_get_version.html
> 3. https://bugs.launchpad.net/ubuntu/+source/pound/+bug/1398007
> 
> -- 
> Tom Fitzhenry
> Email had 2 attachments:
> + pound.cfg
>   1k (application/octet-stream)
> + pound-test-cert.pem
>   2k (application/x-x509-ca-cert)
0001-Add-X-SSL-version-header.patch (text/x-diff, 1.8 KB)
From d8caa2629ad0c9adeb16c45fd6cc5d11da3bbad2 Mon Sep 17 00:00:00 2001
From: Tom Fitzhenry <[email protected]>
Date: Mon, 1 Dec 2014 22:32:43 +0000
Subject: [PATCH] Add X-SSL-version header

Uses https://www.openssl.org/docs/ssl/SSL_get_version.html , so the
value of X-SSL-version is one of
{SSLv2,SSLv3,TLSv1,TLSv1.1,TLSv1.2,unknown}
---
 http.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/http.c b/http.c
index bb2ce8b..caa89e3 100755
--- a/http.c
+++ b/http.c
@@ -953,6 +953,7 @@ do_http(thr_arg *arg)
         /* if SSL put additional headers for client certificate */
         if(cur_backend->be_type == 0 && ssl != NULL) {
             SSL_CIPHER  *cipher;
+            const char *protocolVersion;
 
             if((cipher = SSL_get_current_cipher(ssl)) != NULL) {
                 SSL_CIPHER_description(cipher, buf, MAXBUF - 1);
@@ -968,6 +969,18 @@ do_http(thr_arg *arg)
                 }
             }
 
+            if((protocolVersion = SSL_get_version(ssl)) != NULL) {
+                if(BIO_printf(be, "X-SSL-version: %s\r\n", protocolVersion) <= 0) {
+                    str_be(buf, MAXBUF - 1, cur_backend);
+                    end_req = cur_time();
+                    logmsg(LOG_WARNING, "(%lx) e500 error write X-SSL-version to %s: %s (%.3f sec)",
+                        pthread_self(), buf, strerror(errno), (end_req - start_req) / 1000000.0);
+                    err_reply(cl, h500, lstn->err500);
+                    clean_all();
+                    return;
+                }
+            }
+
             if(lstn->clnt_check > 0 && x509 != NULL && (bb = BIO_new(BIO_s_mem())) != NULL) {
                 X509_NAME_print_ex(bb, X509_get_subject_name(x509), 8, XN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB);
                 get_line(bb, buf, MAXBUF);
-- 
2.2.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.