bouncedcc: refuse DCC requests from IRC aimed at loopback or link-local

The address in an incoming DCC CHAT/SEND is chosen by the remote IRC
user, and ZNC is the side that connects to it, relaying traffic to
whoever connects to the bounce listener. Refuse requests that point at
0/8, 127/8, 169.254/16, 224/3 or values above 32 bits (which
CUtils::GetIP would otherwise mask down to one of those).
This commit is contained in:
Alhuda Khan committed 2026-10-20 17:36:19 +05:30
1 parent 3d96465fc0
commit 8aef9873fc
2 files changed
+26

No files matched your search

+8
View File
@@ -765,6 +765,14 @@ TEST_F(ZNCTest, BounceDCCModule) {
QByteArray line2;
client.ReadUntilAndGet(":friend!user@host PRIVMSG nick :\001DCC CHAT chat", line2);
EXPECT_THAT(line2.toStdString(), Not(HasSubstr("3232235521 54321")));
// Peer must not be able to make ZNC connect to its own loopback
ircd.Write(":friend!user@host PRIVMSG nick :\001DCC CHAT chat 2130706433 6379\001");
client.ReadUntil("refused: bad address 2130706433");
ircd.Write(":friend!user@host PRIVMSG nick :\001DCC SEND f 2852039166 80 1\001");
client.ReadUntil("refused: bad address 2852039166");
ircd.Write(":friend!user@host PRIVMSG nick :\001DCC CHAT chat 6425673729 22\001");
client.ReadUntil("refused: bad address 6425673729");
}
TEST_F(ZNCTest, ChanSaverModule) {