repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
873-pentesting-rsync.mdMarkdown112 lines4.7 KiBrendered raw download
---
title: "873 - Pentesting Rsync"
section: "Network Services"
sectionSlug: "network-services-pentesting"
sourcePath: "src/network-services-pentesting/873-pentesting-rsync.md"
sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/873-pentesting-rsync.md"
sha: "188de82beb54e70956b2952367a0af91d26758b8"
isIndex: false
modified: true
license: "CC-BY-NC-4.0"
---

# 873 - Pentesting Rsync

## **Basic Information**

`rsync` synchronizes files locally, over a remote shell such as SSH, or through the rsync daemon protocol. Its delta-transfer algorithm can reduce network traffic, while options control compression, recursion, and which metadata is preserved.<sup>[[2]](#references)</sup>

The earlier zlib and `stunnel` details remain operationally relevant. With `--compress`, current rsync versions can negotiate `zstd`, `lz4`, `zlibx`, or `zlib`; an older peer is normally assumed to support zlib. A direct rsync-daemon connection is not automatically encrypted: use the remote-shell form over SSH or a correctly authenticated TLS wrapper such as `rsync-ssl`/`stunnel` when confidentiality and server identity are required.<sup>[[2]](#references)[[4]](#references)</sup>

**Default port:** 873

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

## Enumeration

### Banner & Manual communication

```bash
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:<sup>[[1]](#references)</sup>

```bash
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
```

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.

### [**Brute Force**](https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/generic-hacking/brute-force.md#rsync)

### 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:

```bash
# 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
```

With `-a`, this process recursively transfers files and requests archive-mode metadata preservation. Actual ownership, ACL, xattr, device, and permission behavior depends on additional options and privileges.<sup>[[1]](#references)[[2]](#references)</sup>

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

```bash
rsync -av --list-only rsync://username@192.168.0.123/shared_name
rsync -av rsync://username@192.168.0.123:8730/shared_name ./rsyn_shared
```

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

```bash
rsync -av home_user/.ssh/ rsync://username@192.168.0.123/home_user/.ssh
```

## POST

To locate the rsyncd configuration file, execute:

```bash
find /etc \( -name rsyncd.conf -o -name rsyncd.secrets \)
```

Within this file, a `secrets file` parameter might point to a file containing **usernames and passwords** for rsyncd authentication. Module options also control listing, read/write access, path confinement, and allowed hosts.<sup>[[3]](#references)</sup>

## References

- [1] [Pentesting Rsync - SmeegeSec](https://www.smeegesec.com/2016/12/pentesting-rsync.html)
- [2] [rsync project — `rsync(1)` manual](https://download.samba.org/pub/rsync/rsync.1)
- [3] [rsync project — `rsyncd.conf(5)` manual](https://download.samba.org/pub/rsync/rsyncd.conf.5)
- [4] [rsync project — `rsync-ssl(1)` manual](https://download.samba.org/pub/rsync/rsync-ssl.1)