From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.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 11CB5378813 for ; Mon, 8 Jun 2026 12:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780921362; cv=none; b=h/0dG5np1zLUhk9+8GVpGLJ0o4MjoiBB+uWtoxA9Nx9zZt+LFJIFjgGADmraEUtDecS6IGtaoW3B9KOoOKLK8qpVQ704Xq03nl7cIu8z+mQuGmp2VYN1DUBFMEg06pSFR8v1hxY9DxaFN/xCPm0M4JhfyjGf2t20cgyetse+Lo8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780921362; c=relaxed/simple; bh=Dv4CwM9ZJOk/ZPx0EzS3EGyLNfcz1WIk/MBj+Uewcho=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=PymKfmUZrwgfHKKykuD+lU5y0z86arWrfS1ZjHMltzcXkZyiL1Y5Ao6MrUxeXJWm9NkRK878hXNjOVY+tVlBwWB+CAiZuxtSx+koLLaULC40hf1dBnjObou6zTsg4AWELrgqToGWOqno/HBj8QN1vYzRmVnFafcjA2kVKsnPYCs= 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=lL68/l1X; arc=none smtp.client-ip=209.85.222.169 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="lL68/l1X" Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-9157b94a07aso521975385a.0 for ; Mon, 08 Jun 2026 05:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780921360; x=1781526160; 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=MSD/IG5I8Kz7SKo3TgnNWdd+GMqLGnCV42fz5tyyscg=; b=lL68/l1XTnja/AgP3x2Aox8rkZ7AYsxizYpNNRhDz6wP1f6gYXWytuBr3ROgXWo9uu SHxqel6LVR5RhfLZgB1g+alZu5RbwSGPd5n17tnt8QuSULg5z0Sfis17BwV1aFqoq9gV rKK8R69Ws494gHx0+SL2fi7vpVeCnMNB5iqHQn1to051drjbaSvUXGs8BfVT/D0mUYBn /Zu2+Cjwg7cxnWnI5HPmnUgyyXAYDBCykEaWQgZUs28pUWbJVOPO7mes593KQd+TQ2nV 2hy1IzrRLEGsaVuf3+gWdf5r/5b8LFyWFcbBNqpryhQT4QIDi53NjbojCfzJchbpWvTE WT7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780921360; x=1781526160; 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=MSD/IG5I8Kz7SKo3TgnNWdd+GMqLGnCV42fz5tyyscg=; b=nlPA/SAkMtnGb/ac9fUru9fpBnbAvo7pMAXmsODYM/y6t4gD0KKlnNDe4iPoLPaeVU 3CGtBjASd5KVWfrHIjqgKMtvWBIceGnOaeaF+BysxULc79CcaUgJ79OWxtQI5/EXTq7S wGTaUKGPg65Fs/pAiZvBDUxzNqrQYXv2oUK5WaAlD0QUAOrFEDGkhLepQ9ET3xLoxRKm XQcjKDfPWWjWfw6dtGiVg7yAHo7A7ebvnoHx5PDqPsU0rOE2/4KraqMSz1l0F4vP5/W/ bc93lWarUX+5zxsCrXU+0s4EFKXV59apLMpsM1VR+r/Seiy51TfLioU6pG1XyBDESngM kYOw== X-Forwarded-Encrypted: i=1; AFNElJ+n4VgQWNosSc6j6XIFdXAa8L8z8rB3+pNX/wIYlO0shOdH+bYczvelul+iG0vRfYJAsRdlvCCICx7ViiA=@vger.kernel.org X-Gm-Message-State: AOJu0YyMQbBLH0j0+Mv3W0WHI/yco454S7WT1amDAp4ScE4miQDD1ZDa qDlsgZD378G8hCH0FiJnqqIfij8G9dDInIA7nktPZdSltwc2ojPG6pNl X-Gm-Gg: Acq92OG0wIbZCnL4W07o/c7zpAJ0WcVUynxnfvNGo+sBSs/A5IevximhRLqbIn3X3dl emZlV5LiAiD9Ba3jpNibhIGEVcCBVmwUivQ/AxX6LNoMgip2n01TtEHSUs7EPA7MfPaVTz7m2y/ muI1PyP6+TjW/hnnfAA/kclHAhNbcfRVL0aYyDwcKsUIWVG3Uo3qN5f/cBXY+DhMabrE188rxGL jYZhTzPgpJDK5jE3YUFnUBiy6zx8AEbemk54YwyIyQaH7h1i+shc4mXy0C6os6AhVD5Y0qGgfJ1 XHpe1l+k+vLy0cq42TbfS1NnSTrmIpv2Nk5iRb9kXFAxGjSv97ccL6T9fkJZ6eNINC4JnpwmXc6 t0DkhBoHx47XchYhVLLMBzG3WgOU3Cq9XR/1H8+lHtnrSn4uPiDK9wAd8w+KFbzWKcvuduKzIIs wuBjM5pEl3bX33m4eoOHiFebnIeWEdjPoyP3EEIDXummXqiMJNDSIbc9reu43eEHXb1HjEOK+dT xf37WhXVoTa0UMPl+KkvDTVdh8FgL0= X-Received: by 2002:a05:620a:28c5:b0:914:cf92:46fb with SMTP id af79cd13be357-915a9d8894amr2422734485a.32.1780921359977; Mon, 08 Jun 2026 05:22:39 -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-9158a381febsm1691715685a.23.2026.06.08.05.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 05:22:39 -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 v3] sctp: fix uninit-value in __sctp_rcv_asconf_lookup() Date: Mon, 8 Jun 2026 08:22:34 -0400 Message-ID: <20260608122234.459098-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: 7bit __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 chunks as well") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Michael Bommarito --- v3: - Simplify to a single bounds check that the whole address parameter fits in the chunk, written as an addition to avoid unsigned wrap (David Laight); drop the redundant lower-bound test and the param_space/plen locals (Xin Long). v2: - Regenerate from net/main so the patch has index lines and applies cleanly (Xin Long). - Use unsigned int for the decoded length and compare it against the remaining parameter space after the ADDIP header (David Laight). v2: https://lore.kernel.org/all/20260606183821.1688525-1-michael.bommarito@gmail.com/ v1: https://lore.kernel.org/all/20260604175803.2142975-1-michael.bommarito@gmail.com/ net/sctp/input.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/sctp/input.c b/net/sctp/input.c index e119e460ccde0..864741fae4187 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c @@ -1204,6 +1204,14 @@ static struct sctp_association *__sctp_rcv_asconf_lookup( /* Skip over the ADDIP header and find the Address parameter */ param = (union sctp_addr_param *)(asconf + 1); + /* 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. + */ + if (sizeof(*asconf) + ntohs(param->p.length) > ntohs(ch->length)) + return NULL; + af = sctp_get_af_specific(param_type2af(param->p.type)); if (unlikely(!af)) return NULL; base-commit: 9988931df99cf5d68af360e1f23b9c674a0b1b4f -- 2.53.0