mbox series

[nf,0/2] ipvs: fix OOB write when NATing ICMPv6 errors quoting non-first fragments

Message ID 20260925141155.17603-1-axel.mierczuk@1password.com
Headers show
Series ipvs: fix OOB write when NATing ICMPv6 errors quoting non-first fragments | expand

Message

Axel Mierczuk Sept. 25, 2026, 2:11 p.m. UTC
This series fixes a 16-byte OOB write past the verified skb area,
reachable through ICMPv6 errors that quote non-first fragments.
Following Julian's suggestion, it preserves ESP ICMPv6 handling.

Patch 1 includes the embedded IP header in ciph.len at both ICMPv6
call sites when parsing stops at a non-first fragment. The change
follows the ip_vs_fill_iph_skb_icmp() calls and does not depend on
patch 2.

Patch 2 makes ipv6_find_hdr() set *offset to the fragment payload
for non-first fragments when target < 0, so every successful return
updates it. It carries no Fixes tag because it defines an offset
that was previously unspecified.

Axel Mierczuk (2):
  ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
  ipv6: update *offset for non-first fragments in ipv6_find_hdr()

 net/ipv6/exthdrs_core.c         |  6 +++++-
 net/netfilter/ipvs/ip_vs_core.c | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

Comments

Julian Anastasov Sept. 25, 2026, 5:50 p.m. UTC | #1
Hello,

On Fri, 25 Sep 2026, Axel Mierczuk wrote:

> This series fixes a 16-byte OOB write past the verified skb area,
> reachable through ICMPv6 errors that quote non-first fragments.
> Following Julian's suggestion, it preserves ESP ICMPv6 handling.
> 
> Patch 1 includes the embedded IP header in ciph.len at both ICMPv6
> call sites when parsing stops at a non-first fragment. The change
> follows the ip_vs_fill_iph_skb_icmp() calls and does not depend on
> patch 2.
> 
> Patch 2 makes ipv6_find_hdr() set *offset to the fragment payload
> for non-first fragments when target < 0, so every successful return
> updates it. It carries no Fixes tag because it defines an offset
> that was previously unspecified.
> 
> Axel Mierczuk (2):
>   ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
>   ipv6: update *offset for non-first fragments in ipv6_find_hdr()
> 
>  net/ipv6/exthdrs_core.c         |  6 +++++-
>  net/netfilter/ipvs/ip_vs_core.c | 14 ++++++++++++++
>  2 files changed, 19 insertions(+), 1 deletion(-)

	Both patches look good to me, thanks!

Acked-by: Julian Anastasov <ja@ssi.bg>

	The ipv6 patch needs review from the net team and
may need some Fixes line:

Fixes: b777e0ce7437 ("[NETFILTER]: make ipv6_find_hdr() find transport protocol header")

Regards

--
Julian Anastasov <ja@ssi.bg>
Ido Schimmel Sept. 28, 2026, 11:15 a.m. UTC | #2
On Fri, Sep 25, 2026 at 08:50:58PM +0300, Julian Anastasov wrote:
> 
> 	Hello,
> 
> On Fri, 25 Sep 2026, Axel Mierczuk wrote:
> 
> > This series fixes a 16-byte OOB write past the verified skb area,
> > reachable through ICMPv6 errors that quote non-first fragments.
> > Following Julian's suggestion, it preserves ESP ICMPv6 handling.
> > 
> > Patch 1 includes the embedded IP header in ciph.len at both ICMPv6
> > call sites when parsing stops at a non-first fragment. The change
> > follows the ip_vs_fill_iph_skb_icmp() calls and does not depend on
> > patch 2.
> > 
> > Patch 2 makes ipv6_find_hdr() set *offset to the fragment payload
> > for non-first fragments when target < 0, so every successful return
> > updates it. It carries no Fixes tag because it defines an offset
> > that was previously unspecified.
> > 
> > Axel Mierczuk (2):
> >   ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
> >   ipv6: update *offset for non-first fragments in ipv6_find_hdr()
> > 
> >  net/ipv6/exthdrs_core.c         |  6 +++++-
> >  net/netfilter/ipvs/ip_vs_core.c | 14 ++++++++++++++
> >  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> 	Both patches look good to me, thanks!
> 
> Acked-by: Julian Anastasov <ja@ssi.bg>
> 
> 	The ipv6 patch needs review from the net team and
> may need some Fixes line:
> 
> Fixes: b777e0ce7437 ("[NETFILTER]: make ipv6_find_hdr() find transport protocol header")

Doesn't patch 2 make patch 1 redundant? It seems that the comments added
by patch 1 become stale with patch 2, no?

If so, why do we need both? Why not send only patch 2 and blame
63dca2c0b0e7a?
Julian Anastasov Sept. 30, 2026, 5:34 p.m. UTC | #3
Hello,

On Mon, 28 Sep 2026, Ido Schimmel wrote:

> On Fri, Sep 25, 2026 at 08:50:58PM +0300, Julian Anastasov wrote:
> > 
> > > Axel Mierczuk (2):
> > >   ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
> > >   ipv6: update *offset for non-first fragments in ipv6_find_hdr()
> > > 
> > >  net/ipv6/exthdrs_core.c         |  6 +++++-
> > >  net/netfilter/ipvs/ip_vs_core.c | 14 ++++++++++++++
> > >  2 files changed, 19 insertions(+), 1 deletion(-)
> > 
> > 	Both patches look good to me, thanks!
> > 
> > Acked-by: Julian Anastasov <ja@ssi.bg>
> > 
> > 	The ipv6 patch needs review from the net team and
> > may need some Fixes line:
> > 
> > Fixes: b777e0ce7437 ("[NETFILTER]: make ipv6_find_hdr() find transport protocol header")
> 
> Doesn't patch 2 make patch 1 redundant? It seems that the comments added
> by patch 1 become stale with patch 2, no?
> 
> If so, why do we need both? Why not send only patch 2 and blame
> 63dca2c0b0e7a?

	The idea was to have IPVS fix that can be backported
alone, if needed.

Regards

--
Julian Anastasov <ja@ssi.bg>
Ido Schimmel Oct. 1, 2026, 4:10 p.m. UTC | #4
On Wed, Sep 30, 2026 at 08:34:57PM +0300, Julian Anastasov wrote:
> 
> 	Hello,
> 
> On Mon, 28 Sep 2026, Ido Schimmel wrote:
> 
> > On Fri, Sep 25, 2026 at 08:50:58PM +0300, Julian Anastasov wrote:
> > > 
> > > > Axel Mierczuk (2):
> > > >   ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
> > > >   ipv6: update *offset for non-first fragments in ipv6_find_hdr()
> > > > 
> > > >  net/ipv6/exthdrs_core.c         |  6 +++++-
> > > >  net/netfilter/ipvs/ip_vs_core.c | 14 ++++++++++++++
> > > >  2 files changed, 19 insertions(+), 1 deletion(-)
> > > 
> > > 	Both patches look good to me, thanks!
> > > 
> > > Acked-by: Julian Anastasov <ja@ssi.bg>
> > > 
> > > 	The ipv6 patch needs review from the net team and
> > > may need some Fixes line:
> > > 
> > > Fixes: b777e0ce7437 ("[NETFILTER]: make ipv6_find_hdr() find transport protocol header")
> > 
> > Doesn't patch 2 make patch 1 redundant? It seems that the comments added
> > by patch 1 become stale with patch 2, no?
> > 
> > If so, why do we need both? Why not send only patch 2 and blame
> > 63dca2c0b0e7a?
> 
> 	The idea was to have IPVS fix that can be backported
> alone, if needed.

I assumed this was the case and it's your call, but then the appropriate
thing to do would be to wait with patch 2 until patch 1 is in net-next
and change it so that it removes the now dead code. At least that's how
I handle similar cases with my submissions.