๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14993

Re: [PATCH net RESEND] ieee802154: 6lowpan: validate fragment offset against datagram size

#14993
From: netdev-bot+sashiko
Date: Thu, 12 Nov 2026 09:05
122 lines
12550 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit message overstates the security impact and
  misstates the check it adds.

--

ieee802154: 6lowpan: validate fragment offset against datagram size

This commit adds a bounds check to lowpan_frag_queue() that rejects a
6LoWPAN fragment when its offset, or its offset plus length, goes past
the declared datagram size (d_size). The commit message says this stops
an attacker from forging another sender's data. It also compares the
bug to CVE-2019-8359 in Contiki-NG.

> fragment claiming to start far past the end of the datagram is
> accepted the same as a legitimate one, allowing an attacker to forge
> data of another sender.

[ ... ]

> The same class of bug was assigned CVE-2019-8359 (CVSS 9.8) in
> Contiki-NG's 6LoWPAN stack before a 2019 fix; RIOT-OS's implementation

[ ... ]

> Fix by rejecting any fragment whose offset, or offset plus length,
> falls outside [0, d_size).

[ ... ]

> diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c
> index ddb6a5817d098..905ba5f868442 100644
> --- a/net/ieee802154/6lowpan/reassembly.c
> +++ b/net/ieee802154/6lowpan/reassembly.c
> @@ -103,6 +103,9 @@ static int lowpan_frag_queue(struct lowpan_frag_queue *fq,
>  	offset = lowpan_802154_cb(skb)->d_offset << 3;
>  	end = lowpan_802154_cb(skb)->d_size;
>  
> +	if (offset > end || skb->len > end - offset)
> +		goto err;
> +

[Severity: Medium]
Does the commit message match what this check rejects and what it
protects against?

The check accepts offset + skb->len == end, which it has to for the
final fragment. It also accepts a zero-length FRAGN with offset ==
d_size. So the fragment end has a closed upper bound, not the
"[0, d_size)" range the message gives.

ip6_frag_queue() drops zero-length fragments:

	if (end == offset)
		goto discard_fq;

lowpan_frag_queue() still accepts them. They add nothing to fq->q.meat,
so they can't append any data.

About "allowing an attacker to forge data of another sender": the
message assumes the attacker can read d_tag, d_size and the addressing
in the clear. With that, can't the attacker still send an in-range
fragment at the next expected offset? For example, with d_size = 200:

  FRAG1 [0, 64)       legitimate, queued
  FRAGN [64, 136)     attacker, passes the new check
  FRAGN [64, 136)     legitimate, rejected as an overlap
  FRAGN [136, 200)    legitimate, completes the datagram

The attacker's fragment takes the append path in
inet_frag_queue_insert():

	else if (FRAG_CB(last)->ip_defrag_offset + last->len < end) {
		/* This is the common case: skb goes to the end. */
		/* Detect and discard overlaps. */
		if (offset < FRAG_CB(last)->ip_defrag_offset + last->len)
			return IPFRAG_OVERLAP;
		if (offset == FRAG_CB(last)->ip_defrag_offset + last->len)
			fragrun_append_to_last(q, skb);

The legitimate [64, 136) fragment then gets IPFRAG_OVERLAP and is freed
through goto err in lowpan_frag_queue(). The reassembled datagram ends
up holding the attacker's bytes.

Also, 802.15.4 has no source authentication without llsec, so an
attacker can just spoof a whole datagram. This bug doesn't really enable
forging another sender's data, and the patch doesn't prevent it.

About "The same class of bug was assigned CVE-2019-8359 (CVSS 9.8)": the
Contiki-NG bug was an out-of-bounds write into a fixed reassembly
buffer. Linux never copies payload to a computed offset.
inet_frag_reasm_finish() links the fragment skbs to the head:

				head->data_len += fp->len;
				head->len += fp->len;
				head->truesize += fp->truesize;

				*nextp = fp;

So before this patch, an out-of-range offset only changed the contents
of the reassembled payload. It never touched memory outside it. Could
the comparison and the 9.8 score come out of the message? They may
mislead stable and CVE triage.

The change itself looks like a reasonable integrity and robustness fix:
a reassembled datagram can no longer contain bytes past the declared
d_size. Could the message describe it that way, and give the fragment
end's upper bound as closed?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261109090226.799973-1-rc4d5a%40protonmail.com
Technical Details
Message-ID: <179447431152.2199510.14609873818368730049@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361626-linux-kernel-netdev=dewy.ru
References: <20261109090226.799973-1-rc4d5a@protonmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361626-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net RESEND] ieee802154: 6lowpan: validate fragment offset
 against datagram size
Date: Thu, 12 Nov 2026 09:05:11 +0000
Organization: Usenet Network
Message-ID: <179447431152.2199510.14609873818368730049@kernel.org>
References: <20261109090226.799973-1-rc4d5a@protonmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1050639"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:fSZKENCyoucrwPdthYM46AzrVJE= sha256:7tKptUzmVzMQf/9HE8G6xVA5TlnE6d5rFc8gOT+VZSI=
	sha1:IAH8UdR93DEBqAYEqHnq0DbZXVQ= sha256:7TX47Tf+uc61XoPzkGT1Jygq2wGCbBIDJnB8p6hX1do=
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 12D3511417F; Thu, 12 Nov 2026 12:34:38 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	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=kernel.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 sSPuaX6NOSec;
	Thu, 12 Nov 2026 12:34:34 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-361626-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 6542511417E; Thu, 12 Nov 2026 12:34:24 +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 8B2A1121124; Thu, 12 Nov 2026 09:06:16 +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=1794474319;
	b=vrvD1bhYDpo5TCbaTA6dF3JMVel/QuliipJVGGfKD8KF5m5YChU2KYotloM05/69zkhR
	 riD+KSiN4FWPptTgJLuPFN2p3krolF0V/bu3TLe+tbcingvIg7sqN0Hz8USSjMClIzHT9
	 FOzr5fEpHFvBYmkvCqOsjqtINtvxTOwv5MGyXCU67xttIR2S0cTSN1/k+jW1o4G46OMEe
	 JJbyrOnbmJkhQ7yPE9eDKhSc9YDmirWPwSn/MwSqmzfbDQuBhOrWdB4GzwNo/IlEj80J7
	 /6adiGybM1sh48XAIrJj99mCJ7UWFNch1721+Y2Np9iS498LK8tSiQNvoPHtKPQ4jKA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794474319;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=T6KbVd0311ptwDs/ZdF97Qisn+PkZ36G5vjlrqBZgxM=;
	b=p+0Da1GQF6UBh7iqMC+Q16IJjQKALv5GQuvRiguiHLtiRBqyZtne0vBrCqKGGuJakAgq
	 jBmrxg93ur39yLH9tg0xD+TjMeNKiD1z8NNbyWvUaZDriBod5+Wi5XFrCznIfVEBkZHkx
	 BxWsWYwj7+jL0fh9dtvmn0CB26nB3/9PKlpjioUP8oHjdWalznyN3ZcqhBDZ+1NsukZKB
	 5nQ1qnlQVO04ZF6BJgCt8angPbi/RYwLkSHpRwqcczSk6uCRob9VwLI6i0l7EX/eode1l
	 W40QUfcnhyDDcVi5rxcwH/iDtshBABmm5FEv4w1eTg3aR/O498eziDUZ+e5dI9sKU5A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ABn4BWQF;
	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 0725D606A887;
	Thu, 12 Nov 2026 09:05:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ABn4BWQF
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794474313;
	b=reG+ONmERaKbKJ3EA1+OERZZCx5qXFLTkR5VGZt+OeQ+qpEf5ExSiQEozfozwBgkCFxJ
	 vBmDwKP6V+d5t9H9/jhAJ7qj9UcQdppK7GcbjW48H2np67GeGoEYBpNgNs4i9SCpu86Ud
	 H7xEn1fwIDBx/aveff8jQsi0b+rScoJ3X2a389dF8pGz58BSrT/NGZnsBOY+Zlfuah7qA
	 8bHx2zEzln20dMKceFo78I3bQzgW8EcVrDT45i1B1pIylknKn9fCW/c1IzVhc/lULJ62K
	 qvZt7ODZz+QCQKSPQyTtWzC5SnQGnn6kqI1mT3qXjOTONmMaDUgXFz8sRv4zwagPVqg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794474313;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=T6KbVd0311ptwDs/ZdF97Qisn+PkZ36G5vjlrqBZgxM=;
	b=H99ACAb9/m60hgLGsYzjk/Dh7Jj4+0AVr85w7qyNTJ+MuU711cQ7tbhBnX26/A+goI6a
	 e18+T3P1gGMi0JcxjI/DNTUbFuPqQNmilxRAUwdmC2roJYJyCQZqKOqSlVzs0JE9y+jde
	 7WPjp+BHgQA8Bi1q5usJTau8LSeqPn2MvFvhohRMm8Je05Ywb0XyFDmnIPqZtbRCn9V7f
	 HUdcmtIhCkvAli2/G3Lg3fl3gqtoMWuQJnwNZcggcCQOHn1gjR7JhyxvGWkAQDaKMcC5r
	 ul5XkNv5HrU8R8KCC5Du7nM/QDWWkd7GP6zPz1yIAKKqakQxNjbGyMQAj1GcZN7ZTxQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ABn4BWQF;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(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 25003606A332;
	Thu, 12 Nov 2026 09:05:12 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1063C1F00A05;
	Thu, 12 Nov 2026 09:05:12 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794474312;
	bh=T6KbVd0311ptwDs/ZdF97Qisn+PkZ36G5vjlrqBZgxM=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=ABn4BWQFXYKuTtJUDBk+Zly3a0AlZbsm/RtBN8VHj6svE+fQFU7vXsRe/KduTtf93
	 rIcCiDlxV0F8t0erY3ETC3rtkhSRdZnUsEKVtwCKqdZVnxydr+a69qw4b63lC3mAQC
	 wr96Hl2V/0AU6jiYsD77OHXmvXV5qymBmMjA11FOlhk3BLlIZAih4efqU2IGmW7zfl
	 KuklxwuwjkFjf6O37TM9Kn4NrePDSPADEyDWw0F45lPkNShc6buOvx8E9YYm3P6rtM
	 AeyDqjrrMT27eDBiCskVnQFPLu9glY5X9md7DsLjAYJqmU9NnLgjqFzl2qg+qNXGg8
	 0AlNOrZvQH9ug==
X-Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org, alex.aring@gmail.com,
 stefan@datenfreihafen.org, miquel.raynal@bootlin.com, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <20261109090226.799973-1-rc4d5a@protonmail.com>
X-sashiko-severity: Medium
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