Legacy r-Services Enabled (rlogin, rsh, rexec)
The legacy rlogin, rsh or rexec services are enabled; they send data unencrypted and can grant access based only on the client's address and claimed user name.
| Severity | High |
| CVSS 3.1 | 8.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Open in the calculator |
| CVSS 4.0 | 9.2 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-291: Reliance on IP Address for Authentication |
| OWASP Top 10 | A07:2025 Authentication Failures |
| MITRE ATT&CK | T1021 Remote Services, T1078 Valid Accounts, T1040 Network Sniffing |
| Category | Broken Access Control |
Description
The host runs one or more of the Berkeley r-services: rexec on TCP port 512, rlogin on TCP port 513 and rsh on TCP port 514. These services predate SSH and have no encryption. rexec sends the user name and password in plain text, while rlogin and rsh can skip passwords entirely for connections from trusted hosts listed in /etc/hosts.equiv or in a user's .rhosts file, accepting whatever user name the client claims as long as the connection appears to come from a trusted address. A + entry in these files trusts every host or every user.
Where trust relationships exist, an attacker who controls, or can impersonate, a trusted host can log in or run commands as any trusted user without a password, which for root gives complete control of the system. Such trust can be abused by anyone who takes over a trusted host, or its address on the local network, and because the same trust files are often copied between systems, one weakness frequently extends across several hosts. Credentials and commands sent through any of the services can also be captured by anyone able to observe the traffic, and the services accept password guessing.
The services are now rare, but are still found on older Unix systems, specialist and industrial equipment, and clusters where scripts use rsh to run commands between nodes. They are identified by a scan of TCP ports 512 to 514 and confirmed by connecting, for example with an rsh or rlogin client, or with the Nmap rlogin-brute and rexec-brute scripts. Trust relationships are tested by connecting as common account names, including root.
Remediation
Disable the r-services and replace them with SSH:
- Disable the
rexec,rloginandrshservices, whether they are started by systemd socket units or by inetd or xinetd entries (namedexec,loginandshellin/etc/inetd.conf), and remove the server package. - Delete
/etc/hosts.equivand every user's.rhostsfile, and remove any PAM configuration that usespam_rhosts. - Replace scripts and cluster tools that use
rshwith SSH and key-based authentication, restricting each key to the commands and source hosts it needs. - Where a legacy system cannot be changed, restrict TCP ports 512 to 514 with firewall rules to the specific hosts that need them, and plan its replacement.
- Change the passwords of accounts that have been used over these services.
Confirm the fix with a scan of TCP ports 512 to 514, and check that no .rhosts or hosts.equiv files remain, for example with find / -name .rhosts.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.