* [PATCH net] ip6mr: prevent info-leak in ip6mr_cache_report()
@ 2026-11-12 4:24 Henry Martin
2026-11-12 4:31 ` netdev-bot+sinfo
2026-11-16 16:40 ` Ido Schimmel
0 siblings, 2 replies; 3+ messages in thread
From: Henry Martin @ 2026-11-12 4:24 UTC (permalink / raw)
To: David Ahern, Ido Schimmel, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman
Cc: netdev, linux-kernel, Henry Martin, stable
The non-WHOLEPKT branch copies the IPv6 header at offset 0 and then
appends 40 bytes with skb_put(), but the mrt6msg is written at offset 0
after skb_reset_transport_header(), so the appended 40 bytes are never
initialized. They hold stale heap contents.
The report is queued to the mroute6 socket and copied into the
IP6MRA_CREPORT_PKT netlink attribute, disclosing the stale bytes to
user space. The stale bytes can contain kernel heap and image
pointers, and the report is reachable from an unprivileged user
namespace (MRT6_INIT in a new netns, plus the non-root
RTNLGRP_IPV6_MROUTE_R group).
Use skb_put_zero() instead, as the IPv4 code does since
commit 4f34002e2e376 ("ipmr: prevent info-leak in pmr_cache_report()").
This issue was discovered by Tencent CodeBuddy Security.
Fixes: 7bc570c8b4f75 ("[IPV6] MROUTE: Support multicast forwarding.")
Cc: stable@vger.kernel.org
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
---
net/ipv6/ip6mr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index dd0638d3c3f95..b7ae220d6b21d 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1154,7 +1154,7 @@ static int ip6mr_cache_report(const struct mr_table *mrt, struct sk_buff *pkt,
/*
* Add our header
*/
- skb_put(skb, sizeof(*msg));
+ skb_put_zero(skb, sizeof(*msg));
skb_reset_transport_header(skb);
msg = (struct mrt6msg *)skb_transport_header(skb);
--
2.43.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] ip6mr: prevent info-leak in ip6mr_cache_report()
2026-11-12 4:24 [PATCH net] ip6mr: prevent info-leak in ip6mr_cache_report() Henry Martin
@ 2026-11-12 4:31 ` netdev-bot+sinfo
2026-11-16 16:40 ` Ido Schimmel
1 sibling, 0 replies; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-11-12 4:31 UTC (permalink / raw)
To: Henry Martin
Cc: David Ahern, Ido Schimmel, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, netdev, linux-kernel,
stable
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] ip6mr: prevent info-leak in ip6mr_cache_report()
2026-11-12 4:24 [PATCH net] ip6mr: prevent info-leak in ip6mr_cache_report() Henry Martin
2026-11-12 4:31 ` netdev-bot+sinfo
@ 2026-11-16 16:40 ` Ido Schimmel
1 sibling, 0 replies; 3+ messages in thread
From: Ido Schimmel @ 2026-11-16 16:40 UTC (permalink / raw)
To: Henry Martin
Cc: David Ahern, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, netdev, linux-kernel, stable
On Thu, Nov 12, 2026 at 12:24:15PM +0800, Henry Martin wrote:
> The non-WHOLEPKT branch copies the IPv6 header at offset 0 and then
> appends 40 bytes with skb_put(), but the mrt6msg is written at offset 0
> after skb_reset_transport_header(), so the appended 40 bytes are never
> initialized. They hold stale heap contents.
>
> The report is queued to the mroute6 socket and copied into the
> IP6MRA_CREPORT_PKT netlink attribute, disclosing the stale bytes to
> user space. The stale bytes can contain kernel heap and image
> pointers, and the report is reachable from an unprivileged user
> namespace (MRT6_INIT in a new netns, plus the non-root
> RTNLGRP_IPV6_MROUTE_R group).
>
> Use skb_put_zero() instead, as the IPv4 code does since
> commit 4f34002e2e376 ("ipmr: prevent info-leak in pmr_cache_report()").
>
> This issue was discovered by Tencent CodeBuddy Security.
>
> Fixes: 7bc570c8b4f75 ("[IPV6] MROUTE: Support multicast forwarding.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Note that:
1. You're expected to answer to the bot with the requested information.
2. Better, avoid getting your patch flagged by the bot in the first
place by putting the relevant information (a KMSAN trace in this case)
in the commit message. See commit aa1799e93f5e ("ipmr, ip6mr: validate
packets injected into the register vif on xmit"), for example.
Anyway, this code is quite bizarre. Unclear why it allocates room for 80
bytes, writes the IPv6 header to the first 40, then overwrites it with
'mrt6msg' and leaves the remaining 40 bytes as garbage.
I will follow up with the following diff after your patch is in
net-next:
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index b7ae220d6b21..31f0e1ef5601 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1107,7 +1107,7 @@ static int ip6mr_cache_report(const struct mr_table *mrt, struct sk_buff *pkt,
+sizeof(*msg));
else
#endif
- skb = alloc_skb(sizeof(struct ipv6hdr) + sizeof(*msg), GFP_ATOMIC);
+ skb = alloc_skb(sizeof(*msg), GFP_ATOMIC);
if (!skb)
return -ENOBUFS;
@@ -1143,20 +1143,9 @@ static int ip6mr_cache_report(const struct mr_table *mrt, struct sk_buff *pkt,
} else
#endif
{
- /*
- * Copy the IP header
- */
-
- skb_put(skb, sizeof(struct ipv6hdr));
+ msg = skb_put(skb, sizeof(*msg));
skb_reset_network_header(skb);
- skb_copy_to_linear_data(skb, ipv6_hdr(pkt), sizeof(struct ipv6hdr));
-
- /*
- * Add our header
- */
- skb_put_zero(skb, sizeof(*msg));
skb_reset_transport_header(skb);
- msg = (struct mrt6msg *)skb_transport_header(skb);
msg->im6_mbz = 0;
msg->im6_msgtype = assert;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-16 16:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 4:24 [PATCH net] ip6mr: prevent info-leak in ip6mr_cache_report() Henry Martin
2026-11-12 4:31 ` netdev-bot+sinfo
2026-11-16 16:40 ` Ido Schimmel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox