Skip to contentSkip to conversation

ieee802154: require CAP_NET_ADMIN for SIOCSIFADDR

PATCH Applied Sung Byeongchan 4 participants 4 messages Nov 7 – Nov 18

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

PATCH 1/1 ieee802154: require CAP_NET_ADMIN for SIOCSIFADDR

PF_IEEE802154 DGRAM sockets are available to ordinary init-net processes. Their family-specific SIOCSIFADDR path calls the netdev ioctl directly and does not pass through the generic network-device setter capability check. An unprivileged process can therefore change the PAN ID and short address of a separately administrator-owned down WPAN interface.

In a local fakelb fixture, uid 1000 changed both identifiers and the values remained active through a later administrator interface open in three of three fresh KASAN boots.

Require CAP_NET_ADMIN in the socket network namespace before processing SIOCSIFADDR. Keep SIOCGIFADDR and all existing state and value checks unchanged.

The fixed kernel rejected the same unprivileged request with -EPERM and preserved the administrator identity in three of three matched boots. Administrator SET, running-device, invalid-value, wrong-device, cleanup, later-open and recovery controls passed in all baseline and fixed runs.

The demonstrated impact is local cross-principal WPAN identity and policy modification after privileged device setup. Memory corruption, disclosure, RCE and LPE were not demonstrated.

Fixes 9ec767160357 ("net: add IEEE 802.15.4 socket family implementation")
Assisted-by OpenAI Codex
---
 net/ieee802154/socket.c |    4 ++++
 1 file changed, 4 insertions(+)
net/ieee802154/socket.c +4 -0
index be8ca1f053a2b..362457de8424c 100644
@@ -128,6 +128,10 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
 	int ret = -ENOIOCTLCMD;
 	struct net_device *dev;
 
+	if (cmd == SIOCSIFADDR &&
+	    !ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN))
+		return -EPERM;
+
 	if (get_user_ifreq(&ifr, NULL, arg))
 		return -EFAULT;
 

base-commit: d48723711bae9b8cdc56719c448ba42fef28cbee

Signature · 1 line
2.43.0
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

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.

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Sung Byeongchan
Quoted 19 lines · Sung Byeongchan

PF_IEEE802154 DGRAM sockets are available to ordinary init-net processes. Their family-specific SIOCSIFADDR path calls the netdev ioctl directly and does not pass through the generic network-device setter capability check. An unprivileged process can therefore change the PAN ID and short address of a separately administrator-owned down WPAN interface.

In a local fakelb fixture, uid 1000 changed both identifiers and the values remained active through a later administrator interface open in three of three fresh KASAN boots.

Require CAP_NET_ADMIN in the socket network namespace before processing SIOCSIFADDR. Keep SIOCGIFADDR and all existing state and value checks unchanged.

The fixed kernel rejected the same unprivileged request with -EPERM and preserved the administrator identity in three of three matched boots. Administrator SET, running-device, invalid-value, wrong-device, cleanup, later-open and recovery controls passed in all baseline and fixed runs.

Quoted 6 lines

The demonstrated impact is local cross-principal WPAN identity and policy modification after privileged device setup. Memory corruption, disclosure, RCE and LPE were not demonstrated.

Fixes 9ec767160357 ("net: add IEEE 802.15.4 socket family

implementation")

Probably a good stable candidate,

Quoted 2 lines
Assisted-by OpenAI Codex

Nit: extra line

Quoted 9 lines
---
 net/ieee802154/socket.c |    4 ++++
 1 file changed, 4 insertions(+)
net/ieee802154/socket.c +0 -0
index be8ca1f053a2b..362457de8424c 100644

net/ieee802154/socket.c static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, · line 136

Quoted 9 lines
net/ieee802154/socket.c +4 -0
@@ -128,6 +128,10 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
 	int ret = -ENOIOCTLCMD;
 	struct net_device *dev;
 
+	if (cmd == SIOCSIFADDR &&
+	    !ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN))
+		return -EPERM;
+
 	if (get_user_ifreq(&ifr, NULL, arg))
 		return -EFAULT;

The fix is correct, but since you are aligning those checks with other path (like IPv4) maybe for the sake of coherency, those checks should be done in the same order. An unpriviledged user providing an incorrect device would get EPERM instead of EFAULT in devinet_ioctl(). Not sure if that's worth a respin though. In any case,

Thanks,
Miquèl

#3 lore raw
In reply to Sung Byeongchan
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 Sat, 7 Nov 2026 18:36:01 +0900 you wrote:

PF_IEEE802154 DGRAM sockets are available to ordinary init-net processes. Their family-specific SIOCSIFADDR path calls the netdev ioctl directly and does not pass through the generic network-device setter capability check. An unprivileged process can therefore change the PAN ID and short address of a separately administrator-owned down WPAN interface.

In a local fakelb fixture, uid 1000 changed both identifiers and the values remained active through a later administrator interface open in three of three fresh KASAN boots.

[...]

Here is the summary with links:
- ieee802154: require CAP_NET_ADMIN for SIOCSIFADDR

    https://git.kernel.org/netdev/net/c/a0abc1e4c9d5

You are awesome, thank you!

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