NetBSD Problem Report #60485
From www@netbsd.org Thu Jul 23 17:13:50 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "YR2" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 233041A923B
for <gnats-bugs@gnats.NetBSD.org>; Thu, 23 Jul 2026 17:13:50 +0000 (UTC)
Message-Id: <20260723171348.F14C91A923C@mollari.NetBSD.org>
Date: Thu, 23 Jul 2026 17:13:48 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: pf(4): uaf in fragment reassembly
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>
>Number: 60485
>Category: kern
>Synopsis: pf(4): uaf in fragment reassembly
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: pending-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jul 23 17:15:00 +0000 2026
>Closed-Date:
>Last-Modified: Sun Aug 02 13:30:02 +0000 2026
>Originator: Taylor R Campbell
>Release: current, 11, 10, 9, ...
>Organization:
The UafPF Foundation, Inc.
>Environment:
>Description:
pf(4) fragment reassembly may lead to use-after-free of a pf
mbuf tag.
5759 if ((pf_mtag = pf_get_mtag(m)) == NULL) {
...
5762 return (PF_DROP);
5763 }
...
5771 /* We do IP header normalization and packet reassembly here */
5772 if (pf_normalize_ip(m0, dir, kif, &reason, &pd) != PF_PASS) {
5773 action = PF_DROP;
5774 goto done;
5775 }
5776 m = *m0; /* pf_normalize messes with m0 */
...
5969 pf_mtag->flags |= PF_TAG_TRANSLATE_LOCALHOST;
https://nxr.netbsd.org/xref/src/sys/dist/pf/net/pf.c?r=1.87#5758
pf_normalize_ip can change the identity of *m0, so the pf_mtag
previously obtained from m may have been freed.
Forwarded to us by Chris Jarrett-Davies <chrisjd@openai.com>.
>How-To-Repeat:
1. configure pf to reassemble fragments
2. send fragments
(turn on asan or whatever to actually detect it)
>Fix:
Re-acquire pf_mtag from the replacement mbuf.
>Release-Note:
>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60485 CVS commit: src/sys/dist/pf/net
Date: Thu, 23 Jul 2026 17:17:10 +0000
Module Name: src
Committed By: riastradh
Date: Thu Jul 23 17:17:10 UTC 2026
Modified Files:
src/sys/dist/pf/net: pf.c
Log Message:
pf(4): Avoid UAF of pf mbuf tag in fragment reassembly.
PR kern/60485: pf(4): uaf in fragment reassembly
To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/dist/pf/net/pf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 23 Jul 2026 21:04:07 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-11, pullup-10, pullup-9
(and maybe we should just delete pf, I'm sure this is not the only
remotely triggerable issue in our ancient version of it)
State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sat, 25 Jul 2026 19:48:48 +0000
State-Changed-Why:
pullup-11 #398 https://releng.netbsd.org/cgi-bin/req-11.cgi?show=398
pullup-10 #1318 https://releng.netbsd.org/cgi-bin/req-10.cgi?show=1318
pullup-9 #2040 https://releng.netbsd.org/cgi-bin/req-9.cgi?show=2040
From: "Stephen Borrill" <sborrill@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60485 CVS commit: [netbsd-9] src/sys/dist/pf/net
Date: Tue, 28 Jul 2026 11:27:28 +0000
Module Name: src
Committed By: sborrill
Date: Tue Jul 28 11:27:28 UTC 2026
Modified Files:
src/sys/dist/pf/net [netbsd-9]: pf.c
Log Message:
Pull up the following revisions(s) (requested by riastradh in ticket #2040):
sys/dist/pf/net/pf.c: revision 1.88
pf: Fix use-after-free in fragment reassembly.
PR kern/60485: pf(4): uaf in fragment reassembly
To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.83.4.1 src/sys/dist/pf/net/pf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Stephen Borrill" <sborrill@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60485 CVS commit: [netbsd-10] src/sys/dist/pf/net
Date: Tue, 28 Jul 2026 13:39:25 +0000
Module Name: src
Committed By: sborrill
Date: Tue Jul 28 13:39:25 UTC 2026
Modified Files:
src/sys/dist/pf/net [netbsd-10]: pf.c
Log Message:
Pull up the following revisions(s) (requested by riastradh in ticket #1318):
sys/dist/pf/net/pf.c: revision 1.88
pf: Fix use-after-free in fragment reassembly.
PR kern/60485: pf(4): uaf in fragment reassembly
To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.87.2.1 src/sys/dist/pf/net/pf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60485 CVS commit: [netbsd-11] src/sys/dist/pf/net
Date: Sun, 2 Aug 2026 13:26:25 +0000
Module Name: src
Committed By: martin
Date: Sun Aug 2 13:26:25 UTC 2026
Modified Files:
src/sys/dist/pf/net [netbsd-11]: pf.c
Log Message:
Pull up following revision(s) (requested by riastradh in ticket #398):
sys/dist/pf/net/pf.c: revision 1.88
pf(4): Avoid UAF of pf mbuf tag in fragment reassembly.
PR kern/60485: pf(4): uaf in fragment reassembly
To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.87.10.1 src/sys/dist/pf/net/pf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.