Article View: linux.kernel.netdev
Article #10872[PATCH net 10/13] netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport()
From: Pablo Neira Ayuso
Date: Wed, 04 Nov 2026 09:02
Date: Wed, 04 Nov 2026 09:02
52 lines
10544 bytes
10544 bytes
From: Joas Antonio dos Santos <joasantonio108@gmail.com>
ct_sip_parse_transport() compares the value of the "transport=" header
parameter against "TCP"/"UDP" with strncasecmp(..., 3), but it never
checks that the parsed value is at least 3 bytes long.
ct_sip_parse_param() returns matchlen = end - start, where end is the
next ';' or, when there is no ';', the end of the payload buffer
(limit = dptr + datalen). If the "transport=" value is only 1 or 2
bytes long and runs exactly to the end of the payload (e.g. a REGISTER
request whose Contact header ends in ";transport=T" with no trailing
CRLF), matchlen is less than 3 while strncasecmp() still reads up to 3
bytes, reading 1-2 bytes past the end of the linearized skb data.
Add a matchlen check before the comparison, mirroring the
sdp_media_type() pattern a few lines below, so short values cannot reach
strncasecmp().
The bug was found by LLM-assisted manual review of the SIP helper's
parsers and confirmed with a userspace ASan harness built from the
verbatim parser functions, which reports a heap-buffer-overflow read of
size 2 in strncasecmp() called from ct_sip_parse_transport().
Fixes: ea45f12a2766d ("[NETFILTER]: nf_conntrack_sip: parse SIP headers properly")
Link: https://patch.msgid.link/20260815133104.50369-1-joasantonio108@gmail.com/
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Assisted-by: Claude:claude-opus-5-5
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nf_conntrack_sip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 64bc440b1181..b05dc8858d09 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -701,9 +701,9 @@ static int ct_sip_parse_transport(struct nf_conn *ct, const char *dptr,
if (ct_sip_parse_param(ct, dptr, dataoff, datalen, "transport=",
&matchoff, &matchlen)) {
- if (!strncasecmp(dptr + matchoff, "TCP", strlen("TCP")))
+ if (matchlen >= 3 && !strncasecmp(dptr + matchoff, "TCP", 3))
*proto = IPPROTO_TCP;
- else if (!strncasecmp(dptr + matchoff, "UDP", strlen("UDP")))
+ else if (matchlen >= 3 && !strncasecmp(dptr + matchoff, "UDP", 3))
*proto = IPPROTO_UDP;
else
return 0;
--
2.47.3
Technical Details
Message-ID:
<20261104090224.750548-11-pablo@netfilter.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356305-linux-kernel-netdev=dewy.ruReferences:
<20261104090224.750548-1-pablo@netfilter.org>Show 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-356305-linux-kernel-netdev=dewy.ru From: pablo@netfilter.org (Pablo Neira Ayuso) Newsgroups: linux.kernel.netdev Subject: [PATCH net 10/13] netfilter: nf_conntrack_sip: fix OOB read in ct_sip_parse_transport() Date: Wed, 4 Nov 2026 10:02:21 +0100 Organization: Usenet Network Message-ID: <20261104090224.750548-11-pablo@netfilter.org> References: <20261104090224.750548-1-pablo@netfilter.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3358549"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:xnAQpGExjPaJXZ63x6clC4LNyT4= sha256:Fxh5KvASv5LxDwlE8UiuqCFCFsuGObwHeApzhcNBNYI= sha1:Ud+uG6Ua/rGBbTG8tDgE1yxuT8E= sha256:lZYPwmWInPpy4BcQLa0p5BnCChHaftydYtIN03T0+50= 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 64927112B4F; Wed, 4 Nov 2026 12:09:39 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 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, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=netfilter.org 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 xbLAN1tNgOtl; Wed, 4 Nov 2026 12:09:35 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-356305-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=netfilter.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 7C837112B4A; Wed, 4 Nov 2026 12:09:27 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 63D242C36F; Wed, 4 Nov 2026 09:03:00 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1793782969; b=4ckwa89xmS5FwnXB8AsUnEV2A/sWj5ngsFDAxm+yHEL6UWss8EUc9tkZy4WmqiVD/3wk qaOEPinvD0S0EjF8ScMAKPzmPmvmwe0koj3rvqWzgR0G6sm5Je+LySBt7ly2WZL8QZnZi QuVhjMKT0OhhgEmR2r6KuJgEQcLbU2YOEBr+8/PzmJ+nQlZrkJ9Dgr/bSokMnh8wtXcdp ifldLd5D88+9xNhzUNMIkzNrdxbHK6tC1htbfNc83JnX/8zUBVZcW1IOJGEaqGDJVlrwO JlRopIaSAkOhwLFaHg7vSST71TlifDpwpHC9PTW2HQOOO93tHmsGDOdpi6z0r5aG4Dw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793782969; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To: Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=FuJwpB61dP51oRlLlxUKS/oBV8WRen9wZFI8yNkRer0=; b=AoYwlgymbHzn141jkInJpILt9pB9bhsg/xDo/rhtrTP8OWlAtTWc6n7UTKKPm008S5n3 xDW4wcSMAd8PjW9p3xxYqEDs744aA2ZyACMMCjxM1xRpYgtQR6f0/5xow3EZBnVBKBXA+ ue3Eow8APf3ZVLwmzpZIHR+1L85mjZLkBuHs7HvRgEHSs6AUSz0HcL4okd0MMP4K9Lmb0 DcQ+EIe05yrPrBMQ02LVmhpvO/oNpU9sOJ5bShaPcsc+Fjjkp3e3Y60zUYkGJj+G7PCx4 hDOqYPgTwpksZCQXIWRBftc2HjeFXuDoTXXTgjdeYpYBjYcmEYpYNsicd3a3L4xjEuw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=dabTDRjB; dmarc=none header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; arc=fail 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 2084F606D831; Wed, 4 Nov 2026 09:02:49 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=dabTDRjB X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.70.190.124 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793782968; b=lgqAWcMB0s9pCNhfXdDr6tEN5rF3Z1SuX+IKuCHvQtYo3fh9d9pzSAfkH/Y90+FDs5FQ juvmMGgJ5UHYCzj6CBc1DURTy2+0RBwRE3sFPfBY+RIor83Rhl75Fzj/lWhi/bhqaVzUl bPOpGgxdl2PyKTFu+Q3Nv/lr6PsKO7gOnxiY7mEVeHxD+dDMv1IUo8ZYf4WD9dXVD55HC uQhnOdff7+NQPP3kKW64xJltZpFqqH6tuzY4aMPCsU009VqNomYTSAaeiXaosA3e2XsVG 7giYy6U/cmL9djM84cxz6/McN2BWZPEqzQma4jtwFh/6hz68YIlVNY+j0NuYHS9g4zg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793782968; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version; bh=FuJwpB61dP51oRlLlxUKS/oBV8WRen9wZFI8yNkRer0=; b=vkpBwKXsF0BnbNRQ97zN4mcckKYWA06+HE3iRUhfNlhUYnfjwXYDC2B4swbxP1d7+G+S TFRYAogiRf/g8UDJpyGwXRuItJdr+KeiX+bJ1nZoVCYYb0IDATd3wXnS9aGp25Q7+VNw3 0XcMR7UpgmXXo/4BwJ8AHJTc2X68lRatertelX/tn4hDgayferiFovkxZs5EpLX/19EgI vj3HX/EsjvoqhPTakQZzyTPOexXM4TZ+ue5kDa9duBqtnCeYhYlGlmVecJGq/76rAChPS 97EMfGzB1VdvhrYlcXaEJ/faSQKWYKLuRdGTNPWVKqIm4yJ/ngqzPRfq9MdUTSO3GNQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; dkim=pass header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=dabTDRjB; arc=none smtp.remote-ip=217.70.190.124 X-Received: from mail.netfilter.org (mail.netfilter.org [217.70.190.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6C39606D81F; Wed, 4 Nov 2026 09:02:47 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C6C39606D81F X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netfilter.org X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netfilter.org; s=2025; t=1793782966; bh=FuJwpB61dP51oRlLlxUKS/oBV8WRen9wZFI8yNkRer0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dabTDRjBK9iFxTLshFj42QBvFIhRE7HmwSJ+AdU3ZUCsWhvtY6FqIu+mLgA8PKvbS 5m4KzYOQs9gipBoIr8eJhY+qZkCeR4ejd6ghhFzto8sZ8ncdcby5srSYZdVLJB8YzR AqtSh3jWCnMRMVr+gXrcMC50rVF3VtnRRLT0jBqwPjzohX6mpYOpLH4uz5I0VbPiqK zyhOMlDOA/yh+E0LXrop5jy1eKUlTIbh2o7zokd80wT4GvrotyN6DSCI+1Fix0UTH2 8UXU3JgcvVgJLSUfZt73C+ItsZT3RgZgck5X6v1XUk9XTiCN5jBM/ITgZ6pU6wLKxc wWtisTPvyaB8w== X-Received: from localhost.localdomain (mail-agni [217.70.190.124]) by mail.netfilter.org (Postfix) with ESMTPSA id 93B5360085; Wed, 4 Nov 2026 10:02:45 +0100 (CET) X-Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org, horms@kernel.org, fw@strlen.de, ja@ssi.bg X-Mailer: git-send-email 2.47.3 X-In-Reply-To: <20261104090224.750548-1-pablo@netfilter.org> 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