注:屏蔽本漏洞的紧急通知:http://fineui.com/bbs/forum.php?mod=viewthread&tid=7863

本人小学文化,文采不好,写的不好请各位多多包含,

    最近笔者喜欢研究一些代码安全方面的问题,前些日子研究了下力软的框架,发现代码安全方面做的还是不足的,今天偶尔的机会接触了下fineui,从最开始的注入开始,都没有什么突破,

最好就想到列别的排序,从列别排序注入,弄了好久,发现一直没注入成功也没有报错,我就很是奇怪,然后看了下fineui的开源版,看了代码,发现原来他是判断的 ,不是拼接的,难怪注入失败,

本来以为没什么办法了,然后查看页面源码,发现一个引用引起了我的注意:

这个地址,于是去看了下他的源码

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Reflection;
using System.IO;
using System.Drawing.Imaging; namespace FineUI
{
/// <summary>
/// 资源处理程序
/// </summary>
public class ResourceHandler : IHttpHandler
{
/// <summary>
/// 处理资源的请求
/// </summary>
/// <param name="context">Http请求上下文</param>
public void ProcessRequest(HttpContext context)
{
string type = String.Empty;
string typeValue = String.Empty;
string extjsBasePath = GlobalConfig.GetExtjsBasePath();
//resName = "FineUI."; if (!String.IsNullOrEmpty(typeValue = context.Request.QueryString["icon"]))
{
type = "icon";
}
//else if (!String.IsNullOrEmpty(typeValue = context.Request.QueryString["js"]))
//{
// type = "js";
// //resName += "js." + typeValue;
//}
//else if (!String.IsNullOrEmpty(typeValue = context.Request.QueryString["lang"]))
//{
// type = "lang";
// //resName += "js.lang." + typeValue;
//}
else if (!String.IsNullOrEmpty(typeValue = context.Request.QueryString["theme"]))
{
// res.axd?theme=default.grid.refresh.gif
type = "theme";
//resName += "res.theme." + typeValue;
}
//else if (!String.IsNullOrEmpty(typeValue = context.Request.QueryString["css"]))
//{
// type = "css";
// //resName += "res.css." + typeValue;
//}
else if (!String.IsNullOrEmpty(typeValue = context.Request.QueryString["img"]))
{
type = "img";
//resName += "res.img." + typeValue;
}
else
{
context.Response.Write("Not supported!");
return;
} //byte[] binary;
switch (type)
{
case "icon":
if (!typeValue.EndsWith(".png") && !typeValue.EndsWith(".gif"))
{
typeValue = IconHelper.GetName((Icon)Enum.Parse(typeof(Icon), typeValue));
}
//resName += "res.icon." + typeValue;
string serverPath = String.Format("{0}/{1}", GlobalConfig.GetIconBasePath(), typeValue);
context.Response.WriteFile(context.Server.MapPath(serverPath)); context.Response.ContentType = "image/" + GetImageFormat(typeValue);
break;
//case "js":
// context.Response.Write(ResourceHelper.GetResourceContent(resName));
// context.Response.ContentType = "text/javascript";
//case "lang":
// context.Response.Write(ResourceHelper.GetResourceContent(resName));
// context.Response.ContentType = "text/javascript";
// break;
//case "css":
// context.Response.Write(ResourceHelper.GetResourceContent(resName));
// context.Response.ContentType = "text/css";
// break;
case "theme":
string themePath = "";
string themeImageFormat = "";
int lastDotIndex = typeValue.LastIndexOf(".");
if (lastDotIndex >= )
{
themePath = typeValue.Substring(, lastDotIndex).Replace('.', '/');
themeImageFormat = typeValue.Substring(lastDotIndex + );
} context.Response.WriteFile(context.Server.MapPath(String.Format("{0}/res/images/{1}.{2}", extjsBasePath, themePath, themeImageFormat))); context.Response.ContentType = "image/" + GetImageFormat(typeValue);
break;
case "img":
//binary = ResourceHelper.GetResourceContentAsBinary(resName);
//context.Response.OutputStream.Write(binary, 0, binary.Length);
//context.Response.ContentType = "image/" + GetImageFormat(resName); context.Response.WriteFile(context.Server.MapPath(String.Format("{0}/res/images/{1}", extjsBasePath, typeValue))); context.Response.ContentType = "image/" + GetImageFormat(typeValue);
break;
} // 缓存一年,只能通过改变 URL 来强制更新缓存
context.Response.Cache.SetExpires(DateTime.Now.AddYears());
context.Response.Cache.SetCacheability(HttpCacheability.Public);
} //private void RenderImage(HttpContext context, string resName)
//{
// Assembly assembly = Assembly.GetExecutingAssembly();
// using (Stream stream = assembly.GetManifestResourceStream(resName))
// {
// using (System.Drawing.Image image = System.Drawing.Image.FromStream(stream))
// {
// // PNG输出时出现“GDI+ 中发生一般性错误”
// using (MemoryStream ms = new MemoryStream())
// {
// image.Save(ms, image.RawFormat);
// ms.WriteTo(context.Response.OutputStream);
// context.Response.ContentType = "image/" + GetImageFormat(image.RawFormat);
// }
// }
// }
//} private string GetImageFormat(string imageName)
{
int lastDotIndex = imageName.LastIndexOf(".");
if (lastDotIndex >= )
{
return imageName.Substring(lastDotIndex + );
}
return "png";
} private string GetImageFormat(ImageFormat format)
{
if (format == ImageFormat.Bmp)
{
return "bmp";
}
else if (format == ImageFormat.Gif)
{
return "gif";
}
else if (format == ImageFormat.Jpeg)
{
return "jpeg";
}
else if (format == ImageFormat.Png)
{
return "png";
}
else if (format == ImageFormat.Tiff)
{
return "tiff";
}
else if (format == ImageFormat.Icon)
{
return "icon";
}
return "gif";
} /// <summary>
/// 只要请求的 URL 相同,则请求可以重用
/// </summary>
public bool IsReusable
{
get
{
return true;
}
}
}
}

看了下,高兴啊。。太好了,不知道你们看出问题来了没有,

问题代码就在

  case "img":
//binary = ResourceHelper.GetResourceContentAsBinary(resName);
//context.Response.OutputStream.Write(binary, 0, binary.Length);
//context.Response.ContentType = "image/" + GetImageFormat(resName); context.Response.WriteFile(context.Server.MapPath(String.Format("{0}/res/images/{1}", extjsBasePath, typeValue))); context.Response.ContentType = "image/" + GetImageFormat(typeValue);
break;

大家都应该知道 我们引用js或者css的时候经常会有../ 这样的路径,其实很简单,就是上级目录,

我们就利用这个../  把作者写的/res/images/给去掉  也就是变成路径

/res/images/../../web.config  

就这样我们就可以拿到web.config了,然后拼成完整的url:http://fineui.com/demo/res.axd?img=../../../../appboxpro/web.config&t=icon  浏览器输入

ok web.config就这样被拿下来了,,,当然,web.config都拿下了,其它也就都没什么可说的了,

今天就先到这吧。。。还得写文档,明天演示项目,注定又是一个无眠夜。。。

ASP.NET网站入侵第三波(fineui系统漏洞,可导致被拖库)的更多相关文章

  1. ASP.NET网站入侵第二波(LeaRun.信息化快速开发框架 已被笔者拿下)

    笔者小学文化,语言组织能力差,写的不通的地方请大家将就着看,不喜勿喷. 上篇我讲了如何在上传文件中入侵服务器,這次我们稍微多讲一点. 还是先讲下流程: 1.上传代码页面  我上传的是ashx页面. 2 ...

  2. 记一次ASP.NET网站的入侵和如何避免被入侵

    ASP.NET网站入侵第二波(LeaRun.信息化快速开发框架 已被笔者拿下) 详细介绍请看第二波 首先我要申明的是不是什么语言写出来的程序就不安全,而是得看写代码的人如何去写这个程序 前些日子我去客 ...

  3. 图文解说Win7系统机器上发布C#+ASP.NET网站

      1.     概述 在一台干净的Win7机器上发布ASP.NET网站需要准备的有: a)        .NET Framework 环境 b)        数据库 c)        IIS ...

  4. 在Windows系统搭建.NET Core环境并创建运行ASP.NET网站

    微软于6月27日在红帽DevNation峰会上 正式发布了.NET Core 1.0.ASP.NET 1.0和Entity Framework Core 1.0,其将全部支持Windows.OS X和 ...

  5. web安全普及:通俗易懂,如何让网站变得更安全?以实例来讲述网站入侵原理及防护。

    本篇以我自己的网站[http://www.1996v.com]为例来通俗易懂的讲述如何防止网站被入侵,如何让网站更安全. 要想足够安全,首先得知道其中的道理. 本文例子通俗易懂,从"破解网站 ...

  6. ASP.NET 开发必备知识点(1):如何让Asp.net网站运行在自定义的Web服务器上

    一.前言 大家都知道,在之前,我们Asp.net 的网站都只能部署在IIS上,并且IIS也只存在于Windows上,这样Asp.net开发的网站就难以做到跨平台.由于微软的各项技术的开源,所以微软自然 ...

  7. 搭建调用 WebService 的 ASP.NET 网站 (VS2010, C#)

    [系统环境]Windows 7 / 2008r2 [软件环境]Visual Studio 2010 [开发语言]C# [感谢]本文是在 <C#开发和调用Web Service> 一文的基础 ...

  8. 多年前写的一个ASP.NET网站管理系统,到现在有些公司在用

    多年前写的一个ASP.NET网站管理系统,到现在有些公司在用 今早上接到一个电话,自已多年前写的一个ASP.NET网站管理系统,一个公司在用,出了点问题, 第一点是惊奇,5,6年前的东东,手机号码换了 ...

  9. 64位Win7下运行ASP+Access网站的方法

    64位Win7下运行ASP+Access网站的方法 近日系统升级为WIN7 64位之后,突然发现原本运行正常的ASP+ACCESS网站无法正常连接数据库. 网上搜索多次,终于解决了问题,总结了几条经验 ...

随机推荐

  1. vue相关的 helloword示例

    <!DOCTYPE html><html> <head> <title></title> <script src="http ...

  2. ViewPager+Fragment再探:和TAB滑动条一起三者结合

    Fragment前篇: <Android Fragment初探:静态Fragment组成Activity> ViewPager前篇: <Android ViewPager初探:让页面 ...

  3. 如何在TFS中恢复系统默认查询”已指派给我”的设置(TFS 2013)

    故事是这样开始的,一天开发人员求助说,在浏览器中修改了系统默认的工作项查询"已指派给我"的后,发现这个查询每次都提示超时,并且没有办法恢复到初始的设置状态,因为出现超时提示以后,查 ...

  4. 使用::before和::after来完成尖角效果

    一.目标 目标完成下图效果: 二.完成 1.分析 在::before和::after伪元素的用法一文中有说到使用::befrore和::after可以完成一个六边形.这个案例是用一个#star-six ...

  5. ComboBox的联动

    窗体搭建: 实现功能: 加载年级下拉框 选中年级时加载出科目下拉框 加载年级下拉框: 第一步,在DAL层中写一个方法,检索所有的年级名称集合,返回的是泛型集合List<> public L ...

  6. Guava 是个风火轮之函数式编程(3)——表处理

    云栖社区> 博客列表> 正文 Guava 是个风火轮之函数式编程(3)--表处理 潘家邦 2016-01-26 13:19:21 浏览1062 评论0 java Guava 摘要: 早先学 ...

  7. 邮件页面为何只能Table写及注意事项

    编写HTML邮件与编写HTML页面有很大的不同.因为,各面向网民的主流邮箱都或多或少的会对它们接收到的HTML邮件在后台进行过滤.毫无疑问,JS代码是被严格过滤掉的,包括所有的事件监听 属性,如onc ...

  8. vijos1334 NASA的食物计划(二维费用的背包问题)

    背景 NASA(美国航空航天局)因为航天飞机的隔热瓦等其他安 全技术问题一直大伤脑筋,因此在各方压力下终止了航天 飞机的历史,但是此类事情会不会在以后发生,谁也无法 保证,在遇到这类航天问题时,解决方 ...

  9. 如何查看文件是dos格式还是unix格式的?

    一.背景 由于windows和linux对换行的标识不一样,不同系统的代码传递导致代码格式的改变中可能会带来程序无法正常编译通过的问题.因此根据一些编译的错误提示,可以定位到是文件格式的问题,要对程序 ...

  10. JavaScript Boolean 对象

    JavaScript Boolean 对象 Boolean 对象 Boolean 对象用于转换一个不是 Boolean 类型的值转换为 Boolean 类型值 (true 或者false). Bool ...