githubEdit

873 - Pentesting Rsync

circle-check

Basic Information

From wikipediaarrow-up-right:

rsync is a utility for efficiently transferringarrow-up-right and synchronizingarrow-up-right filesarrow-up-right between a computer and an external hard drive and across networkedarrow-up-right computersarrow-up-right by comparing the modification timesarrow-up-rightand sizes of files.[3]arrow-up-right It is commonly found on Unix-likearrow-up-right operating systemsarrow-up-right. The rsync algorithm is a type of delta encodingarrow-up-right, and is used for minimizing network usage. Zlibarrow-up-right may be used for additional data compressionarrow-up-right,[3]arrow-up-right and SSHarrow-up-right or stunnelarrow-up-right can be used for security.

Default port: 873

PORT    STATE SERVICE REASON
873/tcp open  rsync   syn-ack

Enumeration

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

Enumerating Shared Folders

Rsync modules are recognized as directory shares that might be protected with passwords. To identify available modules and check if they require passwords, the following commands are used:

Be aware that some shares might not appear in the list, possibly hiding them. Additionally, accessing some shares might be restricted to specific credentials, indicated by an "Access Denied" message.

Manual Rsync Usage

Upon obtaining a module list, actions depend on whether authentication is needed. Without authentication, listing and copying files from a shared folder to a local directory is achieved through:

This process recursively transfers files, preserving their attributes and permissions.

With credentials, listing and downloading from a shared folder can be done as follows, where a password prompt will appear:

To upload content, such as an authorized_keys file for access, use:

POST

To locate the rsyncd configuration file, execute:

Within this file, a secrets file parameter might point to a file containing usernames and passwords for rsyncd authentication.

References

circle-check

Last updated