List Rsync Modules - Metasploit


This page contains detailed information about how to use the auxiliary/scanner/rsync/modules_list metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: List Rsync Modules
Module: auxiliary/scanner/rsync/modules_list
Source code: modules/auxiliary/scanner/rsync/modules_list.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: -
Target network port(s): 873
List of CVEs: -

An rsync module is essentially a directory share. These modules can optionally be protected by a password. This module connects to and negotiates with an rsync server, lists the available modules and, optionally, determines if the module requires a password to access.

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/rsync/modules_list
msf auxiliary(modules_list) > show options
    ... show and set options ...
msf auxiliary(modules_list) > set RHOSTS ip-range
msf auxiliary(modules_list) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(modules_list) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(modules_list) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(modules_list) > 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


An rsync module is essentially a directory share. These modules can optionally be protected by a password. This module connects to and negotiates with an rsync server, lists the available modules and, optionally, determines if the module requires a password to access.

Vulnerable Application


Configuring rsync on Kali Linux:

Rsync is installed by default on Kali, however we need to configure some modules for the scanner to find. Step three will create the secrets files which we'll use to test the authentication mechanism. Much of this is based on the guide from atlantic.net.

  1. mkdir /home/public_rsync2; mkdir /home/public_rsync3; mkdir /home/public_rsync
  2. Create the configuration file:

    echo -n "[read only files]
    path = /home/public_rsync
    comment = Files are read only
    read only = true
    timeout = 300
    
    [writable]
    path = /home/public_rsync2
    comment = Files can be written to
    read only = false
    timeout = 300
    
    [authenticated]
    path = /home/public_rsync3
    comment = Files require authentication
    read only = true
    timeout = 300
    auth users = rsync1,rsync2
    secrets file = /etc/rsyncd.secrets
    " > /etc/rsyncd.conf
    
  3. echo -n "rsync1:9$AZv2%5D29S740k rsync2:Xyb#vbfUQR0og0$6 rsync3:VU&A1We5DEa8M6^8" > /etc/rsyncd.secrets

  4. chmod 600 /etc/rsyncd.secrets

  5. rsync --daemon

Verification Steps


  1. Do: use auxiliary/scanner/rsync/modules_list
  2. Do: set rhosts [ips]
  3. Do: run

Options


TEST_AUTHENTICATION

Connect to each share and test if authentication is required.

VERBOSE

When set to false, each module will be listed. When set to true each module will be listed, then a summary table will also be printed including if authentication is required, and any module comments. false is the default value.

Scenarios


rsyncd on Kali (using above config)

With verbose set to false:

  msf5 > use auxiliary/scanner/rsync/modules_list
  msf5 auxiliary(scanner/rsync/modules_list) > set rhosts 10.168.202.216
  rhosts => 10.168.202.216
  msf5 auxiliary(scanner/rsync/modules_list) > run

  [+] 10.168.202.216:873    - 3 rsync modules found: read only files, writable, authenticated

With verbose set to true:

  msf5 > use auxiliary/scanner/rsync/modules_list
  msf5 auxiliary(scanner/rsync/modules_list) > set rhosts 10.168.202.216
  rhosts => 10.168.202.216
  msf5 auxiliary(scanner/rsync/modules_list) > set verbose true
  verbose => true
  msf5 auxiliary(scanner/rsync/modules_list) > run

  [+] 10.168.202.216:873    - 3 rsync modules found: read only files, writable, authenticated

  rsync modules for 10.168.202.216:873   
  =======================================

     Name             Comment                       Authentication
     ----             -------                       --------------
     authenticated    Files require authentication  required
     read only files  Files are read only           not required
     writable         Files can be written to       not required

Confirming


nmap

# nmap -p 873 -sV -script=rsync-list-modules 10.168.202.216
Starting Nmap 7.70 ( https://nmap.org ) at 2018-07-12 16:32 EDT
Nmap scan report for 10.168.202.216
Host is up (0.000045s latency).

PORT    STATE SERVICE VERSION
873/tcp open  rsync   (protocol version 31)
| rsync-list-modules: 
|   read only files Files are read only
|   writable        Files can be written to
|_  authenticated   Files require authentication

Go back to menu.

Msfconsole Usage


Here is how the scanner/rsync/modules_list auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/rsync/modules_list

msf6 auxiliary(scanner/rsync/modules_list) > show info

       Name: List Rsync Modules
     Module: auxiliary/scanner/rsync/modules_list
    License: Metasploit Framework License (BSD)
       Rank: Normal

Provided by:
  ikkini
  Jon Hart <[email protected]>
  Nixawk

Check supported:
  No

Basic options:
  Name                 Current Setting  Required  Description
  ----                 ---------------  --------  -----------
  RHOSTS                                yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT                873              yes       The target port (TCP)
  TEST_AUTHENTICATION  true             yes       Test if the rsync module requires authentication
  THREADS              1                yes       The number of concurrent threads (max one per host)

Description:
  An rsync module is essentially a directory share. These modules can 
  optionally be protected by a password. This module connects to and 
  negotiates with an rsync server, lists the available modules and, 
  optionally, determines if the module requires a password to access.

References:
  http://rsync.samba.org/ftp/rsync/rsync.html

Module Options


This is a complete list of options available in the scanner/rsync/modules_list auxiliary module:

msf6 auxiliary(scanner/rsync/modules_list) > show options

Module options (auxiliary/scanner/rsync/modules_list):

   Name                 Current Setting  Required  Description
   ----                 ---------------  --------  -----------
   RHOSTS                                yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT                873              yes       The target port (TCP)
   TEST_AUTHENTICATION  true             yes       Test if the rsync module requires authentication
   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/rsync/modules_list auxiliary module:

msf6 auxiliary(scanner/rsync/modules_list) > show advanced

Module advanced options (auxiliary/scanner/rsync/modules_list):

   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][...]
   READ_TIMEOUT         2                yes       Seconds to wait while reading rsync responses
   SHOW_MOTD            false            yes       Show the rsync motd, if found
   SHOW_VERSION         false            yes       Show the rsync version
   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/rsync/modules_list module can do:

msf6 auxiliary(scanner/rsync/modules_list) > show actions

Auxiliary actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the scanner/rsync/modules_list auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(scanner/rsync/modules_list) > 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.

unexpected response when connecting to <RMODULE>: <RES>


Here is a relevant code snippet related to the "unexpected response when connecting to <RMODULE>: <RES>" error message:

66:	      if res =~ /^#{RSYNC_HEADER} AUTHREQD \S+$/
67:	        'required'
68:	      elsif res =~ /^#{RSYNC_HEADER} OK$/
69:	        'not required'
70:	      else
71:	        vprint_error("unexpected response when connecting to #{rmodule}: #{res}")
72:	        "unexpected response '#{res}'"
73:	      end
74:	    else
75:	      vprint_error("no response when connecting to #{rmodule}")
76:	      'no response'

no response when connecting to <RMODULE>


Here is a relevant code snippet related to the "no response when connecting to <RMODULE>" error message:

70:	      else
71:	        vprint_error("unexpected response when connecting to #{rmodule}: #{res}")
72:	        "unexpected response '#{res}'"
73:	      end
74:	    else
75:	      vprint_error("no response when connecting to #{rmodule}")
76:	      'no response'
77:	    end
78:	  end
79:	
80:	  def rsync_list

no rsync negotiation found


Here is a relevant code snippet related to the "no rsync negotiation found" error message:

112:	        sock.puts("#{RSYNC_HEADER} #{version}\n")
113:	      end
114:	    end
115:	
116:	    unless version
117:	      vprint_error("no rsync negotiation found")
118:	      return
119:	    end
120:	
121:	    _, post_neg_data_lines = rsync_parse_lines(sock.get_once(-1, read_timeout))
122:	    motd_lines = greeting_data_lines + post_neg_data_lines

does not appear to be rsync


Here is a relevant code snippet related to the "does not appear to be rsync" error message:

145:	  def run_host(ip)
146:	    begin
147:	      connect
148:	      version, motd = rsync_negotiate
149:	      unless version
150:	        vprint_error("does not appear to be rsync")
151:	        disconnect
152:	        return
153:	      end
154:	    rescue *HANDLED_EXCEPTIONS => e
155:	      vprint_error("error while connecting and negotiating: #{e}")

error while connecting and negotiating: <E>


Here is a relevant code snippet related to the "error while connecting and negotiating: <E>" error message:

150:	        vprint_error("does not appear to be rsync")
151:	        disconnect
152:	        return
153:	      end
154:	    rescue *HANDLED_EXCEPTIONS => e
155:	      vprint_error("error while connecting and negotiating: #{e}")
156:	      disconnect
157:	      return
158:	    end
159:	
160:	    info = "rsync protocol version #{version}"

Error while listing modules: <E>


Here is a relevant code snippet related to the "Error while listing modules: <E>" error message:

171:	
172:	    modules_metadata = {}
173:	    begin
174:	      modules_metadata = rsync_list
175:	    rescue *HANDLED_EXCEPTIONS => e
176:	      vprint_error("Error while listing modules: #{e}")
177:	      return
178:	    ensure
179:	      disconnect
180:	    end
181:	

no rsync modules found


Here is a relevant code snippet related to the "no rsync modules found" error message:

178:	    ensure
179:	      disconnect
180:	    end
181:	
182:	    if modules_metadata.empty?
183:	      print_status("no rsync modules found")
184:	    else
185:	      modules = modules_metadata.map { |m| m[:name] }
186:	      print_good("#{modules.size} rsync modules found: #{modules.join(', ')}")
187:	
188:	      table_columns = %w(Name Comment)

error while testing authentication on <MODULE_METADATA:NAME>: <E>


Here is a relevant code snippet related to the "error while testing authentication on <MODULE_METADATA:NAME>: <E>" error message:

192:	          begin
193:	            connect
194:	            rsync_negotiate
195:	            module_metadata[:authentication] = get_rsync_auth_status(module_metadata[:name])
196:	          rescue *HANDLED_EXCEPTIONS => e
197:	            vprint_error("error while testing authentication on #{module_metadata[:name]}: #{e}")
198:	            break
199:	          ensure
200:	            disconnect
201:	          end
202:	        end

READ_TIMEOUT must be > 0


Here is a relevant code snippet related to the "READ_TIMEOUT must be > 0" error message:

217:	        port: rport,
218:	        type: 'rsync_modules',
219:	        data: { modules: modules_metadata }
220:	      )
221:	    end
222:	  end
223:	
224:	  def setup
225:	    fail_with(Failure::BadConfig, 'READ_TIMEOUT must be > 0') if read_timeout <= 0
226:	  end
227:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • ikkini
  • Jon Hart <jon_hart[at]rapid7.com>
  • Nixawk

Version


This page has been produced using Metasploit Framework version 6.1.27-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.