]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't allow tor2web-mode Tors to connect to non-HS addresses
authorRobert Ransom <rransom.8774@gmail.com>
Tue, 31 May 2011 14:05:40 +0000 (07:05 -0700)
committerNick Mathewson <nickm@torproject.org>
Wed, 30 Nov 2011 19:54:15 +0000 (14:54 -0500)
The client's anonymity when accessing a non-HS address in tor2web-mode
would be easily nuked by inserting an inline image with a .onion URL, so
don't even pretend to access non-HS addresses through Tor.

src/or/connection_edge.c

index efaad79b6a0b544a17dd6bf3f690894ee6c71f61..bba666d3b93acb30238cad71f123efb736101482 100644 (file)
@@ -1892,6 +1892,14 @@ connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn,
       return -1;
     }
 
+    if (options->Tor2webMode) {
+      log_warn(LD_APP, "Refusing to connect to non-hidden-service hostname %s "
+               "because tor2web mode is enabled.",
+               safe_str_client(socks->address));
+      connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY);
+      return -1;
+    }
+
     if (socks->command == SOCKS_COMMAND_RESOLVE) {
       uint32_t answer;
       struct in_addr in;