Live data from Hacker News

Analysis and Exploitation of a Linux Kernel Vulnerability

perception-point.io

21–30 of 70 posts

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#21
post #7

This vulnerability is a great advertisement for grsecurity/PaX, which mitigates it at the source of the issue thanks to PAX_REFCOUNT.

Unfortunately no major distributions ship those patches by default.

FYI: If you're comfortable with Gentoo, the jump to Hardened Gentoo[1] is an easy one[2] and gives TrustedBSD[3] a run for its money w/r/t out-of-the-box security. It has the SElinux MAC, role based access controlled stuff from GRsec alternatively [you can mix and match GRsec + SElinux except for RBAC and SElinux's ACL system), grsec's ASLR at runtime, modified versions of musl/uclibc, stack protection support (why anyone would write software that could possibly be EIP exploited with countless ASan damn well integrated into some compilers, I haven't a clue), and a whole host more.

Some interesting academic work: http://hmarco.org/data/OnTheEffectivness-NX-SSP-RenewSSP-and...

While SSP is not enough, (use PIE too): http://cybersecurity.upv.es/attacks/offset2lib/offset2lib.ht...

A fun toy: https://github.com/JhetoX/VectorAttackScanner

[1]https://wiki.gentoo.org/wiki/Project:Hardened

[2]https://wiki.gentoo.org/wiki/Hardened/Introduction_to_Harden...

[3]Granted I haven't used it in ages, it's still the benchmark I use in my mind, back when Linux 2.2 was rife with out-of-the-box ROP vulns.

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#22
post #20
post #16

Earlier quoted context omitted.

How do you find those addresses?

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;

Thanks, that worked.

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#23
post #4

Well, the exploit doesn't seem to work on my kernel 4.1.0 system, so that's good.

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.

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#24
Can anyone identify a patch to apply to existing kernels to fix this? Are there any released 3.8+ versions that are not vulnerable? The "mitigations" section at the end is not forthcoming about this. Vulnerable systems remain vulnerable without such information.

This does not seem to be a responsible disclosure of the vulnerability (keep in mind it was posted on their blog 5 days ago).

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#25
post #7

This vulnerability is a great advertisement for grsecurity/PaX, which mitigates it at the source of the issue thanks to PAX_REFCOUNT.

Unfortunately no major distributions ship those patches by default.

Freedom of the Press Foundation (disclosure: I am an employee) ships grsecurity kernels for SecureDrop. You have to build them yourself, but it really isn't that hard to do. We're working on making this easier for everybody by publishing guides [0] to building your own grsecurity kernel, as well as developing an Ansible playbook to automate building hardened kernels [1].

This is all still a work in progress, but expect a blog post once what we have is more polished.

A relatively easy-to-follow blog post was recently published that guides you through building a grsecurity kernel for a Debian desktop installation: [2].

grsecurity was operating a service last year that would allow you to request custom built kernels for a small price, although I can't find it now so it may have been taken offline. This is an ideal solution, and is actually better than packaging the kernels in an distribution's repository, because some of grsecurity's security features are more effective when everybody is running a unique kernel (e.g. RANDSTRUCT).

Finally, the linux-hardening group is working on upstreaming select PaX features into the mainline kernel [3], including PAX_REFCOUNT, which is the protection that would've mitigated this particular vulnerability.

[0]: https://gist.github.com/ageis/a91f36ca99c252291a00 [1]: https://github.com/freedomofpress/grsec/ [2]: https://micahflee.com/2016/01/debian-grsecurity/ [3]: http://lwn.net/Articles/668876/

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#26
post #7

This vulnerability is a great advertisement for grsecurity/PaX, which mitigates it at the source of the issue thanks to PAX_REFCOUNT.

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 ?

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#27
post #11

Earlier quoted context omitted.

Tested on CentOS 7, fully patched. [ohadmin@localhost shm]$ ./cve_2016_0728 PP_KEY uid=99990, euid=99990 Increfing... This is taking a long time. I disabled SELinux and it has been cranking away for a while now. PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1140 ohadmin 20 0 8428 388 296 R 100.0 0.0 9:25.17 cve_2016_0728 No need to test on CentOS 6. Forgot how ancient that kernel is. Update: I am not having a…

That's not how you execute binaries, just "./cve_2016_0728 PP_KEY" is the correct syntax

Yes sorry. I will make the cheap excuse that I am recovering from food poisoning and don't quite have it all together. Thankfully I don't manage nuclear weapons, so we are all safe for now.

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#28

This vulnerability is a great advertisement for grsecurity/PaX, which mitigates it at the source of the issue thanks to PAX_REFCOUNT.

Insomnihack just had a teaser CTF[1] where one of the challenges was to find an exploit in a poorly configured grsecurity-based Linux installation from an archive of the filesystem that was exposing a CGI based web server. It was a really fun challenge!

[1] https://ctftime.org/event/258

Re: Analysis and Exploitation of a Linux Kernel Vulnerability

#30

Did not get root on my test box (OpenSuSE 13.2 64bit) with kernel 3.16.6-2-default uid=10000, euid=10000 Increfing... finished increfing forking... finished forking caling revoke... uid=10000, euid=10000 sh-4.2$

If you have SMAP, i.e. an Haswell or newer Intel CPU, you should not be vulnerable, so that could be an explanation.
Post reply on HN