XpressLearn Home

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4 out of 5)
Loading ... Loading ...
Running commands on a Cisco device from the Windows command line

RSH stands for Remote Shell and originally appeared on the early UNIX platforms. RSH is used to execute commands on a computer running the rshd daemon from another computer. Windows XP and above includes this utility in the default OS installation.

Windows Command Prompt running rsh client

The security used by rsh is considered to be basically non-existent for the following reasons:

The following example shows running a couple of remote commands:

rsh from Windows to a Cisco router

The authentication process between the rsh client and server explained:

The rsh server has a local username, remote username, and an allowed IP source address of every connection allowed to it.

As you can see from the previous explanation, all the information that is really needed to execute commands on a remote rsh server is the local username and which remote usernames and IP’s the server allows. The last two items as previously mentioned, can easily be duplicated from an normally unauthorized computer.

Here is the output from the debug command - debug ip tcp rcmd:

An unsuccessful attempt

%RCMD: [514 <- 10.1.100.20:1023] recv 1022\0
%RCMD: [514 <- 10.1.100.20:1023] recv Administrator\0Administrator\0show run\0
%RCMD: [514 <- 10.1.100.20:1023] recv -- Administrator 10.1.100.20 Administrator not in
trusted hosts database
%RCMD: [514 -> 10.1.100.20:1023] send <BAD,Permission denied.>\n

In the above attempt, there is not a local user called Administrator on the router, thus the request is denied.

A successful attempt

%RCMD: [514 <- 10.1.100.20:1023] recv 1022\0
%RCMD: [514 <- 10.1.100.20:1023] recv Administrator\0Router\0show run\0
%RCMD: [514 -> 10.1.100.20:1023] send <OK>

Steps for configuring a Cisco device to support RSH:

Router(config)#ip rcmd remote-host Router 10.1.100.20 Administrator enable
Router(config)#ip rcmd rsh-enable
Router(config)#no ip rcmd domain-lookup

The previous configuration example allows a host with the IP address of 10.1.100.20 that is logged into the Operating System as the user Administrator to run commands on the device using rsh. Notice the use of the no ip rcmd domain-lookup command. Without this, the router will attempt to do a reverse lookup on the incoming source IP address and will fail if the reverse dns entry does not exist, so in our example scenario, we turn off this behavior. If we had left it on in our test environment the rsh execution would have failed with the following debug output:

%RCMD-4-RCMDDNSFAIL: DNS hostname/ip address mismatch.  10.1.100.20 unknown to DNS

If you need to allow a single user to come from multiple source IP addresses, use an access list in the rcmd configuration as shown in the following example.

Router(config)#access-list 1 remark Source IP addresses allowed to use RCMD
Router(config)#access-list 1 permit 10.1.100.20
Router(config)#access-list 1 permit 192.168.100.20
Router(config)#ip rcmd remote-host Router 1 Administrator enable
Router(config)#ip rcmd rsh-enable

RSH is currently used between Cisco products to serve certain functions. CiscoWorks, which is a Network Management System, uses rsh to run certain processes on Cisco devices that it manages. Also, various Cisco VoIP platforms use rsh to execute commands on routers as needed.

In my opinion, if this type of access could be used in your network, consider only allowing a secured, centrally located computer the ability to execute rsh commands on your network devices. By having a physically and logically secure station that is allowed to run rsh, you stand less of a risk of someone being able to steal it’s identity for replication on an unauthorized computer.

Author Info:

 
Scott is the Founder, Administrator, Architect, Chief Editor and Shameless Hack who wrote and runs Xpresslearn.
 

Scott has been working in the networking field for 13 years and has experience in all the areas: Lan, Wan, Security, Optimization, High Availability, Wireless, and others.

When he is not working on further development of Xpresslearn, Scott loves spending time with his family and has such hobbies as Camping, Fishing, Cars, and Woodworking.

Related Posts:


Leave a Reply