mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-26 22:52:06 +00:00
113 lines
6.3 KiB
Markdown
113 lines
6.3 KiB
Markdown
# 873 - Pentesting Rsync
|
|
|
|
{% hint style="success" %}
|
|
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
|
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
|
|
|
<details>
|
|
|
|
<summary>Support HackTricks</summary>
|
|
|
|
* 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.
|
|
|
|
</details>
|
|
{% endhint %}
|
|
|
|
## **Osnovne informacije**
|
|
|
|
From [wikipedia](https://en.wikipedia.org/wiki/Rsync):
|
|
|
|
> **rsync** je alat za efikasno [prenos](https://en.wikipedia.org/wiki/File\_transfer) i [sinhronizaciju](https://en.wikipedia.org/wiki/File\_synchronization) [fajlova](https://en.wikipedia.org/wiki/Computer\_file) između računara i eksternog hard diska i preko [umreženih](https://en.wikipedia.org/wiki/Computer\_network) [računara](https://en.wikipedia.org/wiki/Computer) upoređujući [vremena izmene](https://en.wikipedia.org/wiki/Timestamping\_\(computing\)) i veličine fajlova.[\[3\]](https://en.wikipedia.org/wiki/Rsync#cite\_note-man\_page-3) Obično se nalazi na [Unix-like](https://en.wikipedia.org/wiki/Unix-like) [operativnim sistemima](https://en.wikipedia.org/wiki/Operating\_system). Rsync algoritam je vrsta [delta kodiranja](https://en.wikipedia.org/wiki/Delta\_encoding) i koristi se za minimiziranje korišćenja mreže. [Zlib](https://en.wikipedia.org/wiki/Zlib) se može koristiti za dodatnu [kompresiju podataka](https://en.wikipedia.org/wiki/Data\_compression),[\[3\]](https://en.wikipedia.org/wiki/Rsync#cite\_note-man\_page-3) a [SSH](https://en.wikipedia.org/wiki/Secure\_Shell) ili [stunnel](https://en.wikipedia.org/wiki/Stunnel) mogu se koristiti za bezbednost.
|
|
|
|
**Podrazumevani port:** 873
|
|
```
|
|
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 moduli** se prepoznaju kao **deljene fascikle** koje mogu biti **zaštićene lozinkama**. Da bi se identifikovali dostupni moduli i proverilo da li zahtevaju lozinke, koriste se sledeće komande:
|
|
```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
|
|
```
|
|
Budite svesni da neki delovi možda neće biti prikazani na listi, što ih može sakriti. Pored toga, pristup nekim delovima može biti ograničen na specifične **credentials**, što je označeno porukom **"Access Denied"**.
|
|
|
|
### [**Brute Force**](../generic-methodologies-and-resources/brute-force.md#rsync)
|
|
|
|
### Ručna Rsync Upotreba
|
|
|
|
Nakon dobijanja **module list**, akcije zavise od toga da li je potrebna autentifikacija. Bez autentifikacije, **listing** i **copying** fajlova iz deljenog foldera u lokalni direktorijum se postiže kroz:
|
|
```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
|
|
```
|
|
Ovaj proces **rekurzivno prenosi fajlove**, čuvajući njihove atribute i dozvole.
|
|
|
|
Sa **akreditivima**, listanje i preuzimanje iz deljenog foldera može se uraditi na sledeći način, gde će se pojaviti prozor za unos lozinke:
|
|
```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
|
|
```
|
|
Da **otpremite sadržaj**, kao što je _**authorized_keys**_ datoteka za pristup, koristite:
|
|
```bash
|
|
rsync -av home_user/.ssh/ rsync://username@192.168.0.123/home_user/.ssh
|
|
```
|
|
## POST
|
|
|
|
Da biste locirali rsyncd konfiguracioni fajl, izvršite:
|
|
```bash
|
|
find /etc \( -name rsyncd.conf -o -name rsyncd.secrets \)
|
|
```
|
|
Within this file, a _secrets file_ parameter might point to a file containing **korisnička imena i lozinke** for rsyncd authentication.
|
|
|
|
|
|
## 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:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
|
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
|
|
|
<details>
|
|
|
|
<summary>Support HackTricks</summary>
|
|
|
|
* 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.
|
|
|
|
</details>
|
|
{% endhint %}
|