Article View: linux.kernel.netdev
Article #24944[PATCH ipsec 0/4] xfrm: iptfs: fix use-after-free by held and queued packets
From: Juan Agustin Niccolini
Date: Tue, 01 Dec 2026 03:21
Date: Tue, 01 Dec 2026 03:21
49 lines
12756 bytes
12756 bytes
IP-TFS keeps packets for later on both sides: received packets in its
reorder window and reassembly buffer, and outgoing packets on its output
queue until the send timer fires. A kept packet points at its device,
and through its SA at its network namespace, without keeping either
alive. Each side can be left holding a freed object of each kind, which
gives four use-after-frees:
receive, namespace patch 1
receive, device patch 2
transmit, namespace patch 3
transmit, device patch 4
An unprivileged user can trigger all four from a user and network
namespace on any kernel with CONFIG_XFRM_IPTFS; no IPsec needs to be
configured, as the user creates the SA. The receive device bug gives an
addition of a chosen value at a chosen kernel address, enough to gain
root. On a configured IP-TFS gateway, the packets queued on transmit
are forwarded traffic, which any host can send without credentials.
Packets that arrive through a vti device also keep vti's tunnel pointer
in skb->cb while held; that is a separate bug in vti and is not
addressed here.
2/4 was discovered by LLM-based static analysis. 1/4 was discovered
while testing the patch for 2/4 on a KASAN build. The other two were
discovered by more thorough static analysis after that unexpected
discovery.
Reproducers: https://github.com/AgusNicco/iptfs-uafs
All 4 untrimmed KASAN reports are also in that repo.
Juan Agustin Niccolini (4):
xfrm: iptfs: free held packets on SA delete to fix a netns UAF
xfrm: iptfs: look up the device of held packets again to fix a UAF
xfrm: iptfs: free queued packets on SA delete to fix a netns UAF
xfrm: iptfs: don't keep the input device of queued packets to fix a
UAF
include/net/xfrm.h | 3 ++
net/xfrm/xfrm_iptfs.c | 83 ++++++++++++++++++++++++++++++++++++++++--
net/xfrm/xfrm_policy.c | 1 +
net/xfrm/xfrm_state.c | 3 ++
4 files changed, 87 insertions(+), 3 deletions(-)
base-commit: 1213df0bc5993e479706c5eba5830243d778f164
--
2.53.0
Technical Details
Message-ID:
<20261201032200.37030-1-juanagusnicco@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374675-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374675-linux-kernel-netdev=dewy.ru
From: juanagusnicco@gmail.com (Juan Agustin Niccolini)
Newsgroups: linux.kernel.netdev
Subject: [PATCH ipsec 0/4] xfrm: iptfs: fix use-after-free by held and queued packets
Date: Mon, 30 Nov 2026 22:21:56 -0500
Organization: Usenet Network
Message-ID: <20261201032200.37030-1-juanagusnicco@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1601757"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:F+ZsKupqt+NieXsBVmNe/0kvbBA= sha256:4cQXic0t4jDwyHrMf6lG6nPidAHZs634Sg1WGMiQXXc=
sha1:ZS3+RhLJcE0jRAdrm7U0WS+YCW0= sha256:iVB+tYIX3FRJ++kb9IuhdOP8TDZ8eMfS/rpug9jWYDA=
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 1C74E117225; Tue, 1 Dec 2026 06:22:26 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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.249,
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 SthxdczWmLcd;
Tue, 1 Dec 2026 06:22:22 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374675-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 27D93117222; Tue, 1 Dec 2026 06:22:12 +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 BADF22B849; Tue, 1 Dec 2026 03:22:08 +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=1796095328;
b=DK2OeAIkvv8S4feuzNopbJ1y/DmTy4j+IyYzG8NcvPxaNhV1GRKaW96XZP5ImQnaC4JF
bEU/PIZIaU+FtUWUSPmuxSgDT3xYyarDrkIvMxBpEswg9GruZW9q2SFQV+MaKH7xbX9tk
bWmOnzczf2U+hXJ87d6VSrfbJT6fLbopcAJFxcbDZ2RafKc5/eckIZO84Er4SrUCCLKaY
wMbSipr7ruOXU6naLShhOv0ABPX2uQ5PUUjlkhIuSIPvsMU3Yr6PegRc8amB3kkCsbe2U
MJrwNXJsgYymkob8NgTpqfWPzaYxof3svZs86G/1rhdAyI9bOxJY79LuNTrVJjmQhNg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796095328;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature: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=bUcXBPcM9zeNJqlLfJ8sfhAwh5M7CteRwHj6fhGMp9s=;
b=gst04xgLZDDlUQNQTmGn4lwgT/xbiqH+uSl2ZxpAeB8xcm6HyQMu7OQfS80AVFHcfV7c
JmXnzDRebUL5my5WIHsDXlVJzMVP80zbEO7r4A/RzYixdI9E3GGgeQR0vMQOvCNDESI+N
PHbM9DWk94QswnIMkVG6PQYGNcIG4aeTtnHwrrMt3JQ9dNMcIMqOZ3CiyP1bPCDc9uqPE
tEWkTsjcG7oD6CzsivoGNLuxB5l7TDIyeuvXzJudIYiD7KcEwT+NVN6K5VevUr0NixhBY
1guYXoD+CF4wj/BlSn4nAHN63dVd1nK9UHLdpfskMNVPogJDL7QT0yacckiP7o2VQkg==
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=20260707 header.b="Xy1GG/bW";
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 93598606A330;
Tue, 1 Dec 2026 03:22:08 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Xy1GG/bW
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.178
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796095327;
b=fkNuIvSvVxJs/uj/MHKd33bvny+am/9oWeo5O+D4NSf3Pl1cEwZC7ufN/rb8Ow22Msyn
/CeOltc0naX9GZKC2ND7E9clka2glsgt+6c8Yfq0Bgf6l59hs/mbxKBmZuibjTeYKXaIj
qDcGchT2L54x0Utr1owibzbvaeckISGlWsJBfW10bmXdAhZPKj8wM1xqyOe7pQo/aGuAP
BqUD0iSdhZBTXz4NHZ+eHSsuLfbze1hv5atXuO2ZKYDrctMd1j+hBcoPZD1Z3Ip+s25mG
jWdUGrGLQWPE62jyWQW2FtiQbdKR+PydbFCnqDIZwTD0NL/asgGtXBKwSHc6F1tnGRw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796095327;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
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=bUcXBPcM9zeNJqlLfJ8sfhAwh5M7CteRwHj6fhGMp9s=;
b=Cc/g4XLwt38xLT/tSmAGnhtoJSoWRZrd6lWqlNadKuMKBka75EQrIVC5G4YApD0ygn8o
DojqDtaZZq75pMbfMLQQNy//tWE1+x813FY+3645WB6O+w6qeh5u2tK6H81NCMgM3PkSX
4utoT68xOaV+VzFk9R3WUw670E8q6HyW7DLaQJLAZ94ku3B3LN5MNH57MIIAXH2cNaxyP
qI2wNF168ezolix4i4vYKy+a/my14kVKaf8OELo/oeEj59O8kdEdPqmka0NmvAeLVQ6by
B4zp3zTSBBNH3Feev/KPZZX4RsGoLjhIMDAzkSqiEmg7HqEVTjnZlyN4R9j0sHoFSCw==
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=20260707 header.b="Xy1GG/bW";
arc=none smtp.remote-ip=209.85.128.178
X-Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178])
(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 5DA00606A31A
for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 03:22:07 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5DA00606A31A
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-yw1-f178.google.com with SMTP id 00721157ae682-8b4d543b6b6so67344647b3.3
for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 19:22:07 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796095326; x=1796700126; 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=bUcXBPcM9zeNJqlLfJ8sfhAwh5M7CteRwHj6fhGMp9s=;
b=Xy1GG/bWOeBwc8D4f3dXTKKchFkP9eEdaaD78BOPZqHT73T7FKrchWEkk0be2o7MTa
4g9dc0tjMODg+DRRs2DCHOngxIUHxv5P8KvyH9eIbUusck9drvqFfmQ0/tQMvWaZHajH
jAiY0d+AmwpCiyPq9t7sY45BcychkaKfiXheOqh6moBPgV0tFrd+uCLg+dXBEscChyvr
RK2Yf8I+GB77KqNv8+xxVNjz7syPsWzNlv3MBSc7Cn9ST/v4w/HV04XYVxirI3k9M73f
VT7rFxcHB7bFeX+4vUyZalpFDqbi0WHiOMmLnHbnEpHrcAqcEC02syvDCGrtjBlmsyin
nJZw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796095326; x=1796700126;
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=bUcXBPcM9zeNJqlLfJ8sfhAwh5M7CteRwHj6fhGMp9s=;
b=wseyvUv3K4aKNlSIed2jpNOhuxak7saD1zhES3N2ShcVUhkMn8Plif3trXoR+m9pyf
HjrD6q32YSjM8gGR+UYFDjq8rEy/Uc8fQGydFQCZyxtwo/+LASKI8yuhbPoluXEvMGd5
WH8WMLPy/8wUPhct1jzoV0hZyduyJscfpXrnxjbPhQBBRpdlP1FENWS9mAbRAbQ7VR52
ZlGrtpir8qDLVLGklyc2orj6HvBqsgJY9hyQAOj2XbJVTFcJv1d6iJ4tH8Hh9eW8Ek5M
Tm7wmQDuPjg9AD8/0NEqT7eMSBSAKfB8WfXqIi/WK/NbZXsKbigsbdA4mp2uEoNGwqve
+03g==
X-Gm-Message-State: APuU4Z/a5EyujmEk14xcUDqIaRqelHgHgoVPQY3qajq+pnwRLBKj0jSB
DuLjKCfMpYr0LqFKXoN/m6+f5gRGaEmKePT4GaYHcZch3Fg5FPakUV49
X-Gm-Gg: AZFdTZeR/RsX7ENSXBuJeHjagyV/DeshrciBGkkCt56Uf16eWk+XT5brCzGhfBrLO/y
cOua5fvvtakdZnJbKVbeYknBbOVudc6+BucnMyanMSV+XuByqJAlmwhWgXzLwVgBe28103QVQKd
CNk0N7be72key7rrxaGZtVeswexSy5JzDA++KhyLt40dDv6D6HM50jf+lHCYJgt033FvK9n347u
9Q1TFuVtQOWsh+xgqp7gdZHqvN+UfQKK/P7VxtX3vMuSuUKa1V0y43X5uPzJjE1dy1gu+7y3e+K
TRUTCfGD8UNRgKzvujx91HCtmf594dkOD5IaA8z+l1yqnoNREa91Qs8UYY4lBZXzx8FYvlRpmdo
T9uNPu2S3tbAFjZodQDnErH6WvKhu7FCJ/3V0or9Ma87AVGhlr0Dt9Le/FzEFgKWaRdvw1DeDPj
yS7HLsnZJnXAWLhuP8+mQ60JIgJ5G4n34WfhE0iwk73Ius6MMLQ4Qkdz7VxAhkITwEeTyinJdFx
LFiQVD4mo0cOtVnzFZ+eq0qXKP1VVSnVvGXra3Cu37qytMJj9Ixd1AuVwaxPEIpkKUXoSUNCW7E
lSPO1yXsP4yoVd7m84ZDF+UTXovpb/2pJ7FfNpu3qDew5a9QDOhzVZldQ+xQAHwVT7Tigyt6cg=
=
X-Received: by 2002:a05:690c:9b09:b0:8b4:a39e:48a2 with SMTP id 00721157ae682-8b520436896mr142326637b3.21.1796095326339;
Mon, 30 Nov 2026 19:22:06 -0800 (PST)
X-Received: from VPN-156-19.vpn.usf.edu ([2607:fe50:0:f802::4046])
by smtp.gmail.com with ESMTPSA id 956f58d0204a3-67df30e4407sm16484916d50.0.2026.11.30.19.22.03
(version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
Mon, 30 Nov 2026 19:22:05 -0800 (PST)
X-Cc: netdev@vger.kernel.org,
ipsec@lists.linux.dev,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>,
Simon Horman <horms@kernel.org>,
Christian Hopps <chopps@labn.net>,
Antony Antony <antony.antony@secunet.com>,
Sabrina Dubroca <sd@queasysnail.net>,
Shaomin Chen <eeesssooo020@gmail.com>,
Roshan Kumar <roshaen09@gmail.com>
X-Mailer: git-send-email 2.53.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