Win7之家( m.airtaxifl.com):對ASP.NET的最新安全漏洞的跟進說明
今天看新聞,看見了關(guān)于ASP.NET的安全漏洞,內(nèi)容大致是:黑客可以下載ASP.NET網(wǎng)站的核心文件(WEB.CONFIG),我估計還可以下載任意文件,例如數(shù)據(jù)庫。
這個BUG基本上是致命的,可是博客園的描述卻非常的少,我看了半天也沒有明白什么意思,如何攻擊,于是挖掘下去,F(xiàn)在把一些明細(xì)寫出來。
微軟原文:
http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx
黑客如何發(fā)起攻擊:
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.
大致意思是關(guān)于 cryptographic oracle. 黑客通過不斷重復(fù)發(fā)送信息,檢測返回的錯誤信息,然后了解加密算法,最后實現(xiàn)攻擊?墒沁@段話還是沒有明白,于是繼續(xù)搜索:
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個研究員發(fā)現(xiàn),通過一個工具,能夠 修改被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。如果網(wǎng)站設(shè)計者啟動了選項,讓安全信息放入 security cookie,那么攻擊者就能夠獲取了 管理員權(quán)限。 包含的影響范圍包括: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(后來被驗證是錯誤的解決方案)。
第一部分小結(jié)
--------------------
問題的關(guān)鍵字包括:
security cookie, ASP.NET Forms Authentication cookie, Machine Key,role information in the security cookie.
大概意思就是,啟動了asp.net的驗證,并且啟動了使用AES加密算法保存敏感信息在驗證框架的cookie中后,黑客能夠獲取machinekey,然后獲得管理員權(quán)限。
現(xiàn)在問題就是,具體是asp.net中什么操作、部署、框架會受到這個影響。于是我進一步搜索。
攻擊方式:padded oracle attack
---------------------------------------
文章下載地址:http://usenix.org/events/woot10/tech/full_papers/Rizzo.pdf
具體我沒有太明白,也不知道和oracle是什么關(guān)系。不過有個回復(fù)說的比較詳細(xì):
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等。技術(shù)上,如果使用了asp.net的默認(rèn)配置,是不需要擔(dān)心的(所謂默認(rèn)配置,就是新建一個asp.net項目的配置,沒有做任何修改)。
窗體驗證:Asp.net Form Authentication:
--------------------------------------------------
http://www.codeproject.com/KB/aspnet/Forms_Auth_Internals.aspx
這次受影響的,主要是因為啟動了asp.net的權(quán)限框架,就是這個所謂的窗體驗證。 這個窗體驗證的原理在上面的連接給出了。
全文小結(jié)
------------------------------------
瀏覽了很多頁面,浪費了1個小時,終于有點頭緒。
問題在于如果用戶使用了微軟提供的窗體驗證框架,就會出現(xiàn)安全漏洞,被黑客破解了保存安全信息的算法(machine key), 然后獲取了管理員權(quán)限,下載服務(wù)器的文件。
如果整個權(quán)限框架是自己寫的,那么就不需要擔(dān)心了。
幸好,本人所有項目代碼、框架代碼都是自己寫的。
---文章來源eNet
評論列表
查看所有 條評論