Linux Remote Protocols

Overview

Linux systems commonly use various remote management protocols for secure access and file transfer. These protocols enable remote administration, file synchronization, and system management across networks.

SSH (Secure Shell)

Overview

SSH (Secure Shell) is a network protocol that enables secure network communication and remote access to network services. It uses encryption to secure the communication channel between client and server.

Key Characteristics:

  • Port 22: Default SSH port

  • Authentication: Public key, password, or certificate-based

  • Encryption: AES, 3DES, ChaCha20-Poly1305

  • Integrity: HMAC-SHA256, HMAC-SHA1

  • Key Exchange: Diffie-Hellman, ECDH

SSH Features

  • Secure Remote Access: Encrypted terminal sessions

  • File Transfer: SCP and SFTP protocols

  • Port Forwarding: Local and remote port forwarding

  • Tunneling: Secure tunneling of other protocols

  • X11 Forwarding: Remote GUI application access

SSH Authentication Methods

SSH Configuration

SSH Enumeration

SSH Security Issues

  1. Weak Authentication: Default or weak passwords

  2. Key Management: Unprotected private keys

  3. Configuration: Insecure SSH daemon settings

  4. Brute Force: Password guessing attacks

  5. Version Vulnerabilities: Outdated SSH versions

Rsync

Overview

Rsync is a utility for efficiently transferring and synchronizing files between computers. It uses the rsync protocol to transfer only the differences between files, making it bandwidth-efficient.

Key Characteristics:

  • Port 873: Default rsync daemon port

  • Protocol: Custom rsync protocol over TCP

  • Efficiency: Delta-sync algorithm (only transfers changes)

  • Authentication: Module-based access control

  • Encryption: Can tunnel through SSH

Rsync Modes

Mode
Description
Usage

Local

Files on same machine

rsync source destination

Remote Shell

SSH/RSH transport

rsync -e ssh source user@host:dest

Rsync Daemon

Native rsync protocol

rsync source rsync://host/module

Rsync Configuration

Rsync Enumeration

Rsync Security Issues

  1. Anonymous Access: Unauthenticated access to shares

  2. Information Disclosure: Directory listings and file access

  3. Data Exfiltration: Ability to download sensitive files

  4. Configuration: Overly permissive access controls

  5. Network Exposure: Rsync accessible from untrusted networks

R-Services (RSH, RCP, RLOGIN)

Overview

R-Services are a suite of remote access services developed for Unix systems. They provide remote shell access, file copying, and remote login capabilities. WARNING: R-Services are inherently insecure and should not be used in production environments.

R-Service Components

Service
Port
Description

RSH

514

Remote shell execution

RCP

514

Remote file copy

RLOGIN

513

Remote login

R-Service Authentication

R-Services use host-based authentication through:

  • .rhosts: Per-user access control

  • /etc/hosts.equiv: System-wide access control

  • Trusted hosts: IP-based authentication

R-Service Configuration Files

R-Service Enumeration

R-Service Security Issues

  1. No Encryption: All communication in plain text

  2. Weak Authentication: Host-based authentication only

  3. Information Disclosure: Verbose error messages

  4. Privilege Escalation: Potential for root access

  5. Network Sniffing: Credentials transmitted in clear text

Advanced Enumeration Techniques

SSH Advanced Enumeration

SSH Brute Force

Rsync Advanced Enumeration

R-Service Exploitation

Practical Examples

HTB Academy Style SSH Enumeration

HTB Academy Style Rsync Enumeration

HTB Academy Lab Questions Examples

Security Assessment

SSH Security Assessment

Rsync Security Assessment

R-Service Security Assessment

Enumeration Checklist

SSH Enumeration

Rsync Enumeration

R-Service Enumeration

Common Vulnerabilities

SSH Vulnerabilities

  • CVE-2018-15473: OpenSSH user enumeration

  • CVE-2016-10009: OpenSSH privilege escalation

  • CVE-2008-5161: OpenSSH client vulnerability

Rsync Vulnerabilities

  • CVE-2014-9512: Rsync path traversal

  • CVE-2011-1097: Rsync daemon security bypass

R-Service Vulnerabilities

  • Inherent Design Flaws: No encryption, weak authentication

  • CVE-1999-0651: R-Services buffer overflow

  • CVE-1999-0025: R-Services authentication bypass

Tools and Techniques

SSH Tools

Rsync Tools

R-Service Tools

Defensive Measures

SSH Hardening

Rsync Security

R-Service Mitigation

Best Practices

SSH Best Practices

  1. Use key-based authentication only

  2. Disable root login

  3. Change default port

  4. Use fail2ban for brute force protection

  5. Regular security updates

  6. Monitor SSH logs

Rsync Best Practices

  1. Use authentication and encryption

  2. Restrict network access

  3. Use read-only shares when possible

  4. Monitor rsync logs

  5. Regular security audits

R-Service Recommendations

  1. Do not use R-Services in production

  2. Replace with SSH

  3. Disable all R-Services

  4. Use secure alternatives

  5. Regular security assessments

Last updated