| Title: | Mac OS X kqueue Local Denial of Service |
|
| Description: |
Inconsistent handling of kqueue and kevent interfaces in the Mac OS X kernel,
allows local unprivileged users to cause a denial of service condition.
This particular vulnerability can be abused by a process registering a queue and a kernel event via the kevent() call, then spawning a child via fork() and attempting to register another event for the same ("parent") queue. The kqueue(2) man page mentions that "queue is not inherited by a child created with fork(2)". |
|
| Author/Contributor: |
Kevin Finisterre <kf [at] digitalmunition.com> - testing on PPC LMH <lmh [at] info-pull.com> - MoKB release, debugging. dugsong - found original issue and provided proof of concept code. |
|
| References: | ||
| Proof of concept or exploit: |
The following proof of concept (C source code, will need Xcode packages installed to have GNU GCC for compilation)
can be used to reproduce the bug: MOKB-24-11-2006.c.bz2
bunzip2 MOKB-24-11-2006.c.bz2 && gcc MOKB-24-11-2006.c -o MOKB-24-11-2006 && ./MOKB-24-11-2006 |
|
| Debugging information: |
It's been tested on an up-to-date (24-11-2006) Mac OS X installation, running on an Intel "shipping" Mac (x86; tested on PPC as well).
brubg:/tmp feuckstevo$ gdb /Volumes/KernelDebugKit/mach_kernel -c core-xnu-792.13.8-172.16.0.10-kevent-bogg
GNU gdb 6.3.50-20050815 (Apple version gdb-573) (Fri Oct 20 15:50:43 GMT 2006)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...
#0 Debugger (message=0x3c9540 "panic") at /SourceCache/xnu/xnu-792.13.8/osfmk/i386/AT386/model_dep.c:770
Line number 770 out of range; /SourceCache/xnu/xnu-792.13.8/osfmk/i386/AT386/model_dep.c has 312 lines.
(gdb) source /Volumes/KernelDebugKit/kgmacros
Loading Kernel GDB Macros package. Type "help kgm" for more info.
(gdb) paniclog
panic(cpu 0 caller 0x001A3135): Unresolved kernel trap (CPU 0, Type 14=page fault), registers:
CR0: 0x8001003b, CR2: 0x000001b8, CR3: 0x00d72000, CR4: 0x000006e0
EAX: 0x00000000, EBX: 0x00000000, ECX: 0x00000004, EDX: 0x000001b8
CR2: 0x000001b8, EBP: 0x13fcbe78, ESI: 0x0285fcc0, EDI: 0x02da1000
EFL: 0x00010206, EIP: 0x00197976, CS: 0x00000008, DS: 0x00000010
Backtrace, Format - Frame : Return Address (4 potential args on stack)
0x13fcbcc8 : 0x128d1f (0x3c9540 0x13fcbcec 0x131df4 0x0)
0x13fcbd08 : 0x1a3135 (0x3cf1f4 0x0 0xe 0x3cea24)
0x13fcbe18 : 0x19a8d4 (0x13fcbe30 0x202 0x13fcbe48 0x12a12f)
0x13fcbe78 : 0x3334f0 (0x1b8 0x2 0x13fcbec8 0x13376f)
0x13fcbec8 : 0x333a76 (0x285fcc0 0x13fcbee8 0x0 0x1a1ec0)
0x13fcbf08 : 0x332bd7 (0x286135c 0x4000013c 0x13fcbf38 0x13adaa)
0x13fcbf38 : 0x33a652 (0x2da11a8 0x4000013c 0x13fcbfc8 0x1)
0x13fcbf68 : 0x378337 (0x2da1000 0x2707940 0x2707984 0x0)
0x13fcbfc8 : 0x19acae (0x25ce7e4 0x19a7f5 0x8 0x203) No mapping exists for frame pointer
Backtrace terminated-invalid frame pointer 0xbffffc48
Kernel version:
Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386
(gdb) bt
#0 Debugger (message=0x3c9540 "panic") at /SourceCache/xnu/xnu-792.13.8/osfmk/i386/AT386/model_dep.c:770
#1 0x00128d1f in panic (str=0x3cf1f4 "Unresolved kernel trap (CPU %d, Type %d=%s), registers:\nCR0: 0x%08x,
CR2: 0x%08x, CR3: 0x%08x, CR4: 0x%08x\nEAX: 0x%08x, EBX: 0x%08x, ECX: 0x%08x,
EDX: 0x%08x\nCR2: 0x%08x, EBP: 0x%08x, ESI: 0x%08x, EDI"...)
at /SourceCache/xnu/xnu-792.13.8/osfmk/kern/debug.c:202
#2 0x001a3135 in kernel_trap (state=0x13fcbe30) at /SourceCache/xnu/xnu-792.13.8/osfmk/i386/trap.c:630
#3 0x0019a8d4 in trap_from_kernel ()
#4 0x003334f0 in kevent_register (kq=0x285fcc0, kev=0x13fcbee8, p=0x0)
at /SourceCache/xnu/xnu-792.13.8/bsd/kern/kern_event.c:1187
#5 0x00333a76 in filt_proc (kn=0x286135c, hint=1073742140) at /SourceCache/xnu/xnu-792.13.8/bsd/kern/kern_event.c:520
#6 0x00332bd7 in knote (list=0x2da11a8, hint=1073742140) at /SourceCache/xnu/xnu-792.13.8/bsd/kern/kern_event.c:1762
#7 0x0033a652 in fork (p=0x2da1000, uap=0x2707940, retval=0x2707984)
at /SourceCache/xnu/xnu-792.13.8/bsd/kern/kern_fork.c:364
#8 0x00378337 in unix_syscall (state=0x25ce7e4) at /SourceCache/xnu/xnu-792.13.8/bsd/dev/i386/systemcalls.c:196
#9 0x0019acae in lo_unix_scall ()
Cannot access memory at address 0xbffffc48
Cannot access memory at address 0xbffffc4c
(gdb) info registers
eax 0x0 0
ecx 0x0 0
edx 0x0 0
ebx 0x1 1
esp 0x13fcbc3c 0x13fcbc3c
ebp 0x13fcbcc8 0x13fcbcc8
esi 0x1 1
edi 0x1000 4096
eip 0x1a8674 0x1a8674
|