]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Discard extraneous renegotiation attempts in the v3 link protocol
authorNick Mathewson <nickm@torproject.org>
Tue, 16 Oct 2012 16:55:50 +0000 (12:55 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 17 Oct 2012 23:18:16 +0000 (19:18 -0400)
Failure to do so left us open to a remotely triggerable assertion
failure. Fixes CVE-2012-2249; bugfix on 0.2.3.6-alpha. Reported by
"some guy from France".

changes/cve-2012-2249 [new file with mode: 0644]
src/or/command.c
src/or/connection_or.c
src/or/connection_or.h

diff --git a/changes/cve-2012-2249 b/changes/cve-2012-2249
new file mode 100644 (file)
index 0000000..625bfa2
--- /dev/null
@@ -0,0 +1,5 @@
+  o Major bugfixes (security):
+    - Discard extraneous renegotiation attempts once the V3 link
+      protocol has been initiated. Failure to do so left us open to
+      a remotely triggerable assertion failure. Fixes CVE-2012-2249;
+      bugfix on 0.2.3.6-alpha. Reported by "some guy from France".
index d8a409bc275dadb163e7e06db21f164ae585c66e..975af046cd0af60445863369c40b1791d8eab69d 100644 (file)
@@ -649,6 +649,7 @@ enter_v3_handshake_with_cell(var_cell_t *cell, or_connection_t *conn)
            "Received a cell while TLS-handshaking, not in "
            "OR_HANDSHAKING_V3, on a connection we originated.");
   }
+  connection_or_block_renegotiation(conn);
   conn->_base.state = OR_CONN_STATE_OR_HANDSHAKING_V3;
   if (connection_init_or_handshake_state(conn, started_here) < 0) {
     connection_mark_for_close(TO_CONN(conn));
index d01638793578020acded727e288492394fb5efb0..6293fe881dabc9fad1226de403cb84c19239624b 100644 (file)
@@ -1186,6 +1186,17 @@ connection_tls_start_handshake(or_connection_t *conn, int receiving)
   return 0;
 }
 
+/** Block all future attempts to renegotiate on 'conn' */
+void
+connection_or_block_renegotiation(or_connection_t *conn)
+{
+  tor_tls_t *tls = conn->tls;
+  if (!tls)
+    return;
+  tor_tls_set_renegotiate_callback(tls, NULL, NULL);
+  tor_tls_block_renegotiation(tls);
+}
+
 /** Invoked on the server side from inside tor_tls_read() when the server
  * gets a successful TLS renegotiation from the client. */
 static void
@@ -1195,8 +1206,7 @@ connection_or_tls_renegotiated_cb(tor_tls_t *tls, void *_conn)
   (void)tls;
 
   /* Don't invoke this again. */
-  tor_tls_set_renegotiate_callback(tls, NULL, NULL);
-  tor_tls_block_renegotiation(tls);
+  connection_or_block_renegotiation(conn);
 
   if (connection_tls_finish_handshake(conn) < 0) {
     /* XXXX_TLS double-check that it's ok to do this from inside read. */
index 3e98f5cce1afa72125b20067ef00668426f848b4..b78c444921bb6ee0c0161591aef8826ee9b31c24 100644 (file)
@@ -21,6 +21,7 @@ or_connection_t *connection_or_get_for_extend(const char *digest,
                                               int *launch_out);
 void connection_or_set_bad_connections(const char *digest, int force);
 
+void connection_or_block_renegotiation(or_connection_t *conn);
 int connection_or_reached_eof(or_connection_t *conn);
 int connection_or_process_inbuf(or_connection_t *conn);
 int connection_or_flushed_some(or_connection_t *conn);