首页 -> 安全研究

安全研究

安全漏洞
.NET Framework ASP.NET Padding Oracle攻击信息泄露漏洞(MS10-070)

发布日期:2010-09-17
更新日期:2010-09-19

受影响系统:
Microsoft .NET Framework 4.0
Microsoft .NET Framework 3.5 SP1
Microsoft .NET Framework 3.5
Microsoft .NET Framework 2.0 SP2
Microsoft .NET Framework 1.0 SP3
描述:
BUGTRAQ  ID: 43316
CVE ID: CVE-2010-3332

Microsoft .NET Framework是一个流行的软件开发工具包。

使用.NET Framework所编译的ASP.Net应用中没有正确地实现加密,攻击者可以解密并篡改敏感数据。

如果要理解这个漏洞,首先要了解加密系统中的提示机制,当你提出问题时提示机制会给出某种形式的答案。此漏洞涉及到ASP.NET对加密信息中填充数据的提示,攻击者可以通过向Web服务器发送特定的密文文本,然后通过检查所返回的出错代码来判断数据是否被正确解密。通过反复上述操作,攻击者就可以收集到足够的信息用来解密剩余部分的密文文本。

成功利用这个漏洞的攻击者可以查看目标服务器上加密的数据,如View State字段中包含的加密信息,在高版本的ASP.NET框架中读取目标服务器上的ASP.NET应用文件,比如web.config。


<*来源:Juliano Rizzo
        Thai Duong
  
  链接:http://www.microsoft.com/technet/security/advisory/2416728.mspx?pf=true
        http://blogs.technet.com/b/srd/archive/2010/09/17/understanding-the-asp-net-vulnerability.aspx
        http://secunia.com/advisories/41409/
        http://www.microsoft.com/technet/security/bulletin/MS10-070.asp
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

http://netifera.com/download/poet/poet-1.0.0-win32-x86.jar
http://www.exploit-db.com/download/15213
http://www.exploit-db.com/download/15292
http://www.exploit-db.com/download/15265

建议:
临时解决方法:

* 启用ASP.NET自定义错误并将所有的错误代码都映射到相同的出错页面。

如果ASP.NET应用中没有web.config文件:

对于.NET Framework 3.5 RTM

1. 在根目录中创建名为web.config的文本文件并注入以下内容:

<configuration>
<location allowOverride="false">
   <system.web>
     <customErrors mode="On" defaultRedirect="~/error.html" />
   </system.web>
</location>
</configuration>

2. 创建包含有通用出错消息的error.html文件并保存到根目录。

3. 或者,重新命名web.config文件中error.html文件指向已有的出错页面,但该页面必须显示通用内容。

对于.NET Framework 3.5 Service Pack 1及之后版本

1. 在根目录中创建名为web.config的文本文件并注入以下内容:

<configuration>
<location allowOverride="false">
   <system.web>
     <customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/ErrorPage.aspx" />
   </system.web>
</location>
</configuration>

2. 如果擅长使用C#,推荐使用以下ErrorPage.aspx文件:

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Security.Cryptography" %>
<%@ Import Namespace="System.Threading" %>

<script runat="server">
        void Page_Load() {
        byte[] delay = new byte[1];
        RandomNumberGenerator prng = new RNGCryptoServiceProvider();

        prng.GetBytes(delay);
        Thread.Sleep((int)delay[0]);
        
        IDisposable disposable = prng as IDisposable;
        if (disposable != null) { disposable.Dispose(); }
    }
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <div>
        An error occurred while processing your request.
    </div>
</body>
</html>

3. 如果擅长使用Visual Basic .NET,推荐使用以下ErrorPage.aspx文件:

<%@ Page Language="VB" AutoEventWireup="true" %>
<%@ Import Namespace="System.Security.Cryptography" %>
<%@ Import Namespace="System.Threading" %>

<script runat="server">
    Sub Page_Load()
        Dim delay As Byte() = New Byte(0) {}
        Dim prng As RandomNumberGenerator = New RNGCryptoServiceProvider()
        
        prng.GetBytes(delay)
        Thread.Sleep(CType(delay(0), Integer))
        
        Dim disposable As IDisposable = TryCast(prng, IDisposable)
        If Not disposable Is Nothing Then
            disposable.Dispose()
        End If
    End Sub
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <div>
        An error occurred while processing your request.
    </div>
</body>
</html>

如果ASP.NET应用中已有web.config文件:

对于.NET Framework 3.5 RTM及之后版本

1. 在已有的web.config文件中插入以下内容:

<?xml version="1.0"?>
<configuration>
<configSections>
...
</configSections>
<appSettings>
...
</appSettings>
<connectionStrings>
...
</connectionStrings>

[<location allowOverride="false">
<system.web>
<customErrors mode="On" defaultRedirect="~/error.html" />
</system.web>
</location>]

<system.web>
...
</system.web>
<system.codedom>
...
</system.codedom>
</configuration>

2. 创建包含有通用出错消息的error.html文件并保存到根目录。

3. 或者,重新命名web.config文件中error.html文件指向已有的出错页面,但该页面必须显示通用内容。

对于.NET Framework 3.5 Service Pack 1及之后版本

1. 在根目录中创建名为web.config的文本文件并注入以下内容:

<?xml version="1.0"?>
<configuration>
<configSections>
...
</configSections>
<appSettings>
...
</appSettings>
<connectionStrings>
...
</connectionStrings>

[<location allowOverride="false">
<system.web>
<customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/ErrorPage.aspx" />
</system.web>
</location>]

</configuration>

<system.web>
...
</system.web>
<system.codedom>
...
</system.codedom>
</configuration>

2. 如果擅长使用C#,推荐使用以下ErrorPage.aspx文件:

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Security.Cryptography" %>
<%@ Import Namespace="System.Threading" %>

<script runat="server">
        void Page_Load() {
        byte[] delay = new byte[1];
        RandomNumberGenerator prng = new RNGCryptoServiceProvider();

        prng.GetBytes(delay);
        Thread.Sleep((int)delay[0]);
        
        IDisposable disposable = prng as IDisposable;
        if (disposable != null) { disposable.Dispose(); }
    }
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <div>
        An error occurred while processing your request.
    </div>
</body>
</html>

3. 如果擅长使用Visual Basic .NET,推荐使用以下ErrorPage.aspx文件:

<%@ Page Language="VB" AutoEventWireup="true" %>
<%@ Import Namespace="System.Security.Cryptography" %>
<%@ Import Namespace="System.Threading" %>

<script runat="server">
    Sub Page_Load()
        Dim delay As Byte() = New Byte(0) {}
        Dim prng As RandomNumberGenerator = New RNGCryptoServiceProvider()
        
        prng.GetBytes(delay)
        Thread.Sleep(CType(delay(0), Integer))
        
        Dim disposable As IDisposable = TryCast(prng, IDisposable)
        If Not disposable Is Nothing Then
            disposable.Dispose()
        End If
    End Sub
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <div>
        An error occurred while processing your request.
    </div>
</body>
</html>

厂商补丁:

Microsoft
---------
Microsoft已经为此发布了一个安全公告(MS10-070)以及相应补丁:
MS10-070:Vulnerability in ASP.NET Could Allow Information Disclosure (2418042)
链接:http://www.microsoft.com/technet/security/bulletin/MS10-070.asp

浏览次数:26505
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障