“0945958e9d7b74e1bd6615f5d0a2ea21ab61d514”上不存在“...sun/git@gitcode.net:openanolis/dragonwell8_jdk.git”
提交 e3d35e92 编写于 作者: D David Leadbeater 提交者: Zheng Zengkai

netfilter: nf_conntrack_irc: Fix forged IP logic

stable inclusion
from stable-v5.10.143
commit e12ce30fe593dd438c5b392290ad7316befc11ca
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I5OWZ7
CVE: CVE-2022-2663

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e12ce30fe593dd438c5b392290ad7316befc11ca

---------------------------

[ Upstream commit 0efe125c ]

Ensure the match happens in the right direction, previously the
destination used was the server, not the NAT host, as the comment
shows the code intended.

Additionally nf_nat_irc uses port 0 as a signal and there's no valid way
it can appear in a DCC message, so consider port 0 also forged.

Fixes: 869f37d8 ("[NETFILTER]: nf_conntrack/nf_nat: add IRC helper port")
Signed-off-by: NDavid Leadbeater <dgl@dgl.cx>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NLiu Jian <liujian56@huawei.com>
Reviewed-by: NYue Haibing <yuehaibing@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 357c12f0
...@@ -207,8 +207,9 @@ static int help(struct sk_buff *skb, unsigned int protoff, ...@@ -207,8 +207,9 @@ static int help(struct sk_buff *skb, unsigned int protoff,
/* dcc_ip can be the internal OR external (NAT'ed) IP */ /* dcc_ip can be the internal OR external (NAT'ed) IP */
tuple = &ct->tuplehash[dir].tuple; tuple = &ct->tuplehash[dir].tuple;
if (tuple->src.u3.ip != dcc_ip && if ((tuple->src.u3.ip != dcc_ip &&
tuple->dst.u3.ip != dcc_ip) { ct->tuplehash[!dir].tuple.dst.u3.ip != dcc_ip) ||
dcc_port == 0) {
net_warn_ratelimited("Forged DCC command from %pI4: %pI4:%u\n", net_warn_ratelimited("Forged DCC command from %pI4: %pI4:%u\n",
&tuple->src.u3.ip, &tuple->src.u3.ip,
&dcc_ip, dcc_port); &dcc_ip, dcc_port);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册