From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (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 DC23B308F39 for ; Fri, 31 Jul 2026 14:08:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785506907; cv=none; b=kHlEmmrhX/pkRauD9M+n/xStT+0tomi+txXu7xdKU6RHf6VKdMFED7jlhu0Akukbb8W+9gCjFkZVCDUyw4Ilj4wVG+sqPgjIwtKdLYkOKNfswr57D4/Flop3Sc1+YejQyAGzu+ObIwnhSxsuTd7LNarpTuIpGhQaUB3e/2c6Hfw= 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.169 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-f169.google.com with SMTP id d75a77b69052e-51c15bf5000so3774821cf.3 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=SNkbGdVl5NWNbrcKCz0DcJSw6RQp7DgzhWvhbfJs8gcQ1CfY9vjnodz0gB5itMPckr 3UOpxCTSm0+BpTJ9iAgTaJxspIEUa0mE9TvwijQHM6JWESV5g6DvlKI9DVgcR+p6OTu8 3qqyaqiJcqU3dvzLJpZgKcrrtDXJ5lgfW5aHmB5juoVD/NQPkRZwmGuuooZxcpr5albO LYLUn+ITSos+AEJ7GGVqXXkz6KWpMi/jxZc9wbwyqPvAO5q5EsBMIGNUTpu0a41c9JPY Zz2MGS2wk/NvPDSPqeas4FGNge6xx2FjUNpulupMine9QRxCEP3w60QvRI74XKGjLzmn Fb4Q== X-Forwarded-Encrypted: i=1; AHgh+Ro8qJ4GeC3MvuotVM6COviGVFT3/ipknzXehWm2ihyBOcxuUtBR25PezA9/clk053hHFYS9b4CFxg+Smd4=@vger.kernel.org X-Gm-Message-State: AOJu0YxeLGkAWe/z+K9skWTVKngZGDZbi2DhZ7akXlyKn/vN2UC6XqiJ a0VEoj2hKci+qXPy9Z6UlP/5m5NJrweHqvP/JqbAbTqZBLBn39Hht65Aj/4K7/d1i8k= X-Gm-Gg: AR+sD104JJ6jQeLcWAZBbBs00NjIgyTMUrTS1DAua0tgCFqJWBXyXomnczkupajZSBF t5ECPXCCF4lDmlizW73acyHleKocUoflOHhc5YDUyMFjoJRnyb59muQhuU8COhcfb8q/RZfgHsP HfaKLqC+zhobG84dABLdPyd7RMLeBk/AyBMGVs5Hl4+stRLdXJA22tzvw/2S8YmdtDVKYLshoN6 /IbbNs+2QDVMUcEV5FBsn/3yQEt1QAKk+PtVFQqT1GkU9EBRZwn/zNt1VFZH8uZrOh7YEavq5O0 s7zhW0Z++fvb5GJbEGmzEaqjz93IA+5hMIszH/20W3piVhfEuyIFoKW3J3v2WkN+YepM6N+jNz8 kSfLhPzSn2094RK2/PblwHsMOoOK2wkKGO2SpwszmX35QHy3Il949vbIGPwUpmf/pLFoZkERVq+ 7tFf5MrUe1zlufjQeFwGmuDxQG8TZNr8ins7yNgSSXmbki1MP0n/YOOCswXb32haMVaw== 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: linux-kernel@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