summaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-08-27 15:33:58 +0000
committerNick Mathewson <nickm@torproject.org>2007-08-27 15:33:58 +0000
commitd3224bad42957bf2e1751c7a1731c8956e003530 (patch)
tree02b92176af96af5ce487d47adfffe5d3fefba5f3 /src/or/connection_edge.c
parent0608ec71fdbd25da4195fd0e40ccd1bec7f3a0a5 (diff)
downloadtor-d3224bad42957bf2e1751c7a1731c8956e003530.tar.gz
tor-d3224bad42957bf2e1751c7a1731c8956e003530.zip
r14227@Kushana: nickm | 2007-08-27 11:33:28 -0400
Add a new ClientDNSRejectInternalAddresses option (default: on) to refuse to believe that any address can map to or from an internal address. This blocks some kinds of potential browser-based attacks, especially on hosts using DNSPort. Also clarify behavior in some comments. Backport candiate? svn:r11287
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 77a95f6764..f4431bacf2 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1247,6 +1247,19 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED);
return 0;
}
+ if (options->ClientDNSRejectInternalAddresses) {
+ /* Don't let people try to do a reverse lookup on 10.0.0.1. */
+ tor_addr_t addr;
+ if (tor_addr_from_str(&addr, socks->address) >= 0 &&
+ tor_addr_is_internal(&addr, 0)) {
+ connection_ap_handshake_socks_resolved(conn, RESOLVED_TYPE_ERROR,
+ 0, NULL, -1, TIME_MAX);
+ connection_mark_unattached_ap(conn,
+ END_STREAM_REASON_SOCKSPROTOCOL |
+ END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED);
+ return -1;
+ }
+ }
} else if (!automap) {
/* For address map controls, remap the address. */
if (addressmap_rewrite(socks->address, sizeof(socks->address),