Article View: linux.kernel.netdev
Article #6555[PATCH] netfilter: nf_conntrack_h323: fix out-of-bounds read in get_bitmap()
From: Duc Anh Luu
Date: Thu, 22 Oct 2026 17:48
Date: Thu, 22 Oct 2026 17:48
63 lines
13375 bytes
13375 bytes
When get_bitmap() decodes a bitmap whose end falls on a byte boundary,
it reads one byte past the position that the caller's
nf_h323_error_boundary() check validated.
For a bitmap of b bits starting at bit offset bs->bit, let
l = bs->bit + b. The caller guards the call with
nf_h323_error_boundary(bs, 0, b), which reserves ceil(l / 8) bytes.
In the (l < 32) path get_bitmap() first consumes l >> 3 whole bytes in
the loop and then unconditionally reads one more byte:
if (l < 32) {
v |= (unsigned int)(*bs->cur) << shift;
...
When l is a multiple of 8 (l == 16 or l == 24), l >> 3 already equals
ceil(l / 8), so the loop has consumed every byte the boundary check
reserved and the extra read touches *bs->end -- one byte out of bounds.
The value read is shifted below the final mask (0xffffffff << (32 - b))
and discarded, so this is a pure over-read, but it still crosses the
boundary nf_h323_error_boundary() is meant to enforce.
The extra byte is only needed when the bitmap spills partial bits into
a further byte, i.e. when (l & 7) is non-zero; for a byte-aligned end
the loop has already read everything. Guard the read accordingly.
Both get_bitmap() call sites in decode_seq() (the field bitmap and the
extension bitmap) are affected, and the decoder runs on
attacker-supplied H.323/H.245/RAS payloads when the nf_conntrack_h323
helper is active.
Reachability and behavioural equivalence were verified with a userspace
libFuzzer/ASan harness driving the unmodified decoder against
exactly-sized buffers; the fix removes the over-read while producing
byte-identical decode output across the whole corpus.
This was found by incomplete-fix analysis -- reviewing the recent
out-of-bounds read fixes in this decoder (decode_choice(), decode_int(),
DecodeQ931()) for sibling sites of the same class. The code review and
harness work were LLM-assisted.
Fixes: ec8a8f3c31dd ("netfilter: nf_ct_h323: Extend nf_h323_error_boundary to work on bits as well")
Signed-off-by: Duc Anh Luu <luuducanh05051995@gmail.com>
---
net/netfilter/nf_conntrack_h323_asn1.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c
index 6830c9da3507..8c04925b7007 100644
--- a/net/netfilter/nf_conntrack_h323_asn1.c
+++ b/net/netfilter/nf_conntrack_h323_asn1.c
@@ -229,7 +229,8 @@ static unsigned int get_bitmap(struct bitstr *bs, unsigned int b)
v |= (unsigned int)(*bs->cur++) << shift;
if (l < 32) {
- v |= (unsigned int)(*bs->cur) << shift;
+ if (l & 7)
+ v |= (unsigned int)(*bs->cur) << shift;
v <<= bs->bit;
} else if (l > 32) {
v <<= bs->bit;
--
2.43.0
Technical Details
Message-ID:
<20261022174855.615855-1-luuducanh05051995@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350734-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350734-linux-kernel-netdev=dewy.ru
From: luuducanh05051995@gmail.com (Duc Anh Luu)
Newsgroups: linux.kernel.netdev
Subject: [PATCH] netfilter: nf_conntrack_h323: fix out-of-bounds read in get_bitmap()
Date: Fri, 23 Oct 2026 00:48:55 +0700
Organization: Usenet Network
Message-ID: <20261022174855.615855-1-luuducanh05051995@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="282257"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:dHNggUKr/0YZYNiVU3/oJk0yrPQ= sha256:xknZD/0PRm5DEyR2WNqci90J3plgqnAkPrkIp+UW+1Q=
sha1:n/qUxXpYVVZ+oiDTuVE6hS0NAH0= sha256:nuHrXVWzSLDkeBa0Od9S8dHAz+e8Vk2yKGKE5Tq77DY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 24910111324; Thu, 22 Oct 2026 20:49:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id uZzUeBaV9aKb;
Thu, 22 Oct 2026 20:49:29 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-350734-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
by mail.dewy.ru (Postfix) with ESMTPS id EB9F11112F7; Thu, 22 Oct 2026 20:49:20 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sin.lore.kernel.org (Postfix) with ESMTP id CFD7926003; Thu, 22 Oct 2026 17:49:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1792691354;
b=lQ0of0qEW8407//uHV6l3wqnxlXuUVjkr1OOJah0XwYp7wHoY+Ow2Ua3u0x29+3E2K7U
FzGd4HUhfIB9PKVOu9G8mSUzICbw6Ua/RrXZj2/KTQHhTGIQqKQ6ZVhPVHmohfTneO7x7
X7hX1wcR4EgkddmTDnVG4ZHEW/baH3wDQmT1fV5GXHkN7XRXN/99XENyTd/Y+ATe4hGal
h88Fr/IUsHhKL9fzMB3qUWildajY7PkCf3mx1ysMIdTnJoZfoUfoPd+D/tCA7TK61+ONg
Nk9D6O8uGDplYI+65CKfp8BEJLx5dbH2bh87vprw/OGn8E0QmTzzQ6LfP+IqP94jm5A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792691354;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=f0ZLBISeyce6U7/hTVm4ywHVaFNN2V0ZlhVxxqx6eaw=;
b=Z3F+TykRudD9AW3+PuOYtVa8vugPv4+7SD5vgn3D9FYmDF7YkM8RjqCxuTOfQT12vxpt
5O9yPX/bEsTHru6tmdmQxtIFpzpLPE0meKaIJRP9OvB8uuJYvF/RV03VWYzOnOz+Eo2PF
M5ea/2a9eXoY37EwSjxS1ZvMpukvHhp30KgmqQ6wYWtL2HKqm+H6JEcpflK+2jvJyHSpQ
AGVo2N3c2I3/BcbQ9s4sOJu2uP8FTIJ+YLyS8spHuiM/3NTGZpm6xTFuRdGe0J7qRwwNZ
7bISFdZJRB0L2mpvq4DRPCHnmKR1XW56gGsH8fvn2fBnwRr3fxcklEXu/FJSmuHprZA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=BzfT9vcQ;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 70354606A32C;
Thu, 22 Oct 2026 17:49:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=BzfT9vcQ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792691353;
b=BqmY+x1SMuOXGYgvLJgIkra5Wy1qiuJS/DT/bTX7jE/X7ZtXcQtN5DDb4Ipu2QE1u7+7
tADAUhJW2D6N+PCDk+sClPnyOucIixfXRlaSzN6lue8Y3hTxzRXMlaZ7e2nK7dRrb/0NL
T78qafL70jmmYcrAbvnuIGB9q4HBW3V+vLitlxvrnXEfGdAgfgKzwagF3Jdd1hALFmEPy
+opgAb/voqeGi7/CHeoTmxTYQeuxD1ZjPbMWmkDZnSVnS0Ifa+gcIAcrexp9I7lun4Ydj
OfK1u1kl3swTiy6mkl/o2wJFhqjBS/MreIqTBKJC1ELaty9bkQWkkAsk2F7uIVAFMGQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792691353;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
Content-Transfer-Encoding;
bh=f0ZLBISeyce6U7/hTVm4ywHVaFNN2V0ZlhVxxqx6eaw=;
b=TusR5trwuDAMte8biFWQDWDLAWekYzICrHsWgKk7dsL4OcRdXyDNJ1jh8OaUvy8xzDec
dJjE0Ed71z3daIbOBj+qHayBCWqu2zO9A1HY51v/AwFcTz3iRIr8gLoCgR1Qwdj/8x3YC
EClWIcmDhYAx7VsrszuIQ+9AVWItR9ub8uhKdWr+zBX1g9qr1mWmk0QQZWUo7Ql/GqtM7
JBfvL16ucrxvO3nqxceIDksxr/KXTnyGDcPk8VjKN6wHjdj/P/MgB5B0JqoxxOAm6GYRI
UYNqqPXOWxCLolE+eK0DfE61bfAjlTBhnuTojuRslv62DZ604SejvvvlAl9unLvA8CA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=BzfT9vcQ;
arc=none smtp.remote-ip=209.85.214.172
X-Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44FF8606A322
for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 17:49:13 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 44FF8606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2ea759cc9b6so3105ad.3
for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 10:49:13 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792691353; x=1793296153; 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:content-type;
bh=f0ZLBISeyce6U7/hTVm4ywHVaFNN2V0ZlhVxxqx6eaw=;
b=BzfT9vcQo0dX9K6hykJfFHWOLKclttgOrxAGaeJvwHPh40AsSaB2+B6F9Pxqkm7hb8
YF/EKuS3WzwcPYEUI8mQTzKQe57H7DY2pRVx9fKu2nFT96xhQgLhXITu7gs0lhAsElfh
uATNeLWjFzfIEHZiN6z89LhNyNM39SBZCGe3mpU2mHEuJBeqdt5Q6CWVotqLk2Sdyw29
o6+Vuz73ku9T1FK0v1w02r2HKp5n2hEk0T404r5gRbt4CykpuinAHNPT1HaWYCjfO8OT
LTLvQHdDMTG30GSCGhC2peA8PWMd3dWf4DPJopyezHSD4rzWwsCcE4QjbbcwLTWAnQfe
eHOg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792691353; x=1793296153;
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:content-type;
bh=f0ZLBISeyce6U7/hTVm4ywHVaFNN2V0ZlhVxxqx6eaw=;
b=kqDUqUkeNbFgqRosLyLWDvaJXpaUEgd5oSBeWR4fhRhSr8wE2acLV+tAPSp68yxsg3
1+SWmrpTsfhQjFQ0SPxvHjtmdMSk73wbjkzSeQ5cNlloKHMtNKVcg/uXUzr1mB7+AJ+O
DSROks8Bfu0MuxYuX9XiKmT6bKSY+41rJNIUkEJeRUavpw39ni865PWZ1UdjS2MJPzG7
e/8dEsJa6Ks/A7HDopqH6Rs3XUB4uuBcKXgn76BvSkLPnMkChI7cPHzN9LTeVxQzsvLD
LEzDgHklSXAhO49H9t6t/7oZ3anPogaSCi+H/HTP5jEpFtSNWYIgRN7qp1nVhQh8sw0n
phuw==
X-Forwarded-Encrypted: i=1; AKwUvBxLpNl2lqLY01N/mpNZeeOQKADlkLYf+b/MRddWQMoixLN+SWigsThdILgSZon2eBm3c3vumpM=@vger.kernel.org
X-Gm-Message-State: AFq9FYIS0GcsQIdind4HC7LA5RcUdZPggxsRU0Z9saygIyX6p++sjY2P
6LcBOqry9Kz78F9WEnOCblflftI0E6xMpV4lYWoNzTdSO0Bawo6oeZJE
X-Gm-Gg: AYBFou1UlPuFvaZYmsbpi2Nvexg+zMAbZAFl7Y6VFsAzkUmAW591FWnLQSFPq7SSE7Y
Ekdf6Tt7gVXUl9N2Aupf1j6isYJh2+PQFDrIV7uhlMFgzF+U+ng3+kVPJQw9U2F/amCz278Q6Rn
NqcDntzIVe8TJR3MqyW+vaYelhyWmPBm4FVxeOg7OhAd1EPs+71z54+X8Fryx6UdarFFOWctW+3
Fwa8XUp43SMGoS3+8Vq2S+o9AO/7no2wxg2/ufVyAwX8oA8zEEEWTb7TQnZqXoUXyKtPMk1LBuG
OGMGOuz3er4x/7BiZJU/Rx0QO75MfqDXsalj+73M23R6u1wqWDP7qU7KOYu9gyTztOG4WafgbVs
fBK9Qek7e5OrVmdGcD75tPTKBTLrSUL0VriEaNEZ6Mi2O0iJibl+B08pa96yXgZfQWc7+cq+mAI
D+6C7BcPZ3MxB+db2cT10mV5u0wG28K3MqIVWGIQ2A9OoO7gikjoCzMs/KOSl7kldMAjNAivXaG
ng/m8rtOvGtaQn0W3QClZoRfOcRPGCx2/SnNxqbfmukGf4xDnjrE47sayfphBu6xTQABgqJzL2k
erJCTZoItNoWvZffZIp+sN9i7YWSQ6QXlEndNZbpixC0em7gu0c4OQUhhYhKNvBsjM+GRSPhLG8
kkgRZSw3GfAI=
X-Received: by 2002:a17:903:2f8f:b0:2db:733c:fd1f with SMTP id d9443c01a7336-2ea7c169201mr1589395ad.8.1792691352522;
Thu, 22 Oct 2026 10:49:12 -0700 (PDT)
X-Received: from test.. ([118.68.116.19])
by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ea7af67e12sm1722565ad.10.2026.10.22.10.49.09
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 22 Oct 2026 10:49:12 -0700 (PDT)
X-Cc: netfilter-devel@vger.kernel.org,
phil@nwl.cc,
coreteam@netfilter.org,
eric.sesterhenn@x41-dsec.de,
netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Duc Anh Luu <luuducanh05051995@gmail.com>
X-Mailer: git-send-email 2.43.0
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list