From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 BAA4A4C6F02 for ; Thu, 4 Jun 2026 17:58:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780595890; cv=none; b=uqNwEtrg2quRz2ksGJkvcEO1pzUiAzDh/sOV40k0c3uE02WmQl0XKc/IYK0iChpCKmc4l1Ry9MB9PvqSy0A7+OExEcWs8KsAdygslfoZSusUzpw33SBfBvGSbNEjxyv/6tQ9+bwxTBo0pPTQiMXrtUn73LGaoKveB/6QqfYnGnI= 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.182 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-f182.google.com with SMTP id af79cd13be357-9156ceb55ffso89262385a.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=GojigLPrab5ezeTYEdz3fhUVhCXdrk+4OK0LhEdFH9iIgRVPosEayUpxnj8SRIfIIt ZAjgiDlA5iU7P2qeanTIOW7IlmTPXN1qS7NiaH1UPcyL5ukZK10I+tBexHXwd9MhPEvj qEDtCdgxUZkdGLes1iVS7V2c8d5B+/M8bZfiGXWbXu4nqc2mrXiKm+fTSOvfg6h4hwC9 pbZaukj4qS39EtEs6iWvsuC1a99sGJRHj5PqTY3d0D/tAaXbXvpZgiMEsv6XI19rkqZ3 I4dYAHYgob291hcar9161ifkErq3D8D2HkbcgVXKEYrLLBTRnztGGoZSBxjEU5EksVMi MdUA== X-Forwarded-Encrypted: i=1; AFNElJ9MiJGCC+ZXbYOnoIZLgXzo9+/0+PbtYFOiTGT4EPakCkegDmiUh7S7gLWrLZtOufc8ahnKKB8=@vger.kernel.org X-Gm-Message-State: AOJu0YyNV5bkkeph0yFM+SNu/10NZB5v3ssXHo8FNiMokoAqLTIhetms JvhfqynTbA+v+FYSdd1QXff0RmgrBe8sACA/Ly5i4oCu0z4VP603cJ3G X-Gm-Gg: Acq92OExyR/w+H89h7TYwsFroECC6ySt0ftyIEmMLI0/0S18XdurEoEkoqE4bzonwWU oTT0ZIgELs6O7SrmJ75LtPNcuEVIMrf0QTnRfFpq2pgLEE588Up3vaN00dMtDD0KbOnteRu3r4H I6jfkRsQwZVv+/ba2fPDD4SD7LbZQKuP6at2cxyo0cGkZW9shG85/MBaMAsH0vkJnyHwr8ldwOi j3CykCcIn6DFy9JNnZvfvLwFsfUQaNEoGb6mPv5mvCyLDLUsCpbzEdnauYvVglrf+7CJ1Gh5qI9 5houQRjEDGPuat8SE3UHC/j73Hnz0CDil9/Yvp4khh5CdXloM9g0FczmbndNAo6Qn4FD2i+PD1R Y4LNpe6xPqv1cKjTWwqkwwHVl0R6xeXNsY3OBhRy0O+eA3wHOhg4IcTxzlSKLQSJmOxQovEq9nR 8HBY/Aaazl3BGuN8KqDL5Gc1kH6SWHtBKaqeHtDhlBdyW72FIqUyKkU4tEjPZI31HD9+oVKUn6e RU6pxIXdBoY8TmBsj3SWrfvlxdKsOg= 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: netdev@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 --- 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_lookup( struct sctp_addip_chunk *asconf = (struct sctp_addip_chunk *)ch; struct sctp_af *af; union sctp_addr_param *param; union sctp_addr paddr; + __u16 plen; if (ntohs(ch->length) < sizeof(*asconf) + sizeof(struct sctp_paramhdr)) return NULL; @@ -1204,6 +1205,16 @@ 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. Mirror the bound sctp_walk_params() applies on the + * INIT path. + */ + plen = ntohs(param->p.length); + if (plen < sizeof(struct sctp_paramhdr) || + (u8 *)param + plen > (u8 *)ch + ntohs(ch->length)) + return NULL; + af = sctp_get_af_specific(param_type2af(param->p.type)); if (unlikely(!af)) return NULL;