kernel: deny swconfig set requests for unprivileged users
authorJo-Philipp Wich <jo@mein.io>
Mon, 4 Jul 2016 18:46:24 +0000 (20:46 +0200)
committerZoltan HERPAI <wigyori@uid0.hu>
Mon, 4 Jul 2016 18:46:24 +0000 (20:46 +0200)
commit94a986d88ffdc6868aaf13e6a18cb220434adbef
tree800e081573dc641563293733f36a76c945feb5e4
parent8207cd3298c926ac66e2aba188c4846d7ed69649
kernel: deny swconfig set requests for unprivileged users

The swconfig kernel infrastructure fails to do any permissions checks when
changing settings. As such an ordinary user account on a device with a
switch can change switch settings without any special permissions.
Routers generally have few non-admin users so this isn't a big hole, but it
is a security hole. Likely the greatest danger is for multifunction devices
which have a lot of extra daemons, compromising a low-security daemon would
allow one to modify switch settings and cause the router/switch to appear to
lock-up (or cause other sorts of troublesome nyetwork behavior).

Implement a check for CAP_NET_ADMIN in swconfig_set_attr() and deny any
requests originating from user contexts lacking this capability.

Reported-by: Elliott Mitchell <ehem+openwrt@m5p.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
target/linux/generic/files/drivers/net/phy/swconfig.c