Skip to content

Commit 40f5814

Browse files
committed
Land rapid7#3570, @ikkini scanner for rsync
2 parents b4e3ce0 + 9fb9ab8 commit 40f5814

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
##
2+
# This module requires Metasploit: http//metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core'
7+
8+
class Metasploit3 < Msf::Auxiliary
9+
10+
include Msf::Exploit::Remote::Tcp
11+
include Msf::Auxiliary::Scanner
12+
include Msf::Auxiliary::Report
13+
14+
def initialize
15+
super(
16+
'Name' => 'Rsync Unauthenticated List Command',
17+
'Description' => 'List all (listable) modules from a rsync daemon',
18+
'Author' => 'ikkini',
19+
'References' =>
20+
[
21+
['URL', 'http://rsync.samba.org/ftp/rsync/rsync.html']
22+
],
23+
'License' => MSF_LICENSE
24+
)
25+
register_options(
26+
[
27+
Opt::RPORT(873)
28+
], self.class)
29+
end
30+
31+
def run_host(ip)
32+
connect
33+
version = sock.get_once
34+
35+
print_good("#{ip}:#{rport} - rsync #{version.strip} found")
36+
report_service(:host => ip, :port => rport, :proto => 'tcp', :name => 'rsync')
37+
report_note(
38+
:host => ip,
39+
:proto => 'tcp',
40+
:port => rport,
41+
:type => 'rsync_version',
42+
:data => version.strip
43+
)
44+
45+
# making sure we match the version of the server
46+
sock.puts("#{version}")
47+
# the listing command
48+
sock.puts("\n")
49+
listing = sock.get(20)
50+
disconnect
51+
52+
return if listing.blank?
53+
54+
print_good("#{ip}:#{rport} - rsync listing found")
55+
listing.gsub!('@RSYNCD: EXIT', '') # not interested in EXIT message
56+
listing_sanitized = Rex::Text.to_hex_ascii(listing.strip)
57+
58+
vprint_status("#{ip}:#{rport} - #{version.rstrip} #{listing_sanitized}")
59+
report_note(
60+
:host => ip,
61+
:proto => 'tcp',
62+
:port => rport,
63+
:type => 'rsync_listing',
64+
:data => listing_sanitized
65+
)
66+
end
67+
end

0 commit comments

Comments
 (0)