码迷,mamicode.com
首页 > 系统相关 > 详细

蚂蚁分类getshell

时间:2017-04-12 22:09:02      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:getshell   蚂蚁分类   

  程序介绍:我们毫无保留的告诉你们这个Mymps蚂蚁分类信息系统5.6S多城市版网站源码+新版手机界面纯安装版,去除域名限制,你可以无限制的安装使用,无功能限制,亲测保证稳定运行。此程序部分核心文件是用zend加密的,但不影响使用。如果你安装不上,原因很简单就是服务器环境问题。


/member/include/inc_shop.php

if($if_corp == 1){

                //???????????

                if($ac == ‘base‘){

                        if(empty($tname)) write_msg(‘‘,‘?m=shop&type=corp&error=39‘);

                        if(empty($areaid)) write_msg(‘‘,‘?m=shop&type=corp&error=40‘);

                        $db -> query("UPDATE `{$db_mymps}member` SET tname=‘$tname‘,catid=‘$catids‘,areaid=‘$areaid‘,introduce=‘$introduce‘,address=‘$address‘,busway=‘$busway‘,mappoint=‘$mappoint‘,msn=‘$msn‘,web=‘$web‘ $where AND if_corp = ‘1‘");

                        write_msg(‘‘,‘?m=shop&type=corp&success=13‘);

                } elseif($ac == ‘template‘) {

                        if($_FILES[$name_file][‘name‘]){

                                require_once MYMPS_INC.‘/upfile.fun.php‘;

                                $destination = "/banner/".date(‘Ym‘)."/";

                                $mymps_image = start_upload($name_file,$destination,0,‘‘,‘‘,$oldbanner,‘‘);

前面的ac不用管就是if判断然后进入操作而已。我们主要看template这里,获取$name_file的上传内容然后传入start_upload,这里说一下传参中可控的有$oldbanner
看下函数内容

function start_upload( $file_name, $destination_folder, $watermark = 0, $limit_width = "", $limit_height = "", $edit_filename = "", $edit_pre_filename = "" )

{

    global $mymps_global;

    global $timestamp;

    if ( !is_uploaded_file( $_FILES[$file_name][‘tmp_name‘] ) )

    {

        write_msg( "请重新选择您要上传的图片!" );

    }

    $file = $_FILES[$file_name];

    @createdir( MYMPS_UPLOAD.$destination_folder );

    $file_name = $file[‘tmp_name‘];

    $pinfo = pathinfo( $file[‘name‘] );

    $ftype = $pinfo[‘extension‘];

    $fname = $pinfo[basename];

    if ( empty( $edit_filename ) && empty( $edit_pre_filename ) )

    {

        $destination_file = $timestamp.random( ).".".$ftype;

        $destination = MYMPS_UPLOAD.$destination_folder.$destination_file;

        $small_destination = MYMPS_UPLOAD.$destination_folder."pre_".$destination_file;

    }

    else

    {

        $destination = MYMPS_ROOT.$edit_filename;

        $small_destination = MYMPS_ROOT.$edit_pre_filename;

        $forbidarray = array(

            MYMPS_ROOT."/images/logo.gif",

            MYMPS_ROOT."/images/nopic.gif",

            MYMPS_ROOT."/images/nophoto.jpg",

            MYMPS_ROOT."/images/noavatar.gif",

            MYMPS_ROOT."/images/noavatar_small.gif"

        );

        if ( !in_array( $destination, $forbidarray ) || $destination != MYMPS_ROOT )

        {

            @unlink( $destination );

        }

        if ( !in_array( $small_destination, $forbidarray ) || $destination != MYMPS_ROOT )

        {

            @unlink( $small_destination );

        }

        unset( $forbidarray );

    }

    if ( file_exists( $destination ) )

    {

        write_msg( "同名图片已存在,请重新选择您要上传的图片!" );

    }

    if ( !move_uploaded_file( $file_name, $destination ) )

    {

        write_msg( "图片上传失败,请重新选择您要上传的图片!" );

}

看这里

$file = $_FILES[$file_name];

    @createdir( MYMPS_UPLOAD.$destination_folder );

    $file_name = $file[‘tmp_name‘];

    $pinfo = pathinfo( $file[‘name‘] );

    $ftype = $pinfo[‘extension‘];

    $fname = $pinfo[basename];

先是获取了文件内容然后获取了文件后缀以及文件名这些

{

        $destination = MYMPS_ROOT.$edit_filename;

        $small_destination = MYMPS_ROOT.$edit_pre_filename;

        $forbidarray = array(

            MYMPS_ROOT."/images/logo.gif",

            MYMPS_ROOT."/images/nopic.gif",

            MYMPS_ROOT."/images/nophoto.jpg",

            MYMPS_ROOT."/images/noavatar.gif",

            MYMPS_ROOT."/images/noavatar_small.gif"

        );

这里的edit与edit_pre讲道理的是非空所以进入了该if进行后缀以及路径拼接(期间并无任何效验)

<p class="MsoNormal" style="text-indent:20.0000pt;"><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;">if ( file_exists( $destination ) )</span><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;"><o:p></o:p></span></p><p class="MsoNormal" style="text-indent:20.0000pt;"><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;">    {</span><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;"><o:p></o:p></span></p><p class="MsoNormal" style="text-indent:20.0000pt;"><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;">        write_msg( "<font face="宋体">同名图片已存在,请重新选择您要上传的图片!</font><font face="Courier New">" );</font></span><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;"><o:p></o:p></span></p><p class="MsoNormal" style="text-indent:20.0000pt;"><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;">    }</span><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;"><o:p></o:p></span></p><p class="MsoNormal" style="text-indent:20.0000pt;"><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;">    if ( !move_uploaded_file( $file_name, $destination ) )</span><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;"><o:p></o:p></span></p><p class="MsoNormal" style="text-indent:20.0000pt;"><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;">    {</span><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;"><o:p></o:p></span></p><p class="MsoNormal" style="text-indent:20.0000pt;"><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;">        write_msg( "<font face="宋体">图片上传失败,请重新选择您要上传的图片!</font><font face="Courier New">" );</font></span><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;"><o:p></o:p></span></p><p class="MsoNormal" style="text-indent:20.0000pt;"><span style="mso-spacerun:‘yes‘;font-family:宋体;mso-ascii-font-family:‘Courier New‘;mso-hansi-font-family:‘Courier New‘;mso-bidi-font-family:‘Times New Roman‘;color:rgb(0,0,0);font-size:10.0000pt;mso-font-kerning:1.0000pt;">    }</span></p>

下面接着判断了是否存在相同名如果不存在同名则直接上传。
本地复现:
技术分享Old我们指定的文件名
技术分享不过印象中我并不记得蚂蚁分类会存在这个漏洞啊!!抱着各种心情多看一下.随便看一个
技术分享发现除了我们那个每个上面都会有一个check_upimage的调用 看看怎么回事
技术分享


本文出自 “渗透测试” 博客,请务必保留此出处http://149154431.blog.51cto.com/12629141/1915245

蚂蚁分类getshell

标签:getshell   蚂蚁分类   

原文地址:http://149154431.blog.51cto.com/12629141/1915245

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!