R-Services
CPTS Notes2 min read
CPTS Notes
- Foundations
- Enumeration with Nmap
- Passwords
- Wordlists
- Cracking
- Protected Files
- Spraying and Defaults
- Hunting (Windows)
- Hunting (Linux)
- Hunting (Shares)
- Hunting (Traffic)
- Looting (Windows)
- Looting (Linux)
- File Services
- FTP
- SMB
- NFS
- Rsync
- Network
- DNS
- SNMP
- SMTP
- Mail Retrieval
- Cloud Mail
- Databases
- MySQL
- MSSQL
- Remote Access
- SSH
- R-Services
- RDP
- WinRM
- WMI
- Linux
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- File Transfer
- Choosing a Method
- Serving Files
- Windows Transfers
- Linux Transfers
- Code One-Liners
- Session Transfers
- Protected Transfers
- Detection & Evasion
- Windows
- Reading Files
- Editing Files
- Searching Files
- Requests and Transfer
- Local Enumeration
- Privesc Primer
- Reference
- Port References
- DNS Resolution
- The Mail Pipeline
- SMB & NetBIOS
TL;DR
R-services. A legacy Unix remote-access suite (rlogin, rsh, rexec, rcp) on TCP 512 (rexec),
513 (rlogin), and 514 (rsh). Cleartext, and replaced by SSH. They trust the client, so a
misconfigured trust file grants access with no password.
First checks: the three ports open, and a .rhosts or /etc/hosts.equiv trust.
Commands
| Command | Port | Does |
|---|---|---|
rlogin <host> -l <user> |
513 | Log in to a remote host. |
rsh <host> <cmd> |
514 | Run a command, no login. |
rexec |
512 | Run a command with a username and password. |
rwho |
513/udp | List logged-in users network-wide. |
rusers -al <host> |
— | Detailed logged-in users. |
Enumeration
Sweep.
sudo nmap -sV -p512,513,514 -oA scans/r-services $TARGET # rexec, rlogin, and rsh ports and versionsList users on the network.
rwho # logged-in users across the networkrusers -al $TARGET # detailed logged-in users on the hostThe names are accounts to target.
Common misconfigurations
- A
.rhostsor/etc/hosts.equiventry trusting a host or user, which skips authentication. - The
+wildcard in a trust file, which trusts everyone. - The services reachable at all, since they are cleartext and obsolete.
Attack playbook
R-services trust the client. Abuse the trust.
- Log in on a trust. When
.rhostsorhosts.equivtrusts your host or user (or uses+),rloginlogs you in with no password.rlogin <host> -l <user> # log in as a trusted user - Name targets.
rwhoandrusersgive logged-in usernames to feed this and other services. - Run commands. A trusted relationship also runs commands with
rsh.rsh <host> <cmd> # run one command, no login - Reuse credentials. Found passwords may work on
rexec.
Practice boxes
R-services are legacy and rare on current boxes.
When you meet R-services, the win is a
.rhoststrust that lets you log in without a password.