Netdev List
 help / color / mirror / Atom feed
* [PATCH ipsec 0/4] xfrm: iptfs: fix use-after-free by held and queued packets
@ 2026-12-01  3:21 Juan Agustin Niccolini
  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
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Juan Agustin Niccolini @ 2026-12-01  3:21 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu, David S . Miller
  Cc: netdev, ipsec, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Willem de Bruijn, Simon Horman, Christian Hopps, Antony Antony,
	Sabrina Dubroca, Shaomin Chen, Roshan Kumar

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-01  3:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  3:21 [PATCH ipsec 0/4] xfrm: iptfs: fix use-after-free by held and queued packets Juan Agustin Niccolini
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox