Thread View: linux.kernel.netdev
5 messages
5 total messages
Started by Pablo Neira Ayuso
Fri, 13 Nov 2026 01:14
[PATCH net 01/15] ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
Author: Pablo Neira Ayuso
Date: Fri, 13 Nov 2026 01:14
Date: Fri, 13 Nov 2026 01:14
62 lines
10586 bytes
10586 bytes
From: Axel Mierczuk <axel.mierczuk@1password.com>
ipv6_find_hdr() does not set the header offset for non-first
fragments, so an ICMPv6 error embedding such an ESP fragment leaves
ip_vs_fill_iph_skb_icmp() with len == off. The NAT paths size
skb_ensure_writable() from len, and ip_vs_nat_icmp_v6() then writes
the embedded addresses after the validated area.
Include the embedded IP header in ciph.len at both ICMPv6 call
sites when parsing stops at a non-first fragment. ESP lookup does
not require a transport header. Non-first TCP, UDP and SCTP fragments
bypass IPVS ICMP handling before connection lookup.
This fix does not depend on patch 2. Stable kernels without commit
342e24a339b9 ("ipvs: do not mangle ICMP replies for non-first fragments")
also need that commit to handle incoming ICMPv6 errors quoting
non-first ESP fragments.
Fixes: 63dca2c0b0e7 ("ipvs: Fix faulty IPv6 extension header handling in IPVS")
Cc: stable@vger.kernel.org
Suggested-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Axel Mierczuk <axel.mierczuk@1password.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/ipvs/ip_vs_core.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 8a3c880fdb26..76213159404f 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1206,6 +1206,13 @@ static int ip_vs_out_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb,
true, &ciph))
return NF_ACCEPT; /* The packet looks wrong, ignore */
+ /* ipv6_find_hdr() does not include the embedded header for
+ * non-first fragments, add it so that ESP can pass and the
+ * NAT writable checks cover the rewritten addresses
+ */
+ if (ciph.len == ciph.off)
+ ciph.len += sizeof(struct ipv6hdr);
+
pp = ip_vs_proto_get(ciph.protocol);
if (!pp)
return NF_ACCEPT;
@@ -2036,6 +2043,13 @@ static int ip_vs_in_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb,
if (!ip_vs_fill_iph_skb_icmp(AF_INET6, skb, offset, true, &ciph))
return NF_ACCEPT;
+ /* ipv6_find_hdr() does not include the embedded header for
+ * non-first fragments, add it so that ESP can pass and the
+ * NAT writable checks cover the rewritten addresses
+ */
+ if (ciph.len == ciph.off)
+ ciph.len += sizeof(struct ipv6hdr);
+
pd = ip_vs_proto_data_get(ipvs, ciph.protocol);
if (!pd)
return NF_ACCEPT;
--
2.47.3
Re: [PATCH net 01/15] ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
Author: netdev-bot+sinfo
Date: Fri, 13 Nov 2026 01:16
Date: Fri, 13 Nov 2026 01:16
22 lines
8636 bytes
8636 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then. The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH net 01/15] ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
Author: Pablo Neira Ayuso
Date: Fri, 13 Nov 2026 03:17
Date: Fri, 13 Nov 2026 03:17
28 lines
9328 bytes
9328 bytes
On Fri, Nov 13, 2026 at 01:16:59AM +0000, netdev-bot+sinfo@kernel.org wrote: > Hi! > > This is an automated message. This series looks like a fix, but its > commit messages seem to be missing some information: > > - How the issue was discovered, e.g. hit in production, hit during > development, syzbot report, manual code inspection, LLM or static > analysis tool scan. This is a PR, there is a mix of patches coming from different sources but... > - Whether the issue was actually triggered, or is only theoretical > (e.g. found by LLM and not proven at runtime). If it was triggered > please include the symptoms, like the stack trace or kernel messages. ... these are mostly LLM findings. > Please do not repost the series just to address the above. Instead, > reply to this email with the missing information, so that reviewers > can take it into account. If the series needs another revision for > other reasons, please include the information in the commit messages > then. > > The evaluation is done by an LLM so it may be wrong, if you think > that is the case please reply and explain.
Re: [PATCH net 01/15] ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
Author: netdev-bot+sashiko
Date: Sat, 14 Nov 2026 02:15
Date: Sat, 14 Nov 2026 02:15
111 lines
11807 bytes
11807 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] Commit "ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6" has
only `Fixes: 63dca2c0b0e7`.
- [Low] The commit message says "This fix does not depend on patch 2".
--
ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
This patch changes both ICMPv6 handlers in IPVS. When ipv6_find_hdr()
stops at a non-first fragment and leaves ciph.len == ciph.off, the
embedded IPv6 header is now added to ciph.len. The skb_ensure_writable()
range used by the NAT paths then covers the addresses that
ip_vs_nat_icmp_v6() rewrites.
> This fix does not depend on patch 2. Stable kernels without commit
> 342e24a339b9 ("ipvs: do not mangle ICMP replies for non-first fragments")
> also need that commit to handle incoming ICMPv6 errors quoting
> non-first ESP fragments.
>
> Fixes: 63dca2c0b0e7 ("ipvs: Fix faulty IPv6 extension header handling in IPVS")
[Severity: Low]
The incoming half of this bug only seems to have become reachable with
342e24a339b9. That path is
ip_vs_in_icmp_v6()->ip_vs_icmp_xmit_v6()->ip_vs_nat_icmp_v6().
Before that commit, ip_vs_in_icmp_v6() had:
if (ciph.fragoffs)
return NF_ACCEPT;
342e24a339b9 changed it to:
if (ciph.fragoffs && !pp->dont_defrag)
return NF_ACCEPT;
ESP sets .dont_defrag = 1 in ip_vs_proto_ah_esp.c, so non-first ESP
fragments now reach ip_vs_icmp_xmit_v6(). There, wlen = ciph->len sizes
skb_ensure_writable(), and without this fix ciph->len equals ciph->off.
ip_vs_nat_icmp_v6() then writes the embedded addresses past that range.
The paragraph above reads as if 342e24a339b9 is only a functional
prerequisite. Should it say that 342e24a339b9 exposed the incoming-path
write, and add a second Fixes: 342e24a339b9 tag? The existing
Fixes: 63dca2c0b0e7 tag plus Cc: stable already covers backports, so
this is mostly about traceability.
> diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
> index 8a3c880fdb266..76213159404f0 100644
> --- a/net/netfilter/ipvs/ip_vs_core.c
> +++ b/net/netfilter/ipvs/ip_vs_core.c
> @@ -1206,6 +1206,13 @@ static int ip_vs_out_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb,
> true, &ciph))
> return NF_ACCEPT; /* The packet looks wrong, ignore */
>
> + /* ipv6_find_hdr() does not include the embedded header for
> + * non-first fragments, add it so that ESP can pass and the
> + * NAT writable checks cover the rewritten addresses
> + */
> + if (ciph.len == ciph.off)
> + ciph.len += sizeof(struct ipv6hdr);
[Severity: Low]
This isn't a bug, but is "so that ESP can pass" accurate for the IPv6
paths? A len vs off comparison only exists on the IPv4 side, for example
in ip_vs_nat_icmp():
if (cih->ihl * 4 != ciph->len - ciph->off)
return false;
None of these compare ciph.len with ciph.off:
- ip_vs_out_icmp_v6()
- ip_vs_in_icmp_v6()
- handle_response_icmp()
- ip_vs_icmp_xmit_v6()
- ip_vs_nat_icmp_v6()
- the AH/ESP conn_in_get/conn_out_get handlers
So the only effect seems to be the larger skb_ensure_writable() range.
Later in the series, "ipv6: update *offset for non-first fragments in
ipv6_find_hdr()" makes ipv6_find_hdr() do this for non-first fragments:
*offset = start + sizeof(struct frag_hdr);
After that change, the first clause of this comment is no longer true.
The ciph.len == ciph.off check also can't fire any more, here or in the
copy added to ip_vs_in_icmp_v6().
Separately, the commit message says "This fix does not depend on patch
2." Once merged, "patch 2" won't point to anything in git history. Could
it name "ipv6: update *offset for non-first fragments in ipv6_find_hdr()"
instead?
> +
> pp = ip_vs_proto_get(ciph.protocol);
> if (!pp)
> return NF_ACCEPT;
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113011447.2357709-2-pablo%40netfilter.org
Re: [PATCH net 01/15] ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
Author: Pablo Neira Ayuso
Date: Sun, 15 Nov 2026 23:56
Date: Sun, 15 Nov 2026 23:56
53 lines
10140 bytes
10140 bytes
Hi Julian, On Sat, Nov 14, 2026 at 10:06:38PM +0200, Julian Anastasov wrote: > > Hello, > > On Sat, 14 Nov 2026, netdev-bot+sashiko@kernel.org wrote: > > > Thank you for your contribution! Sashiko AI review found more severe > > issue(s) in other patches of this series. This mail is only an FYI, in case > > you want to address the nit picks below when you respin. > > In summary: we can drop current patches 1, 2, 15 and > should address problems in 7. OK; then I'll drop 1, 2, 7 and 15. Regarding 7, see below. > We plan to update patch 2 to check for present data. > Both patches 1 and 2 go together, so they can be dropped for > now and improved in next version. > > Patches 4, 8, 10 and 14 are ok, even if wording can be improved. > > Patch 5: we prefer to drop the traffic when port 0 is involved > > Patch 7 should be checked by the Netfilter guys. It seems it is possible to create an expectation on unconfirmed conntrack entries from the IPVS ftp helper. For a TCP connection, the conntrack entry should not be already in confirmed state when the FTP helper runs in most cases. So I think easiest way is to make a patch to prevent unconfirmed conntracks from expectations in the IPVS FTP helper. > Patch 11: NO_CPORT is before connection is established and > we do not sync conns in master before establishment. So, > nothing bad can happen in practice. > > Patch 12: races are possible but nothing fatal > > Patch 15: The patch was meant for ip_vs_bind_xmit_v6. daddr can > be further limited in next version, so this patch can be dropped. > > > -- > > Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113011447.2357709-2-pablo%40netfilter.org > > Regards > > -- > Julian Anastasov <ja@ssi.bg>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads