the last unbiased stronghold

Finding sysent On OS X 10.6.1

Finding sysent On OS X 10.6.1
Posted Oct 19, 2009
Authored by boecke

Small write up called finding sysent on OS X 10.6.1. Good information for Mac OS X rootkit writers.

tags | paper
systems | apple, osx
MD5 | 1f7a894ac48ac1a38127b27394425867

Finding sysent On OS X 10.6.1

Change Mirror Download


Finding sysent on OS X 10.6.1
Written by Braeden Thomas

Regards to the gods of OS X security-dev
nemo, Landon Fuller and many others

Darwin Kernel Version 10.0.0:
root:xnu-1456.1.25~1/RELEASE_I386 i386

The latest release from Apple (Snow Leopard) or 10.6.1 has broken most 10.5.*
KEXT rootkits, primarily because the method provided by Landon Fuller has
either been fixed by Apple or I have done something catastrophically wrong.
I'm assuming there has been a problem with Apple implementing their KPI interfaces
for Kernel Development so I'm just going to say for now that a static pointer may
be the only option [as far as I know at this point]. A quick search through
the kernel presents us with a slightly different organisation of the sysent table
with reference to the Landon Fuller technique (32 bytes from _nsysent export).

$ otool -d /mach_kernel
0082f020 00 00 00 00 ed 1e 49 00 00 00 00 00 00 00 00 00
0082f030 01 00 00 00 00 00 00 00 01 00 00 00 72 78 47 00
0082f040 b0 f0 4e 00 00 00 00 00 00 00 00 00 04 00 00 00
0082f050 00 00 00 00 74 95 47 00 00 00 00 00 00 00 00 00
00000000 ***********************************************
00831870 ae 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00

It's now located at -0x2850 from the _nsysent symbol.
You'll notice _nosys (0x00491eed) and _exit (0x00477872) can be found here,
the sysent table in 10.6.1 has 430 (0x01ae) syscalls in total.

And here's for the magic code, that isn't really magic - primarily
because it provides no sanity checks whatsoever. OS X kernel panic is baaahd.

/* $ sysent.c */
/* $ Static Pointer to sysent on OS X 10.6.1 */
/* $ root:xnu-1456.1.25~1/RELEASE_I386 i386 */

#include "osxrt.h"
#define _NSYSENT_OSX_10_6_1_ 0x00831870
#define _NOSYS_OSX_10_6_1_ 0x2850

static struct sysent *_sysent = ( struct sysent * )( _NSYSENT_OSX_10_6_1_ - _NOSYS_OSX_10_6_1_ );

/* $ EOF */

A simple sanity check would be just to check a few rows of the array and verify
whether the value return from sy_narg corresponds with the amount of arguments
that - that specific syscall actually has.

It hath been found, once again!

$ tail -f /var/log/kernel.log
Sep 22 21:18:13 Homeground kernel[0]: _sysent: 0x82f020
Sep 22 21:18:13 Homeground kernel[0]: lstat64: 0x2e4ba3 2
Sep 22 21:18:13 Homeground kernel[0]: chdir: 0x2e89f3 1

So get rooting on OS X again, 2.6.* and Win32 isn't allowed to have all the fun.

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2012

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2012 Packet Storm. All rights reserved.

close