Rsync
CPTS Notes2 min read
CPTS Notes
- Foundations
- Enumeration with Nmap
- Passwords
- Wordlists
- Cracking
- Protected Files
- Spraying and Defaults
- Hunting (Windows)
- Hunting (Linux)
- Hunting (Shares)
- Hunting (Traffic)
- Looting (Windows)
- Looting (Linux)
- File Services
- FTP
- SMB
- NFS
- Rsync
- Network
- DNS
- SNMP
- SMTP
- Mail Retrieval
- Cloud Mail
- Databases
- MySQL
- MSSQL
- Remote Access
- SSH
- R-Services
- RDP
- WinRM
- WMI
- Linux
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- File Transfer
- Choosing a Method
- Serving Files
- Windows Transfers
- Linux Transfers
- Code One-Liners
- Session Transfers
- Protected Transfers
- Detection & Evasion
- Windows
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- Reference
- Port References
- DNS Resolution
- The Mail Pipeline
- SMB & NetBIOS
TL;DR
Rsync. Fast file copy and sync, local or remote, using a delta-transfer algorithm. TCP 873 as a standalone daemon, or tunneled over SSH. Admins use it for backups and mirrors, so it holds useful files.
First checks: the modules (shares) it exposes, and whether they list and read without authentication.
Enumeration
List the modules.
nmap -sV -p873 -oA scans/rsync $TARGET # version of the rsync daemonrsync rsync://$TARGET/ # list the modulesMany modules allow anonymous listing.
List a module’s contents.
rsync -av --list-only rsync://$TARGET/<module> # list the files without downloading-av is archive and verbose.
Common misconfigurations
- Anonymous read of a module.
- Anonymous write to a module.
- A module exposing home directories or
.sshkeys. - No authentication on a backup share.
Attack playbook
Rsync is a file share. Pull what it holds.
- Download a module. Search the files for credentials, SSH keys, and configs.
rsync -av rsync://$TARGET/<module> ./loot # download the module to ./loot
- Reuse what you find. Keys and passwords from a backup share often open SSH or another service.
- Write if allowed. A writable module mapped to a web root or a
.sshdirectory takes a payload or a key. - Over SSH. When rsync runs on top of SSH, add
-e ssh(or-e "ssh -p2222"for a non-standard port) and credentials.
Practice boxes
| Box | Difficulty | Rsync’s role |
|---|---|---|
| Synced | Starting Point | Anonymous rsync module: list it and pull the flag. |
Rsync is a backup share. The win is reading files, often SSH keys, that open another service.