Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 195012737E3; Mon, 23 Mar 2026 14:48:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774277316; cv=none; b=kHAps/Afzngd483wm2c1MWT45NVbOFdacV8pisy06zSLdolV5dpAvHbq90JA20mFr/+ubCGBGhq40Q6Gdbc4vJ0J7J2sZBpVyGUYgbAWNWwOr95HzYrA9BmW/LuAhBi7VAP1KmTfWdQgJC50Q20Xu73qKJzqk0MZzM7QMe3HcVw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774277316; c=relaxed/simple; bh=m9pdqQa8d0Z8BEeVTqJAMStmaGGLIuz7UvJnjSaSUq4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gCs4nE2Msbq4dflHM8+St2OSexWr51SBFLAFgQEMUeKNV73K2bL53P5XJm9yMWmAhV5arDv7MQcb8s8mpAgFjxRmPWm3V6mwmNYkDtREFTq0JEB/fa5khxtK7za4fUAoj1N8oCLUonavK0UbsYc/iVZCSrE1OVHSy3XMqLUlj+o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fuxWAHHo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fuxWAHHo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7014CC2BCB1; Mon, 23 Mar 2026 14:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774277315; bh=m9pdqQa8d0Z8BEeVTqJAMStmaGGLIuz7UvJnjSaSUq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fuxWAHHobChnGtCj29euhySs46ONNsmT+0GnzoiSMe55MN1h7x1y+3C9TofH6xKK+ i49YoEShUfEe0VH7Ls17qRhhbcQwPdpg7Qu8hrCMFWx25GHu+QPBUNAZuSdhmwv+kJ 9KbAsrSwZZlDMNOWLXEy33elM5gqAv+OWFcxjJ8c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Klaudia Kloc , =?UTF-8?q?Dawid=20Moczad=C5=82o?= , Jenny Guanni Qu , Florian Westphal , Sasha Levin Subject: [PATCH 6.12 395/460] netfilter: nf_conntrack_h323: fix OOB read in decode_int() CONS case Date: Mon, 23 Mar 2026 14:46:31 +0100 Message-ID: <20260323134536.274931747@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134526.647552166@linuxfoundation.org> References: <20260323134526.647552166@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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jenny Guanni Qu [ Upstream commit 1e3a3593162c96e8a8de48b1e14f60c3b57fca8a ] In decode_int(), the CONS case calls get_bits(bs, 2) to read a length value, then calls get_uint(bs, len) without checking that len bytes remain in the buffer. The existing boundary check only validates the 2 bits for get_bits(), not the subsequent 1-4 bytes that get_uint() reads. This allows a malformed H.323/RAS packet to cause a 1-4 byte slab-out-of-bounds read. Add a boundary check for len bytes after get_bits() and before get_uint(). Fixes: 5e35941d9901 ("[NETFILTER]: Add H.323 conntrack/NAT helper") Reported-by: Klaudia Kloc Reported-by: Dawid Moczadło Signed-off-by: Jenny Guanni Qu Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/netfilter/nf_conntrack_h323_asn1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c index 62aa22a078769..c972e9488e16f 100644 --- a/net/netfilter/nf_conntrack_h323_asn1.c +++ b/net/netfilter/nf_conntrack_h323_asn1.c @@ -331,6 +331,8 @@ static int decode_int(struct bitstr *bs, const struct field_t *f, if (nf_h323_error_boundary(bs, 0, 2)) return H323_ERROR_BOUND; len = get_bits(bs, 2) + 1; + if (nf_h323_error_boundary(bs, len, 0)) + return H323_ERROR_BOUND; BYTE_ALIGN(bs); if (base && (f->attr & DECODE)) { /* timeToLive */ unsigned int v = get_uint(bs, len) + f->lb; -- 2.51.0