From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.178 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== 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== 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 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 ; Tue, 1 Dec 2026 03:22:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5DA00606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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 Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-8b4d543b6b6so67344647b3.3 for ; Mon, 30 Nov 2026 19:22:07 -0800 (PST) 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) 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) From: Juan Agustin Niccolini To: Steffen Klassert , Herbert Xu , "David S . Miller" Cc: netdev@vger.kernel.org, ipsec@lists.linux.dev, Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , Christian Hopps , Antony Antony , Sabrina Dubroca , Shaomin Chen , Roshan Kumar 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 Message-ID: <20261201032200.37030-1-juanagusnicco@gmail.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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