Skip to contentSkip to conversation

ipv6: fix potential UAF caused by ip6_forward_proxy_check()

PATCH Applied Eric Dumazet 4 participants 4 messages May 5 – May 7

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: fix potential UAF caused by ip6_forward_proxy_check()

ip6_forward_proxy_check() calls pskb_may_pull() which might re-allocate skb->head.

Reload ipv6_hdr() after the pskb_may_pull() call to avoid using the freed memory.

Fixes e21e0b5f19ac ("[IPV6] NDISC: Handle NDP messages to proxied addresses.")
---
 net/ipv6/ip6_output.c | 3 +++
 1 file changed, 3 insertions(+)
net/ipv6/ip6_output.c +3 -0
index 7e92909ab5be3f86b10bf9527e97f3bfe794e9e9..aee91ba04130527ceb19881dc1e7232a5d2c8580 100644
@@ -468,6 +468,7 @@ static int ip6_forward_proxy_check(struct sk_buff *skb)
 		default:
 			break;
 		}
+		hdr = ipv6_hdr(skb);
 	}
 
 	/*
@@ -582,6 +583,8 @@ int ip6_forward(struct sk_buff *skb)
 	if (READ_ONCE(net->ipv6.devconf_all->proxy_ndp) &&
 	    pneigh_lookup(&nd_tbl, net, &hdr->daddr, skb->dev)) {
 		int proxied = ip6_forward_proxy_check(skb);
+
+		hdr = ipv6_hdr(skb);
 		if (proxied > 0) {
 			/* It's tempting to decrease the hop limit
 			 * here by 1, as we do at the end of the
Signature · 1 line
2.54.0.545.g6539524ca2-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Eric Dumazet

ip6_forward_proxy_check() calls pskb_may_pull() which might re-allocate skb->head.

Reload ipv6_hdr() after the pskb_may_pull() call to avoid using the freed memory.

Quoted 7 lines
Fixes e21e0b5f19ac ("[IPV6] NDISC: Handle NDP messages to proxied addresses.")
---
 net/ipv6/ip6_output.c | 3 +++
 1 file changed, 3 insertions(+)
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Eric Dumazet
Quoted 9 lines · Eric Dumazet

ip6_forward_proxy_check() calls pskb_may_pull() which might re-allocate skb->head.

Reload ipv6_hdr() after the pskb_may_pull() call to avoid using the freed memory.

Fixes e21e0b5f19ac ("[IPV6] NDISC: Handle NDP messages to proxied addresses.")
#3 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Tue, 5 May 2026 13:00:56 +0000 you wrote:

ip6_forward_proxy_check() calls pskb_may_pull() which might re-allocate skb->head.

Reload ipv6_hdr() after the pskb_may_pull() call to avoid using the freed memory.

Fixes e21e0b5f19ac ("[IPV6] NDISC: Handle NDP messages to proxied addresses.")

[...]

Here is the summary with links:
- [net] ipv6: fix potential UAF caused by ip6_forward_proxy_check()

    https://git.kernel.org/netdev/net/c/7aaa8f5e45a9

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html