Skip to content

Commit 46e7f80

Browse files
committed
Limit the number of IPs we use from each DNS seeder
A risk exists where a malicious DNS seeder eclipses a node by returning an enormous number of IP addresses. In this commit we mitigate this risk by limiting the number of IP addresses addrman learns to 256 per DNS seeder.
1 parent b225010 commit 46e7f80

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/net.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,8 @@ void CConnman::ThreadDNSAddressSeed()
16311631
if (!resolveSource.SetInternal(host)) {
16321632
continue;
16331633
}
1634-
if (LookupHost(host.c_str(), vIPs, 0, true))
1634+
unsigned int nMaxIPs = 256; // Limits number of IPs learned from a DNS seed
1635+
if (LookupHost(host.c_str(), vIPs, nMaxIPs, true))
16351636
{
16361637
for (const CNetAddr& ip : vIPs)
16371638
{

0 commit comments

Comments
 (0)