aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Pustogarov <ivanpustogarov@users.noreply.github.com>2014-12-07 17:30:57 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-03-09 12:25:20 +0100
commit200f29363b06cbe8e35dfc5e1b818a0dd96c8474 (patch)
tree99aa406beaabac2818b50f4a6ce1a20c3429b699
parentd5d89980284179436a5f3009a5346581fdaa9a01 (diff)
downloadbitcoin-200f29363b06cbe8e35dfc5e1b818a0dd96c8474.tar.xz
Ignore getaddr messages on Outbound connections.
The only time when a client sends a "getaddr" message is when he esatblishes an Outbound connection (see ProcessMessage() in src/main.cpp). Another bitcoin client is expected to receive a "getaddr" message only on Inbound connection. Ignoring "gettaddr" requests on Outbound connections can resolve potential privacy issues (and as was said such request normally do not happen anyway). Rebased-From: dca799e1db6e319fdd47e0bfdb038eab0efabb85 Github-Pull: #5442
-rw-r--r--src/main.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d77eb2877e..9295c81ce8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3976,7 +3976,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
- else if (strCommand == "getaddr")
+ // This asymmetric behavior for inbound and outbound connections was introduced
+ // to prevent a fingerprinting attack: an attacker can send specific fake addresses
+ // to users' AddrMan and later request them by sending getaddr messages.
+ // Making users (which are behind NAT and can only make outgoing connections) ignore
+ // getaddr message mitigates the attack.
+ else if ((strCommand == "getaddr") && (pfrom->fInbound))
{
pfrom->vAddrToSend.clear();
vector<CAddress> vAddr = addrman.GetAddr();