Administrators can access a router for administrative purposes in a variety of ways. For example, as shown in Figure 3-2, a PC running terminal emulation software can telnet into a router. The Telnet connection is considered to be using a vty line (a “virtual tty” line). Alternatively, a PC using terminal emulation software can connect directly to a router’s console (“con”) line over a serial connection. For remote administrative access, many Cisco routers also have an auxiliary line (“aux”) that might connect to a modem.
Telnet sends data in clear text. Therefore, if an attacker intercepted a series of Telnet packets, he could view their contents, such as usernames and passwords. For a more secure connection, administrators might choose to use Secure Shell (SSH) for access over a vty line. Modern Cisco routers also offer a graphical interface called Cisco Security Device Manager (SDM), which is accessible over the network using HTTP or HTTPS.
However, regardless of how an administrator chooses to access a router, the router typically challenges the administrator to provide either a password or a username/password combination before access is granted. As soon as an administrator is granted access to the router, she might be in user mode, where she has a limited number of commands she can issue. However, most router administration is performed from privileged mode. To access privileged mode from user mode, the administrator enters the enable command. Typically, the administrator then is prompted to enter another password, sometimes called the enable password. Interestingly, by default, a router has no password protection of any kind.
To protect a router from unauthorized access, a “strong” password should be selected. A strong password is one that is difficult for an attacker to guess or compromise by launching a dictionary attack or brute-force attack. A dictionary attack occurs when an attacker tries to use passwords from a file containing commonly used passwords. A brute-force attack occurs when an attacker tries all combinations of characters until a match is found. Recommended Cisco guidelines for selecting a strong router password include the following:
- Select a password that is at least ten characters long. The security password minlength 10 global configuration mode commands can be used to enforce this password length recommendation.
- Use a mixture of alphabetic (both uppercase and lowercase), numeric, and special characters.
- The password should not be a common word found in a dictionary.
- Create a policy that dictates how and when passwords are to be changed.
When an administrator initially either sets up a router from the factory and chooses to run the setup script or issues the setup command, the System Configuration dialog appears. The administrator is prompted to enter basic router configuration parameters, including the passwords described in Table 3-7.
Password Type | Description |
Enable secret password |
This password is used to permit access to a router’s privileged mode. The password is stored in the router’s configuration as an MD5 hash value, making it difficult for an attacker to guess and impossible to see with the naked eye. |
Enable password | This password is not encrypted (or hashed) by default. Therefore, the enable password is considered weaker than the enable secret password. However, Cisco IOS still supports the enable password for backward compatibility. For example, if the IOS version on a router were rolled back to a version that supported the enable password but not the enable secret password, the enable password would offer some level of security. |
vty password | When an administrator connects to a router over a network connection (such as a Telnet or SSH connection), she might be prompted to enter a vty password to have access to the virtual tty line to which she is connecting. |
Even after the System Configuration dialog completes, and the router is functioning in a production environment, administrators can still change the router passwords. For example, the enable secret password global configuration mode command can be used to set the router’s enable secret password. Consider Example 3-1, which shows an enable secret password being set to Cisc0Pr3$$. Notice how the enable secret password then appears in the running configuration. The string of characters shown is not an encrypted version of the password. Rather, the string is the result of an MD5 hash function, which always yields a 128-bit hash value that is also known as a “digest.”
Example 3-1 Setting the Enable Secret Password
R1(config)# enable secret Cisc0Pr3$$
R1(config)# end
R1# show running-config
!
hostname R1
!
enable secret 5 $1$kmOB$rL419kUxmQphzVVTgO4sP1
!
To configure a password for a router’s console, the administrator enters line configuration mode for con 0 and specifies a password with the password command. Then, to force console connections to require a password, the login command is issued, as shown in Example 3-2.
Example 3-2 Setting the Console Password
R1(config)# line con 0
R1(config-line)# password 1mA$3cr3t
R1(config-line)# login
Similarly, you can set a password for the auxiliary port. Enter line configuration mode for aux 0 and specify a password and require a login, like the console port configuration illustrated in Example 3-3.
Example 3-3 Setting the Auxiliary Port Password
R1(config)# line aux 0
R1(config-line)# password @uxP@$$w0rd
R1(config-line)# login
In addition to physically connecting to a router via the console or auxiliary port, administrators can connect to a router using a Telnet or SSH connection. Instead of connecting to physical ports, these types of connections use virtual ports. Specifically, by default a router has five virtual tty lines (that is, “vty”), vty 0 to vty 4, over which administrators can remotely connect. Similar to the console and auxiliary ports, passwords can be assigned to these vty lines, as shown in Example 3-4.
Example 3-4 Setting the vty Line Password
R1(config)# line vty 0 4
R1(config-line)# login
R1(config-line)# password MyP@$$w0rd
The enable secret password appears in the running configuration as an MD5 hash value. However, the console, auxiliary, and vty line passwords appear in the running configuration as plain text, as shown in Example 3-5.
Example 3-5 Line Passwords Appearing in Plain Text
R1# show running-config
!
line con 0
password 1mA$3cr3t
login
line aux 0
password @uxP@$$w0rd
login
line vty 0 4
password MyP@$$w0rd
login
To better secure these passwords, a password encryption service can be enabled on the router. This service uses a Cisco-proprietary algorithm that is based on a Vigenere cipher. This algorithm is far from secure. Its password can be easily compromised with downloadable utilities freely available on the Internet (such as the GetPass utility from Boson Software). However, enabling the password encryption service does help prevent someone from obtaining a password from the casual inspection of a router’s configuration.
The password encryption service is enabled in global configuration mode using the service password-encryption command. After enabling this service, the console, auxiliary, and vty line passwords appear in an encrypted format. The 7 that appears after the password command indicates that the password has been encrypted using this Cisco proprietary encryption algorithm, as shown in Example 3-6.
Example 3-6 Cisco-Proprietary Password Encryption Results
R1(config)# service password-encryption
R1# show run
!
line con 0
password 7 091D43285D5614005818
login
line aux 0
password 7 06261A397C6E4D5D1247000F
login
line vty 0 4
password 7 09615739394153055B1E00
login
Aside from having a single password for all administrators, individual user accounts can be used to give different login credentials (that is, username/password combinations) to different administrators. Although an external user database (such as a Cisco Secure Access Control Server [ACS]) could be used, a simple way to configure a user database is to add the username/password combinations to a router’s configuration. Example 3-7 shows the addition of a username and password using the username kevinw secret $up3r$3cr3tcommand. The password will appear in the router’s configuration as an MD5 hash value.
Example 3-7 Configuring a Local User Database
R1(config)# username kevinw secret $up3r$3cr3t
R1(config)# end
R1# show run
!
username kevinw secret 5 $1$geU5$vc/uDRS5dWiOrpQJTimBw/
!
If an attacker gains physical access to a router, he could connect to the router’s console port and reboot the router. During the bootup process, the attacker could generate a break sequence, causing the router to enter ROM monitor (ROMMON) mode. From ROMMOM mode, the attacker could reset the router’s password and thereby gain access to the router’s configuration.
Although the ability to perform this type of password recovery often proves useful to administrators, if the router’s physical security cannot be guaranteed, this feature opens vulnerability for attackers. To mitigate this threat, an administrator can disable the password recovery feature by issuing the no service password-recovery command in global configuration mode. After entering this command, the administrator is cautioned not to execute this command without another plan for password recovery, because ROMMON will no longer be accessible.
Limiting the number of failed login attempts
If an attacker uses a brute-force attack or a dictionary attack when attempting to log in to a device, such as a router, multiple login attempts typically fail before the correct credentials are found. To mitigate these types of attacks, a Cisco IOS router can suspend the login process for 15 seconds, following a specified number of failed login attempts. By default, a 15-second delay is introduced after ten failed login attempts. However, the security authentication failure rate number_of_failed_attempts log configuration command (issued in global configuration mode) can be used to specify the maximum number of failed attempts (in the range of 2 to 1024) before introducing the 15-second delay.
Example 3-8 illustrates setting the maximum number of attempts to five. Also, notice the log command, which causes a TOOMANY_AUTHFAILS syslog message to be written to a syslog server.
Example 3-8 Setting the Number of Failed Login Attempts
R1# conf term
R1(config)# security authentication failure rate 5 log
R1(config)# end
Setting a Login Inactivity Timer
After an administrator provides appropriate credentials and successfully logs into a router, the router could become vulnerable to attack if the administrator walks away. To help prevent an unattended router from becoming a security weakness, a 10-minute inactivity timer is enabled by default. However, Cisco recommends that inactivity timers be set to no more than 3 minutes. Fortunately, administrators can adjust the inactivity windows with the exec-timeout minutes [seconds] command, issued in line configuration mode. Consider Example 3-9, which shows setting the inactivity timer for the console, auxiliary, and vty lines to 2 minutes and 30 seconds.
Example 3-9 Setting an Inactivity Timer
R1# conf term
R1(config)# line con 0
R1(config-line)# exec-timeout 2 30
R1(config-line)# exit
R1(config)# line aux 0
R1(config-line)# exec-timeout 2 30
R1(config-line)# exit
R1(config)# line vty 0 4
R1(config-line)# exec-timeout 2 30
—Original resources appeared in searchnetworkingchannel.techtarget.com
More PDF FILE: ISR overview and providing secure administrative access & Cisco Security Device Manager Overview
More Related Cisco Topics:
How to Set Up Cisco Router Auxiliary, Console and Telnet Passwords?