As more and more users access the Internet, and as companies expand their networks, the challenge to provide security for internal networks becomes increasingly difficult. Companies must determine which areas of their internal networks they must protect, learn how to restrict user access to these areas, and determine which types of network services they should filter to prevent potential security breaches.
Cisco Systems provides several network, or protocol, layer features to increase security on IP networks. These features include controls to restrict access to routers and communication servers by way of console port, Telnet, Simple Network Management Protocol (SNMP), Terminal Access Controller Access Control System (TACACS), vendor token cards, and access lists. Firewall architecture setup is also discussed.
Caution: While this case study addresses the issues with regard to the network or protocol layer, which is the most relevant in the context of an Internet connection, ignoring host-level security, even with network- layer filtering in place, can be dangerous. For host-level security measures, refer to your application's documentation and the recommended reading list at the end of this case study.
The word security connotes protection against malicious attack by evildoers, but security is also connected with controlling the effects of errors and equipment failures. Anything that can protect against a deliberate, intelligent, calculated attack will probably help against random misfortune.
Security measures keep people honest in the same way that locks do. This case study provides specific actions you can take to improve the security of your network. Before going into specifics, however, it will help if you understand the following basic concepts that are essential to any security system:
Security measures can never make it impossible for a user to perform unauthorized tasks with a computer system. They can only make it harder. The idea is to make sure the network security controls are beyond either the attacker's ability or motivation.
When you design your security measures, you should understand their costs and weigh those costs against the potential benefits. To do that, you must understand the costs of the measures themselves and the costs and likelihoods of security breaches. If you incur security costs out of proportion to the actual dangers, you have done yourself a disservice.
If your security measures interfere with essential use of the system, those measures will be resisted and perhaps circumvented. To get compliance, you must make sure that users can get their work done, and you must sell your security measures to users. Users must understand and accept the need for security.
Any user can compromise system security, at least to some degree. Passwords, for instance, can often be found simply by calling legitimate users on the telephone, claiming to be a system administrator, and asking for them. If your users understand security issues, and if they understand the reasons for your security measures, they are far less likely to make an intruder's life easier.
At a minimum, users should be taught never to release passwords or other secrets over unsecured telephone lines (especially cellular telephones) or electronic mail (e-mail). Users should be wary of questions asked by people who call them on the telephone. Some companies have implemented formalized network security training for their employees; that is, employees are not allowed access to the Internet until they have completed a formal training program.
For console port and Telnet access, you can set up two types of passwords. The first type of password, the login password, allows the user nonprivileged access to the router. After accessing the router, the user can enter privileged mode by entering the enable command and the proper password. Privileged mode provides the user with full configuration capabilities.
SNMP access allows you to set up different SNMP community strings for both nonprivileged and privileged access. Nonprivileged access allows users on a host to send the router SNMP get-request and SNMP get-next- request messages. These messages are used for gathering statistics from the router. Privileged access allows users on a host to send the router SNMP set-request messages in order to make changes to the router's configurations and operational state.
line console 0 login password 1forAllWhen you log in to the router, the router login prompt is as follows:
User Access Verification Password:You must enter the password "1forAll" to gain nonprivileged access to the router. The router response is as follows:
router>Nonprivileged mode is signified on the router by the > prompt. At this point, you can enter a variety of commands to view statistics on the router, but you cannot change the configuration of the router.
Never use "cisco" or other obvious derivatives, such as "pancho" for a Cisco router password. These will be the first passwords intruders will try if they recognize the Cisco login prompt.
enable-password san-franTo access privileged mode, enter the following command:
router> enable Password:Enter the password "san-fran" to gain privileged access to the router. The router responds as follows:
router#Privileged mode is signified by the # prompt. In privileged mode, you can enter all commands to view statistics and configure the router.
line console 0 exec-timeout 1 30
There are two methods to hide the clear text passwords. First, the command service password-encryption will store the passwords in an encrypted manner, so that anyone performing a write terminal and show configuration will not be able to determine the clear text password. The encryption scheme is an unsophisticated reversible algorithm. The second method is to use the command enable secret password. This involves a one-way encryption scheme based on an MDS hashing function. This second method is more secure and is avaiable in software versions 10.0(9) and later, 10.2(5) and later, and 10.3(2) and later. If you forget the password, regaining access to the router requires you to have physical access to the router.
Although encryption is helpful, it can be compromised and thus should not be the sole method used for network security.
line vty 0 4 login password marinWhen a user Telnets to a router IP address, the router provides a prompt similar to the following:
% telnet router Trying ... Connected to router. Escape character is `^]'. User Access Verification Password:If the user enters the correct nonprivileged password, the following prompt appears:
router>
access-list 12 permit 192.85.55.0 0.0.0.255 line vty 0 4 access-class 12 in
With TACACS enabled, the router prompts the user for a username and a password. Then, the router queries a TACACS server to see if the user provided the correct password. A TACACS server typically runs on a UNIX workstation. Public domain TACACS servers can be obtained via anonymous ftp to cco.cisco.com. The file name is tacacsd.shar. A fully supported TACACS server is bundled with CiscoWorks Version 2.
The configuration command tacacs-server host specifies the UNIX host running a TACACS server that will validate requests sent by the router. You can enter the tacacs-server host command several times to specify multiple TACACS server hosts for a router.
The following commands specify a TACACS server and allow a login to succeed if the server is down or unreachable:
tacacs-server host 129.140.1.1 tacacs-server last-resort succeedTo force users who access the router via Telnet to authenticate themselves using TACACS, enter the following configuration commands:
line vty 0 4 login tacacs
The tacacs-server extended command enables a Cisco device to run in extended TACACS mode. The UNIX system must be running the extended TACACS daemon, which can be obtained via anonymous ftp to ftp.cisco.com. The filename is xtacacsd.shar. This daemon allows communication servers and other equipment to talk to the UNIX system and update an audit trail with information on port usage, accounting data, or any other information the device can send.
The command username user password [0 | 7] password allows you to store and maintain a list of users and their passwords on a Cisco device instead of on a TACACS server. The number 0 stores the password in cleartext in the configuration file. The default number 7 stores the password in an encrypted format. If you do not have a TACACS server and still want to authenticate users on an individual basis, you can set up users with the following configuration commands:
username steve password steve-pass username allan password allan-passThe two users, Steve and Allan, will be authenticated via passwords that are stored in encrypted format.
The token card system relies on a physical card that must be in your possession in order to provide authentication. By using the appropriate hooks in the TACACS server code, third-party companies can offer these enhanced TACACS servers to customers. One such product is the Enigma Logic SafeWord security software system. Other card-key systems, such as Security Dynamics SmartCard, can be added to TACACS as well.
The SNMP agent on the router allows you to configure different community strings for nonprivileged and privileged access. You configure community strings on the router via the configuration command snmp-server community string [RO | RW] [access-list]. We will explore the various options of this command in the following sections.
Unfortunately, SNMP community strings are sent on the network in cleartext ASCII. Thus, anyone who has the ability to capture a packet on the network can discover the community string. This may allow unauthorized users to query or modify routers via SNMP. For this reason, using the no snmpserver trap-authentication command may prevent intruders from using trap messages (sent between SNMP managers and agents) to discover community strings.
The Internet community recognizing this problem, greatly enhanced the secureness of SNMP version 2 (SNMPv2) as described in Request For Comments (RFC) 1446. SNMPv2 uses an algorithm called MD5 to authenticate communications between an SNMP server and agent. MD5 verifies the integrity of the communications, authenticates the origin, and checks for timeliness. Further, SNMPv2 has the ability to use the Data Encryption Standard for encrypting information. Cisco supports SNMPv2 in version 10.3 and later.
snmp-server community public ROYou can also specify a list of IP addresses that are allowed to send messages to the router using the access-list option with the snmp-server community command. In the following configuration example, only hosts 1.1.1.1 and 2.2.2.2 are allowed nonprivileged mode SNMP access to the router:
access-list 1 permit 1.1.1.1 access-list 1 permit 2.2.2.2 snmp-server community public RO 1
snmp-server community private RWYou can also specify a list of IP addresses that are allowed to send messages to the router by using the access-list option of the snmp- server community command. In the following configuration example, only hosts 5.5.5.5 and 6.6.6.6 are allowed privileged mode SNMP access to the router:
access-list 1 permit 5.5.5.5 access-list 1 permit 6.6.6.6 snmp-server community private RW 1
_ _ _ _ | ( ) ---------- | application ( Internet )-/-| Router |--| gateway (_ _ _ _ ) ---------- | ------------ |--| Host | | ------------ | _ _ _ _ _ | ------------ ( ) |--| Router |-/-( Internal ) | ------------ ( Network ) | (_ _ _ _ _) |In this architecture, the router that is connected to the Internet (exterior router) forces all incoming traffic to go to the application gateway. The router that is connected to the internal network (interior router) only accepts packets from the application gateway.
The application gateway institutes per-application and per-user policies. In effect, the gateway controls the delivery of network-based services both into and from the internal network. For example, only certain users might be allowed to communicate with the Internet, or only certain applications are permitted to establish connections between an interior and exterior host.
The route and packet filters should be set up to reflect the same policies. If the only application that is permitted is mail, then only mail packets should be allowed through the router. This protects the application gateway and avoids overwhelming it with packets that it would otherwise discard.
_ _ _ _ | ( ) B.B.14.1 ---------- B.B.13.1 | ( Outside )-------/-|Firewall|----------| Communication ( world ) | router | | server (_ _ _ _ ) ---------- |B.B.13.2------------ |--------| | | ------------ | | Application | gateway |B.B.13.100 ------------ |-----------| Host | | ------------ | _ _ _ _ _ | ------------ ( ) |--| Router |-/-( Internal ) | ------------ ( Network ) | (_ _ _ _ _) |In our case study, the firewall router allows incoming new connections to one or more communication servers or hosts. Having a designated router act as a firewall is desirable because it clearly identifies the router's purpose as the external gateway and avoids encumbering other routers with this task. In the event that the internal network needs to isolate itself, the firewall router provides the point of isolation so that the rest of the internal network structure is not affected.
Connections to the hosts are restricted to incoming File Transfer Protocol (FTP) requests and e-mail services as described later in the section "Defining Access Lists" under "Configuring the Firewall Router." The incoming Telnet, or modem, connections to the communication server are screened by the communication server running TACACS username authentication, as described later in the section "Configuring the Firewall Communication Server."
Note: Connections from one communication server modem line to another outgoing modem line (or to the outside world) should be disallowed to prevent unauthorized users from launching an attack on the outside world from your resources. Because intruders have already passed the communication server TACACS authentication at this point, they are likely to have someone's password. It is an excellent idea to keep TACACS passwords and host passwords distinct from one another.
interface ethernet 0 ip address B.B.13.1 255.255.255.0 interface serial 0 ip address B.B.14.1 255.255.255.0 router igrp network B.B.0.0This simple configuration provides no security and allows all traffic from the outside world onto all parts of the network. To provide security on the firewall router, use access lists and access groups as described in the following section, "Defining Access Lists."
In our case study, incoming e-mail and news is permitted for a few hosts, but File Transfer Protocol (FTP), Telnet, and rlogin services are permitted only to hosts on the firewall subnet. We use IP extended access lists (range 100 to 199) and Transmission Control Protocol/ Internet Protocol (TCP/IP) or User Datagram Protocol (UDP) port numbers to filter traffic. When a connection is to be established for e-mail, Telnet, FTP, and so forth, the connection will attempt to open a service on a specified port number. You can, therefore, filter out selected types of connections by denying packets that are attempting to use that service. For a list of well-known services and ports, see the section "Filtering TCP and UDP Services."
An access list is invoked after a routing decision has been made but before the packet is sent out on an interface. The best place to define an access list is on a preferred host using your favorite text editor. You can create a file that contains the access-list statements, place the file (marked readable) in the default Trivial File Transfer Protocol (TFTP) directory, and then network load the file onto the router.
The network server storing the file must be running a TFTP daemon and have TCP/IP network access to the firewall router. Before network loading the access control definition, we remove any previous definition of this access list by using the following command:
no access-list 101We then permit any packets returning to our machines from already established connections. With the established keyword, a match occurs if the TCP datagram has the acknowledgment (ACK) or reset (RST) bits set.
access-list 101 permit tcp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 establishedBecause of a vulnerability in the Cisco IOS software, you should use versions later than 10.0(9), 10.2(5), and 10.3(2) when using the established keyword in extended IP access control lists.
If any firewall routers share a common network with an outside provider, you may want to allow access from those hosts to your network. In our case study, the outside provider has a serial port that uses the firewall router Class B address (B.B.14.2) as a source address as follows:
access-list 101 permit ip B.B.14.2 0.0.0.0 0.0.0.0 255.255.255.255The following example illustrates how to deny traffic from a user attempting to spoof any of your internal addresses from the outside world (without using 9.21 input access lists):
access-list 101 deny ip B.B.0.0 0.0.255.255 0.0.0.0 255.255.255.255The following commands allow Domain Name Server (DNS) and Network Time Protocol (NTP) requests and replies
access-list 101 permit udp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eq 53 access-list 101 permit udp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eq 123The following command denies the Network File Server (NFS) User Datagram Protocol (UDP) port:
access-list 101 deny udp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eq 2049The following commands deny OpenWindows on ports 6001 and 6002 and deny X11 on ports 2001 and 2002. This protects the first two screens on any host. If you have any machine that uses more than the first two screens, be sure to block the appropriate ports .
access-list 101 deny tcp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eq 6001 access-list 101 deny tcp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eq 6002 access-list 101 deny tcp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eq 2001 access-list 101 deny tcp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eq 2002The following commands permit Telnet access to the communication server (B.B.13.2):
access-list 101 permit tcp 0.0.0.0 255.255.255.255 B.B.13.2 0.0.0.0 eq 23The following commands permit File Transfer Protocol (FTP) access to the host on subnet 13:
access-list 101 permit tcp 0.0.0.0 255.255.255.255 B.B.13.100 0.0.0.0 eq 21 access-list 101 permit tcp 0.0.0.0 255.255.255.255 B.B.13.100 0.0.0.0 eq 20Note: For the following examples, network B.B.1.0 is on the internal network. See Figure 2.
The following commands permit TCP and UDP connections for port numbers greater than 1023 to a very limited set of hosts. Make sure no communication servers or protocol translators are in this list.
access-list 101 permit tcp 0.0.0.0 255.255.255.255 B.B.13.100 0.0.0.0 gt 1023 access-list 101 permit tcp 0.0.0.0 255.255.255.255 B.B.1.100 0.0.0.0 gt 1023 access-list 101 permit tcp 0.0.0.0 255.255.255.255 B.B.1.101 0.0.0.0 gt 1023 access-list 101 permit udp 0.0.0.0 255.255.255.255 B.B.13.100 0.0.0.0 gt 1023 access-list 101 permit udp 0.0.0.0 255.255.255.255 B.B.1.100 0.0.0.0 gt 1023 access-list 101 permit udp 0.0.0.0 255.255.255.255 B.B.1.101 0.0.0.0 gt 1023Note: Standard FTP uses ports above 1023 for its data connections; therefore, for standard FTP operation, ports above 1023 must all be open. For more detail, see the section "File Transfer Protocol (FTP) Port."
The following commands permit DNS access to the DNS server(s) listed by the Network Information Center (NIC):
access-list 101 permit tcp 0.0.0.0 255.255.255.255 B.B.13.100 0.0.0.0 eq 53 access-list 101 permit tcp 0.0.0.0 255.255.255.255 B.B.1.100 0.0.0.0 eq 53The following commands permit incoming Simple Mail Transfer Protocol (SMTP) e-mail to only a few machines:
access-list 101 permit tcp 0.0.0.0 255.255.255.255 B.B.13.100 0.0.0.0 eq 25 access-list 101 permit tcp 0.0.0.0 255.255.255.255 B.B.1.100 0.0.0.0 eq 25The following commands allow internal Network News Transfer Protocol (NNTP) servers to receive NNTP connections from a list of authorized peers:
access-list 101 permit tcp 16.1.0.18 0.0.0.1 B.B.1.100 0.0.0.0 eq 119 access-list 101 permit tcp 128.102.18.32 0.0.0.0 B.B.1.100 0.0.0.0 eq 119The following command permits Internet Control Message Protocol (ICMP) for error message feedback:
access-list 101 permit icmp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255Every access list has an implicit "deny everything else" statement at the end of the list to ensure that attributes that are not expressly permitted will be denied.
Fortunately, there is an alternative to this behavior that allows the client to open the data socket, which allows you to have the firewall and FTP too. The client sends a PASV command to the server, receives back a port number for the data socket, then opens the data socket to the indicated port, and finally sends the transfer.
In order to implement this, the standard FTP client program must be replaced with a modified one that supports the PASV command. Most recent implementations of the FTP server already support the PASV command. The only trouble with this idea is that it breaks down when the server site has also blocked arbitrary incoming connections.
Source files for a modified FTP program that works through a firewall are now available via anonymous FTP at ftp.cisco.com. The file is /pub/ passive-ftp.tar.Z This is a version of BSD 4.3 FTP with the PASV patches. It works through a firewall router that allows only incoming established connections.
Caution: Care should be taken in providing anonymous FTP service on the host system. Anonymous FTP service allows anyone to access the hosts, without requiring an account on the host system. Many implementations of the FTP server have severe bugs in this area. Also, take care in the implementation and setup of the anonymous FTP service to prevent any obvious access violations. For most sites, anonymous FTP service is disabled.
interface ethernet 0 ip access-group 101 outThe access-list can also be applied to the serial interface on incoming traffic:
interface serial 0 ip access-group 101 inIf we wanted to control outgoing access to the Internet from our network, we would define an access list and apply it to either the outgoing packets on serial 0 of the firewall router or the incoming packets on ethernet 0. To do this, we would need to allow returning packets from hosts using Telnet or FTP to access the firewall subnetwork B.B.13.0.
Table 1: Well-Known TCP and UDP Services and Ports ------------------------------------------------------------------------ Service Port Type Port Number ------------------------------------------------------------------------ File Transfer Protocol (FTP)---Data TCP 20FTP---Commands TCP 21
Telnet TCP 23
Simple Mail Transfer Protocol (SMTP)---E-mail TCP 25
Terminal Access Controller Access Control System (TACACS) UDP 49
Domain Name Server (DNS) TCP and UDP 53
Trivial File Transfer Protocol (TFTP) UDP 69
finger TCP 79
SUN Remote Procedure Call (RPC) UDP 111
Network News Transfer Protocol (NNTP) TCP 119
Network Time Protocol (NTP) TCP and UDP 123
NeWS TCP 144
Simple Management Network Protocol (SNMP) UDP 161
SNMP (traps) UDP 162
Border Gateway Protocol (BGP) TCP 179
rlogin TCP 513
rexec TCP 514
talk TCP and UDP 517
ntalk TCP and UDP 518
Open Windows TCP and UDP 2000
Network File System (NFS) UDP 2049
X11 TCP and UDP 6000
------------------------------------------------------------------------
Table 2: CERT Advisory on TCP and UDP Services and Ports ------------------------------------------------------------------------ Service Port Type Port Number ------------------------------------------------------------------------ DNS zone transfers TCP and UDP 53Note: Cisco also recommends that you filter the TCP service, finger, at port 79.TFTP daemon (tftpd) UDP 69
link---commonly used by intruders TCP 87
SUN RPC TCP and UDP 111*
NFS UDP 2049
BSD UNIX r commands (rsh, rlogin, and so forth) TCP 512 - 514
line printer daemon (lpd) TCP 515
UNIX-to-UNIX copy program daemon (uucpd) TCP 540
Open Windows TCP and UDP 2000
X Windows TCP and UDP 6000+ ------------------------------------------------------------------------
*Port 111 is only a directory service. If you can guess the ports the actual data services are on, you can still talk to them. Most RPC services do not have fixed port numbers. You should find the ports that these services can be on and block them.
This figure illustrates a host that is "spoofing," or illegally claiming to be an address that it is not. Someone in the outside world is claiming to originate traffic from network 131.108.17.0. Although the address is spoofed, the router interface to the outside world assumes that the packet is coming from 131.108.17.0. If the input access list on the router allows traffic coming from 131.108.17.0, it will accept the illegal packet. To avoid this spoofing situation, an input access list should be applied to the router interface to the outside world. This access list would not allow any packets with addresses that are from the internal networks of which the router is aware (17.0 and 18.0).
_ _ _ _ | ( ) ---------- |131.108.17.0 ( Outside )----/----| Router |----| ( world ) | | | (_ _ _ _ )\ ---------- | \ | | packet \ | claiming to be \ ------------ from source 131.108.18.0 address 131.108.17.0If you have several internal networks connected to the firewall router and the router is using output filters, traffic between internal networks will see a reduction in performance created by the access list filters. If input filters are used only on the interface going from the router to the outside world, internal networks will not see any reduction in performance.
Note: If an address uses source routing, it can send and receive traffic through the firewall router. For this reason, we recommend that you always disable source routing on the firewall router with the no ip source-route command.
interface Ethernet0 ip address B.B.13.2 255.255.255.0 ! access-list 10 deny B.B.14.0 0.0.0.255 access-list 10 permit B.B.0.0 0.0.255.255 ! access-list 11 deny B.B.13.2 0.0.0.0 access-list 11 permit B.B.0.0 0.0.255.255 ! line 2 login tacacs location FireWallCS#2 ! access-class 10 in access-class 11 out ! modem answer-timeout 60 modem InOut telnet transparent terminal-type dialup flowcontrol hardware stopbits 1 rxspeed 38400 txspeed 38400 ! tacacs-server host B.B.1.100 tacacs-server host B.B.1.101 tacacs-server extended ! line vty 0 15 login tacacs
access-list 10 deny B.B.14.0 0.0.0.255 access-list 10 permit B.B.0.0 0.0.255.255We allow outgoing connections only to internal network hosts and to the communication server. This prevents a modem line in the outside world from calling out on a second modem line:
access-list 11 deny B.B.13.2 0.0.0.0 access-list 11 permit B.B.0.0 0.0.255.255
access-class 10 in access-class 11 out
banner exec Ctrl-c message Ctrl-c
Most of these systems have their own defined protocol. Some, such as Mosaic, use several different protocols to obtain the information in question.
Use caution when designing access lists applicable to each of these services. In many cases, the access lists will become interrelated as these service become interrelated.