Hello,
A behaviour question about IPVS and ICMP path-MTU, with a lab measurement. I think IPVS
forwards service traffic using non-forwarding MTU semantics, so an off-path host can shrink
or black-hole a virtual service's traffic with one forged ICMP. I'd like your view on whether
this should follow the forwarding path's anti-spoofing stance.
Background
Since f87c10a8aa1e ("ipv4: introduce ip_dst_mtu_maybe_forward and protect forwarding path
against pmtu spoofing"), the IPv4 forwarding path ignores an ICMP-learned path MTU
(net.ipv4.ip_forward_use_pmtu=0 by default), because it can be forged, and honours only a
locked route MTU. ip_dst_mtu_maybe_forward(dst, true) implements that for ip_forward().
IPVS reads the MTU through dst_mtu() in ip_vs_xmit.c (for example __ip_vs_get_out_rt(),
and ensure_mtu_is_adequate()). dst_mtu() -> ipv4_mtu() -> ip_dst_mtu_maybe_forward(dst,
false) (net/ipv4/route.c), i.e. the non-forwarding case, which returns the learned rt_pmtu
regardless of the lock. So for traffic an IPVS director forwards to a real server, a learned
(and forgeable) PMTU is trusted, which the ordinary forward path would ignore.
Measured (kernel 7.0.0-43-generic, network namespaces)
Director r1 in NAT mode, virtual service on r1, real server behind a second router; an
off-path host that can reach r1's public address but has no route to the inside client.
One ICMP type 3 code 4 to r1, from the attacker's own address, quoting a UDP datagram
r1 -> real-server:443 with next-hop MTU 1000 (an ordinary, UNLOCKED value):
- r1 route to the real server: "mtu 1000" (unlocked).
- A client's 1200-byte UDP datagrams with DF through the virtual service: 0 of 3 delivered;
the director returns fragmentation-needed. Non-DF traffic is delivered. 2 of 2 runs.
- A forged value below net.ipv4.route.min_pmtu (551 -> stored locked 552) does the same;
with net.ipv4.route.min_pmtu=68 the value is stored unlocked and the effect persists,
which shows it is the learned value, not the lock, that IPVS is acting on.
So unlike ip_forward(), IPVS acts on an unlocked forged PMTU, not only on the locked
sub-min_pmtu case. The gate is only that the director accept the unsolicited ICMP on its
input path (the default on many setups).
Question / suggested direction
Should IPVS treat the packets it forwards with the forwarding path's MTU semantics, i.e.
ignore an unlocked ICMP-learned PMTU the way ip_dst_mtu_maybe_forward(dst, true) does, and
honour only a locked route MTU? I have not sent a patch because the MTU value in
ip_vs_xmit.c is used both to emit fragmentation-needed and to decide fragmentation, and the
right change is your call. I'm happy to prepare and test one in whatever direction you prefer.
Related: a forwarding-path fix for the locked sub-min_pmtu case is on netdev:
https://lore.kernel.org/netdev/2026…@jamessawyer.co.uk
The netfilter flowtable uses ip_dst_mtu_maybe_forward(dst, true) and is covered by it; IPVS,
using dst_mtu() directly, is not.
This was found with AI assistance; the measurements were run in my own lab and checked
against the logs. A reproducer is available on request and is not being published.
James Sawyer
IPVS: forwarded service traffic honours a forged (unlocked) ICMP path MTU
- From
- jame…@outlook.com (James Sawyer)
- Organization
- Usenet Network
- Message-ID
- <DU4P…@DU4P194MB2971.EURP194.PROD.OUTLOOK.COM>
- Date
- Newsgroups
- linux.kernel.netdev