The security of Cisco IOS devices consists of multiple factors, including physical and logical access to the device, configuration of the device, and the inherent security of the software being used. The security configuration of a device, specifically in relation to device security, is conveyed using documented best practices. The document entitled Cisco Guide to Harden Cisco IOS Devices represents one collection of those best practices.
The integrity of the software used on Cisco IOS devices, in this case Cisco IOS software, is also important to device security. Depending on severity, security issues in Cisco IOS software are communicated to customers using Security Advisories, Security Responses, or Cisco bug release notes. Further details are documented in the Cisco Security Vulnerability Policy.
It may be possible for an attacker to insert malicious code into a Cisco IOS software image and load it onto a Cisco device that supports that image. This attack scenario could occur on any device that uses a form of software, given a proper set of circumstances. This document will describe best practices that network administrators can use to reduce the risk of malicious code being installed on Cisco IOS devices. Additionally, this document will offer some methods that administrators can use to mitigate the risks of introducing malicious code into the network.
Security Best Practices
Cisco recommends that the following security best practices be implemented to improve the security posture of the network. These practices are particularly relevant to ensure that Cisco IOS devices only use authorized and unaltered Cisco IOS software images.
Supply Chain Integrity
To minimize the risk associated with malicious code, it is important that network administrators develop and consistently apply a secure methodology for Cisco IOS software image management. This secure process must be used from the time a Cisco IOS software image is downloaded from Cisco.com until a Cisco IOS device begins using it.
Although processes may vary based on the network and its security and change management requirements, the following procedure represents an example of best practices that may help minimize the possibility of malicious code installation.
Change control is a mechanism through which changes being made to network devices are requested, approved, implemented, and audited. In the context of ensuring the authenticity of Cisco IOS software images used in the network, change control is relevant because it helps greatly when determining which changes have been authorized and which are unauthorized. Change control is important to help ensure that only authorized and unaltered Cisco IOS software is used on Cisco IOS devices in the network.
The server that is used to distribute software to Cisco IOS devices in the network is a critical component of network security. Several best practices should be implemented to help ensure the authenticity and integrity of software that is distributed from this server. These best practices include:
Cisco IOS software used in the network must be kept up-to-date so that new security functionality can be leveraged and exposure to known vulnerabilities disclosed through Cisco Security Advisories is minimal.
Cisco is continually evolving the security of Cisco IOS software images through the implementation of new security functionality and the resolution of bugs. For these reasons, it is imperative that network administrators maintain their networks in a manner that includes using up-to-date software. Failure to do so could expose vulnerabilities that may be used to gain unauthorized access to a Cisco IOS device.
The comprehensive implementation of Authentication, Authorization,
and Accounting (AAA) is critical to ensuring the security of
interactive access to network devices. Furthermore, AAA, and
specifically authorization and accounting functions, should be used to
limit the actions authenticated users can perform in addition to
providing an audit trail of individual user actions.
Once AAA has been implemented to control which users can log in to particular network devices, access control should be implemented to limit from which IP addresses users may perform management functions on a network device. This access control includes multiple security features and solutions to limit access to a device:
For more information, please consult the following sections of the Cisco Guide to Harden Cisco IOS devices: Securing Interactive Management Sessions and Fortifying the Simple Network Management Protocol.
For network administrators to understand events taking place on a network, a comprehensive logging structure using centralized log collection and correlation must be implemented. Additionally, a standardized logging and time configuration must be deployed on all network devices to facilitate accurate logging. Furthermore, logging from the AAA functions in the network should be included in the centralized logging implementation.
Once comprehensive logging is in place on a network, the collected data must be used to monitor network activity for events that may indicate unauthorized access to a network device, or unauthorized actions by legitimate users. These types of events could represent the first step in undermining the security on a Cisco IOS device. Because the following items may represent unauthorized access or unauthorized actions, they should be monitored closely.
Network administrators can use one of several security features to verify the authenticity and integrity of Cisco IOS software images in use on their network devices. It is also possible to use a process that does not rely on features in the Cisco IOS software.
The following sections contain information on Cisco IOS software features and administrative processes that can be used to verify the authenticity and integrity of a Cisco IOS software image.
The MD5 File Validation feature, added in Cisco IOS Software Releases 12.2(4)T and 12.0(22)S, allows network administrators to calculate the MD5 hash of a Cisco IOS software image file that is loaded on a device. It also allows administrators to verify the calculated MD5 hash against that provided by the user. Once the MD5 hash value of the installed Cisco IOS image is determined, it can also be compared with the MD5 hash provided by Cisco to verify the integrity of the image file.
Note: The MD5 File Validation feature can only be used to check the integrity of a Cisco IOS software image that is stored on a Cisco IOS device. It cannot be used to check the integrity of an image running in memory.
MD5 hash calculation and verification using the MD5 File Validation feature can be accomplished using the following command:
verify /md5 filesystem:filename [md5-hash]
Network administrators can use the verify /md5 privileged EXEC command to verify the integrity of image files that are stored on the Cisco IOS file system of a device. The following shows how to use the verify /md5 command on a Cisco IOS device:
router#verify /md5 disk0:c7301-jk9s-mz.124-10.bin .....<output truncated>.....Done! verify /md5 (disk0:c7301-jk9s-mz.124-10.bin) = ad9f9c902fa34b90de8365c3a5039a5b router#
Network administrators can also provide an MD5 hash to the verify command. If provided, the verify command will compare the calculated and provided MD5 hashes as illustrated in the following example:
router#verify /md5 disk0:c7301-jk9s-mz.124-10.bin ad9f9c902fa34b90de8365c3a5039a5b .....<output truncated>.....Done! Verified (disk0:c7301-jk9s-mz.124-10.bin) = ad9f9c902fa34b90de8365c3a5039a5b router#
If the network administrator provides an MD5 hash that does not match the hash calculated by the MD5 File Validation feature, an error message will be displayed. This message is shown in the following example:
router#verify /md5 disk0:c7301-jk9s-mz.124-10.bin 0c5be63c4e339707efb7881fde7d5324 .....<output truncated>.....Done! %Error verifying disk0:c7301-jk9s-mz.124-10.bin Computed signature = ad9f9c902fa34b90de8365c3a5039a5b Submitted signature = 0c5be63c4e339707efb7881fde7d5324 router#
In the preceding examples, the verify /md5 command calculates and displays the MD5 hash for the entire Cisco IOS image file. This approach is in contrast to the updated verify command present with the "Image Verification" feature, which calculates the hash for the entire Cisco IOS image as well as specific portions of the uncompressed Cisco IOS image file.
For additional information on how to use this feature, please consult the document entitled MD5 File Validation.
The Image Verification feature, added in Cisco IOS Software Releases 12.3(4)T, 12.0(26)S, and 12.2(18)S, builds on the MD5 File Validation functionality to more easily allow network administrators to verify the integrity of an image file that is loaded on the Cisco IOS file system of a device. The purpose of the Image Verification feature is to ensure that corruption of the Cisco IOS software image file has not occurred. The corruption detected by this feature could have occurred at any time, such as during the download from Cisco.com or the installation process.
Note: The Image Verification feature does not check the integrity of the image running in memory.
Cisco IOS software image file verification using this feature can be accomplished using the following commands:
Note: Only the file verify auto global configuration command and the verify privileged EXEC command will be covered in this document. For information on the copy /verify and reload /verify commands, reference the Image Verification of the Cisco IOS Security Configuration Guide.
Network administrators can use the file verify auto global configuration command to enable verification of all images that are either copied using the copy privileged EXEC command or loaded using the reload privileged EXEC command. These images are automatically verified for image file integrity.
The following example shows how to configure the file verify auto Cisco IOS feature:
router#configure terminal router(config)#file verify auto router(config)#exit router#
In addition to file verify auto, both the copy and the reload commands have a /verify argument that enables the Image Verification feature to check the integrity of the Cisco IOS image file. This argument must be used each time an image is copied to or reloaded on a Cisco IOS device if the global configuration command file verify auto is not present.
Network administrators can also use the verify privileged EXEC command, originally introduced for the "MD5 File Validation" feature and updated by the "Image Verification" feature, to verify the integrity of image files that are stored locally on a device. The following example demonstrates how to use the updated verify command on a Cisco IOS device:
router#verify disk0:c7301-jk9s-mz.124-10.bin Verifying file integrity of disk0:c7301-jk9s-mz.124-10.bin .....<output truncated>.....Done! Embedded Hash MD5 : 0C5BE63C4E339707EFB7881FDE7D5324 Computed Hash MD5 : 0C5BE63C4E339707EFB7881FDE7D5324 CCO Hash MD5 : AD9F9C902FA34B90DE8365C3A5039A5B Signature Verified router#
In the preceding output, three MD5 hash values are displayed by the verify command. The following is an explanation of each MD5 hash value:
In certain circumstances, network administrators may consider moving an existing Cisco IOS software image file from a Cisco IOS device to an administrative workstation. Once on the administrative workstation, independent tools can be used to calculate the MD5 hash of the file.
Two options are available for administrators to perform this task. One option allows the administrator to use the Cisco IOS software in use on the device to copy the stored Cisco IOS software image file to an administrative workstation. If this process is being carried out for security reasons, administrators are advised to use a secure protocol (such as SCP) to transfer the file. However, it is technically possible to perform this process using other protocols, including RCP, TFTP, FTP, HTTP or HTTPS. This process is accomplished using the copy command as illustrated in the following example:
router#copy flash:c7301-jk9s-mz.124-10.bin scp:c7301-jk9s-mz.124-10.bin Address or name of remote host ? 10.1.1.1 Destination username [cisco]? user Destination filename [c7301-jk9s-mz.124-10.bin]? <enter> Writing c7301-jk9s-mz.124-10.bin Password: <enter password> ! Sink: C0644 28905508 c7301-jk9s-mz.124-10.bin !!!!!<output truncated>!!!!! 28905508 bytes copied in 22.280 secs (1297375 bytes/sec) router#
A second and recommended option, one that provides an additional level of security, is to restart a Cisco IOS device using a known-good version of Cisco IOS software from a trusted location. Administrators can accomplish this task using the boot system global configuration command as illustrated in the following example:
router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. router(config)#boot system ftp c7301-jk9s-mz.124-10.bin 10.1.1.1 router(config)#end router#copy running-config startup-config Destination filename [startup-config]? <enter> Building configuration... [OK] router#reload
Note: On some platforms, the Cisco IOS device may load the locally stored boot image before loading a Cisco IOS software system image from the network.
Once the network device has been restarted with a known-good Cisco IOS image, a network administrator can verify the locally stored image using the verify command or by copying the Cisco IOS software image to a remote file server for offline verification.
For additional information about copying, loading, and maintaining system images, reference the Loading and Managing System Images of the Cisco IOS Configuration Fundamentals Configuration Guide.
Once a file is stored on an administrative workstation, a network administrator can verify the MD5 hash for that Cisco IOS image file using an MD5 hashing utility. Such utilities include md5sum for the Linux operating system, md5 for the BSD operating system, and fsum, MD5summer, and WinMD5 for Microsoft Windows platforms. Additionally, the size of the Cisco IOS image file can be obtained using the ls command on Linux and BSD operating systems and the dir command on Microsoft Windows platforms.
The following example demonstrates the MD5 calculation and file size display for Linux-based systems:
$ $ md5sum c7301-jk9s-mz.124-10.bin ad9f9c902fa34b90de8365c3a5039a5b c7301-jk9s-mz.124-10.bin $ $ ls -l c7301-jk9s-mz.124-10.bin -r--r--r-- 1 user user 28905508 May 16 15:17 c7301-jk9s-mz.124-10.bin $
The following example illustrates this process for BSD-derived
$ $ md5 c7301-jk9s-mz.124-10.bin MD5 (c7301-jk9s-mz.124-10.bin) = ad9f9c902fa34b90de8365c3a5039a5b $ $ ls -l c7301-jk9s-mz.124-10.bin -r--r--r-- 1 user user 28905508 May 16 21:36 c7301-jk9s-mz.124-10.bin $
The following example sho100ws the use of the fsum utility and the dir command on a Windows system:
C:\>fsum -md5 c7301-jk9s-mz.124-10.bin SlavaSoft Optimizing Checksum Utility - fsum 2.52.00337 Implemented using SlavaSoft QuickHash Library <www.slavasoft.com> Copyright (C) SlavaSoft Inc. 1999-2007. All rights reserved.
Note: The use of the fsum utility is for illustrative purposes only and should not be interpreted as an endorsement of the tool.
Once the MD5 hash and file size for a Cisco IOS software image has been collected, network administrators can verify authenticity of the image using information provided by the Cisco IOS Upgrade Planner tool during the download process. The Cisco IOS Upgrade Planner tool requires a valid Cisco.com account and provides details about each publicly available IOS image.
Network administrators must identify their Cisco IOS software release (this can be done by using information obtained from output provided by the show version command) and navigate through the Cisco IOS Upgrade Planner tool to locate the image in use on the Cisco IOS device. Network administrators should verify that the CCO Hash calculated by the Cisco IOS verify command (part of the Cisco IOS "Image Verification" feature), the MD5 hash calculated by the verify /md5 command (part of the "MD5 File Validation" Cisco IOS feature), or the MD5 hash calculated by a third-party utility matches the MD5 hash that is provided by the Cisco IOS Upgrade Planner tool.
If the MD5 hash value for the whole Cisco IOS image file does not match the MD5 hash provided by Cisco, network administrators should download the Cisco IOS image file from the Cisco IOS Upgrade Planner and use the file verification methods described in this document to verify integrity of the Cisco IOS image file.
The following is an example of the information provided by the Cisco IOS Upgrade Planner tool during one of the steps required for downloading a Cisco IOS software image file from www.cisco.com.
Table 1. IOS Software Image Information
Best practices require that network administrators know and trust the tools that can be used to verify the authenticity of a Cisco IOS software image. This document explains those tools and highlights methods to minimize risk.
Tim Sammut (firstname.lastname@example.org)
Joseph Karpenko (email@example.com)
Tim Sammut and Joseph Karpenko are members of the Security Intelligence Engineering organization at Cisco. Additional content produced by Security Intelligence Engineering is located in the Security Intelligence Best Practices section of Cisco Security Intelligence Operations.
Cisco Guide to Harden Cisco IOS Devices
Cisco Security Vulnerability Policy
Cisco IOS Security Configuration Guide
Loading and Managing System Images http://www.cisco.com/en/US/docs/ios/fundamentals/configuration/guide/cf_system_images_ps6350_TSD_Products_Configuration_Guide_Chapter.html
This document is part of Cisco Security Intelligence Operations.
This document is provided on an "as is" basis and does not imply any kind of guarantee or warranty, including the warranties of merchantability or fitness for a particular use. Your use of the information on the document or materials linked from the document is at your own risk. Cisco reserves the right to change or update this document at any time.