Commit 7b735ef
rtnetlink: add missing netlink_ns_capable() check for peer netns
rtnl_newlink() lacks a CAP_NET_ADMIN capability check on the peer
network namespace when creating paired devices (veth, vxcan,
netkit). This allows an unprivileged user with a user namespace
to create interfaces in arbitrary network namespaces, including
init_net.
Add a netlink_ns_capable() check for CAP_NET_ADMIN in the peer
namespace before allowing device creation to proceed.
Fixes: 81adee4 ("net: Support specifying the network namespace upon device creation.")
Signed-off-by: Nikolaos Gkarlis <nickgarlis@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260402181432.4126920-1-nickgarlis@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 1979645 commit 7b735ef
1 file changed
Lines changed: 27 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3894 | 3894 | | |
3895 | 3895 | | |
3896 | 3896 | | |
3897 | | - | |
| 3897 | + | |
| 3898 | + | |
3898 | 3899 | | |
3899 | 3900 | | |
3900 | 3901 | | |
3901 | 3902 | | |
3902 | | - | |
| 3903 | + | |
| 3904 | + | |
3903 | 3905 | | |
3904 | 3906 | | |
3905 | | - | |
3906 | | - | |
3907 | | - | |
3908 | | - | |
3909 | | - | |
3910 | | - | |
3911 | | - | |
3912 | | - | |
3913 | | - | |
| 3907 | + | |
| 3908 | + | |
| 3909 | + | |
| 3910 | + | |
3914 | 3911 | | |
3915 | 3912 | | |
| 3913 | + | |
| 3914 | + | |
| 3915 | + | |
| 3916 | + | |
| 3917 | + | |
| 3918 | + | |
| 3919 | + | |
| 3920 | + | |
3916 | 3921 | | |
3917 | 3922 | | |
3918 | | - | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
| 3926 | + | |
| 3927 | + | |
| 3928 | + | |
| 3929 | + | |
| 3930 | + | |
| 3931 | + | |
| 3932 | + | |
3919 | 3933 | | |
3920 | 3934 | | |
3921 | 3935 | | |
| |||
4054 | 4068 | | |
4055 | 4069 | | |
4056 | 4070 | | |
4057 | | - | |
| 4071 | + | |
4058 | 4072 | | |
4059 | 4073 | | |
4060 | 4074 | | |
| |||
0 commit comments