对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), 然后获取了管理员权限,下载服务器的文件。

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

幸好,我的所有项目代码、框架代码都是自己写的。哈哈哈!


后续补充
--------------------------------------

http://tech.ddvip.com/2008-12/1230195492102937.html

这篇文章是08年发的,非常详细的说明了asp.net的窗体验证中存在的严重安全漏洞。希望各位有时间好好看下。主要是微软的加密算法脑残了,导致黑客容易复制一个验证cookie。

我们的最新动态 (Bamboo@pixysoft.net)

    *1.ORM技术升级到第四代.使用动态编译技术.全面提升性能.[2010-9-11]
    *2.Reflection反射框架全面优化.进入第四代技术.性能提升2倍~10倍...[2010-8-29]
    *3.日志框架全面升级到第二代.支持模块日志记录.[2010-8-24]

在电子设计自动化(EDA)领域,Verilog HDL 是一种重要的硬件描述语言,广泛应用于数字系统的设计,尤其是在嵌入式系统、FPGA 设计以及数字电路教学中。本文将探讨如何利用 Verilog HDL 实现一个 16×16 点阵字符显示功能。16×16 点阵显示器由 16 行和 16 列的像素组成,共需 256 个二进制位来控制每个像素的亮灭,常用于简单字符或图形显示。 要实现这一功能,首先需要掌握基本的逻辑门(如与门、或门、非门、与非门、或非门等)和组合逻辑电路,以及寄存器和计数器等时序逻辑电路。设计的核心是构建一个模块,该模块接收字符输入(如 ASCII 码),将其换为 16×16 的二进制位流,进而驱动点阵的 LED 灯。具体而言,该模块包含以下部分:一是输入接口,通常为 8 位的 ASCII 码输入,用于指定要显示的字符;二是内部存储,用于存储字符对应的 16×16 点阵数据,可采用寄存器或分布式 RAM 实现;三是行列驱动逻辑,将点阵数据换为驱动 LED 矩阵的信号,包含 16 个行输出线和 16 个列使能信号,按特定顺序选通点亮对应 LED;四是时序控制,通过计数器逐行扫描,按顺序控制每行点亮;五是复用逻辑(可选),若点阵支持多颜色或亮度等级,则需额外逻辑控制像素状态。 设计过程中,需用 Verilog 代码描述上述逻辑,并借助仿真工具验证功能,确保能正确将输入字符换为点阵显示。之后将设计综合到目标 FPGA 架构,通过配置 FPGA 实现硬件功能。实际项目中,“led_lattice”文件可能包含 Verilog 源代码、测试平台文件、配置文件及仿真结果。其中,测试平台用于模拟输入、检查输出,验证设计正确性。掌握 Verilog HDL 实现 16×16 点阵字符显示,涉及硬件描述语言基础、数字逻辑设计、字符编码和 FPGA 编程等多方面知识,是学习
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值