From nobody Mon Jun 8 08:28:39 2026 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (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 B50F731F986 for ; Thu, 4 Jun 2026 17:58:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780595890; cv=none; b=l6Nq9ZjB73JuQZ7RCwXO/s+3COUK2nkk7juJ8agguyvdEZBNWEF5FlXovv7gBnV/ahbibDRV1jPx8okxw1nNb8rxdpFzss1CyGpfAaNTjDcWH6nA79hEwmK61HvwNSBZLIMQuCwqi1t7ItZxu+LTgYqmwws9uD9e5caq6ZXoEEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780595890; c=relaxed/simple; bh=QgKf+3clhhMLNlggfZvWCRY5iz5ATGH7muhRFNw4wbA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MdCeFANT27sQiPk80+PSDULdyEHjFxRbJ1ZMbhhThG1DKOIonOIMuq6qOw415esbmG7kw+gSKaWRuVYQ3fZD052Lds4uhGNVmfDjNAIpCflQ4OLm6utDRdGDaG/dJJFVOAKZ9DLPpAGOpr7oDOKXIjxq3vuBYVizwmVgQ12Wh+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gs17Tqkp; arc=none smtp.client-ip=209.85.222.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gs17Tqkp" Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-9156ceb55ffso89262485a.0 for ; Thu, 04 Jun 2026 10:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780595888; x=1781200688; 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; bh=2qQO5dPJpJPnmsYjavZ2xiv11ddii1u7KjXOe802ZBo=; b=gs17Tqkpe7H4tRM33lhFgoJhiitdUIk24IfI+FDCTBJTy19KIFT/6H++WiYWJbfCHr xIr5hmCSyWBh+d7P1r3EKgTfbqBcr3HzL6HLGMVPAW8N0XIzW+zpo8N2ZpHsyrZLQBQz w5+Qfr44orLZf4CODGigGAvRVhnOfwL6p8Csr+upT+ZvrZMvIbgZ/5fpHosYFPyNGz2u Od8pXuwb4jVxH7lmxPAew/ofAMiAWsnGTNGT+iNDecq3n7mAV8OoMxYdUWwO+eEK84SX XQGaJX9Nh/BaVUB0sGMJ8N2229XXkWWks5PZLqOuTaw6J5sJJ4F06lEcVuvKNItrnUWY 7U8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780595888; x=1781200688; 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; bh=2qQO5dPJpJPnmsYjavZ2xiv11ddii1u7KjXOe802ZBo=; b=sCq7rmxMrnW9dgthSrIFntVk3KnmsZS+CemW90z3Qlfb36M7OGPxtK3NGxQMHA7Sbe 2fJiXq6vC+wLYQgZfCteU1q4XmN4hmHJhhxPlUJBXJYuHQZSv5aIRSqQPB5h3swtRpn2 rE3ozeTqEry/U/HtGOKl31DxzXezIfKDTO5pOct2idnyw9rPU8Xo0QU0xW+qL0LTy9kY w7g26etuf9KwmURg4tJrZj5h+6w+OJFklRCffkDzbHbmJ4gx42fao1ECNngyIFsM3spm iaqkQWYprvYi+ImbdfPcwd6wEezdb2FnKZ0zwaVPN9auuPlGZLd5ZgbN92eM6A+1QjNv Wz0w== X-Forwarded-Encrypted: i=1; AFNElJ/kGhzPip5D1pG9iMaHULYL8i8p7gx3NLEjaYs0cSHrNWH/ZeKg6bgBw0nfNd6bxr2BV+VFfRw8Ywhr38w=@vger.kernel.org X-Gm-Message-State: AOJu0YzyZOnc+A3iLAb7vEWWminWfGBphblqy1bqKZ7hmiHCM/b6ccFW F5cMiY/KRWdreTff4i6ZK/q1VFCENEJnZ0pMIM4HAGnhrwl8WAm7qMGS X-Gm-Gg: Acq92OGv4jcd3fh0CAj79cO4QTEErL+bxS9yHd5/bcD1PB+/uiIFX3d0sn/iSZVXRrD HTv8sXs+tGkMoE/3hdw2SebgafuadgRThu0b3SBGuHV76/01eI2h/xjg7OZ/TVmmrqXXMXFboHE R/oywUX7JEo0benwDG3QIazk6YpKC36pIiXBDgNPppi1tWlTKGo8XbwztmowsKEg5xgYKOUOd1w RI040DXVL3XqrlQzqDZpnec26AQa6nPPylSrJV+xt5QzUtj5Hv03d3XF7YmjwfbyK+i9AoFHN7S +XrR9S9BOjfxIDsuHm41/LOPUR7Vj7/1u1ivPiquZXNDiH1VRvu5a8vnKkzzxMeKtZaA9T47sJR 5Iq3Mv88XxBYslTlAh2ICgym+cSBqR9sAYUcRg6ZhCoXH9TwX9Gc/ox12iqBbCuDQLYbOwpGGK2 39FZC8GU9UUz+FEBMypcZmH7mEn/R5TnU7FdirqJAHqa+27dn+yrXeFiTtwbBInkU/HLocaXBXa OImW3GZdAKke7xYhvekDumQePwjFIk= X-Received: by 2002:a05:620a:480a:b0:8c9:f8e5:9f12 with SMTP id af79cd13be357-915a9e0a7c5mr25895485a.57.1780595887710; Thu, 04 Jun 2026 10:58:07 -0700 (PDT) Received: from server0 (c-68-48-65-54.hsd1.mi.comcast.net. [68.48.65.54]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9158a381abfsm650227285a.27.2026.06.04.10.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 10:58:07 -0700 (PDT) From: Michael Bommarito To: Marcelo Ricardo Leitner , Xin Long Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Vlad Yasevich , linux-sctp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net] sctp: fix uninit-value in __sctp_rcv_asconf_lookup() Date: Thu, 4 Jun 2026 13:58:03 -0400 Message-ID: <20260604175803.2142975-1-michael.bommarito@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" __sctp_rcv_asconf_lookup() in net/sctp/input.c only checks that the ASCONF chunk can hold the ADDIP header and a parameter header, then calls af->from_addr_param(), which reads the full address (16 bytes for IPv6) trusting the parameter's declared length. An unauthenticated peer can send a truncated trailing ASCONF chunk that declares an IPv6 address parameter but stops after the 4-byte parameter header; reached from the no-association lookup path, from_addr_param() then reads uninitialized bytes past the parameter. Impact: an unauthenticated SCTP peer makes the receive path read up to 16 bytes of uninitialized memory past a truncated ASCONF address parameter. The sibling __sctp_rcv_init_lookup() bounds parameters with sctp_walk_params(); this path open-codes the fetch and omits the bound. Verify the whole address parameter lies within the chunk before from_addr_param() reads it, the same class of fix as commit 51e5ad549c43 ("net: sctp: fix KMSAN uninit-value in sctp_inq_pop"). Fixes: df2185771439 ("[SCTP]: Update association lookup to look at ASCONF c= hunks as well") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Michael Bommarito --- net/sctp/input.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/sctp/input.c b/net/sctp/input.c --- a/net/sctp/input.c +++ b/net/sctp/input.c @@ -1196,6 +1196,7 @@ static struct sctp_association *__sctp_rcv_asconf_loo= kup( struct sctp_addip_chunk *asconf =3D (struct sctp_addip_chunk *)ch; struct sctp_af *af; union sctp_addr_param *param; union sctp_addr paddr; + __u16 plen; =20 if (ntohs(ch->length) < sizeof(*asconf) + sizeof(struct sctp_paramhdr)) return NULL; @@ -1204,6 +1205,16 @@ static struct sctp_association *__sctp_rcv_asconf_lo= okup( /* Skip over the ADDIP header and find the Address parameter */ param =3D (union sctp_addr_param *)(asconf + 1); =20 + /* The whole address parameter must lie within the chunk before + * af->from_addr_param() reads the variable-length address; otherwise a + * truncated trailing ASCONF chunk lets it read uninitialized bytes past + * the parameter. Mirror the bound sctp_walk_params() applies on the + * INIT path. + */ + plen =3D ntohs(param->p.length); + if (plen < sizeof(struct sctp_paramhdr) || + (u8 *)param + plen > (u8 *)ch + ntohs(ch->length)) + return NULL; + af =3D sctp_get_af_specific(param_type2af(param->p.type)); if (unlikely(!af)) return NULL;