对ASP.NET的最新安全漏洞的跟进说明

今天看新闻,看见了关于ASP.NET的安全漏洞,内容大致是:黑客可以下载ASP.NET网站的核心文件(WEB.CONFIG),我估计还可以下载任意文件,例如数据库。

这个BUG基本上是致命的,可是博客园的描述却非常的少,我看了半天也没有明白什么意思,如何攻击,于是挖掘下去。现在把一些明细写出来。

微软原文:

http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx

黑客如何发起攻击:

To understand how this vulnerability works, you need to know about cryptographic oracles. An oracle in the context of cryptography is a system which provides hints as you ask it questions. In this case, there is a vulnerability in ASP.NET which acts as a padding oracle. This allows an attacker to send cipher text to the web server and learn if it was decrypted properly by examining which error code was returned by the web server. By making many such requests (and watching what errors are returned) the attacker can learn enough to successfully decrypt the rest of the cipher text.

大致意思是关于 cryptographic oracle. 黑客通过不断重复发送信息,检测返回的错误信息,然后了解加密算法,最后实现攻击。可是这段话还是没有明白,于是继续搜索:

http://visualstudiomagazine.com/articles/2010/09/14/aspnet-security-hack.aspx

这篇文章说明了大致的攻击流程。由于这个问题影响非常大,我就不翻译中文了,只是简单概述一下:

they can repeatedly modify an ASP.NET Forms Authentication cookie encrypted using AES and, by examining the errors returned, determine the Machine Key used to encrypt the cookie. The process is claimed to be 100 percent reliable and takes between 30 and 50 minutes for any site.

2个研究员发现,通过一个工具,能够 修改被AES加密过的 ASP.NET窗体验证cookie;然后检查返回错误信息;获取Machine Key。这个过程100%成功而且只需要30分钟。

Once the Machine Key is determined, attackers can create bogus forms authentication cookies. If site designers have chosen the option to embed role information in the security cookie, then attackers could arbitrarily assign themselves to administrator roles. This exposure also affects other membership provider features, spoofing protection on the ViewState, and encrypted information that might be stored in cookies or otherwise be made available at the client.

一旦machine key被破解出来了,黑客就能够模拟出验证 cookie。如果网站设计者启动了选项,让安全信息放入 security cookie,那么攻击者就能够获取了 管理员权限。 包含的影响范围包括:membership provider, viewstate, 保存在security cookie里面的所有信息。

While the exposure is both wide and immediate, the fix is simple. The hack exploits a bug in .NET’s implementation of AES encryption. The solution is to switch to one of the other encryption mechanisms — to 3DES, for instance. Since encryption for the membership and roles providers is handled by ASP.NET, no modification of existing code should be required for Forms Authentication.

这个bug源于AES加密算法中的一个bug。因此解决方案就是:使用DES(后来被验证是错误的解决方案)。

第一部分小结

问题的关键字包括:

security cookie, ASP.NET Forms Authentication cookie, Machine Key,role information in the security cookie.
  
大概意思就是,启动了asp.net的验证,并且启动了使用AES加密算法保存敏感信息在验证框架的cookie中后,黑客能够获取machinekey,然后获得管理员权限。

现在问题就是,具体是asp.net中什么操作、部署、框架会受到这个影响。于是我进一步搜索。

攻击方式:padded oracle attack

文章下载地址:http://usenix.org/events/woot10/tech/full_papers/Rizzo.pdf

具体我没有太明白,也不知道和oracle是什么关系。不过有个回复说的比较详细:

Before worrying too much, go to http://usenix.org/events/woot10/tech/full_papers/Rizzo.pdf and read the original paper from Rizzo and Duong (May 25th, 2010). The “padded oracle attack” relies on a chaining block cypher (common) but also requires the “oracle”. As some have correctly pointed out above, we need to have ASP.NET (or Java since this is not unique to .NET) return the padding error exception. Without that information, the exploit doesn’t work. By default, this exception information is not reported by ASP.NET and this is configurable behavior for Java. If you go to the aforementioned link, I think you’ll find more interesting reading related to cracking CAPTCHA using this exploit. However, that too requires cooperation from the web site. It’s great learning about exploits and even a little fun but the media sure scares a lot of people (and scares up a lot of clicks) by providing this hyperbole. One guy above said he was happy he used Java. Read the PDF above and you will find Rizzo and Duong found the

problem with Java (JSF but also Ruby on Rails) and then turned to see if the same exploit would work with ASP.NET. Technically, it is an exploit but if it doesn’t happen with properly configured servers (or the default ASP.NET configuration), it’s much ado about nothing.

大致意思是,这个问题不仅仅存在在asp.net,而且还有java等。技术上,如果使用了asp.net的默认配置,是不需要担心的(所谓默认配置,就是新建一个asp.net项目的配置,没有做任何修改)

窗体验证:Asp.net Form Authentication:

http://www.codeproject.com/KB/aspnet/Forms_Auth_Internals.aspx

这次受影响的,主要是因为启动了asp.net的权限框架,就是这个所谓的窗体验证。 这个窗体验证的原理在上面的连接给出了。

全文小结

浏览了很多页面,浪费了1个小时,终于有点头绪。

问题在于如果用户使用了微软提供的窗体验证框架,就会出现安全漏洞,被黑客破解了保存安全信息的算法(machine key), 然后获取了管理员权限,下载服务器的文件。

如果整个权限框架是自己写的,那么就不需要担心了。

幸好,本人所有项目代码、框架代码都是自己写的

【编辑推荐】

  1. ASP常见的安全漏洞
  2. 利用ASP.NET的内置功能抵御Web攻击

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/130705.html<

(0)
运维的头像运维
上一篇2025-02-26 05:08
下一篇 2025-02-26 05:10

相关推荐

  • 个人主题怎么制作?

    制作个人主题是一个将个人风格、兴趣或专业领域转化为视觉化或结构化内容的过程,无论是用于个人博客、作品集、社交媒体账号还是品牌形象,核心都是围绕“个人特色”展开,以下从定位、内容规划、视觉设计、技术实现四个维度,详细拆解制作个人主题的完整流程,明确主题定位:找到个人特色的核心主题定位是所有工作的起点,需要先回答……

    2025-11-20
    0
  • 社群营销管理关键是什么?

    社群营销的核心在于通过建立有温度、有价值、有归属感的社群,实现用户留存、转化和品牌传播,其管理需贯穿“目标定位-内容运营-用户互动-数据驱动-风险控制”全流程,以下从五个维度展开详细说明:明确社群定位与目标社群管理的首要任务是精准定位,需明确社群的核心价值(如行业交流、产品使用指导、兴趣分享等)、目标用户画像……

    2025-11-20
    0
  • 香港公司网站备案需要什么材料?

    香港公司进行网站备案是一个涉及多部门协调、流程相对严谨的过程,尤其需兼顾中国内地与香港两地的监管要求,由于香港公司注册地与中国内地不同,其网站若主要服务内地用户或使用内地服务器,需根据服务器位置、网站内容性质等,选择对应的备案路径(如工信部ICP备案或公安备案),以下从备案主体资格、流程步骤、材料准备、注意事项……

    2025-11-20
    0
  • 如何企业上云推广

    企业上云已成为数字化转型的核心战略,但推广过程中需结合行业特性、企业痛点与市场需求,构建系统性、多维度的推广体系,以下从市场定位、策略设计、执行落地及效果优化四个维度,详细拆解企业上云推广的实践路径,精准定位:明确目标企业与核心价值企业上云并非“一刀切”的方案,需先锁定目标客户群体,提炼差异化价值主张,客户分层……

    2025-11-20
    0
  • PS设计搜索框的实用技巧有哪些?

    在PS中设计一个美观且功能性的搜索框需要结合创意构思、视觉设计和用户体验考量,以下从设计思路、制作步骤、细节优化及交互预览等方面详细说明,帮助打造符合需求的搜索框,设计前的规划明确使用场景:根据网站或APP的整体风格确定搜索框的调性,例如极简风适合细线条和纯色,科技感适合渐变和发光效果,电商类则可能需要突出搜索……

    2025-11-20
    0

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注