Live data from Hacker News

Analysis and Exploitation of a Linux Kernel Vulnerability

perception-point.io

41–50 of 70 posts

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#41
post #26
post #7

Earlier quoted context omitted.

Unfortunately no major distributions ship those patches by default.

Copperhead-os is an open-source android ROM that includes the security features of grsecurity. It runs on nexus-5 and Galaxy-S4. https://copperhead.co/android/ Which of course ,raises the question: Why doesn't Google integrate this into android, or at the very least for a secure/business version of android ?

And it's not vulnerable: https://twitter.com/CopperheadSec/status/689553753423216641

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#42
post #35
post #20

Earlier quoted context omitted.

By looking at /proc/kallsyms : grep commit_creds /proc/kallsyms grep prepare_kernel_cred /proc/kallsyms Then update addresses as shown in one of the code snippets: _commit_creds commit_creds = 0xffffffff81094250; _prepare_kernel_cred prepare_kernel_cred = 0xffffffff81094550;

Question for you. As a normal user, grepping these values I actually get 0000000000000000. I can't imagine these being the actual values. Is it possible that because I remount my /proc with the hidepid=2 option the values are not visible for normal non-root accounts?

That only hides the pid directories of others users, and indeed on my system remounting /proc with hidepid=2 I'm still able to see the same values for kallsyms. Maybe your kernel is compiled without the CONFIG_KEYS=y option? (I'm spitballing here).

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#43
post #35
post #20

Earlier quoted context omitted.

By looking at /proc/kallsyms : grep commit_creds /proc/kallsyms grep prepare_kernel_cred /proc/kallsyms Then update addresses as shown in one of the code snippets: _commit_creds commit_creds = 0xffffffff81094250; _prepare_kernel_cred prepare_kernel_cred = 0xffffffff81094550;

Question for you. As a normal user, grepping these values I actually get 0000000000000000. I can't imagine these being the actual values. Is it possible that because I remount my /proc with the hidepid=2 option the values are not visible for normal non-root accounts?

make sure you have privileges to read that file. I ran grep without sudo and got that address on Ubuntu 15.10, but with sudo it will display an actual address.

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#44
post #42
post #35

Earlier quoted context omitted.

Question for you. As a normal user, grepping these values I actually get 0000000000000000. I can't imagine these being the actual values. Is it possible that because I remount my /proc with the hidepid=2 option the values are not visible for normal non-root accounts?

That only hides the pid directories of others users, and indeed on my system remounting /proc with hidepid=2 I'm still able to see the same values for kallsyms. Maybe your kernel is compiled without the CONFIG_KEYS=y option? (I'm spitballing here).

It is indeed compiled with CONFIG_KEYS=y. Does this protect me against this issue? I'm not sure what this means.

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#45
post #43
post #35

Earlier quoted context omitted.

Question for you. As a normal user, grepping these values I actually get 0000000000000000. I can't imagine these being the actual values. Is it possible that because I remount my /proc with the hidepid=2 option the values are not visible for normal non-root accounts?

make sure you have privileges to read that file. I ran grep without sudo and got that address on Ubuntu 15.10, but with sudo it will display an actual address.

As I understand it the whole idea of this exploit is getting sudo access from a normal user.

Exploiting from root to root doesn't make a lot of sense. If the values are not retrievable as normal user this exploit can't be used.. Right?

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#46
post #3

Is there a reason that there's no overflow check on these refcounts? I suppose it's something like, these are hot paths in general and there's no good hardware support for atomic-increment-if-not-overflow?

The path can only be so 'hot'... any given cryptographic operation using the artifacts maintained by this `keyring' system will be many orders of magnitude greater than an overflow check on allocation, hardware support or not. I think we're left to conclude this is just another instance of naive C programming.

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#47
post #31

Earlier quoted context omitted.

Arch seems to be kosher $ uname -r 4.3.3-2-ARCH No root: $ ./cve_2016_0728 PP_KEY uid=1000, euid=1000 Increfing... finished increfing forking... finished forking caling revoke... uid=1000, euid=1000 Only took about 25 minutes on a Lenovo core i7. That's kind of scary. EDIT: Actually it seems that atomic_t is 64 bits long with x86_64 these days, so no hope of overflowing.

Arch is not kosher. You need to do this: https://news.ycombinator.com/item?id=10931954

I did. I still maintain that the reason why the exploit doesn't work is this:

include/asm-generic/atomic-long.h:

  #if BITS_PER_LONG == 64
  typedef atomic64_t atomic_long_t;
  ...
  #else
  typedef atomic_t atomic_long_t;
Just checking it with a 32-bit VM with the latest upstream kernel.

EDIT: No, I was wrong. atomic_t is 32 bits also with 64 bit architecture. Must be something else then, let's see.

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#49
post #39
post #36

Earlier quoted context omitted.

Is SMAP required for mitigation, or is SMEP enough? IIUC SMEP is on Sandy Bridge processors too.

According the lwn comments it should be sufficient (and the post by perception-point suggests that it would at least make things more difficult), but I haven't the hardware to test for myself.

I have Sandy Bridge, i7-2820QM. The exploit code has been running for nearly an hour, still "Increfing..."

EDIT:

    [chris@f23m cve20160728]$ ./cve_2016_0728 PP_KEY
    uid=1000, euid=1000
    Increfing...
    finished increfing
    forking...
    finished forking
    caling revoke...
    uid=1000, euid=1000
    sh-4.3$

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#50
post #40

Earlier quoted context omitted.

Arch Linux does: https://www.archlinux.org/packages/?name=linux-grsec

> by default Arch don't even have coreutils "by default". Yes, I know, you're supposed to install them anyway, but if you follow the standard install guide, there is no GRsec.

Oh, I interpreted the "by default" as "being installable without compiling it from source". But I guess more distros are able to do that.
Post reply on HN