From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D51873AF677 for ; Wed, 29 Jul 2026 06:50:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.96.220.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785307849; cv=none; b=qUgi68wwLLfLNluk+fh3lne/4CilYxtav9t71s9Igjsslbl9mcHNyvuaZIpgjEWAfPxEV9FYuOT/Qqx88ScsT0KcmMFUYgyUcIssjWACqCKrzK9lEPiaqWBum6vxNwOrtvaYpPE3n6SmXuTgE3ei07vvvsandXRbzMNR2SI+icc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785307849; c=relaxed/simple; bh=7CHz+Gs80/s/Qq30So5Vv3eI98DIPEoaGhgLoRAUCvk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N+R6yVHxoSoimQfejIGngo7cuGK8ODlRQsQM9qfjo8nqUrQw+VnhCJFLLUq5Lz1LWcqNwdG2p0NXEYpAqwXzUrdghtRxlD9idX/ItyzjP+/6tcFNpp5R458MSQpR7CfSOUSxKllZ9RgdQZJ6gCcm1D8dVYduhJKB1kT83uLVt8Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b=EwJ8ceRG; arc=none smtp.client-ip=62.96.220.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.b="EwJ8ceRG" Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id 6A86820758; Wed, 29 Jul 2026 08:50:46 +0200 (CEST) X-Virus-Scanned: by secunet Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gR134sm1Jk-1; Wed, 29 Jul 2026 08:50:45 +0200 (CEST) Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id BEED220754; Wed, 29 Jul 2026 08:50:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com BEED220754 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1785307845; bh=5x8JSb65oQKn2aXP9mAYCUDMuF/YzRjvPDq4HY1/+7o=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=EwJ8ceRG3CYdZLyGncjW/T+RqkkSLEMm+nIivO5LRBGFRRzly9X4X82ixiGgi9Lvx fZctermOlSk6lgaX12LzLIE2CcMq9Qa+tRMXZtKHrJHxlprqD+FqFmqn0gOxKpRslX IHHbmw8FrLH38K4nDhthKWytmptv5wELea5dyCoy8yWDOA2vxY3hWWv70U/7xalIkW gIrTI4m0oy90xsLJaYLfUPG0mXBeDRHiVAYxh6sjXxFW9SMnQYa8dAHXvbk+QTu5Ro MVjGnteqDV9TQIceScdKtQKcoed+KAp/gaYjVUSv29qXgF4NKe/Q1IFKAE7EmxdSOV tO6PghSDeJXBw== Received: from secunet.com (10.182.7.193) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Wed, 29 Jul 2026 08:50:45 +0200 Received: (nullmailer pid 1592277 invoked by uid 1000); Wed, 29 Jul 2026 06:50:38 -0000 From: Steffen Klassert To: David Miller , Jakub Kicinski CC: Herbert Xu , Steffen Klassert , Subject: [PATCH 1/8] xfrm6: fix out-of-bounds write in xfrm6_input_addr() when secpath is full Date: Wed, 29 Jul 2026 08:50:11 +0200 Message-ID: <20260729065035.1591985-2-steffen.klassert@secunet.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260729065035.1591985-1-steffen.klassert@secunet.com> References: <20260729065035.1591985-1-steffen.klassert@secunet.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-03.secunet.de (10.32.0.183) To EXCH-01.secunet.de (10.32.0.171) From: Xiang Mei The depth check in xfrm6_input_addr() is off by one: if (1 + sp->len == XFRM_MAX_DEPTH) goto drop; ... sp->xvec[sp->len++] = x; xfrm_input() can leave sp->len == XFRM_MAX_DEPTH, and the transport-mode receive path re-enters IPv6 input via xfrm_trans_reinject() with that secpath preserved. If the inner packet carries a destination-options HAO option or a type-2 routing header, xfrm6_input_addr() is called with sp->len == XFRM_MAX_DEPTH; the check (1 + 6 == 6) is false, so sp->xvec[sp->len++] writes one slot past the 6-element xvec[]. The write stays within the sec_path allocation (invisible to KASAN); UBSAN_BOUNDS flags it and panics under panic_on_warn. Use "sp->len >= XFRM_MAX_DEPTH", matching xfrm_input(). This also restores one chain level the old check rejected at sp->len == 5. UBSAN: array-index-out-of-bounds in net/ipv6/xfrm6_input.c:309:10 index 6 is out of range for type 'xfrm_state *[6]' Fixes: 9473e1f631de ("[XFRM] MIPv6: Fix to input RO state correctly.") Reported-by: Weiming Shi Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Xiang Mei Signed-off-by: Steffen Klassert --- net/ipv6/xfrm6_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index 89d0443b5307..07edef258984 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c @@ -247,7 +247,7 @@ int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, goto drop; } - if (1 + sp->len == XFRM_MAX_DEPTH) { + if (sp->len >= XFRM_MAX_DEPTH) { XFRM_INC_STATS(net, LINUX_MIB_XFRMINBUFFERERROR); goto drop; } -- 2.43.0