From 638fdedcf16cf7d6f7c586d36f7ef335c1c9714f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 23 Oct 2011 16:06:06 +0000 Subject: Don't send a certificate chain on outgoing TLS connections from non-relays --- changes/issue-2011-10-19L | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 changes/issue-2011-10-19L (limited to 'changes') diff --git a/changes/issue-2011-10-19L b/changes/issue-2011-10-19L new file mode 100644 index 0000000000..972823eeea --- /dev/null +++ b/changes/issue-2011-10-19L @@ -0,0 +1,12 @@ + o Security fixes: + + - Don't send TLS certificate chains on outgoing OR connections + from clients and bridges. Previously, each client or bridge + would use a single cert chain for all outgoing OR connections + for up to 24 hours, which allowed any relay connected to by a + client or bridge to determine which entry guards it is using. + This is a potential user-tracing bug for *all* users; everyone + who uses Tor's client or hidden service functionality should + upgrade. Fixes CVE-2011-2768. Bugfix on FIXME; found by + frosty_un. + -- cgit v1.2.3-54-g00ecf From af12c39d6de5bbcd24915db3c4cc9404f102ac02 Mon Sep 17 00:00:00 2001 From: Robert Ransom Date: Sun, 23 Oct 2011 14:27:56 -0700 Subject: Don't use any OR connection which sent us a CREATE_FAST cell for an EXTEND Fix suggested by Nick Mathewson. --- changes/issue-2011-10-19L | 9 +++++++++ src/or/command.c | 6 ++++++ src/or/connection_or.c | 5 +++++ src/or/or.h | 4 ++++ 4 files changed, 24 insertions(+) (limited to 'changes') diff --git a/changes/issue-2011-10-19L b/changes/issue-2011-10-19L index 972823eeea..1fefd7267e 100644 --- a/changes/issue-2011-10-19L +++ b/changes/issue-2011-10-19L @@ -10,3 +10,12 @@ upgrade. Fixes CVE-2011-2768. Bugfix on FIXME; found by frosty_un. + - Don't use any OR connection on which we have received a + CREATE_FAST cell to satisfy an EXTEND request. Previously, we + would not consider whether a connection appears to be from a + client or bridge when deciding whether to use that connection to + satisfy an EXTEND request. Mitigates CVE-2011-2768, by + preventing an attacker from determining whether an unpatched + client is connected to a patched relay. Bugfix on FIXME; found + by frosty_un. + diff --git a/src/or/command.c b/src/or/command.c index 61b898cead..a17a3a6025 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -285,7 +285,13 @@ command_process_create_cell(cell_t *cell, or_connection_t *conn) * a CPU worker. */ char keys[CPATH_KEY_MATERIAL_LEN]; char reply[DIGEST_LEN*2]; + tor_assert(cell->command == CELL_CREATE_FAST); + + /* Make sure we never try to use the OR connection on which we + * received this cell to satisfy an EXTEND request, */ + conn->is_connection_with_client = 1; + if (fast_server_handshake(cell->payload, (uint8_t*)reply, (uint8_t*)keys, sizeof(keys))<0) { log_warn(LD_OR,"Failed to generate key material. Closing."); diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 95cc02e34f..35f6da9214 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -519,6 +519,11 @@ connection_or_get_for_extend(const char *digest, tor_assert(tor_memeq(conn->identity_digest, digest, DIGEST_LEN)); if (conn->_base.marked_for_close) continue; + /* Never return a connection on which the other end appears to be + * a client. */ + if (conn->is_connection_with_client) { + continue; + } /* Never return a non-open connection. */ if (conn->_base.state != OR_CONN_STATE_OPEN) { /* If the address matches, don't launch a new connection for this diff --git a/src/or/or.h b/src/or/or.h index 4105ff42eb..72e4c639ad 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1031,6 +1031,10 @@ typedef struct or_connection_t { * because the connection is too old, or because there's a better one, etc. */ unsigned int is_bad_for_new_circs:1; + /** True iff we have decided that the other end of this connection + * is a client. Connections with this flag set should never be used + * to satisfy an EXTEND request. */ + unsigned int is_connection_with_client:1; uint8_t link_proto; /**< What protocol version are we using? 0 for * "none negotiated yet." */ circid_t next_circ_id; /**< Which circ_id do we try to use next on -- cgit v1.2.3-54-g00ecf From a74e7fd40f1a77eb4000d8216bb5b80cdd8a6193 Mon Sep 17 00:00:00 2001 From: Robert Ransom Date: Sun, 23 Oct 2011 15:21:49 -0700 Subject: Reject create cells on outgoing OR connections from bridges --- changes/issue-2011-10-23G | 9 +++++++++ src/or/command.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 changes/issue-2011-10-23G (limited to 'changes') diff --git a/changes/issue-2011-10-23G b/changes/issue-2011-10-23G new file mode 100644 index 0000000000..45f86754f0 --- /dev/null +++ b/changes/issue-2011-10-23G @@ -0,0 +1,9 @@ + o Security fixes: + + - Reject CREATE and CREATE_FAST cells on outgoing OR connections + from a bridge to a relay. Previously, we would accept them and + handle them normally, thereby allowing a malicious relay to + easily distinguish bridges which connect to it from clients. + Fixes CVE-2011-2769. Bugfix on 0.2.0.3-alpha, when bridges were + implemented; found by frosty_un. + diff --git a/src/or/command.c b/src/or/command.c index a17a3a6025..54f23bb0cd 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -219,6 +219,7 @@ static void command_process_create_cell(cell_t *cell, or_connection_t *conn) { or_circuit_t *circ; + or_options_t *options = get_options(); int id_is_high; if (we_are_hibernating()) { @@ -230,9 +231,11 @@ command_process_create_cell(cell_t *cell, or_connection_t *conn) return; } - if (!server_mode(get_options())) { + if (!server_mode(options) || + (!public_server_mode(options) && conn->is_outgoing)) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, - "Received create cell (type %d) from %s:%d, but we're a client. " + "Received create cell (type %d) from %s:%d, but we're connected " + "to it as a client. " "Sending back a destroy.", (int)cell->command, conn->_base.address, conn->_base.port); connection_or_send_destroy(cell->circ_id, conn, -- cgit v1.2.3-54-g00ecf