News for hackers. Stuff that matters.
Re:Exploiting the Linux kernel via packet sockets by dohqu8Zi on Wednesday May 10, 2017 @05:08PM (#14311737)
No.

Create a new user namespace and you have CAP_NET_RAW within your shiny new namespace.

Re:Exploiting the Linux kernel via packet sockets by ploxiln on Thursday May 11, 2017 @12:31AM (#14313834)
Right, but "unprivileged user namespaces" are disabled in many contexts, because they've been a source of many vulnerabilities due to code originally thought to only be reachable by root anyway.

Archlinux has user namespaces disabled, docker does not use them by default and does not allow them inside containers by default, on Ubuntu I make sure to disable kernel.unprivileged_userns_clone on all the servers I deploy to, etc.

Re:Exploiting the Linux kernel via packet sockets by glandium on Wednesday May 10, 2017 @08:10PM (#14312885)
But you need capabilities to create that new user namespace (CAP_SYS_ADMIN, I think)
Re:Exploiting the Linux kernel via packet sockets by scarybeast on Wednesday May 10, 2017 @09:20PM (#14313246)
No. It's exploitable by a normal unprivileged user on modern Ubuntu. From the article, "Let’s see how we can exploit this vulnerability. I’m going to be targeting x86-64 Ubuntu 16.04.2 with 4.8.0-41-generic kernel version with KASLR, SMEP and SMAP enabled. Ubuntu kernel has user namespaces available to unprivileged users (CONFIG_USER_NS=y and no restrictions on it’s usage), so the bug can be exploited to gain root privileges by an unprivileged user."
Re:Exploiting the Linux kernel via packet sockets by d33 on Wednesday May 10, 2017 @05:35PM (#14311941)
That's pretty interesting. Does it mean it allows escaping Docker containers if you compromise a service ran as root in it?
Re:Exploiting the Linux kernel via packet sockets by user5994461 on Thursday May 11, 2017 @09:54AM (#14315990)
As a rule of Thumb, an attack can ALWAYS escape from Docker containers.

These containers are a light way to separate processes. They are not intended as a security measure to isolate malicious processes that tries to escape.

Re:Exploiting the Linux kernel via packet sockets by dohqu8Zi on Wednesday May 10, 2017 @05:37PM (#14311957)
No, Docker usually drops CAP_NET_RAW within the container. But you can change that and other container technologies definitely keep CAP_NET_RAW within the container.
Re:Exploiting the Linux kernel via packet sockets by wrongmmmm on Wednesday May 10, 2017 @07:40PM (#14312739)
Not true. CAP_NET_RAW is on by default: https://github.com/moby/moby/blob/master/oci/defaults_linux....

Otherwise no one could ping from a container.

Re:Exploiting the Linux kernel via packet sockets by dohqu8Zi on Thursday May 11, 2017 @03:11AM (#14314319)
Thanks for the correction.
Re:Exploiting the Linux kernel via packet sockets by dohqu8Zi on Wednesday May 10, 2017 @05:40PM (#14311973)
BTW: Depending on the configuration you can create a new namespace within Docker to gain CAP_NET_RAW since namespaces can nest.
Re:Exploiting the Linux kernel via packet sockets by caf on Wednesday May 10, 2017 @09:59PM (#14313378)
You also need to create a network namespace, because to create an AF_PACKET socket you need to have CAP_NET_RAW in the user namespace that owns your network namespace, not the user namespace you're in.