Netdev List
 help / color / mirror / Atom feed
From: Juan Agustin Niccolini <juanagusnicco@gmail.com>
To: Steffen Klassert <steffen.klassert@secunet.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>
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>
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	[thread overview]
Message-ID: <20261201032200.37030-1-juanagusnicco@gmail.com> (raw)

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


             reply	other threads:[~2026-12-01  3:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  3:21 Juan Agustin Niccolini [this message]
2026-12-01  3:21 ` [PATCH ipsec 1/4] xfrm: iptfs: free held packets on SA delete to fix a netns UAF Juan Agustin Niccolini
2026-12-01  3:21 ` [PATCH ipsec 2/4] xfrm: iptfs: look up the device of held packets again to fix a UAF Juan Agustin Niccolini
2026-12-01  3:21 ` [PATCH ipsec 3/4] xfrm: iptfs: free queued packets on SA delete to fix a netns UAF Juan Agustin Niccolini
2026-12-01  3:22 ` [PATCH ipsec 4/4] xfrm: iptfs: don't keep the input device of queued packets to fix a UAF Juan Agustin Niccolini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201032200.37030-1-juanagusnicco@gmail.com \
    --to=juanagusnicco@gmail.com \
    --cc=antony.antony@secunet.com \
    --cc=chopps@labn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eeesssooo020@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@kernel.org \
    --cc=ipsec@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=roshaen09@gmail.com \
    --cc=sd@queasysnail.net \
    --cc=steffen.klassert@secunet.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox