rexec and the trusted r-commands must not be conflated. rexecd receives a username and password for authentication; it does not consult ~/.rhosts or /etc/hosts.equiv. Those trust files are used by services such as rsh and rlogin. A host may expose both service families, but passwordless execution through rsh is a separate endpoint and does not bypass rexec authentication.
# identify the services independently
nmap -sV -p512,513,514 <target> # rexec, rlogin, and rsh use separate ports
# rexec still requires its username and password; avoid placing the password in argv
rexec -l <user> <target> id
# only a separately exposed rsh service can use matching host trust
rsh -l <user> <target> id
Exploitation notes#
- Confirm each exposed service rather than assuming that a host running
rexecdalso runsrshdorrlogind. - If
rshorrloginis independently available, assess its.rhostsandhosts.equivrules under that service's authentication model. - For
rexecitself, the relevant credential risk is cleartext password capture.