~/service-rsync

Rsync

CPTS Notes2 min read

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 daemon
rsync rsync://$TARGET/ # list the modules

Many 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 .ssh keys.
  • No authentication on a backup share.

Attack playbook

Rsync is a file share. Pull what it holds.

  1. Download a module. Search the files for credentials, SSH keys, and configs.
    rsync -av rsync://$TARGET/<module> ./loot # download the module to ./loot
  2. Reuse what you find. Keys and passwords from a backup share often open SSH or another service.
  3. Write if allowed. A writable module mapped to a web root or a .ssh directory takes a payload or a key.
  4. 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.