Cisco IOS Security Hardening: 15 Critical Commands Every Admin Must Know

Cisco IOS Security Hardening: 15 Critical Commands Every Admin Must Know

Cisco IOS ships with default settings optimized for connectivity, not security. Hardening it means disabling legacy services, enforcing encrypted access, and adding authentication layers the default config entirely lacks. These 15 commands address the highest-impact security gaps found in real-world Cisco IOS audits.

Why IOS Hardening Matters

A Cisco router straight out of the box is a networking device — not a secured one. IOS defaults exist to make the device operational quickly, not to minimize its attack surface. When you look at what’s enabled by default, the picture is concerning:

  • Cisco Discovery Protocol broadcasts device model and IOS version to every connected neighbor
  • The HTTP server provides an unencrypted web management interface on many older IOS versions
  • Telnet is the default transport for VTY management lines, transmitting credentials in cleartext
  • Small IP services (echo, chargen, discard) are on by default and can be abused in amplification attacks
  • IP source routing is enabled, potentially allowing attackers to influence packet paths
  • SNMP may be configured with default community strings “public” and “private”

Each of these is a known attack vector that the NSA, CIS, and DISA have been documenting for decades. Yet they still appear in the majority of enterprise router audits. The commands below close the most impactful of these gaps.

Test first: Apply these changes during a maintenance window. Some commands — particularly those affecting VTY authentication — can lock you out if misconfigured. Always keep a console session or out-of-band access open before changing management access settings.

The 15 Critical Hardening Commands

#1

enable algorithm-type scrypt secret

The enable secret command stores the privileged-mode password as a one-way hash rather than the reversible Type 7 cipher used by enable password. The algorithm-type scrypt option uses the modern scrypt key derivation function — far more resistant to brute force than the older MD5-based Type 5 hash.

! Remove the old weak enable password if present Router(config)# no enable password ! Set a strong enable secret with scrypt (IOS 15.3+) Router(config)# enable algorithm-type scrypt secret YourStrongPassword! ! On older IOS (pre-15.3), use at minimum: Router(config)# enable secret YourStrongPassword!
CIS L1DISA STIGCritical
#2

service password-encryption

This command applies Type 7 cipher to all plaintext passwords in the configuration — VTY passwords, line passwords, OSPF keys. It’s not cryptographically strong, but it prevents shoulder-surfing and accidental exposure in config backups. It’s a baseline, not a substitute for proper secrets management.

Router(config)# service password-encryption ! Verify all passwords are now encrypted Router# show running-config | include password
CIS L1NSA RSCG
#3

ip ssh version 2 + transport input ssh

Telnet transmits everything — including your password — in cleartext. Anyone with network access between you and the router can capture your credentials with a packet sniffer. SSH encrypts the session. SSH version 2 is mandatory; version 1 has known vulnerabilities. RSA keys must be at least 2048 bits.

! Generate 2048-bit RSA keys (required for SSH) Router(config)# crypto key generate rsa modulus 2048 ! Force SSH version 2 only Router(config)# ip ssh version 2 Router(config)# ip ssh time-out 60 Router(config)# ip ssh authentication-retries 3 ! Lock ALL VTY lines to SSH only — no Telnet Router(config)# line vty 0 15 Router(config-line)# transport input ssh Router(config-line)# login local ! Verify SSH is active Router# show ip ssh
CIS L1DISA STIGNSA RSCGCritical
#4

exec-timeout on all lines

An idle management session left open is an open door. The default exec-timeout on VTY lines is often 0 — no timeout at all. Set timeouts on every line: console, VTY, and auxiliary.

! 10-minute timeout on all VTY lines Router(config)# line vty 0 15 Router(config-line)# exec-timeout 10 0 ! 5-minute timeout on console Router(config)# line console 0 Router(config-line)# exec-timeout 5 0 ! Near-zero timeout on AUX port Router(config)# line aux 0 Router(config-line)# exec-timeout 0 1
CIS L1DISA STIG
#5

aaa new-model

AAA (Authentication, Authorization, Accounting) is the proper framework for managing who can access the router, what they can do, and logging what they did. Without it, you’re relying on basic line passwords with no accounting. With AAA you can integrate RADIUS/TACACS+ for centralized authentication and get a complete audit trail.

Router(config)# aaa new-model Router(config)# aaa authentication login default local Router(config)# aaa authorization exec default local if-authenticated Router(config)# aaa accounting exec default start-stop local ! If you have a TACACS+ server: ! Router(config)# tacacs server TACACS-SRV ! Router(config-server-tacacs)# address ipv4 10.0.0.10 ! Router(config-server-tacacs)# key SecretKey123
CIS L1DISA STIGNSA RSCG
#6

no ip http server / no ip http secure-server

The IOS HTTP server provides a browser-based management interface. The unencrypted version (port 80) transmits credentials in cleartext. Unless you specifically need web-based management, disable both. If a management platform requires HTTPS access, disable only the plain HTTP server and leave HTTPS.

Router(config)# no ip http server Router(config)# no ip http secure-server ! Verify no HTTP listener remains Router# show ip http server status
CIS L1NSA RSCGHigh
#7

no ip source-route

IP source routing allows a packet’s sender to specify the path through the network — a legitimate feature in early networking that is now primarily used by attackers to bypass security controls. Disable it on every production router.

Router(config)# no ip source-route ! Verify — should return nothing if disabled Router# show running-config | include source-route
CIS L1NSA RSCGDISA STIG
#8

no service tcp-small-servers / no service udp-small-servers

These disable legacy TCP and UDP diagnostic services (echo, chargen, daytime, discard) that can be abused in amplification DoS attacks. They’re off by default in newer IOS releases but should be explicitly disabled to ensure they can’t be accidentally re-enabled.

Router(config)# no service tcp-small-servers Router(config)# no service udp-small-servers ! Also disable other legacy services Router(config)# no ip finger Router(config)# no ip bootp server Router(config)# no service config
CIS L1NSA RSCG
#9

no cdp enable (on external interfaces)

Cisco Discovery Protocol broadcasts device model, IOS version, interface IPs, and capabilities to directly connected neighbors. Useful for internal network management, but it hands attackers detailed reconnaissance data on external-facing interfaces. Disable globally and re-enable only on internal interfaces where needed.

! Disable globally Router(config)# no cdp run ! OR disable only on external/WAN interface Router(config)# interface GigabitEthernet0/0 Router(config-if)# no cdp enable Router# show cdp interface GigabitEthernet0/0
CIS L1NSA RSCG
#10

banner login

A login banner serves two purposes: legal and operational. It establishes that unauthorized access is prohibited — a requirement for prosecution in many jurisdictions. Keep it factual and avoid including device details like hostname, IOS version, or IP addresses that help attackers.

Router(config)# banner login ^ ******************************************************************************* * AUTHORIZED ACCESS ONLY * * This system is the property of [Your Organization]. * * Unauthorized access is prohibited and will be prosecuted. * * All activity on this system is monitored and logged. * ******************************************************************************* ^
CIS L1DISA STIG
#11

security passwords min-length

IOS lets you enforce a minimum password length for all locally configured passwords. The CIS Benchmark recommends a minimum of 10 characters. DISA STIG requires 15 characters for privileged accounts in high-security environments.

! Enforce minimum 10-character passwords Router(config)# security passwords min-length 10 ! Also configure lockout after failed attempts Router(config)# security authentication failure rate 3 log
CIS L1DISA STIG
#12

logging host + service timestamps

Local logs stored only on the device can be tampered with or lost if the device is compromised or rebooted. Send logs to an external syslog server immediately. Timestamp every log entry so events can be correlated across devices during incident response.

! Configure local logging buffer Router(config)# logging buffered 32768 informational ! Enable timestamps Router(config)# service timestamps log datetime msec localtime show-timezone ! Send to remote syslog server Router(config)# logging host 10.0.0.20 Router(config)# logging trap informational Router# show logging
CIS L2DISA STIGNSA RSCG
#13

ntp server + ntp authenticate

Without accurate time synchronization, log correlation is impossible — if each device has a different clock, you can’t reconstruct the sequence of events during an incident. NTP authentication prevents attackers from injecting fake time updates that could corrupt your audit trail.

Router(config)# ntp authenticate Router(config)# ntp authentication-key 1 md5 NTPAuthKey123 Router(config)# ntp trusted-key 1 Router(config)# ntp server 10.0.0.5 key 1 Router(config)# ntp server 10.0.0.6 key 1 Router# show ntp status Router# show ntp associations
CIS L1DISA STIG
#14

no ip proxy-arp + no ip directed-broadcast

Proxy ARP allows the router to respond to ARP requests on behalf of hosts on other networks. On external or untrusted interfaces this can allow attackers to intercept traffic. IP directed broadcast enables Smurf amplification attacks. Both should be disabled on all untrusted interfaces.

Router(config)# interface GigabitEthernet0/0 Router(config-if)# no ip proxy-arp Router(config-if)# no ip directed-broadcast ! Apply to all interfaces facing untrusted networks
CIS L1NSA RSCG
#15

ip access-class on VTY lines

Even with SSH enforced, your management interface should only be reachable from authorized management IP addresses. An access-class on VTY lines drops connection attempts from any source not on your approved list — providing defense-in-depth if credentials are ever compromised.

! Define management source ACL Router(config)# ip access-list standard MGMT-ACCESS Router(config-std-nacl)# permit 10.10.10.0 0.0.0.255 Router(config-std-nacl)# permit 192.168.1.0 0.0.0.255 Router(config-std-nacl)# deny any log ! Apply to all VTY lines Router(config)# line vty 0 15 Router(config-line)# access-class MGMT-ACCESS in
CIS L1DISA STIGNSA RSCGCritical

Quick Reference Table

#CommandCISSecurity Benefit
1enable algorithm-type scrypt secretL1Strong privileged password hash
2service password-encryptionL1Obscures plaintext passwords in config
3ip ssh version 2 + transport input sshL1Eliminates cleartext Telnet access
4exec-timeout 10 0L1Closes idle management sessions
5aaa new-modelL1Centralized auth + full accounting trail
6no ip http serverL1Removes unencrypted web management
7no ip source-routeL1Blocks source routing attacks
8no service tcp/udp-small-serversL1Removes amplification attack surface
9no cdp enable (external)L1Stops device info disclosure
10banner loginL1Legal notice for unauthorized access
11security passwords min-lengthL1Enforces minimum password length
12logging hostL2Remote syslog for tamper-proof audit trail
13ntp server + ntp authenticateL1Accurate timestamps for log correlation
14no ip proxy-arpL1Prevents ARP-based interception
15access-class MGMT-ACL inL1Restricts management to authorized IPs only

How to Verify Your Hardening

After applying these commands, verify in two ways. First, use IOS show commands:

Router# show ip ssh ! SSH version and config Router# show running-config | section vty ! VTY line settings Router# show running-config | include http ! HTTP server status Router# show logging ! Logging destinations Router# show ntp status ! NTP synchronization

Second, paste your updated config into the free router audit tool and run the full 60-check suite. Compare your new score against the baseline. A well-hardened device should score 80+ and have zero Critical or High findings.

See How Many of These Your Router Is Missing

Paste your Cisco IOS config and instantly see which hardening commands are absent.

Run Free Audit →

Frequently Asked Questions

What is the single most important Cisco IOS hardening command?
If you could apply only one, disable Telnet and require SSH: line vty 0 15 / transport input ssh. Cleartext management access is the most commonly exploited weakness in Cisco IOS devices.
Does Cisco IOS have a built-in security hardening feature?
Yes — the auto secure command interactively walks through basic hardening steps. However it makes changes immediately and doesn’t cover everything. Using a dedicated router audit tool to assess first, then applying changes manually, gives you better control and documentation.
What’s the difference between enable password and enable secret?
enable password stores the password as a reversible Type 7 cipher — easily decoded. enable secret stores it as a one-way hash (MD5 by default, scrypt on newer IOS). Always use enable secret, preferably with algorithm-type scrypt on IOS 15.3+.
Can I apply all 15 commands at once without risk?
Most can be applied safely, but VTY changes are the exception. Before applying transport input ssh, confirm SSH is working and RSA keys are generated. Apply VTY changes last, keep a console session open as a fallback, and test from a second terminal before closing your current session.

© 2025 RouterAuditTool.com — Free Cisco IOS & IOS-XE Security Audit Tool

All configuration processing is performed client-side. No data is transmitted to any server.