From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 582AF2D7DF1; Tue, 21 Jul 2026 22:57:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674654; cv=none; b=qSbPuNyYaaxb/2qGHPXOxxb1kIGCVSD+c+Pk8F1rD6hd7bgltGTI3fONGJWMZXKXZcojNBA2ZPcszqW2RhiLMVzBGj56vndUrwFjihVR8bYsVKI7oOwXww4nAzjud6kLaIT657W4Q63vo3GbXBhmSC2ZGqcxaMgx9O6a+8L0l/k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674654; c=relaxed/simple; bh=aSBMN97iIHlGQEaGhb8OoXqxu8obeJjA0jva2MglbjQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RQLp8NLazfPezKR6BmI/BeiRpWeuTsAkCXUAk2G9Gk4RB3FkmldP7fzRyQ9zyqzFSb4+tEF2SsdHDz1RUSzZmAKWKbj5bmP6UCHxS7RL177C/cCQ7C/b9VNT3YN9WezvKTiECfGfzddH8AlCYoB3sFKw26wrW1tSeciyz0zBN+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sq9aELKQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="sq9aELKQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE6661F00A3D; Tue, 21 Jul 2026 22:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784674653; bh=E1slzgY8Ib4HSZYMUstUxF5C8n/NLUAzE2P0G6/ZOx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sq9aELKQXV3FaLXUmTvCIAMpkskMR1zwkvu03RH921UZ9DfCDoamBOs0DiiV2GMZO rIkZW/aropR10xIjESQuuTYyRUXvaEHe/dRSsG40ZrsxWTEisKSIRx+A/iwbklEQcJ ttrSAfnkDvnojh9tJ7dgCeCs4zuyAxCXyxdSQDvY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Alexandru Hossu , Sasha Levin Subject: [PATCH 5.10 621/699] staging: rtl8723bs: fix WEP length underflow and OOB read in OnAuth() Date: Tue, 21 Jul 2026 17:26:20 +0200 Message-ID: <20260721152409.754775024@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexandru Hossu [ Upstream commit a1fc19d61f661d47204f095b593de507884849f7 ] OnAuth() has two bugs in the shared-key authentication path. When the Privacy bit is set, rtw_wep_decrypt() is called without verifying that the frame is long enough to contain a valid WEP IV and ICV. Inside rtw_wep_decrypt(), length is computed as: length = len - WLAN_HDR_A3_LEN - iv_len and then passed as (length - 4) to crc32_le(). If len is less than WLAN_HDR_A3_LEN + iv_len + icv_len (32 bytes), length - 4 is negative and, after the implicit cast to size_t, causes crc32_le() to read far beyond the frame buffer. Add a minimum length check before accessing the IV field and calling the decryption path. When processing a seq=3 response, rtw_get_ie() stores the Challenge Text IE length in ie_len, but the subsequent memcmp() always reads 128 bytes regardless of ie_len. IEEE 802.11 mandates a challenge text of exactly 128 bytes; reject any IE whose length field differs, matching the check already applied to OnAuthClient(). Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver") Cc: stable Signed-off-by: Alexandru Hossu Link: https://patch.msgid.link/20260522004605.1039209-1-hossu.alexandru@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -886,6 +886,9 @@ unsigned int OnAuth(struct adapter *pada DBG_871X("+OnAuth\n"); + if (len < WLAN_HDR_A3_LEN) + return _FAIL; + sa = GetAddr2Ptr(pframe); auth_mode = psecuritypriv->dot11AuthAlgrthm; @@ -897,6 +900,9 @@ unsigned int OnAuth(struct adapter *pada prxattrib->hdrlen = WLAN_HDR_A3_LEN; prxattrib->encrypt = _WEP40_; + if (len < WLAN_HDR_A3_LEN + 8) + return _FAIL; + iv = pframe+prxattrib->hdrlen; prxattrib->key_index = ((iv[3]>>6)&0x3); @@ -1014,7 +1020,7 @@ unsigned int OnAuth(struct adapter *pada p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_, _CHLGETXT_IE_, (int *)&ie_len, len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ - 4); - if (!p || ie_len <= 0) { + if (!p || ie_len != 128) { DBG_871X("auth rejected because challenge failure!(1)\n"); status = _STATS_CHALLENGE_FAIL_; goto auth_fail;