Skip to content
Snippets Groups Projects
Commit 3d8b73db authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

Discard extraneous renegotiation attempts in the v3 link protocol

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".

This patch is a forward-port to 0.2.4, to work with the new channel
logic.
parent 94a03099
No related branches found
No related tags found
No related merge requests found
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".
......@@ -1130,6 +1130,7 @@ enter_v3_handshake_with_cell(var_cell_t *cell, channel_tls_t *chan)
"Received a cell while TLS-handshaking, not in "
"OR_HANDSHAKING_V3, on a connection we originated.");
}
connection_or_block_renegotiation(chan->conn);
chan->conn->base_.state = OR_CONN_STATE_OR_HANDSHAKING_V3;
if (connection_init_or_handshake_state(chan->conn, started_here) < 0) {
connection_or_close_for_error(chan->conn, 0);
......
......@@ -1251,6 +1251,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
......@@ -1260,8 +1271,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. */
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment