Local Root-Exploit für Kernel 2.6.17-2.6.24.1

Rund um die Sicherheit des Systems und die Applikationen
Roger Wilco
Posts: 5923
Joined: 2004-05-23 12:53
 

Local Root-Exploit für Kernel 2.6.17-2.6.24.1

Post by Roger Wilco »

Gestern ist ein lokaler Root-Exploit für den Linux-Kernel 2.6.17 bis einschließlich 2.6.24.1 veröffentlicht worden. Der Proof-of-Concept Exploit funktioniert leider ziemlich gut.

Code: Select all

$ uname -a
Linux x2 2.6.24-gentoo #1 SMP Sun Jan 27 16:26:02 CET 2008 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD GNU/Linux
$ gcc -static -Wno-format 5092.c -o exploit
$ id
uid=1000(user) gid=100(users) Gruppen=[...]
$ ./exploit
-----------------------------------
 Linux vmsplice Local Root Exploit
 By qaaz
-----------------------------------
[+] mmap: 0x0x100000000000 .. 0x0x100000001000
[+] page: 0x0x100000000000
[+] page: 0x0x100000000038
[+] mmap: 0x0x4000 .. 0x0x5000
[+] page: 0x0x4000
[+] page: 0x0x4038
[+] mmap: 0x0x1000 .. 0x0x2000
[+] page: 0x0x1000
[+] mmap: 0x0x2b7a6ce42000 .. 0x0x2b7a6ce74000
[+] root
$ id
uid=0(root) gid=0(root) Gruppen=[...]
Ein Fix für den Bug wurde mit Kernel 2.6.24.2 (sowie 2.6.23.16 und 2.6.22.18) veröffentlicht. Die Änderung findet sich im Git-Repository auf kernel.org unter http://git.kernel.org/?p=linux/kernel/g ... 04f49cbc44

Im Bugreport bei Debian ist ein Programm verlinkt, dass das betroffene Feature (vmsplice) deaktiviert und den Exploit unbrauchbar machen soll.

Code: Select all

$ gcc disable-vmsplice-if-exploitable.c -o disable-vmsplice-if-exploitable
$ id
uid=1000(user) gid=100(users) Gruppen=[...]
$ ./disable-vmsplice-if-exploitable
-----------------------------------
 Linux vmsplice Local Root Exploit
 By qaaz
-----------------------------------
[+] mmap: 0x0x100000000000 .. 0x0x100000001000
[+] page: 0x0x100000000000
[+] page: 0x0x100000000038
[+] mmap: 0x0x4000 .. 0x0x5000
[+] page: 0x0x4000
[+] page: 0x0x4038
[+] mmap: 0x0x1000 .. 0x0x2000
[+] page: 0x0x1000
[+] mmap: 0x0x2b31791a9000 .. 0x0x2b31791db000
[+] root
Exploit gone!

$ ./5092
-----------------------------------
 Linux vmsplice Local Root Exploit
 By qaaz
-----------------------------------
[+] mmap: 0x0x100000000000 .. 0x0x100000001000
[+] page: 0x0x100000000000
[+] page: 0x0x100000000038
[+] mmap: 0x0x4000 .. 0x0x5000
[+] page: 0x0x4000
[+] page: 0x0x4038
[+] mmap: 0x0x1000 .. 0x0x2000
[+] page: 0x0x1000
[+] mmap: 0x0x2af31570c000 .. 0x0x2af31573e000
[-] vmsplice
$ id
uid=1000(user) gid=100(users) Gruppen=[...]
Die beste Lösung ist derzeit, falls möglich auf einen Kernel 2.622.18, 2.6.23.16 oder 2.6.24.2 zu wechseln bzw. auf gefixte Kernelpakete des jeweiligen Distributors zu warten. Der oben genannte Quickfix soll das Problem kurzfristig lösen, aber das System angeblich auch instabil machen.

Quellen:
Changelog Kernel 2.6.22.18, 2.6.23.16, 2.6.24.2
http://marc.info/?t=120263655300003&r=1&w=2
http://cve.mitre.org/cgi-bin/cvename.cg ... -2008-0009
http://cve.mitre.org/cgi-bin/cvename.cg ... -2008-0010
Slashdot.org - Linux Kernel 2.6 Local Root Exploit
milw0rm.com - Linux Kernel 2.6.17 - 2.6.24.1 vmsplice Local Root Exploit
milw0rm.com - Linux Kernel 2.6.23 - 2.6.24 vmsplice Local Root Exploit
http://www.reactivated.net/weblog/archi ... ty-issues/

Bugreports bei verschiedenen Distributoren:
Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=209460
Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=432229
RHEL: https://bugzilla.redhat.com/show_bug.cgi?id=432251
Ubuntu: https://bugs.launchpad.net/ubuntu/+sour ... bug/190587
Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=464953
User avatar
Joe User
Project Manager
Project Manager
Posts: 11183
Joined: 2003-02-27 01:00
Location: Hamburg
 

Re: Local Root-Exploit für Kernel 2.6.17-2.6.24.1

Post by Joe User »

Ned Ludd auf der Gentoo-Hardened-Mailingliste:
FYI everybody... Look at that.. A properly configured host using PaX the
way the PaX Team suggests prevents this and may other types of bugs.

Anyway for those of you not using PaX the way it's suggested to use
(which also happens to be Hardened defaults) then you could/should
consider this patch if you have local users which are not trusted.
http://git.kernel.org/?p=linux/kernel/g ... 04f49cbc44
After patching a user tried >10000 iterations of both exploits and
everything appeared to be fine.

For those of you looking for a quick work around for your production
servers and don't/can't reboot just quite yet.. Md of freenode offers
this runtime kernel module.

11:32 < Md> reminder: please do not hurry to reboot your linux servers,
http://www.linux.it/~md/software/novmsplice.tgz is a kernel module
which disables the system calls used by the exploit

The current exploit while not appearing to work can result in a DoS
The feature uderef catches it... but yesterday a user while in testing
executed the exploit many many times. At 943rd execution the system
froze.

We are told that while unfortunately when the bug is triggered, the
kernel holds locks and due to uderef catching it, and the kernel will
also kill the task. It would do so regardless of uderef if the ptr it
dereferences isn't mapped memory.
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
sledge0303
Posts: 695
Joined: 2005-09-16 00:06
Location: Berlin-Reinickendorf
 

Re: Local Root-Exploit für Kernel 2.6.17-2.6.24.1

Post by sledge0303 »

Roger Wilco wrote:
Im Bugreport bei Debian ist ein Programm verlinkt, dass das betroffene Feature (vmsplice) deaktiviert und den Exploit unbrauchbar machen soll.

$ gcc disable-vmsplice-if-exploitable.c -o disable-vmsplice-if-exploitable
Der Patch führt dazu, das System wird instabil weil damit der Kernelspeicher durcheinander geraten soll. Hab es selbst nicht getestet, aber laut Berichten anderer Admins wird bei Ausführung des Patch zuerst der Exploit 'ausprobiert' und hat lediglich damit den selben Effekt erreicht.
Wenn man sich den Quellcode von 'disable-vmsplice-if-exploitable.c' genau vorher anschaut... mir ging es nicht besser, hab den Tipp in einem anderen Foren weitergereicht und wurde auf diesen Thread hingewiesen...
Roger Wilco
Posts: 5923
Joined: 2004-05-23 12:53
 

Re: Local Root-Exploit für Kernel 2.6.17-2.6.24.1

Post by Roger Wilco »

sledge0303 wrote:Der Patch führt dazu, das System wird instabil weil damit der Kernelspeicher durcheinander geraten soll.
Ist leider tatsächlich so. Die Maschine, auf der ich das ausprobiert habe, ist 2 Stunden später dann abgeschmiert. Das Kernelmodul ist wohl ungefährlicher. ;)

Unter http://www.linuxforen.de/forums/showpos ... ostcount=3 wird übrigens noch eine Möglichkeit mit SystemTap vorgestellt. Ich weiß allerdings nicht, ob oder wie gut diese funktioniert.
sledge0303
Posts: 695
Joined: 2005-09-16 00:06
Location: Berlin-Reinickendorf
 

Re: Local Root-Exploit für Kernel 2.6.17-2.6.24.1

Post by sledge0303 »

Man wird eh nicht drum herum kommen einen neuen Kernel einzupflegen oder wartet bis der Distributor die entsprechenden Patches zur Verfügung stellt.
Ob dein gelinkter Beitrag eine wirkliche Lösung darstellt... sollte man bezweifeln.
User avatar
Joe User
Project Manager
Project Manager
Posts: 11183
Joined: 2003-02-27 01:00
Location: Hamburg
 

Re: Local Root-Exploit für Kernel 2.6.17-2.6.24.1

Post by Joe User »

Ich habe die anderen Distributoren jetzt nicht geprüft, aber Gentoo hat die beiden Bugs bereits gestern gefixt.
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.