From: Ido Schimmel <idosch@nvidia.com>
To: "Cen Zhang (Microsoft)" <cenzhang@linux.microsoft.com>
Cc: David Ahern <dsahern@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Ben Greear <greearb@candelatech.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, AutonomousCodeSecurity@microsoft.com,
tgopinath@linux.microsoft.com
Subject: Re: [PATCH net v2] ipv6: fix fib6 walker UAF on NLM_F_REPLACE
Date: Mon, 2 Nov 2026 09:33:47 +0200 [thread overview]
Message-ID: <20261102073347.GA765417@shredder> (raw)
In-Reply-To: <20261028160018.73299-1-cenzhang@linux.microsoft.com>
On Wed, Oct 28, 2026 at 12:00:18PM -0400, Cen Zhang (Microsoft) wrote:
> fib6_walker uses w->leaf to remember the next fib6_info to dump, so an
> RTM_GETROUTE dump can continue there on the next recvmsg(). This
> assumes that whoever removes a route from the tree also updates the
> walkers pointing at it. fib6_del_route() does: it moves w->leaf to
> the next route. The NLM_F_REPLACE branch of fib6_add_rt2node() does
> not: it removes the old route, fib6_add() frees it, and w->leaf keeps
> pointing at the freed object.
>
> The fn_sernum version check in fib6_dump_table() normally protects
> against resuming on a stale w->leaf, but it can be bypassed:
> ip6_link_failure() resets fn_sernum to -1 when the default route
> fails, which an unprivileged user in a user+net namespace can cause:
>
> 1) link failure fn_sernum = -1
> 2) dump pauses on route R
> 3) replace R fn_sernum changed, R freed
> 4) link failure fn_sernum = -1
> 5) dump resumes -1 == -1, reads freed R <- UAF
>
> BUG: KASAN: slab-use-after-free in rt6_fill_node+0x1c22/0x2cd0
> Read of size 4 at addr ff11000011fa0064 by task poc/101
> rt6_fill_node <- rt6_dump_route
>
> Fix by adjusting walkers separately for replacement and deletion.
> For replacement, add fib6_walkers_replace_leaf() points w->leaf
> at the new route. For deletion and ECMP sibling removal,
> fib6_walkers_skip_rt() calls fib6_walkers_replace_leaf() with the
> next route. Reset w->skip_in_node when updating w->leaf, and set
> w->state to FWS_U when no next route remains.
>
> Fixes: 4a287eba2de3 ("IPv6 routing, NLM_F_* flag support: REPLACE and EXCL flags support, warn about missing CREATE flag")
> Cc: AutonomousCodeSecurity@microsoft.com
> Signed-off-by: Cen Zhang (Microsoft) <cenzhang@linux.microsoft.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
next prev parent reply other threads:[~2026-11-02 7:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 16:00 Cen Zhang (Microsoft)
2026-11-02 7:33 ` Ido Schimmel [this message]
2026-11-02 10:00 ` patchwork-bot+netdevbpf
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=20261102073347.GA765417@shredder \
--to=idosch@nvidia.com \
--cc=AutonomousCodeSecurity@microsoft.com \
--cc=cenzhang@linux.microsoft.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=greearb@candelatech.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tgopinath@linux.microsoft.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
all inboxes | Powered by JetHome®