From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22E1C3BCD01 for ; Fri, 31 Jul 2026 14:08:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785506907; cv=none; b=LiV4j+/m/K6chjIwrzMqdJ58/Xp7IGse5N45ept5nd0kIqHgSyy1yhkle5D4g0fKR27Um0GykE/cwlgaMbHZcuad7Fviak3l0S2L7suWcOqXb8tuYqpew9dTBco9D9bsXF7Wy03OQ1d6hjsaIxjYNHiGfzBaAUYdiDPQj+PRupo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785506907; c=relaxed/simple; bh=S8ZYhVxFV3d81I8luPNn70FLZtYvMhbuabZAfFkqwIg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dJO23TWAFKOziuAPisGVHtDN2b7qsmEIx4k3EE8VqCgf6pIm9weOr8cpUbK7t8gg9+MfY8wDf/6INYwS9ilQqYGk7pKbp869es5uIF+cS+V7zcwgy94o75PaNH1aXp5nlJQ63zuH8Ywbc5+56aUxBHfzamz9FeiLebQGpSx3K+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=trailofbits.com; spf=pass smtp.mailfrom=trailofbits.com; dkim=pass (2048-bit key) header.d=trailofbits.com header.i=@trailofbits.com header.b=D6lFA0k2; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=trailofbits.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=trailofbits.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=trailofbits.com header.i=@trailofbits.com header.b="D6lFA0k2" Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-51c0ecfaee7so5892031cf.0 for ; Fri, 31 Jul 2026 07:08:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trailofbits.com; s=google; t=1785506904; x=1786111704; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=4CYqaoDHFTXverpQiHzNbFE4tLgoDQ4zGj2U6cQ1kUE=; b=D6lFA0k2d+qI7i6En2Q2Y3mDRPFJAr7PRpHhc8NoYXZWmwn7BT3qoc/xV+iQZcdmEO N6kHiy+mV94Ie89UxbGSNX8WC4ztQN8LODekF49M0r7dBJysGlCQdyo+oW30hujfefLE q+c6eu2mIbi4+GBp0xKPWKbaoOFdambS61TBDcvZmAGfXuMW+SQ0J9WBolO0AD1lbtlW ewPHR1JD3egBiYl7XnfFPT0IDIvMnDSOq9X8XgAxqY3MYoOADzVA3FzMPEGdCMS7m2fJ aE/vPM8R6SPYS4II1doR+tXAaM02bZvK5wRETTIZwG8soIZM9L7a6Sc2XeQGKXl8ACYw RdwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785506904; x=1786111704; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=4CYqaoDHFTXverpQiHzNbFE4tLgoDQ4zGj2U6cQ1kUE=; b=gXCxQKWU7OxOvjj2lBzAiocyhDPYKW+3ij9SEldjf1epu7Kf7MIoOl/7Fvia+VTBLo pyTouLkD8V/lflZfUFHlpvzA16WubmUQAvKngndKqraTRP//fZL/6J2qtE+1ye/rG8DY Dv9bbeGScI1O6wDTrSO0NzElcWB207fgBAC214PxCyy4l6UcHVRNpVP7q8Y/HYRoOAxu hJEmT0HV/GwLJ7Zd/AeGo20CB/UvbVcDckmS4LDtixxvubzY0sND+UuqssmCwGL1/9mI AmvjmhSSRYbiIG+lxylK61fu9sWvKu6tGJPGCQPUPIEg2rW3/ZoF611x8pSlfdC1pwJl Q/bg== X-Forwarded-Encrypted: i=1; AHgh+RoAZbPare+2rLB2D8bdDaFK0JHi9vx7/RZkyjMVl3B9CxOdXBIJcVpYW/1XvHcztR4Ol7O/iNQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9/pDUzryXbgiNStI1Q8T6NPj2otpR8XfRpHEqKpfrlt13BWEK h0P6LXpJrVUT1twZ0odVZehQNDH1CW1D2IRocd/lSB8bkGalCj/G00NjMiBZxFATbVg= X-Gm-Gg: AR+sD114y/JLXr3L0ZqYBwYunZvRdNkENm5X7tHgyQ1Mb/By6aMawJybYU4+f3EK/qF oGU/LhRoC3EXNcEJdNUdcrqf/nTt9ZayRnzsvIlKbCyZKhtfFiQTltclTlAUL/8TrSdBipeOZ/n AHLPbAUVuy3yr5wS5mSnjSSDkGI9x6r/M4n/vpTAAlFXpqrXNSEzR/uX0GuH2UyTjypOGCbi5tv KceBZjFZYATWZ2d5s1DIZGBxNh/lGQQ4xXFsl9WJ30wzNv9wp4nmWMgxJo3ggnj7lxH1W12X6TY Ydz7W6omXeVwFwdjfweIRWlUf1qAnPMcyVlq1QzF7lgglNs4UWrq0HhHzkg+/WFDoEshT4O4Z+W g7EJaBgWzAQwniDhXPnfdQMZn4IKi4LULvqwxywcn5sRaVALnU1F9YuHv7qqep9arh8XFXAuQkc VrPMnTOmGroJp8oekqRVUrR3pnG3YEv2JvoMz4Nru2jItTTQ9RV7TRIRl3f6rYuWnn3g== X-Received: by 2002:a05:622a:8f:b0:51b:f563:f613 with SMTP id d75a77b69052e-52b567c6399mr3664281cf.35.1785506903762; Fri, 31 Jul 2026 07:08:23 -0700 (PDT) Received: from localhost ([146.190.222.192]) by smtp.gmail.com with UTF8SMTPSA id d75a77b69052e-52b4ebeb909sm8257931cf.29.2026.07.31.07.08.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 31 Jul 2026 07:08:23 -0700 (PDT) From: David Lee To: horms@verge.net.au, ja@ssi.bg, pablo@netfilter.org, fw@strlen.de, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: David Lee , Kyle Zeng , Dominik 'Disconnect3d' Czarnota , phil@nwl.cc, netdev@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] ipvs: clear IPv4 options after rebasing tunnel ICMP errors Date: Fri, 31 Jul 2026 14:08:22 +0000 Message-ID: <20260731140822.567128-1-david.lee@trailofbits.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ip_vs_in_icmp() rebases an skb from the outer ICMP packet to the quoted original request before passing it to icmp_send(). However, IPCB(skb)->opt still describes the outer IPv4 header. A timestamp option in the outer header can therefore leave an offset that points into the quoted transport header after the rebase. __ip_options_echo() treats a byte at that stale location as the option length and copies it into the fixed-size option storage on the __icmp_send() stack, causing a stack out-of-bounds write. Clear the stale option metadata after resetting the network header. Keep the remaining control block fields, including the ingress interface used by the ICMP response path. Fixes: f2edb9f7706d ("ipvs: implement passive PMTUD for IPIP packets") Cc: stable@vger.kernel.org Bug found and triaged by OpenAI Security Research and validated by Trail of Bits. Assisted-by: Codex:gpt-5.6-sol gpt-5.5-cyber Signed-off-by: Kyle Zeng --- Trail of Bits has a reproducer for this bug that triggers a KASAN stack-out-of-bounds write in __ip_options_echo() and can share if needed. net/netfilter/ipvs/ip_vs_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index bafab9345..fe06c380c 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c @@ -1951,6 +1951,7 @@ ip_vs_in_icmp(struct netns_ipvs *ipvs, struct sk_buff *skb, int *related, if (pskb_pull(skb, offset2) == NULL) goto ignore_tunnel; skb_reset_network_header(skb); + memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); /* Ensure the IP header is present in headroom */ if (!pskb_may_pull(skb, hlen_orig)) goto ignore_tunnel; -- 2.53.0