Router Security and Cisco IOS Management
Security Threats and Router Vulnerabilities
- Routers as Strategic Targets: Because routers serve as gateways between networks, they are primary targets for attackers. Compromising a router can lead to several severe consequences:
- Access Control Compromise: This exposes network configuration details, facilitating further attacks against other internal network components.
- Routing Table Compromise: Attackers can reduce overall network performance, deny communication services (DoS), and expose sensitive data by rerouting it through malicious nodes.
- Traffic Filter Misconfiguration: Incorrectly configured filters can expose internal devices to scans and attacks, allowing attackers to remain undetected.
- Common Attack Vectors: Attackers utilize several methods to compromise routers, including:
- Trust exploitation attacks.
- IP spoofing.
- Session hijacking.
- Man-in-the-Middle () attacks.
- Switch Security: While the focus is on routers, most best practices (such as hardening and password management) apply equally to securing switches.
Fundamental Router Security Practices
- Physical Security:
- Routers must be located in a locked room accessible only to authorized personnel.
- To mitigate Denial of Service () risks stemming from power failures, routers should be connected to an Uninterruptible Power Supply ().
- Cisco IOS Updates:
- Administrators should update the IOS whenever advisable, though the latest version is not always the most stable.
- The best practice is to use the "latest stable release" that fulfills the specific feature requirements of the network.
- Backup Procedures: Always maintain secure copies of the router image () and the configuration file on a (Trivial File Transfer Protocol) server.
- Router Hardening: This involves eliminating potential abuse by disabling unnecessary services and unused ports that are enabled by default on factory settings.
Managing Router Passwords and Encryption
- General Password Best Practices:
- Never write passwords down or leave them in visible locations (desks, monitors).
- Avoid dictionary words, names, phone numbers, or dates.
- Complexity: Combine at least one lowercase letter, one uppercase letter, one digit, and one special symbol.
- Length: A minimum of characters is recommended.
- Deliberate Misspelling: Example: Change "Security" to "".
- Frequency: Change passwords as often as possible to limit the window of exposure if a password is cracked.
- Passphrases: Using a full sentence or phrase is a highly recommended method for creating complex, secure passwords.
- Cisco IOS Password Encryption Schemes:
- Plain Text: By default, Cisco IOS leaves passwords in plain text in the configuration. The command
R1(config)# username Student password cisco123shows a password with a "" in the running config, indicating it is unhidden. - Type 7 Encryption (Simple): Uses a weak algorithm to hide passwords from "shoulder surfing." Enabled via the global command
. It applies to,passwords,,, andports. - Type 5 Encryption (Highly Secure): Uses an hash. The command
implements this. The router prioritize theover the. For local databases, use:. This appears as a "" in the configuration.
- Plain Text: By default, Cisco IOS leaves passwords in plain text in the configuration. The command
- Minimum Password Length: Since Cisco IOS Release , the
command can be used to prevent the use of common short passwords (e.g., "lab" or "cisco"). It only affects passwords created after the command is issued.
Securing Remote Administrative Access
- Access Methods:
- Local Access: Connecting via the console port is the most secure but becomes unmanageable as network size increases.
- Remote Access: Convenient but risky. (TCP port ) is insecure because matches everything in clear text.
- Protection Strategies:
- Establish a dedicated management network (e.g., a specific Management or physical network).
- Encrypt all traffic between the admin computer and the router.
- Controlling VTY Lines:
- Restrict incoming protocols using the
command. For example,only allows Secure Shell. - Preventing VTY DoS: Routers usually have five VTY lines. An attacker can occupy all lines at the login prompt to block administrators.
- Mitigation 1: Apply Access Control Lists () using
on the last VTY line to restrict it to a specific workstation IP. - Mitigation 2: Configure VTY timeouts using
to clear idle sessions. - Mitigation 3: Enable TCP keepalives using
to clear orphaned sessions from crashes.
- Restrict incoming protocols using the
SSH (Secure Shell) Configuration
- Requirements: SSH replaces Telnet, utilizing TCP port for privacy and integrity. It requires a "cryptographic" IOS image.
- Configuration Steps:
- Set Hostname:
. - Set Domain Name:
. - Generate Asymmetric Keys: Use
. Cisco recommends a minimum modulus length of . - Local Authentication: Define a local user and assign SSH to VTY lines.
- Set Timeouts (Optional):
sets the timeout to seconds.limits failed attempts.
- Set Hostname:
- Client Access: Requires applications like PuTTY or TeraTerm choosing the SSH option on port .
Logging Router Activity
- Logging Levels: Cisco routers support levels of logging:
- : Emergencies (system unstable).
- : Alerts.
- : Critical.
- : Errors.
- : Warnings.
- : Notifications.
- : Informational.
- : Debugging.
- Storage: Logs can be saved in router memory or forwarded to a central Syslog Server (e.g., Kiwi Syslog Daemon).
- Time Stamps: Critical for accurate log review. Configured via
and.
Disabling Vulnerable Services and Interfaces
- Services to Disable:
- Cisco Discovery Protocol (CDP): Use
. (Exception: CDP is often needed for IP Phones). - Source Routing:
. - Classless Routing:
. - Small Servers:
and(covers echo, discard, chargen). - Finger:
. - BOOTP:
. - HTTP:
. - Remote Configuration:
. - SNMP: Use
. Versions prior to send data in plain text.
- Cisco Discovery Protocol (CDP): Use
- Interface Hardening:
- Unused interfaces: Use the
command. - Ad hoc routing:
. - SMURF Attack Prevention:
.
- Unused interfaces: Use the
- DNS Security: By default, IOS sends name queries to the broadcast address
. If not using a name server, disable it with. If using one, specify it with.
Securing Routing Protocols
- Attack Types:
- Disruption of Peers: Less critical as protocols auto-heal.
- Falsification of Routing Information: High risk. Can cause routing loops, redirect traffic to insecure links for monitoring, or discard traffic (blackholing).
- Solution: MD5 Authentication: Routers compare signatures produced by an encryption algorithm, a secret shared key, and the packet contents. Supported by , , , , and .
- RIPv2 Security Steps:
- Step 1: Prevent Propagation: Use
to stop updates on all ports, thento enable only required ports. - Step 2: MD5 Setup: Create a
, define anumber and, and apply to the interface. - Step 3: Verification: Use
to confirm authentication and route acquisition.
- Step 1: Prevent Propagation: Use
- EIGRP/OSPF Authentication:
- EIGRP: Requires a key chain and MD5 enablement on the interface.
- OSPF: Configure the MD5 key and enable authentication directly on the interface.
Cisco AutoSecure
- Overview: A single command (
) to disable non-essential processes and services. - Modes:
- Interactive (Default): Prompts user for options regarding banners, passwords, SSH, and firewall features.
- Non-interactive: Uses recommended Cisco defaults instantly. Command:
.
- Scope: Can be applied to
orplanes.
Cisco IOS Software Management
- Updates vs. Upgrades:
- Updates: Fix bugs, same feature set, typically free.
- Upgrades: Add new features/technologies, change versions, not free.
- Migration Process (4 Phases):
- Plan: Set goals, profile hardware, identify resources.
- Design: Select the specific IOS release.
- Implement: Schedule and execute migration.
- Operate: Monitor progress and maintain backups.
- Online Tools:
- Public Access: Cisco IOS Reference Guide, Technical Documents, Cisco Feature Navigator.
- Login Required: Bug Toolkit, Software Advisor, IOS Upgrade Planner.
Cisco IOS Integrated File System (IFS)
- Command:
lists available directories, free memory, and permissions (ro, wo, rw). - Key Directories:
- Flash: Marked with an asterisk (
) as default; a pound sign (#) indicates it is bootable. Stores the current IOS. - NVRAM: Stores the
. Access via.
- Flash: Marked with an asterisk (
- URL Prefix Notation: Cisco uses a format similar to web URLs:
(e.g.,).
Cisco IOS File Naming Conventions
Example file:
: Platform (Cisco 1841).: Feature set. Others involve(IP only),(Enterprise/All),(Plus),(-bit IPsec),(Firewall/IDS),(-bit 3DES).: Execution location and compression (RAM-based, compressed).: The version number.: Binary executable extension.
Backup and Recovery of IOS Images
- Using TFTP to Backup:
- Ping the server to verify access.
- Verify disk space using
. - Command:
. Exclamation points () signify successful transfer of individual UDP segments.
- Using TFTP to Upgrade:
- Command:
. - Note: It may prompt to erase flash if space is insufficient.
- Command:
- Resilient Configuration: On platforms supporting disks, this feature secures a working copy of the image and config to withstand malicious erasures of flash/NVRAM.
- Disaster Recovery (tftpdnld): Used when IOS is deleted and the router is in ROMmon mode.
- Connect PC to console and TFTP server to the first Ethernet port.
- Set ROMmon environment variables (case sensitive, no spaces around "").
- Execute
and confirm with "". - Reload using the
command.
- Disaster Recovery (xmodem): Extremely slow; uses the console cable. Command:
.- Speed can be improved by changing connection to
from the default.
- Speed can be improved by changing connection to
Troubleshooting and Password Recovery
- Command Types:
: Displays static info for fact-gathering. Usefor options.: Displays dynamic events. High priority in CPU queue; should be used during quiet hours. Disable with.
- Helper Commands:
: Required to see debug output during a Telnet/SSH session.: Used to check CPU utilization before running debugs.
- Password Recovery Procedure:
- Identify configuration register (usually
). - Power cycle and press Break to enter ROMmon.
- Change register to
usingto bypass startup config. the router.- Once in Privilege EXEC,
(Critical: do NOT reverse this copy or you lose the config). - Change passwords/secrets and perform
on interfaces. - Restore register:
. to save changes.
- Identify configuration register (usually