aboutsummaryrefslogtreecommitdiff
path: root/src/or/command.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-10-23 22:58:38 -0400
committerNick Mathewson <nickm@torproject.org>2012-10-23 22:58:38 -0400
commit758428dd32128874cefacc92ef63c1b5bc9a656e (patch)
treeb0cca05ceabf3871afe66ffc734995b6f3e9c101 /src/or/command.c
parentb99457d4295b2329e65f3e01b24b57d5c78ca017 (diff)
downloadtor-758428dd32128874cefacc92ef63c1b5bc9a656e.tar
tor-758428dd32128874cefacc92ef63c1b5bc9a656e.tar.gz
Fix a remotely triggerable assertion failure (CVE-2012-2250)
If we completed the handshake for the v2 link protocol but wound up negotiating the wong protocol version, we'd become so confused about what part of the handshake we were in that we'd promptly die with an assertion. This is a fix for CVE-2012-2250; it's a bugfix on 0.2.3.6-alpha. All servers running that version or later should really upgrade. Bug and fix from "some guy from France." I tweaked his code slightly to make it log the IP of the offending node.
Diffstat (limited to 'src/or/command.c')
-rw-r--r--src/or/command.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/command.c b/src/or/command.c
index 975af046c..d935b5b18 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -719,6 +719,15 @@ command_process_versions_cell(var_cell_t *cell, or_connection_t *conn)
"handshake. Closing connection.");
connection_mark_for_close(TO_CONN(conn));
return;
+ } else if (highest_supported_version != 2 &&
+ conn->_base.state == OR_CONN_STATE_OR_HANDSHAKING_V2) {
+ /* XXXX This should eventually be a log_protocol_warn */
+ log_fn(LOG_WARN, LD_OR,
+ "Negotiated link with non-2 protocol after doing a v2 TLS "
+ "handshake with %s. Closing connection.",
+ fmt_addr(&conn->_base.addr));
+ connection_mark_for_close(TO_CONN(conn));
+ return;
}
conn->link_proto = highest_supported_version;