Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: james@jamessawyer.co.uk
Cc: David Ahern <dsahern@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Stefano Brivio <sbrivio@redhat.com>,
	Sabrina Dubroca <sd@queasysnail.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] ipv4: do not trust ICMP-locked PMTU while forwarding
Date: Sun, 6 Dec 2026 17:32:16 +0200	[thread overview]
Message-ID: <20261206153216.GA157583@shredder> (raw)
In-Reply-To: <20261203-ipv4-fwd-icmp-locked-pmtu-v1-1-e5f48573bbf0@jamessawyer.co.uk>

On Thu, Dec 03, 2026 at 11:59:01AM +0000, James Sawyer via B4 Relay wrote:
> From: James Sawyer <james@jamessawyer.co.uk>
> 
> Commit f87c10a8aa1e ("ipv4: introduce ip_dst_mtu_maybe_forward and
> protect forwarding path against pmtu spoofing") made the forwarding
> path ignore path MTUs learned from ICMP, because they can be forged,
> and only honour an MTU the administrator locked on the route.
> 
> Commit d52e5a7e7ca4 ("ipv4: lock mtu in fnhe when received PMTU <
> net.ipv4.route.min_pmtu") made ICMP-learned values below min_pmtu
> "locked" as well, so the host stops setting DF on its own packets, and
> switched ip_dst_mtu_maybe_forward() to ip_mtu_locked(). As a result the
> only learned PMTU that forwarding still trusts is a value below
> min_pmtu, which is the value an off-path attacker would pick.
> 
> One ICMP fragmentation-needed message sent to a router, quoting a UDP
> packet from the router to a destination D with an MTU below 552, makes
> the router clamp to 552 every DF packet it forwards to D, for 600 s,
> renewable. Hosts behind the router get frag-needed (mtu = 552) from
> their gateway, and DF traffic larger than that (for example QUIC, which
> needs 1200 bytes) to D fails; their TCP MSS to D drops to 500. No socket
> has to match the quoted packet: a quoted ICMP echo reply reaches
> ipv4_update_pmtu() through icmp_err(), and a quoted UDP packet does so
> through udp_err_update_exception().
> 
> While forwarding, trust only the administrative lock again, in both
> places the helper tests it; the 576-byte clamp for gateway routes
> further down must not apply to an ICMP-induced lock either. Local
> traffic keeps the 2018 behaviour (no DF on its own packets).
> 
> Reproduced on 7.0.0-43-generic (Ubuntu 26.04) with network namespaces:
> a NAT gateway with two inside hosts, an attacker that can reach only
> the gateway's public address and D, and UDP 1200-byte payloads with
> IP_PMTUDISC_DO and IP_PMTUDISC_PROBE from both inside hosts: 0 of 3
> delivered after one forged message with MTU 551 (3 runs); delivered
> after a forged MTU of 1000 (unlocked) and with net.ipv4.route.min_pmtu=68
> (the same value stored unlocked). Quoting an echo reply instead of UDP
> gave the same result. The same worked from an inside host against a
> gateway whose input policy trusts its LAN. An independent reproduction
> on a second VM with separately written scripts matched every case.
> 
> Tested on v7.4-rc1 in QEMU with the same setup: unpatched, one forged
> MTU 551 left 0 of 3 DF datagrams delivered from each inside host; with
> this patch the exception is still stored ("mtu lock 552") but forwarded
> traffic is unaffected (3 of 3, ping -M do 1400 passes), and the
> router's own output still honours the stored PMTU. Built with W=1
> (ip_forward.o, ip_output.o) without warnings.
> 
> The netfilter flowtable uses the same helper and is covered by this
> change. IPVS (dst_mtu() in ip_vs_xmit.c) and ipmr have their own MTU
> logic and are not changed here. A reproducer is available on request.
> 
> This issue was found and the fix written with AI assistance.
> 
> Fixes: d52e5a7e7ca4 ("ipv4: lock mtu in fnhe when received PMTU < net.ipv4.route.min_pmtu")
> Signed-off-by: James Sawyer <james@jamessawyer.co.uk>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

      reply	other threads:[~2026-12-06 15:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 11:59 [PATCH net] ipv4: do not trust ICMP-locked PMTU while forwarding James Sawyer via B4 Relay
2026-12-06 15:32 ` Ido Schimmel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261206153216.GA157583@shredder \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=james@jamessawyer.co.uk \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbrivio@redhat.com \
    --cc=sd@queasysnail.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox