Applying Network Security Lecture 1 Notes
Applying Network Security Lecture 1 Notes
— No standard method
o Reconnaissance attacks: information gathering
o Access attacks: gaining access, data retrieval, escalate access privileges to
administrator status
o DoS Attacks: create interruption of network services to users, devices, or
applications
DEFENDING THE NETWORK
— Shut down unnecessary ports
— Complex passwords which are frequently changed
— Develop written security policy for company
— Develop identity validation methods and educate employees about social engineering
risk
— Control physical system access
— Encrypt and password protect sensitive data
— Security hardware and software such as: firewalls, IPSs, VPN devices, antivirus,
content filtering
— Perform backups and test backed-up files regularly
— Keep patches up-to-date via a weekly or daily installation if possible — to prevent
buffer overflow and privilege escalation attacks
— Perform security audits to test the network
SECURE THE EDGE ROUTER
SECURE THE NETWORK INFRASTURCTURE
— Single Router: Single router connects protected network / internal LAN to the internet.
All security policies configured on this router
— Défense-in-Depth: multiple layers of security prior to traffic entering the protected
LAN. Three primary layers of defence: the edge router, the firewall, and an internal
routers that connects to the protected LAN
— DMZ: can be used for servers that must be accessible from the internet or another
external network. DMZ can be set up between two routers, with an internal router
connecting to the protected network and an external router connecting to the
unprotected network
THREE AREAS OF ROUTER SECURITY
— Is important
— If unauthorised person gains admin access to a router, that person could alter routing
parameters, disable routing functions, or discover and gain access to other systems
within the network
— Several tasks involved in securing administrative access to an infrastructure device:
o Restrict device accessibility
o Log and account for all access
o Authenticate access
o Authorise actions
o Present legal notification
o Ensure the confidentiality of data
SECURE LOCAL AND REMOTE ACCESS
— Weak passwords: simple dictionary words, mother’s maiden name, car make, user name
and birthday, simple words and numbers
— Strong passwords: alphanumeric character combinations, combinations of alphanumeric
characters, symbols, and inclusion of a space
CONFIGURE PASSWORDS
— MD5 hashes no longer considered secure because attackers can reconstruct valid
certificates
o This allows attackers to spoof any website
o Enable secret password uses a MD5 hash by default
— Now recommended that you configure all secret passwords using either type 8 or type 9
passwords
— Type 8 and type 9 introduced in Cisco IOS 15.3(3)M.
— Type 8 and type 9 use SHA encryption
— enable algorithm-type command syntax — enter an unecrypted password
— login blocking = enabling a detection profile that lets you configure a network device to
react to repeated failed login attempts by refusing furrther connection requests
— Access Control Lists (ACLs) can be used to permit legitimate connections from
addresses of know system admininstrators
— banner — global configuration mode command to specify appropraite messages.
Banners protect organisation from a legal perspective
CONFIGURE LOGIN ENHANCEMENT FEATURES
— login block-for — disables logins after a specified number of failed login attempts
(defends against DoS attacks)
— login quiet-mode — maps to an ACL that identifes the permitted hosts
— login-delay — specifies number of seconds that user must wait between unsuccesful
login attempts
— log on-success — logs succesful login attempts
— log on-failure — logs unsuccesful login attempts
— to hep Cisco IOS device provide DoS detection use: login block-for — monitors login
device activity and operates in two modes. Must issue before any other login command
o Normal mode (watch mode): router keeps count of number of failed login
attempts within an identified amount of time
o Quiet mode (quiet period): if number of failed logins exceeds configured
threshold, all login attempts using Telnet, SSH, and HTTP are denied for time
period specified in the login block-for command
— Three commands that can be configured to help an admin detect a password attack
— Each lets a device generate syslog messges for failed or succesful login attempts
— First two generate syslog messages for successful and unsuccesful login attempts
o login on-success log
o login on-failure log
— security authentication failure rate — can be configured to generate a log message when
the login failure rate is exceeded | an altenative to the login on-failure log command
— show login — verify login block-for command settings and current mode
— show login failures — displays info regarding the failed attempts, such as IP address
form which failed login attempts originated
CONFIGURE SSH
ENABLE SSH
— configure a Cisco device to support SSH using the following six steps:
1. configure a unique device hostname (config terminal) (hostname R1)
2. generate the IP domain name (ip domain name span.com)
3. generate a key to encrypt SSH traffic (crypto key generate rsa general-keys
modulus 1024)
4. verify or create a local database entry (username bob secret cisco)
5. authenticate against the local database (line vty 0 4)
6. enable vty inbound SSH sessions (login local) (transport input ssh) (exit)
— connect using an SSH client (e.g., PuTTY, OpenSSH, TeraTerm) running on a host
— Generally, the SSH client initiates an SSH connection to the router
— The router SSH service prompts for correct username and password combination
— After login verified, the router can be managed as if the admin was using a standrard
telnet session
CONFIGURE PRIVILEGE LEVELS
LIMITING COMMAND AVAILABILITY
— Cisco IOS can provide infrasturcture access using privilege level or role-based CLI
— By default, the Cisco IOS software CLI has two levels of access to commands
o User EXEC mode (privlilege level 1), and Privileged EXEC mode (privilege
level 15)
— 16 privilege levels in total (higher = user has more router access)
— Commands available at lower levels are also executable at higher levels
o Level 0: predefined for user-level access privileges. Seldom used, but includes
five commands: disable, enable, exit, help, and logout
o Level 1: default level for login with the router promp Router >. User cannot
make any changes or view the running configuration file
o Level 2-14: may be customised for user-level privileges. Commands from
lower levels may be moved up to another higher level, or higher level
commands can be moved down to a lower level
o Level 15: reserved for enable mode privileges (enable command). Users can
change configurations and view configuration files
LIMITING COMMAND AVAILABILITY
— Ptivilege mode {level level | reset} — assign commands to a custom privilege level
— Privilege exec level level [command] — Configure privilege level with specific commands
— Are two methods for assigning passwords to the different privilege levels
o username name privilege level secret password — (global). Assign privilege level to a
specific user
o enable secret level level — (global). Assign privilege level to a specific EXEC mode
LIMITATIONS OF PRIVILEGE LEVELS
— no access control to specific interfaces, ports, logical interfaces, and slots on a router
— commands available at lower privilege levels are always executanle at higher levels
— commands specifically set at a higher privilege level arte not avialble for lower
privileged users
— assigning a command with multiple keywords allows access to all commands that use
those keywords. E.g. allowing access to show ip route allows the user access to all
‘show’ and ‘show ip’ commands
CONFIGURE ROLE-BASED CLI
ROLE-BASED CLI ACCESS
— Cisco IOS Release 12.3.(11)T feature provides finer, mor granulat access by controlling
which commands are available to specific roles
— Role-based CLI access enables the network admin to create different views of router
configurations for different users
— Each view defines the CLI commands that each user can access
— It addresses security, availability, and operational efficency
ROLE-BASED VIEWS
— Role-based CLI provides three types of views that dicate which commands are available
o Root View: to configure any view for the system, the admin must be in root
view
o CLI View: a specific set of commands can be bundled into a CLI view
o Superview: a superview consists of one or more CLI views
— Superviews have several specific characteristics:
o A single CLI can be shared within multiple superviews
o Commands cannot be configured for a superview. An admin must add
commands to the CLI view and add that CLI view to the superview
o Users logged into a superview can access all the commands that are configured
for any of the CLI views that are part of the superview
o Each superview has a password that is used to switch between superviews or
from a CLI view to a superview
o Deleting a superview does not delete the associated CLI views. The CLI views
remain available to be assigned to another superview
— Steps essentially the same as configuring a CLI view, except that the view view-name
command is used to assign commands to the superview
1. Create view and enter superview configuration mode (parser view view-name
superview)
2. Assign a secret password to the view (secret password). This sets a password to
protect access to the superview
— enable view view-name — verify a view. Enter the name of the view to verify and
provide the password to log into the view
— use question mark (?) command to verify that the commands available in the view are
correct. The example enables the USER superview and list the commands available in
the view
— the example below enables the SUPPORT superview and lists the commands available
in the view
— this example enables the JR-ADMIN view and lists the commands available in the view
— By not specifying a view for the enable view command, you can login as root. From the
root view, use the show parser view all command to see a summary of all views
SUMMARY
SECURE CISCO IOS IMAGE AND CONFIGURATION FILES
CISCO IOS RESILIENT CONFIGURATION FEATURE
— Cisco IOS resilient configuration feature allows for faster recovery if someone
maliciously or unintentionally reformats flash memory or erases the startup
configuration file in non-volatile random-access memory (NVRAM)
o The config file in the primary bootset is a copy of the running configuration
that was in the router when the feature was first enabled
o The feature secures the smallest working set of files to preserve persistent
storage space
o No extra space is required to secure the primary Cisco IOS image file. The
feature automatically detects image or configuration version mismatch
o Only local storage is used for securing files
o The feature can be disabled only through a console session
FEATURE DEFAULT
Cisco Discovery Protocol (CDP) Enabled
Link Layer Discovery Protocol (LLDP) Disabled
Configuration autoloading Disabled
FTP server Disabled
TFTP server Disabled
Network Time Protocol (NTP) service Disabled
Packet assembler / dissembler (PAD) service Enabled
TCP and User Datagram Protocol (UDP) Enabled in versions 11.3 and later
minor services
Maintenance Operation Protocol (MDP) Enabled on most Ethernet interfaces
service
Simple Network Management Protocol Enabled
(SNMP)
HTTP or HTTPS configuration and Setting is Cisco device dependent
monitoring
Domain Name System (DNS) Enabled
Internet Control Message Protocol (ICMP) Enabled
redirects
IP source routing Enabled
Finger service Enabled
ICMP unreachable notifications Enabled
ICMP mask reply Disabled
IP identification service Enabled
TCP keepalives Disabled
Gratuitous ARP (GARP) Enabled
Proxy ARP Enabled
— The table below shows recommended security settings for protocols and services:
FEATURE RECOMMENDATION
Link Layer Discovery Protocol (LLDP) Should be disabled globally or on a per-
interface basis if it is not required
Configuration autoloading Should remain disabled when not in use by
the router
FTP server Should be disabled when it is not required
TFTP server It should be disabled when it is not required
Network Time Protocol (NTP) service It should remain disabled when it is not
required
Packet assembler / disassembler (PAD) It should be explicitly disabled when not in
service use
TCP and User Datagram Protocol (UDP) Disable this service explicitly
minor services
Maintenance Operation Protocol (MOP) It should be explicitly disabled when it is not
service in use
Simple Network Management Protocol Disable this service when it is not required
(SNMP)
HTTPS or HTTPS configuration and Disable service if it is not required. If this
monitoring service is required, restrict access to the
router HTTP or HTTPS service using access
control lists (ACLs)
Domain Name System (DNS) Disable when it is not required. If the DNS
lookup service is required, ensure that you
set the DNS server address explicitly
Internet Control Message Protocol (ICMP) Disable when it is not required
redirects
IP source routing Disable this service when it is not required
Finger service Disable this service when it is not required
ICMP unreachable notifications Disable on interfaces to untrusted networks
ICMP mask reply Disable on interfaces to untrusted networks
IP identification service Service should be explicitly disabled
TCP keepalives Should be enabled globally to manage TCP
connections and prevent certain denial of
service (DoS) attacks. Service is enabled in
Cisco IOS Software releases before Cisco
IOS Release 12.0 and is disabled in Cisco
IOS Release 12.0 and later. Disable this
service when it is not required
Gratuitous ARP (GARP) Disable gratuitous ARPs on each router
interface unless this service is needed
Proxy ARP Disable this service on each interface
CISCO AUTOSECURE
— AutoSecure can lock down the management plane functions and the forwarding plane
services and functions of a router. There are several management plane services and
functions:
o Secure BOOTP, CDP, FTP, TFTP, PAD, UDP, and TCP small servers, MOP,
ICMP (redirects, mask-replies), IP source routing, Finger, password encryption,
TCP keepalives, gratuitous ARP, proxy ARP, and directed broadcast
o Legal notification using a banner
o Secure password and login functions
o Secure NTP
o Secure SSH access
o TCP intercept services
— There are three forwarding plane services and functions that AutoSecure enables:
o Cisco Express Forwarding (CEF)
o Traffic filtering with ACLs
o Cisco IOS firewall inspection for common protocols
SYSLOG OPERATION
— On Cisco network devices, the syslog protocol starts by sending system messages and
debug output to a local logging process that is internal to the device
— How the logging process manages these messages and outputs is based on device
configuration
— As shown in the figure, popular destinations for syslog messages include the:
o Logging buffer (RAM inside a router or switch)
o Console line
o Terminal line
o Syslog server
SYSLOG FACILITIES
— Syslog facilities are service identifiers that identify and categorise system state data for
error and event message reporting
— The logging facility options that are available are specific to the networking device
— By default, the format of syslog messages on the Cisco IOS Software is as follows:
— For example, sample output on a Cisco switch for an EtherChannel link changing state
to up is:
— Here the facility is LINK and the severity level is 3, with a MNEMONIC of UPDOWN
CONFIGURE SYSLOG TIMESTAMPS
— By default, log messages are not timestamped
— Log messages should be timestamped so that when they are sent to another destination,
such as a Syslog server, there is record of when the message was generated
— service timestamps log datetime = force logged events to display date and time
— As shown in the command output, when the R1 GigabitEthernet 0/0/0 interface is
reactivated, the log messages now contain the date and time
SYSLOG SYSTEMS
— Syslog implementations always contain two types of systems:
o Syslog servers (log hosts): these systems accept and process log messages from
syslog clients
o Syslog clients: routers or other types of equipment that generate and forward
log messages to syslog servers
— The topology in the figure identifies the syslog server at IP address 10.2.2.6. The rest of
the servers and devices in the topology can be configured as syslog clients, which send
syslog messages to the syslog server
SYSLOG CONFIGURATION
— Configure system logging with the following steps:
1. Set the destination logging host using the logging [host] command
2. (Optional) Set the log severity (trap) level using the logging trap command
3. (Optional) Set the source interface using the logging source-interface command
4. (Optional) Enable logging to all enabled destinations with the logging on command
NTP CONFIGURATION
TIME AND CALENDAR SERVICES
— The software clock on a router or switch starts when the system boots
— It is the primary source of time for the system
— It is important to synchronise the time across all devices on the network because all
aspects of managing, securing, troubleshooting, and planning networks require accurate
timestamping
— The date and time settings on a router or switch can be manually configured, using the
clock set command, as shown in the example:
NTP CONFIGURATION
— NTP networks use a hierarchical system of time sources
— Each level in this hierarchical system is called a stratum
— The stratum level is defined as the number of hop counts from the authorative source
— The sample network consists of four stratum levels who acquire their times as follows:
o Stratum 1 server gets its time from the stratum 0 time source
o Stratum 2 server gets its time from the stratum 1 server
o Stratum 3 server gets its time from the stratum 2 server
— ntp server ip-address = configure a NTP server the device should use as a source. If the
source is another Cisco device. It must be configured with the ntp master [stratum]
command
— Use the show ntp associations and show ntp status commands to verify the device is
synchronised with the NTP server
SNMP CONFIGURATION
INTRODUCTION TO SNMP
— SNMP is an application layer protocol that provides a message format for
communication between managers and agents
— The SNMP system consists of three elements:
o SNMP manager
o SNMP agents (managed node)
o Management Information Base (MIB)
— To configure SNMP on a networking device, it is first necessary to define the
relationship between the manager and the agent
— The SNMP manager is part of a network management system (NMS). The SNMP
manager runs SNMP management software
— As shown in the figure, the SNMP manager can collect information from an SNMP
agent by using the ‘get’ action
— It can change configurations on an agent by using the ‘set’ action.
— In addition, SNMP agents can forward information directly to a network manager by
using ‘traps’
SNMP OPERATION
— There are two primary SNMP manager requests:
o get request: used by the NMS to query the device for data
o set request: used by the NMS to change configuration variables in the agent
device. A set request can also initiate actions within a device. For example, a
set request can cause a router to reboot, send a configuration file, or receive a
configuration file
— SNMP manager uses the get and set actions to perform the operations described in the
table
SNMP VERSIONS
— Here are several versions of SNMP:
o SNMPv1: this is the Simple Network Management Protocol, a Full Internet
Standard, that is defined in RFC 1157
o SNMPv2c: this is defined in RFCs 1901 to 1908. It uses a community-string-
based Administrative Framework
o SNMPv3: this is an interoperable standards-based protocol originally defined in
RFCs 2273 to 2275. It provides secure access to devices by authenticating and
encrypting packets over the network. It includes these security features:
message integrity to ensure that a packet was not tampered with in transit,
authentication to determine that the message is from a valid source, and
encryption to prevent the contents of a message from being read by an
unauthorised source
— All versions use SNMP managers, agents, and MIBs. Cisco IOS software supports the
above three versions. Both SNMPv1 and SNMPv2c use a community-based form of
security. The community of managers that is able to access the MIB of the agent is
defined by a community string. SNMPv3 provides for both security models and security
levels
SNMP VULNERABILITES
— In any network topology, at least on manager node should run SNMP management
software. Network devices that can be managed, such as switches, routers, servers, and
workstations, are equipped with the SNMP agent software module
— SNMP is vulnerable to attack precisely because SNMP agents can be polled with get
requests and accept configuration changes with set requests, as shown in the figure:
SNMPv3
— SNMPv3 provides three security features:
o Message integrity and authentication: ensures that a packet has not been
tampered with in transit and is from a valid source
o Encryption: scrambles the contents of a packet to prevent it from being seen by
an unauthorised source
o Access control: restricts each principal to certain actions on specific portions of
data
SNMPv3 SECURITY CONFIGURATION
— SNMPv3 can be secured with only a few commands:
1. Configure an ACL that will permit access to authorised SNMP managers
2. Configure an SNMP view with the snmp-server view command to identify the
MIB OIDs that the SNMP manager will be able to read. Configuring a view is
required to limit SNMP messages to read-only access
4. Configure SNMP group user features with the snmp-server user command:
a. Configure a username and associate the user with the group name
configured in step 3
b. Set the SNMP version to 3 with the v3 keyword
c. Set the authentication type to either md5 or sha and configure an
authentication password. SHA is preferred and should be supported by the
SNMP management software
d. Require encryption with the priv keyword and configure an encryption
password
SNMPv3 VERIFICATION
— Verify that the SNMP manager can send get requests to R1 by using an SNMP
management tool, such as the ManageEngine’s free SNMP MIB Browser. Configure
the tool with the user details. When a user is configured, use the SNMP management
tool’s features to test that the configured user can access the SNMP agent
— In the figure below, the network administrator entered the OID for the IP addressing
table. The get request returned all the addressing information for R1. The network
administrator authenticated with the appropriate credentials
— Verify that the data was encrypted by running a protocol analyser, such as Wireshark,
and capture the SNMP packets
To limit hacker access to sensitive network equipment and services — deploy Access
control to limit who or what can use specific resources. Also limits services or options
available after access granted
Many types of authentication possible on a Cisco device — varying security levels
Simplest method of remote access authentication: configure a login and password
combination on console, vty lines, and aux ports — easiest to implement, but also
weakest and least secure. Provides no accountability. Anyone with password can enter
device and alter configuration if have password
SSH: more secure form of remote access. Requires both username and password (both
encrypted during transmissions). Local database method provides additional security
because an attacker is required to know a username and a password.
Also provides more accountability because the username is recorded when a user logs
in. although Telnet can be configured using a username and password, both are sent in
plaintext, which makes it vulnerable to being captured and exploited.
Local database method has some limitations
o The user accounts must be configured locally on each device
o In a large enterprise environment that has multiple routers and switches to
manage, it can take time to implement and change local databases on each
device. Additionally, the local database configuration provides no fallback
authentication method. e.g. what if the administrator forgets the username and
password for that device? With no backup method available for authentication,
password recovery becomes only option
Better solution is to have all devices refer to the same database of usernames and
passwords from a central server
7.1.2 AAA COMPONENTS
AAA network security services provide primary framework to set up access control on
a network device
AAA: a way to control who is permitted to access a network (authenticate) and what
they can do while they are there (authorise)
AAA also allows auditing of actions that users perform while accessing the network
(accounting)
Network and administrative AAA security in the Cisco environment has three
functional components:
o Authentication: Users and admins must prove identity before accessing the
network and network resources. Authentication can be established using:
username and password combinations, challenge and response questions, token
cards, and other methods
o Authorisation: after user is authenticated, authorisation services determine
which resource the user can access and which operations the user is allowed to
perform. E.g. “User ‘Student’ can access host serverXYZ using SSH only”
o Accounting and auditing: accounting records what the user does, including
what is accessed, the amount of time the resource is accessed, and any changes
that were made. Accounting keeps track of how network resources are used. An
example is “User ‘Student’ accessed host serverXYZ using SSH for 15
minutes”
o Like a credit card: card identifies who can use it, how much user can spend, and
keeps account of items and services user purchased
AAA Authentication can be used to authenticate users for administrative access or can
be used to authenticate users for remote network access.
Cisco provides two common methods of implementing AAA services:
o Local AAA Authentication: Local AAA uses a local database for
authentication. This method sometimes known as self-contained
authentication. Method stores usernames and passwords locally in the Cisco
router, and users authenticate against the local database, as shown in the figure.
This database is the same one that is required for establishing role-based CLI.
Local AAA ideal for smaller networks
o Server-Based AAA Authentication: with server-based method, the router
accesses a central AAA server, such as the Cisco Secure Access Control
System (ACS) for Windows, which is shown in the figure. Central AAA server
contains the usernames and passwords for all users. The router uses either the
Remote Authentication Dial-In User Service (RADIUS) or Terminal Access
Controller Access Control System (TACACS+) protocols to communicate with
the AAA server. When there are multiple routers and switches, server-based
AAA is more appropriate because accounts can be administered from a central
location rather than on individual devices
7.1.4 AUTHORISATION
After users successfully authenticated against selected AAA data source, either local or
server-based, they are then authorised for specific network resources, as shown in the
figure
Authorisation: controls what users can and cannot do on the network after they are
authenticated. Similar to how privilege levels and role-based CLI give users specific
rights and privileges to certain commands on the router
Authorisation is typically implemented using a AAA server. Authorisation uses a set of
attributes that describes the user’s access to the network. These attributes are compared
to the information contained within the AAA database, and a determination of
restrictions for that user is made and delivered to the local router where the user is
connected
Authorisation is automatic and does not require users to perform additional steps after
authentication, authorisation is implemented immediately after the user is authenticated
7.1.5 ACCOUNTING
AAA Accounting collects and reports usage data. This data can be used for purposes
such as auditing or billing. Collected data might include: the start and stop connection
times, the commands executed, the number of packets, and the number of bytes
Accounting is implemented using a AAA server. This service reports usage statistics
back to the ACS server. These statistics can be extracted to create detailed reports about
the configuration of the network
One widely deployed use of accounting is to combine it with AAA authentication. This
helps with managing access to internetworking devices by network administrative staff.
Accounting provides more security than just authentication. The AAA servers keep a
detailed log of exactly what the authenticated user does on the device, as shown in the
figure. This includes all EXEC and configuration commands issued by the user. The log
contains numerous data fields, including the username, the date and time, and the actual
command that was entered by the user. This information is useful when troubleshooting
devices. It also provides leverage against individuals who perform malicious actions
Network Accounting: collects usage records for network access over various remote
access connections
Connection Accounting: captures information about all outbound connections made
from the AAA client, such as Telnet or SSH
EXEC Accounting: captures information about user EXEC terminal sessions (user
shells) on the network access server, including username, date, start and stop times, and
the access server IP address
System Accounting: captures information about all system-level events (for example,
when the system reboots or when accounting is turned on or off)
Command Accounting: captures information about the EXEC shell commands for a
specified privilege level that are being executed on a network access server. Each
command accounting records includes a list of the commands executed for that
privilege level, as well as the date and time each command was executed, and the user
who executed it
7.2 CONFIGURE LOCAL AAA AUTHENTICATION
7.2.1 AUTHENTICATE ADMINISTRATIVE ACCESS
aaa new-model = enable AAA | global config command | must be configured first | no
other AAA commands available until entered | Note: when command first entered: an
unseen ‘default’ authentication using the local database is automatically applied to all
lines except the console. For this reason, always configure a local database entry before
enabling AAA
no aaa… = disable AAA
aaa authentication login = enable authentication of the console, aux, and vty lines |
default keyword applies authentication to all lines. Alternatively, a custom
authentication method can be configured using a list-name
Command Description
Final portion of command identifies the type of methods that will be queried to
authenticate the users. Up to four methods can be defined, providing fallback methods
should one method not be available
When user attempts to log in: first method listed is used
Cisco IOS software attempts authentication with the next listed authentication method
only when there is no response or an error from the previous method occurs
If the authentication method denies the user access, the authentication process stops and
no other authentication methods are allowed
local or local-case = enable local authentication using a preconfigured database | local
accepts a username regardless of case | local-case is case sensitive
enable = specify that a user can authenticate using the enable password | to ensure that
the authentication succeeds even if all methods return an error, specify none as the final
method | Note: for security purposes, use none only when testing the AAA
configuration. It should never be applied on a live network | keyword
The table displays common methods that can be specified:
group radius Uses the list of all RADIUS servers for authentication.
group tacacs+ Uses the list of all TACACS+ servers for authentication.
aaa authentication login list-name = different method lists can be applied to different
interfaces and lines | for flexibility | e.g. an admin could apply a special login for SSH
and then have the default login method for the line console, as shown in the example
in this example: the vty line would only use the local database for authentication. All
other lines (i.e., console and aux lines) would use the local database and use the enable
password as a fallback if there were no database entries on the device
Notice that the named list has to be explicitly enable on the line using the login
authentication line config command. If a line has a custom authentication method list
applied to it, that method list overrides the default method list for that interface
When a custom authentication method list is applied to an interface, it is possible to
return to the default method list by using the no authentication login command
Unlike login delay command which introduces a delay between failed login attempts
without locking the account, the aaa local authentication attempts max-fail
command locks the user account if the authentication fails. The locked out user account
remains locked until it is manually cleared by an administrator using the clear aaa
local user lockout | privileged EXEC mode command
show aaa local user lockout = display a list of all locket-out users | in privileged
EXEC mode
when a user logs into a Cisco router that uses AAA, a unique ID is assigned to that
user’s session. Throughout the life of the sessions, various attributes that are related to
the session are collected and stored internally within the AAA database. These
attributes can include: the IP address of the user, the protocol that is used to access the
router (e.g., PPP), the speed of the connection, and the number of packets or bytes that
are received or transmitted
show aaa user = display attributes that are collected for one AAA session | in
privileged EXEC mode | this command does not provide information for all users who
are logged into a device, but only for those who have been authenticated or authorised
using AAA, or whose sessions are being accounted for by the AAA module
show aaa sessions = can be used to show the unique ID of a session, as shown in the
example
Local suitable in very small networks — but does not scale well
Most corporate environments have multiple switches, routers, other infrastructure
devices, multiple router admins, and hundreds or thousands of users needing access to
the corporate LAN — maintaining a local database for each device is not feasible
To solve this challenge, one or more AAA servers can be used to manage the user and
administrative access needs for an entire corporate network
AAA server software can create a central user and administrative access database to
which all devices in the network can refer. It may also work with many external
databases, including Active Directory and Lightweight Directory Access Protocol
(LDAP)
These databases store user account information and passwords, allowing for central
administration of user accounts. For increased redundancy, multiple servers can be
implemented. The figure shows the process of authenticating router administrator users
Server-Based Authentication:
1. User establishes a connection with the router
2. The router prompts the user for a username and password
3. The router passes the username and password to the Cisco Secure ACS
(server or engine)
4. The Cisco Secure ACS authenticates the user. The user is provided access
to the router (administrative access) or the network, based on information
found in the Cisco Secure ACS database
Cisco Identity Services Engine (ISE) is an identity and access control policy platform
that enables enterprises to enforce compliance, enhance infrastructure security, and
streamline their service operations.
The architecture of Cisco ISE allows enterprises to gather real-time contextual
information from networks, users, and devices.
The administrator can then use that information to make proactive governance decisions
by tying identity to various network elements.
These network elements include access switches, wireless LAN controllers (WLCs),
VPNs, gateways, and data center switches.
BYOD (Bring Your Own Device) is becoming more common and even necessary in
many enterprises. Cisco ISE defines fair access policies and enforces compliance for all
end devices including BYOD.
Cisco ISE is the main policy component for Cisco TrustSec and is a Cisco technology
that protects assets such as data, applications, and mobile devices from unauthorized
access.
Cisco ISE combines policy definition, control, and reporting in one appliance. ISE
works with existing network infrastructure to provide network administrators with
information about the end devices (known as endpoints) that attach to the network.
Several features of ISE are:
o Asset Visibility - Provides visibility and control over who and what is on the
network consistently, across wireless, wired, and VPN connections. Cisco ISE
uses probes and device sensors to listen to the way devices connect to the
network. The Cisco ISE profile database, which is extensive, then classifies the
device. This gives the visibility and context that is required to grant the right
level of network access
o Posture assessment – Determines if the device complies with device security
policies before it connects to the network. It can determine if a device is clean
of viruses and suspicious applications and can even make sure that a device’s
antivirus software is up to date
o Segmentation - Cisco ISE uses contextual data about network devices and
endpoints to facilitate network segmentation. Security group tags, access
control lists, network access protocols, and policy sets that define authorization,
access, and authentication, are some ways in which Cisco ISE enables secure
network segmentation
o Guest management and secure wireless – Enables providing secure network
access to visitors, contractors, consultants, and customers
o Threat Containment - If Cisco ISE detects threat or vulnerability attributes
from an endpoint, adaptive network control policies are sent to dynamically
change the access levels of the endpoint. After the threat or vulnerability is
evaluated and addressed, the endpoint can be given back its original access
policy
ISE provides context-aware identity management:
o To determine whether users are accessing the network on an authorized, policy-
compliant device
o To establish user identity, location, and access history, which can be used for
compliance and reporting
o To assign services based on the assigned user role, group, and associated policy
(job role, location, device type, etc.)
o To grant authenticated users access to specific segments of the network, or
specific applications and services, or both, based on authentication results
TACAS+ and RADIUS are both authentication protocols that are used to communicate
with AAA servers. As shown in the table, each supports different capabilities:
Unlike Local AAA Authentication, server-based AAA must identify various TACACS+
and RADIUS servers that the AAA service should consult when authenticating and
authorizing users
There are four basic steps to configure server-based authentication:
1. Globally enable AAA to allow the use of all AAA elements. This step is a
prerequisite for all other AAA commands
2. Specify the server that will provide AAA services for the router. This can be a
TACACS+ or RADIUS server
3. Configure the encryption key needed to encrypt the data transfer between the
network device and AAA server
4. Configure the AAA authentication method list to refer to the TACACS+ or
RADIUS server. For redundancy, it is possible to configure more than one
server
7.4.2 CONFIGURE TACACS+ SERVERS
TACACS+ and RADIUS protocols are used to communicate between clients and the
AAA security servers. The figure displays the AAA reference topology for this topic
To configure a TACACS+ server:
o globally enable AAA using the aaa new-model command.
o Next, use the tacacs server name command.
o In TACACS+ server configuration mode, configure the IPv4 address of the
TACACS+ server using the address ipv4 command. The address ipv4
command allows the option to modify the authentication port and the
accounting port.
o You can also specify an IPv6 address with the address ipv6 ipv6-address
command
o Next, use the single-connection command to enhance TCP performance by
maintaining a single TCP connection for the life of the session. Otherwise, by
default, a TCP connection is opened and closed for each session. If required,
multiple TACACS+ servers can be identified by entering their respective IPv4
addresses using the tacacs server name command
o The key key command is used to configure the shared secret key to encrypt the
data transfer between the TACACS+ server and AAA-enabled router. This key
must be configured exactly the same way on both the router and the TACACS+
server
The example displays a sample TACACS+ server configuration
To configure a RADIUS server, use the radius server name command. This puts you
into radius server configuration model
Because RADIUS uses UDP, there is no equivalent single-connection keyword. If
required, multiple RADIUS servers can be identified by entering a radius server name
command for each server
In RADIUS server configuration mode, configure the IPv4 address of the RADIUS
server using the address ipv4 ipv4-address command. You can also specify an IPv6
address with the address ipv6 ipv6-address command
By default, Cisco routers use port 1645 for the authentication and port 1646 for the
accounting. However, IANA has reserved ports 1812 for the RADIUS authentication
port and 1813 for the RADIUS accounting port. It is important to make sure these ports
match between the Cisco router and the RADIUS server
To configure the shared secret key for encrypting the password, use the key command.
This key must be configured exactly the same way on the router and the RADIUS
server
The example displays a sample RADIUS server configuration
7.4.4 AUTHENTICATE TO THE AAA SERVER CONFIGURATION COMMANDS
When the AAA security servers have been identified, the servers must be included in
the method list of the aaa authentication login command.
AAA servers are identified using the group tacacs+ or group radius keywords.
Refer to the example to see command syntax options available with the aaa
authentication login command
To configure a method list for the default login to authenticate first using a TACACS+
server, second with a RADIUS server, and finally with a local username database,
specify the order with the aaa authentication login default command, as highlighted in
the example.
It is important to realize that R1 will only attempt to authenticate using RADIUS if the
TACACS+ server is not reachable. Likewise, R1 would only attempt to authenticate
using the local database if the TACACS+ and RADIUS servers are unavailable
While authentication must ensure that the device or end user is legitimate, authorization
is concerned with allowing and disallowing authenticated users access to functions of
the network device interface
The TACACS+ protocol allows the separation of authentication from authorization.
A router can be configured to restrict the user to performing only certain functions after
successful authentication.
Keep in mind that RADIUS does not separate the authentication from the authorization
process
Another important aspect of authorization is the ability to control user access to specific
services. Controlling access to configuration commands greatly simplifies the
infrastructure security in large enterprise networks
In the animation, the JR-ADMIN has successfully established an SSH session with the
router and authenticated to the TACACS+ AAA server. Click Play to see how the
server responds to different commands
In the animation, the JR-ADMIN is permitted to access the show version command, but
not the configure terminal command. The router queries the AAA server for
permission to execute the commands on behalf of the user. When the user issues
the show version command, the server sends an ACCEPT response. If the user issues
a configure terminal command, the server sends a REJECT response
By default, TACACS+ establishes a new TCP session for every authorization request,
which can lead to delays when users enter commands. To improve performance, AAA
supports persistent TCP sessions that are configured with the single-connection tacacs
server configuration mode command
7.5.2 AAA AUTHORISATION CONFIGURATION
When AAA authorization is not enabled, all users are allowed full access.
After authentication is started, the default changes to allow no access.
This means that the administrator must create a user with full access rights before
authorization is enabled, as shown in the example. Failure to do so immediately locks
the administrator out of the system the moment the aaa authorization command is
entered.
The only way to recover from this is to reboot the router. If this is a production router,
rebooting might be unacceptable. Be sure that at least one user always has full rights.
Companies often need to keep track of which resources individuals or groups use. AAA
accounting enables usage tracking. An example of usage tracking is when one
department charges another department for access, or when one company provides
internal support to another company. The accounting function is similar to the
accounting information provided in a credit card billing statement as shown in the
figure
Although accounting is generally considered a network management or financial
management issue, it is discussed briefly here because it is so closely linked with
security
One security issue that is addressed by accounting is the creation of a list of users and
the time of day they logged into the system. If, for example, the administrator knows
that a worker logs in to the system in the middle of the night, this information can be
used to further investigate the purpose of the login
Another reason to implement accounting is to create a list of changes occurring on the
network, the user that made the changes, and the exact nature of the changes. Knowing
this information helps the troubleshooting process if the changes cause unexpected
results
When accounting is configured on a AAA server it functions as a central repository for
accounting information.
It tracks events that occur on the network, similar to the way in which financial activity
is tracked for a credit card account.
Each session that is established through Cisco Secure ACS can be fully accounted for
and stored on the server. This stored information can be very helpful for management,
security audits, capacity planning, and network usage billing.
Like authentication and authorization method lists, method lists for accounting define
the way accounting is performed and the sequence in which these methods are
performed.
After it is enabled, the default accounting method list is automatically applied to all
interfaces, except those that have a user-defined, or custom, accounting method list that
has been explicitly defined.
As with AAA authentication, either the keyword default or a list-name can be used
Next, the record type, or trigger, is configured. The trigger specifies what actions cause
accounting records to be updated. Possible triggers include:
o start-stop: sends a ‘start’ accounting notice at the beginning of a process and a
‘stop’ accounting notice at the end of a process
o stop-only: sends a ‘stop’ accounting record for all cases including
authentication failures
o none: disables accounting services on a line or interface
The examples show the command syntax and method list options available
The example shows an accounting configuration that logs the use of EXEC commands
and network connections
Local authentication does not scale well to large networks that have many networking
devices and users.
The legacy Cisco Secure ACS AAA server has been replaced by Cisco ISE.
ISE provides many access-related security functions beyond AAA functionality.
The TACACS+ and RADIUS protocols provide communication between a network
device and a AAA server.
The choice of protocol defends on the needs of the enterprise.
TACACS+ encrypts all communication while RADIUS only encrypts passwords.
TACACS+ separates the authentication and authorization processes, while they are
combined in RADIUS.
In addition, TACACS+ uses TCP while RADIUS uses UDP. It is important to note that
RADIUS supports remote access technologies such as 802.1X and SIP. There are other
important differences between the protocols.
TACACS+ is a Cisco enhancement of the original TACACS protocol and is not
compatible with the original version.
RADIUS is an open standard IETF protocol. It is widely used with VoIP because it
supports SIP.
The next generation protocol that is an alternative to RADIUS is Diameter AAA.
AAA authorization is concerned with allowing authenticated users access to only the
resources that they need to access.
For network administrators, the type of access that is permitted to the device command
line and network services can be controlled.
The type of authorization is configured with the aaa authorization command. Types
can be network, for network services, exec, for the User EXEC mode,
and command for all EXEC mode commands including configuration commands.
When AAA authorization is not enabled, all users are allowed full access.
After authentication is started, the default changes to allow no access.
This means that the administrator must create a user with full access rights before
authorization is enabled. Failure to do so immediately locks the administrator out of the
system the moment the aaa authorization command is entered. The only way to
recover from this is to reboot the router.
AAA accounting tracks the resources accessed by a user, or the device functions that an
administrator has accessed.
One reason to implement accounting is to create a list of changes that occurred on the
network device, the user that made the changes, and the exact nature of the changes.
Knowing this information helps the troubleshooting process if the changes cause
unexpected results.
The aaa accounting command options track the following types of information:
o network - all network-related service requests, including PPP
o exec - accounting for the EXEC shell session
o connection - accounting on all outbound connections such as SSH and Telnet
The record type or trigger specifies what actions cause accounting records to be
updated.
Triggers include the beginning and end of a process or authentication failures.
Accounting can also be disabled on a device line or interface.
MODULE 8
8.1 INTRODUCTION TO ACCESS CONTROL LISTS
8.1.1 WHAT IS AN ACL?
An ACL is a series of IOS commands that are used to filter packets based on
information found in the packet header.
By default, a router does not have any ACLs configured. However, when an ACL is
applied to an interface, the router performs the additional task of evaluating all network
packets as they pass through the interface to determine if the packet can be forwarded.
An ACL uses a sequential list of permit or deny statements, known as access control
entries (ACEs) | Note: ACEs are also commonly called ACL statements
When network traffic passes through an interface configured with an ACL, the router
compares the information within the packet against each ACE, in sequential order, to
determine if the packet matches one of the ACEs. This process is called packet
filtering
Several tasks performed by routers require the use of ACLs to identify traffic. The table
lists some of these tasks with examples:
Task Example
Limit network traffic to increase network A corporate policy prohibits video traffic on
performance the network to reduce the network load.
Task Example
Packet filtering controls access to a network by analysing the incoming and/or outgoing
packets and forwarding them or discarding them based on given criteria. Packet filtering
can occur at Layer 3 or Layer 4, as shown in the figure.
Cisco routers support two types of ACLs:
o Standard ACLs: ACLs only filter at Layer 3 using the source IPv4 address
only
o Extended ACLs: ACLs filter at Layer 3 using the source and / or destination
IPv4 address. They can only filter at Layer 4 using TCP, UDP ports, and
optional protocol type information for finer control
ACLs number 1 to 99, or 1300 to 1999 are standard ACLs while ACLs number 100 to
199, or 2000 to 2699 are extended ACLs, as shown in the output.
Named ACLs
Named ACLs is the preferred method to use when configuring ACLs. Specifically,
standard and extended ACLs can be named to provide information about the purpose of
the ACL. For example, naming an extended ACL FTP-FILTER is far better than having
a numbered ACL 100.
The ip access-list global configuration command is used to create a named ACL, as
shown in the following example
ACLs define the set of rules that give added control for packets that enter inbound
interfaces, packets that relay through the router, and packets that exit outbound
interfaces of the router.
ACLs can be configured to apply to inbound traffic and outbound traffic, as shown in
the figure.
Note: ACLs do not act on packets that originate from the router itself.
An inbound ACL filters packets before they are routed to the outbound interface.
An inbound ACL is efficient because it saves the overhead of routing lookups if the
packet is discarded. If the packet is permitted by the ACL, it is then processed for
routing.
Inbound ACLs are best used to filter packets when the network attached to an inbound
interface is the only source of packets that need to be examined.
An outbound ACL filters packets after being routed, regardless of the inbound interface.
Incoming packets are routed to the outbound interface and then they are processed
through the outbound ACL.
Outbound ACLs are best used when the same filter will be applied to packets coming
from multiple inbound interfaces before exiting the same outbound interface.
The last ACE statement of an ACL is always an implicit deny that blocks all traffic.
By default, this statement is automatically implied at the end of an ACL even though it
is hidden and not displayed in the configuration.
Note: An ACL must have at least one permit statement otherwise all traffic will be
denied due to the implicit deny ACE statement.
In the previous topic, you learned about the purpose of ACLs. This topic explains how
ACLs use wildcard masks.
An IPv4 ACE uses a 32-bit wildcard mask to determine which bits of the address to
examine for a match. Wildcard masks are also used by the Open Shortest Path First
(OSPF) routing protocol.
A wildcard mask is similar to a subnet mask in that it uses the ANDing process to
identify which bits in an IPv4 address to match. However, they differ in the way they
match binary 1s and 0s.
Unlike a subnet mask, in which binary 1 is equal to a match and binary 0 is not a match,
in a wildcard mask, the reverse is true.
Wildcard masks use the following rules to match binary 1s and 0s:
o Wildcard mask bit 0: match the corresponding bit value in the address
o Wildcard mask bit 1: ignore the corresponding bit value in the address
The table lists some examples of wildcard masks and what they would identify:
Using wildcard masks will take some practice. Refer to the examples to learn how the
wildcard mask is used to filter traffic for one host, one subnet, and a range IPv4
addresses.
Wildcard to Match a Host
In this example, the wildcard mask is used to match a specific host IPv4 address.
Assume ACL 10 needs an ACE that only permits the host with IPv4 address
192.168.1.1. Recall that “0” equals a match and “1” equals ignore. To match a specific
host IPv4 address, a wildcard mask consisting of all zeroes (i.e., 0.0.0.0) is required.
The table lists in binary, the host IPv4 address, the wildcard mask, and the permitted
IPv4 address.
The 0.0.0.0 wildcard mask stipulates that every bit must match exactly. Therefore, when
the ACE is processed, the wildcard mask will permit only the 192.168.1.1 address. The
resulting ACE in ACL 10 would be access-list 10 permit 192.168.1.1 0.0.0.0.
INSERT TABLE
Wildcard Mask to Match an IPv4 Subnet
In this example, ACL 10 needs an ACE that permits all hosts in the 192.168.1.0/24
network. The wildcard mask 0.0.0.255 stipulates that the very first three octets must
match exactly but the fourth octet does not.
The table lists in binary, the host IPv4 address, the wildcard mask, and the permitted
IPv4 addresses.
When processed, the wildcard mask 0.0.0.255 permits all hosts in the 192.168.1.0/24
network. The resulting ACE in ACL 10 would be access-list 10 permit 192.168.1.0
0.0.0.255.
INSERT TABLE
Wildcard Mask to Match an IPv4 Address Range
In this example, ACL 10 needs an ACE that permits all hosts in the 192.168.16.0/24,
192.168.17.0/24, …, 192.168.31.0/24 networks. The wildcard mask 0.0.15.255 would
correctly filter that range of addresses.
The table lists in binary the host IPv4 address, the wildcard mask, and the permitted
IPv4 addresses.
The highlighted wildcard mask bits identify which bits of the IPv4 address must match.
When processed, the wildcard mask 0.0.15.255 permits all hosts in the 192.168.16.0/24
to 192.168.31.0/24 networks. The resulting ACE in ACL 10 would be access-list 10
permit 192.168.16.0 0.0.15.255.
INSERT TABLE
Calculating wildcard masks can be challenging. One shortcut method is to subtract the
subnet mask from 255.255.255.255. Refer to the examples to learn how to calculate the
wildcard mask using the subnet mask.
Example 1
Assume you wanted an ACE in ACL 10 to permit access to all users in the
192.168.3.0/24 network. To calculate the wildcard mask, subtract the subnet mask (i.e.,
255.255.255.0) from 255.255.255.255, as shown in the table.
The solution produces the wildcard mask 0.0.0.255. Therefore, the ACE would
be access-list 10 permit 192.168.3.0 0.0.0.255.
INSERT TABLE
Example 2
In this example, assume you wanted an ACE in ACL 10 to permit network access for
the 14 users in the subnet 192.168.3.32/28. Subtract the subnet (i.e., 255.255.255.240)
from 255.255.255.255, as shown in the table.
This solution produces the wildcard mask 0.0.0.15. Therefore, the ACE would
be access-list 10 permit 192.168.3.32 0.0.0.15.
INSERT TABLE
Example 3
In this example, assume you needed an ACE in ACL 10 to permit only networks
192.168.10.0 and 192.168.11.0. These two networks could be summarized as
192.168.10.0/23 which is a subnet mask of 255.255.254.0. Again, you subtract
255.255.254.0 subnet mask from 255.255.255.255, as shown in the table.
This solution produces the wildcard mask 0.0.1.255. Therefore, the ACE would
be access-list 10 permit 192.168.10.0 0.0.1.255.
INSERT TABLE
Example 4
Consider an example in which you need an ACL number 10 to match networks in the
range between 192.168.16.0/24 to 192.168.31.0/24. This network range could be
summarized as 192.168.16.0/20 which is a subnet mask of 255.255.240.0. Therefore,
subtract 255.255.240.0 subnet mask from 255.255.255.255, as shown in the table.
This solution produces the wildcard mask 0.0.15.255. Therefore, the ACE would
be access-list 10 permit 192.168.16.0 0.0.15.255.
INSERT TABLE
Working with decimal representations of binary wildcard mask bits can be tedious. To
simplify this task, the Cisco IOS provides two keywords to identify the most common
uses of wildcard masking. Keywords reduce ACL keystrokes but more importantly,
keywords make it easier to read the ACE.
The two keywords are:
host: this keyword substitutes for the 0.0.0.0 mask. This mask states that all IPv4
address bits must match to filter just one host address
any: this keyword substitutes for the 255.255.255.255 mask. This mask says to ignore
the entire IPv4 address or to accept any addresses
For example, in the command output, two ACLs are configured. The ACL 10 ACE
permits only the 192.168.10.10 host and the ACL 11 ACE permits all hosts.
Alternatively, the keywords host and any could have been used to replace the
highlighted output.
The following commands accomplishes the same task as the previous commands.
To create a numbered standard ACL, use the following global configuration command:
Use the no access-list access-list-number global configuration command to remove a
numbered standard ACL.
The table provides a detailed explanation of the syntax for a standard ACL:
Parameter Description
Naming an ACL makes it easier to understand its function. To create a named standard
ACL, use the following global configuration command:
This command enters the named standard configuration mode where you configure the
ACL ACEs.
ACL names are alphanumeric, case sensitive, and must be unique. Capitalizing ACL
names is not required but makes them stand out when viewing the running-config
output. It also makes it less likely that you will accidentally create two different ACLs
with the same name but with different uses of capitalization.
Note: Use the no ip access-list standard access-list-name global configuration
command to remove a named standard IPv4 ACL.
In the example, a named standard IPv4 ACL called NO-ACCESS is created. Notice that
the prompt changes to named standard ACL configuration mode. ACE statements are
entered in the named standard ACL sub configuration mode. Use the help facility to
view all the named standard ACL ACE options.
The three highlighted options are configured similar to the numbered standard ACL.
Unlike the numbered ACL method, there is no need to repeat the initial ip access-
list command for each ACE.
The procedural steps for configuring extended ACLs are the same as for standard
ACLs. The extended ACL is first configured, and then it is activated on an interface.
However, the command syntax and parameters are more complex to support the
additional features provided by extended ACLs.
To create a numbered extended ACL, use the following global configuration command:
ip access-group 0 0
Use the no access-list access-list-number global configuration command to remove an
extended ACL.
Although there are many keywords and parameters for extended ACLs, it is not
necessary to use all of them when configuring an extended ACL. The table provides a
detailed explanation of the syntax for an extended ACL:
Parameter Description
destination.
The command to apply an extended IPv4 ACL to an interface is the same as the
command used for standard IPv4 ACLs.
To remove an ACL from an interface, first enter the no ip access-group interface
configuration command. To remove the ACL from the router, use the no access-
list global configuration command.
Note: The internal logic applied to the ordering of standard ACL statements does not
apply to extended ACLs. The order in which the statements are entered during
configuration is the order they are displayed and processed.
Extended ACLs can filter on many different types of internet protocols and ports.
Protocol Options
Extended ACLs can filter on different port number and port name options. This
example configures an extended ACL 100 to filter HTTP traffic. The first ACE uses
the www port name. The second ACE uses the port number 80. Both ACEs achieve
exactly the same result.
Configuring the port number is required when there is not a specific protocol name
listed such as SSH (port number 22) or an HTTPS (port number 443), as shown in the
next example.
TCP can also perform basic stateful firewall services using the
TCP established keyword. The keyword enables inside traffic to exit the inside private
network and permits the returning reply traffic to enter the inside private network, as
shown in the figure.
However, TCP traffic generated by an outside host and attempting to communicate with
an inside host is denied.
The established keyword can be used to permit only the return HTTP traffic from
requested websites, while denying all other traffic.
In the topology, the design for this example shows that ACL 110, which was previously
configured, will filter traffic from the inside private network. ACL 120, using
the established keyword, will filter traffic coming into the inside private network from
the outside public network.
In the example, ACL 120 is configured to only permit returning web traffic to the inside
hosts. The new ACL is then applied outbound on the R1 G0/0/0 interface. The show
access-lists command displays both ACLs. Notice from the match statistics that inside
hosts have been accessing the secure web resources from the internet.
Notice that the permit secure HTTPS counters (i.e., eq 443) in ACL 110 and the return
established counters in ACL 120 have increased.
The established parameter allows only responses to traffic that originates from the
192.168.10.0/24 network to return to that network. Specifically, a match occurs if the
returning TCP segment has the ACK or reset (RST) flag bits set. This indicates that the
packet belongs to an existing connection. Without the established parameter in the
ACL statement, clients could send traffic to a web server, and receive traffic returning
from the web server. All traffic would be permitted.
Naming an ACL makes it easier to understand its function. To create a named extended
ACL, use the following global configuration command:
This command enters the named extended configuration mode. Recall that ACL names
are alphanumeric, case sensitive, and must be unique.
In the example, a named extended ACL called NO-FTP-ACCESS is created and the
prompt changed to named extended ACL configuration mode. ACE statements are
entered in the named extended ACL sub configuration mode.
Named extended ACLs are created in essentially the same way that named standard
ACLs are created.
The topology in the figure is used to demonstrate configuring and applying two named
extended IPv4 ACLs to an interface:
SURFING - This will permit inside HTTP and HTTPS traffic to exit to the internet.
BROWSING - This will only permit returning web traffic to the inside hosts while all
other traffic exiting the R1 G0/0/0 interface is implicitly denied.
The example shows the configuration for the inbound SURFING ACL and the
outbound BROWSING ACL.
The SURFING ACL permits HTTP and HTTPS traffic from inside users to exit the
G0/0/1 interface connected to the internet. Web traffic returning from the internet is
permitted back into the inside private network by the BROWSING ACL.
The SURFING ACL is applied inbound and the BROWSING ACL applied outbound
on the R1 G0/0/0 interface, as shown in the output.
Inside hosts have been accessing the secure web resources from the internet. The show
access-lists command is used to verify the ACL statistics. Notice that the permit secure
HTTPS counters (i.e., eq 443) in the SURFING ACL and the return established
counters in the BROWSING ACL have increased.
8.4 MODIFY ACLs
8.4.1 TWO METHODS TO MODIFY AN ACL
After an ACL is configured, it may need to be modified. ACLs with multiple ACEs can
be complex to configure. Sometimes the configured ACE does not yield the expected
behaviours. For these reasons, ACLs may initially require a bit of trial and error to
achieve the desired filtering result.
This section will discuss two methods to use when modifying an ACL:
o Use a Text Editor
o Use Sequence Numbers
ACLs with multiple ACEs should be created in a text editor. This allows you to plan the
required ACEs, create the ACL, and then paste it into the router interface. It also
simplifies the tasks to edit and fix an ACL.
For example, assume ACL 1 was entered incorrectly using 19 instead of 192 for the
first octet, as shown in the running configuration:
In the example, the first ACE should have been to deny the host at 192.168.10.10.
However, the ACE was incorrectly entered.
To correct the error:
o Copy the ACL from the running configuration and paste it into the text editor.
o Make the necessary changes.
o Remove the previously configured ACL on the router. Otherwise, pasting the
edited ACL commands will only append (i.e., add) to the existing ACL ACEs
on the router.
o Copy and paste the edited ACL back to the router.
Assume that ACL 1 has now been corrected. Therefore, the incorrect ACL must be
deleted, and the corrected ACL 1 statements must be pasted in global configuration
mode, as shown in the output:
An ACL ACE can also be deleted or added using the ACL sequence numbers. Sequence
numbers are automatically assigned when an ACE is entered. These numbers are listed
in the show access-lists command. The show running-config command does not
display sequence numbers.
In the previous example, the incorrect ACE for ACL 1 is using sequence number 10, as
shown in the example:
An ACL is made up of one or more access control entries (ACEs) or statements. When
configuring and applying an ACL, be aware of the guidelines summarized in this list:
o Create an ACL globally and then apply it.
o Ensure the last statement is an implicit deny any or deny ip any any.
o Remember that statement order is important because ACLs are processed top-
down.
o As soon as a statement is matched the ACL is exited.
o Always filter from the most specific to the most generic. For example, deny a
specific host and then permit all other hosts.
o Remember that only one ACL is allowed per interface, per protocol, per
direction.
o Remember that new statements for an existing ACL are added to the bottom of
the ACL by default.
o Remember that router-generated packets are not filtered by outbound ACLs.
o Place standard ACLs as close to the destination as possible.
o Place extended ACLs as close to the source as possible.
After creating an ACL, the administrator can apply it in a number of different ways.
The following shows the command syntax to apply an ACL to an interface or to the vty
lines.
Named Standard ACL Example
The figure below shows a named standard ACL applied to outbound traffic.
This figure shows two named extended ACLs. The SURFING ACL is applied to
inbound traffic and the BROWSING ACL is applied to outbound traffic.
Named Extended ACL Example
Enabling the log parameter on a Cisco router or switch seriously affects the
performance of that device. The log parameter should only be used when the network is
under attack, and an administrator is trying to determine who the attacker is.
Applying ACLs to interfaces and lines is just one of their many possible uses. ACLs are
also an integral part of other security configurations, such as network address
translation (NAT), zone-based firewalls, and virtual private networks.
Extended ACLs should be located as close as possible to the source of the traffic to be
filtered. This way, undesirable traffic is denied close to the source network without
crossing the network infrastructure.
Standard ACLs should be located as close to the destination as possible. If a standard
ACL was placed at the source of the traffic, the "permit" or "deny" will occur based on
the given source address no matter where the traffic is destined.
Placement of the ACL and therefore, the type of ACL used, may also depend on a
variety of factors as listed in the table.
Bandwidth of the networks It may be desirable to filter unwanted traffic at the source to
involved prevent transmission of bandwidth-consuming traffic.
Following the guidelines for ACL placement, standard ACLs should be located as close
to the destination as possible.
In the figure, the administrator wants to prevent traffic originating in the
192.168.10.0/24 network from reaching the 192.168.30.0/24 network.
Following the basic placement guidelines, the administrator would place a standard
ACL on router R3. There are two possible interfaces on R3 to apply the standard ACL:
R3 S0/1/1 interface (inbound) - The standard ACL can be applied inbound on the R3
S0/1/1 interface to deny traffic from .10 network. However, it would also filter .10
traffic to the 192.168.31.0/24 (.31 in this example) network. Therefore, the standard
ACL should not be applied to this interface.
R3 G0/0/0 interface (outbound) - The standard ACL can be applied outbound on the
R3 G0/0/0 interface. This will not affect other networks that are reachable by R3.
Packets from .10 network will still be able to reach the .31 network. This is the best
interface to place the standard ACL to meet the traffic requirements.
Extended ACLs should be located as close to the source as possible. This prevents
unwanted traffic from being sent across multiple networks only to be denied when it
reaches its destination.
However, the organization can only place ACLs on devices that they control. Therefore,
the extended ACL placement must be determined in the context of where organizational
control extends.
In the figure, for example, Company A wants to deny Telnet and FTP traffic to
Company B’s 192.168.30.0/24 network from their 192.168.11.0/24 network while
permitting all other traffic.
There are several ways to accomplish these goals. An extended ACL on R3 would
accomplish the task, but the administrator does not control R3. In addition, this solution
allows unwanted traffic to cross the entire network, only to be blocked at the
destination. This affects overall network efficiency.
The solution is to place an extended ACL on R1 that specifies both source and
destination addresses.
There are two possible interfaces on R1 to apply the extended ACL:
R1 S0/1/0 interface (outbound) - The extended ACL can be applied outbound on the
S0/1/0 interface. However, this solution will process all packets leaving R1 including
packets from 192.168.10.0/24.
R1 G0/0/1 interface (inbound) - The extended ACL can be applied inbound on the
G0/0/1 so that only packets from the 192.168.11.0/24 network are subject to ACL
processing on R1. Because the filter is to be limited to only those packets leaving the
192.168.11.0/24 network, applying the extended ACL to G0/0/1 is the best solution.
ACLs can be used to mitigate many network threats, such as IP address spoofing and
denial of service (DoS) attacks. Most DoS attacks use some type of spoofing. IP address
spoofing overrides the normal packet creation process by inserting a custom IP header
with a different source IP address. Attackers can hide their identity by spoofing the
source IP address.
There are many well-known classes of IP addresses that should never be seen as source
IP addresses for traffic entering an organization’s network. For example, in the figure
the S0/0/0 interface is attached to the internet and should never accept inbound packets
from the following addresses:
o All zeros addresses
o Broadcast addresses
o Local host addresses (127.0.0.0/8)
o Automatic Private IP Addressing (APIPA) addresses (169.254.0.0/16)
o Reserved private addresses (RFC 1918)
o IP multicast address range (224.0.0.0/4)
The 192.168.1.0/24 network is attached to the R1 G0/0 interface. This interface should
only allow inbound packets with a source address from that network. The ACL for G0/0
shown in the figure will only permit inbound packets from the 192.168.1.0/24 network.
All others will be discarded.
Inbound on S0/0/0:
Inbound on G0/0:
An effective strategy for mitigating attacks is to explicitly permit only certain types of
traffic through a firewall. For example, Domain Name System (DNS), Simple Mail
Transfer Protocol (SMTP), and File Transfer Protocol (FTP) are services that often
must be allowed through a firewall.
It is also common to configure a firewall so that it permits administrators remote access
through the firewall.
Secure Shell (SSH), syslog, and Simple Network Management Protocol (SNMP) are
examples of services that a router may need to include.
While many of these services are useful, they should be controlled and monitored.
Exploitation of these services leads to security vulnerabilities.
The figure shows an example topology with ACL configurations to permit specific
services on the Serial 0/0/0 interface
INBOUND ON SERIAL 0/0/0
8.6.3 MTIGATE ICMP ATTACKS
Hackers can use Internet Control Message Protocol (ICMP) echo packets (pings) to
discover subnets and hosts on a protected network and to generate DoS flood attacks.
Hackers can use ICMP redirect messages to alter host routing tables. Both ICMP echo
and redirect messages should be blocked inbound by the router.
Several ICMP messages are recommended for proper network operation and should be
allowed into the internal network:
o Echo reply - Allows users to ping external hosts.
o Source quench - Requests that the sender decrease the traffic rate of messages.
o Unreachable - Generated for packets that are administratively denied by an
ACL.
As a rule, block all other ICMP message types outbound.
ACLs are used to block IP address spoofing, selectively permit specific services
through a firewall, and to allow only required ICMP messages.
The figure shows a sample topology and possible ACL configurations to permit specific
ICMP services on the G0/0 and S0/0/0 interfaces.
INBOUND ON S0/0/0
INBOUND ON G0/0
Management protocols, such as SNMP, are useful for remote monitoring and
management of networked devices.
However, they can still be exploited. If SNMP is necessary, exploitation of SNMP
vulnerabilities can be mitigated by applying interface ACLs to filter SNMP packets
from non-authorized systems.
An exploit may still be possible if the SNMP packet is sourced from an address that has
been spoofed and is permitted by the ACL.
These security measures are helpful, but the most effective means of exploitation
prevention is to disable the SNMP server on IOS devices for which it is not required.
As shown in the figure, use the command no snmp-server to disable SNMP services on
Cisco IOS devices.
In recent years, many networks have begun the transition to an IPv6 environment. Part
of the need for the transition to IPv6 is because of the inherent weaknesses in IPv4.
Unfortunately, as the migration to IPv6 continues, IPv6 attacks are becoming more
pervasive.
IPv4 will not disappear overnight. IPv4 will coexist with IPv6 and then gradually be
replaced by IPv6.
This creates potential security holes.
An example of a security concern is threat actors leveraging IPv4 to exploit IPv6 in dual
stack environments.
Dual stack is an integration method in which a device has connectivity to both IPv4 and
IPv6 networks.
In a dual stack environment devices operate with two IP protocol stacks.
Threat actor can accomplish stealth attacks that result in trust exploitation by using
dual-stacked hosts, rogue Neighbor Discovery Protocol (NDP) messages, and tunneling
techniques.
Teredo tunneling, for example, is an IPv6 transition technology that provides automatic
IPv6 address assignment when IPv4/IPv6 hosts are located behind IPv4 network
address translation (NAT) devices.
It accomplishes this by embedding the IPv6 packets inside IPv4 UDP packets. The
threat actor gains a foothold in the IPv4 network. The compromised host sends rogue
router advertisements (RAs), which triggers dual stacked hosts to obtain an IPv6
address.
The threat actor can then use this foothold to move around, or pivot, inside the network.
The threat actor can compromise additional hosts before sending traffic back out of the
network, as shown in the figure.
Parameter Description
source-ipv6-prefix /
The source or destination IPv6 network or class of
prefix-length
networks for which to set deny or permit conditions.
destination-ipv6-address / prefix-length
An ACL is a series of IOS commands that are used to filter packets based on
information found in the packet header. By default, a router does not have any ACLs
configured. An ACL uses a sequential list of permit or deny statements, known as
ACEs. The packet filtering process occurs when network traffic passes through an
interface configured with an ACL, and the router compares the information within the
packet against each ACE, in sequential order, to determine if the packet matches one of
the ACEs. Packet filtering can occur at Layer 3 or Layer 4. Cisco routers support
Standard ACLs and Extended ACLs. ACLs number 1 to 99, or 1300 to 1999 are
standard ACLs while ACLs number 100 to 199, or 2000 to 2699 are extended ACLs.
Named ACLs are the preferred method to use when configuring ACLs. The name
provides information about the purpose of the ACL. ACLs define the set of rules that
give added control for packets that enter inbound interfaces, packets that relay through
the router, and packets that exit outbound interfaces of the router.
WILDCARD MASKING
An IPv4 ACE uses a 32-bit wildcard mask to determine which bits of the address to
examine for a match. Wildcard masks are also used by the OSPF routing protocol. A
wildcard mask is similar to a subnet mask in that it uses the ANDing process to identify
which bits in an IPv4 address to match. However, they differ in the way they match
binary 1s and 0s. Unlike a subnet mask, in which binary 1 is equal to a match and
binary 0 is not a match, in a wildcard mask, the reverse is true. One shortcut method to
calculate wildcard masks is to subtract the subnet mask from 255.255.255.255. The
Cisco IOS provides two keywords, host and any, to simplify the most common uses of
wildcard masking. Keywords reduce ACL keystrokes and make it easier to read the
ACE.
CONFIGURING ACLs
When configuring a complex ACL, it is suggested that you use a text editor and write
out the specifics of the policy to be implemented, add the IOS configuration commands
to accomplish those tasks, include remarks to document the ACL, and copy and paste
the commands onto the device. Always thoroughly test an ACL to ensure that it
correctly applies the desired policy. To create a numbered standard ACL, use the
command access-list access-list-number {deny | permit | remark text} source [source-
wildcard] [log]. To create a named standard ACL, use the command ip access-list
standard access-list-name. ACL names are alphanumeric, case sensitive, and must be
unique. The procedural steps for configuring extended ACLs are the same as for
standard ACLs. The command to apply an extended IPv4 ACL to an interface is the
same as the command used for standard IPv4 ACLs is ip access-group {access-list-
number | access-list-name} {in | out}. Extended ACLs can filter on many different
types of internet protocols and ports. TCP can also perform basic stateful firewall
services using the TCP established keyword. The keyword enables inside traffic to exit
the inside private network and permits the returning reply traffic to enter the inside
private network.
MODIFYING ACLs
ACLs with multiple ACEs should be created in a text editor. This allows you to plan the
required ACEs, create the ACL, and then paste it into the router interface, and makes
editing the ACL simpler. An ACL ACE can also be deleted or added using the ACL
sequence numbers. Sequence numbers are automatically assigned when an ACE is
entered. These numbers are listed in the show access-lists command.
IMPLEMENTING ACLs
When configuring and applying an ACL, be aware of the guidelines summarized in this
list:
Every ACL should be placed where it is the most efficient. Extended ACLs should be
located as close as possible to the source of the traffic to be filtered. Standard ACLs
should be located as close to the destination as possible. Factors influencing ACL
placement include the extent of organizational control, bandwidth of the networks
involved, and ease of configuration.
MITIGATE ATTACKS WITH ACLs
ACLs can be used to mitigate many network threats, such as IP address spoofing and
DoS attacks. An effective strategy for mitigating attacks is to explicitly permit only
certain types of traffic through a firewall. Both ICMP echo and redirect messages
should be blocked inbound by the router. If SNMP is necessary, exploitation of SNMP
vulnerabilities can be mitigated by applying interface ACLs to filter SNMP packets
from non-authorized systems. Several ICMP messages are recommended for proper
network operation and should be allowed into the internal network including echo reply,
source quench, and unreachable. Several ICMP messages should be allowed to exit the
network including echo, parameter problem, packet too big, and source quench. As a
rule, block all other ICMP message types outbound.
IPv6 ACLs
IPv6 has several features that meet modern-day network requirements: IPsec, Mobile
IP, RSVP, and address scalability. Dual stack is an integration method in which a
device has connectivity to both IPv4 and IPv6 networks. In a dual stack environment
devices operate with two IP protocol stacks. Attackers can accomplish stealth attacks
that result in trust exploitation by using dual-stacked hosts, rogue NDP messages, and
tunneling techniques. To mitigate attacks against IPv6 infrastructures and protocols, the
strategy should include filtering at the edge using various techniques, such as IPv6
ACLs. The ACL functionality in IPv6 is similar to ACLs in IPv4. However, there is no
equivalent to IPv4 standard ACLs. In addition, all IPv6 ACLs must be configured with
a name. IPv6 ACLs allow filtering based on source and destination addresses that are
traveling inbound and outbound to a specific interface. They also support traffic
filtering based on IPv6 option headers and optional, upper-layer protocol type
information for finer granularity of control, similar to extended ACLs in IPv4.
MODULE 9
9.1 SECURE NETWORKS WITH FIREWALLS
9.1.1 FIREWALLS
Firewall = a system, or group of systems, that enforces an access control policy between
networks
Common Firewall Properties
Firewall Benefits
Important to understand the different types of firewalls and their specific capabilities so
that the right firewall is used for each situation:
Packet Filtering (Stateless) Firewall
Packet filtering firewalls are usually part of a router firewall, which permits or denies
traffic based on Layer 3 and Layer 4 information. They are stateless firewalls that use a
simple policy table look-up that filters traffic based on specific criteria
For example, SMTP servers listen to port 25 by default. An administrator can configure
the packet filtering firewall to block port 25 from a specific workstation to prevent it
from broadcasting an email virus
Stateful Firewall
Stateful firewalls are the most versatile and the most common firewall technologies in
use. Stateful firewalls provide stateful packet filtering by using connection information
maintained in a state table. Stateful filtering is a firewall architecture that is classified at
the network layer. It also analyses traffic at OSI Layer 4 and Layer 5
Application Gateway Firewall
An application gateway firewall (proxy firewall), as shown in the figure, filters
information at Layers 3, 4, 5, and 7 of the OSI reference model. Most of the firewall
control and filtering is done in software. When a client needs to access a remote server,
it connects to a proxy server. The proxy server connects to the remote server on behalf
of the client. Therefore, the server only sees a connection from the proxy server
Next Generation Firewall
Packet filtering firewalls are usually part of a router firewall, which permits or denies
traffic based on Layer 3 and Layer 4 information.
They are stateless firewalls that use a simple policy table look-up that filters traffic
based on specific criteria, as shown in the figure.
For example, SMTP servers listen to port 25 by default. An administrator can configure
the packet filtering firewall to block port 25 from a specific workstation to prevent it
from broadcasting an email virus
There are several advantages of using a packet filtering firewall:
o Packet filters implement simple permit or deny rule sets
o Packet filters have a low impact on network performance
o Packet filters are easy to implement, and are supported by most routers
o Packet filters provide an initial degree of security at the network layer
o Packet filters perform almost all the tasks of a high-end firewall at a much
lower cost
Packet filters do not represent a complete firewall solution, but they are an important
element of a firewall security policy. There are several disadvantages of using a packet
filtering firewall:
o Packet filters are susceptible to IP spoofing. Threat actors can send arbitrary
packets that meet ACL criteria and pass through the filter.
o Packet filters do not reliably filter fragmented packets. Because fragmented IP
packets carry the TCP header in the first fragment and packet filters filter on
TCP header information, all fragments after the first fragment are passed
unconditionally. Decisions to use packet filters assume that the filter of the first
fragment accurately enforces the policy.
o Packet filters use complex ACLs, which can be difficult to implement and
maintain.
o Packet filters cannot dynamically filter certain services. For example, sessions
that use dynamic port negotiations are difficult to filter without opening access
to a whole range of ports.
Packet filters are stateless. They examine each packet individually rather than in the
context of the state of a connection.
Benefits Limitations
Primary
means of No Application Layer inspection
defence
Strong Limited tracking of stateless protocols
packet
filtering
Improved
performance
Difficult to defend against dynamic port negotiation
over packet
filters
Defends
against
No authentication support
spoofing and
DoS attacks
Richer data
log
Firewall design is primarily about device interfaces permitting or denying traffic based
on the source, the destination, and the type of traffic.
Some designs are as simple as designating an outside network and inside network,
which are determined by two interfaces on a firewall.
Here are three common firewall designs:
Private and Public
As shown in the figure, the public network (or outside network) is untrusted, and the
private network (or inside network) is trusted.
Typically, a firewall with two interfaces is configured as follows:
o Traffic originating from the private network is permitted and inspected as it
travels toward the public network. Inspected traffic returning from the public
network and associated with traffic that originated from the private network is
permitted.
o Traffic originating from the public network and traveling to the private network
is generally blocked.
Demilitarised Zone
A demilitarized zone (DMZ) is a firewall design where there is typically one inside
interface connected to the private network, one outside interface connected to the public
network, and one DMZ interface, as shown in the figure.
o Traffic originating from the private network is inspected as it travels toward the
public or DMZ network. This traffic is permitted with little or no restriction.
Inspected traffic returning from the DMZ or public network to the private
network is permitted.
o Traffic originating from the DMZ network and traveling to the private network
is usually blocked.
o Traffic originating from the DMZ network and traveling to the public network
is selectively permitted based on service requirements.
o Traffic originating from the public network and traveling toward the DMZ is
selectively permitted and inspected. This type of traffic is typically email, DNS,
HTTP, or HTTPS traffic. Return traffic from the DMZ to the public network is
dynamically permitted.
o Traffic originating from the public network and traveling to the private network
is blocked.
Zone-Based Policy Firewalls
Zone-based policy firewalls (ZPFs) use the concept of zones to provide additional
flexibility.
A zone is a group of one or more interfaces that have similar functions or features.
Zones help you specify where a Cisco IOS firewall rule or policy should be applied.
In the figure, security policies for LAN 1 and LAN 2 are similar and can be grouped
into a zone for firewall configurations.
By default, the traffic between interfaces in the same zone is not subject to any policy
and passes freely. However, all zone-to-zone traffic is blocked. In order to permit traffic
between zones, a policy allowing or inspecting traffic must be configured.
The only exception to this default deny any policy is the router self zone.
The self zone is the router itself and includes all the router interface IP addresses.
Policy configurations that include the self zone would apply to traffic destined to and
sourced from the router. By default, there is no policy for this type of traffic.
Traffic that should be considered when designing a policy for the self zone includes
management plane and control plane traffic, such as SSH, SNMP, and routing
protocols.
A layered defence uses different types of firewalls that are combined in layers to add
depth to the security of an organization.
Policies can be enforced between the layers and inside the layers.
These policy enforcement points determine whether traffic is forwarded or discarded.
For example, traffic that comes in from the untrusted network first encounters a packet
filter on the edge router. If allowed by the policy, the traffic goes to the screened
firewall or bastion host system that applies more rules to the traffic and discards suspect
packets.
A bastion host is a hardened computer that is typically located in the DMZ. Then the
traffic goes to an interior screening router. The traffic moves to the internal destination
host only after successfully passing through all policy enforcement points between the
outside router and the inside network. This type of DMZ setup is called a screened
subnet configuration.
A layered defence approach is not all that is needed to ensure a safe internal network. A
network administrator must consider many factors when building a complete in-depth
defence:
o Firewalls typically do not stop intrusions that come from hosts within a network
or zone.
o Firewalls do not protect against rogue access point installations.
o Firewalls do not replace backup and disaster recovery mechanisms resulting
from attack or hardware failure.
o Firewalls are no substitute for informed administrators and users.
This partial list of best practices can serve as a starting point for a firewall security
policy:
o Position firewalls at security boundaries. Firewalls are a critical part of network
security, but it is unwise to rely exclusively on a firewall for security.
o Deny all traffic by default.
o Permit only services that are needed.
o Ensure that physical access to the firewall is controlled.
o Regularly monitor firewall logs.
o Practice change management for firewall configuration changes.
o Remember that firewalls primarily protect from technical attacks originating
from the outside.
MODULE 10
10.1 ZPF OVERVIEW
10.1.1 BENEFITS OF A ZPF
The primary motivations for network security professionals to migrate to the ZPF
model are structure and ease of use.
The structured approach is useful for documentation and communication. The ease of
use makes network security implementations more accessible to a larger community of
security professionals.
There are several benefits of a ZPF:
o It is not dependent on ACLs.
o The router security posture is to block unless explicitly allowed.
o Policies are easy to read and troubleshoot with the Cisco Common
Classification Policy Language (C3PL). C3PL is a structured method to create
traffic policies based on events, conditions, and actions. This provides
scalability because one policy affects any given traffic, instead of needing
multiple ACLs and inspection actions for different types of traffic.
o Virtual and physical interfaces can be grouped into zones.
o Policies are applied to unidirectional traffic between zones.
When deciding whether to implement IOS Classic Firewall or a ZPF, it is important to
note that both configuration models can be enabled concurrently on a router.
However, the models cannot be combined on a single interface. For example, an
interface cannot be simultaneously configured as a security zone member and for IP
inspection.
10.1.2 ZPF DESIGN
Policies identify actions that the ZPF will perform on network traffic. Three possible
actions can be configured to process traffic by protocol, source and destination zones
(zone pairs), and other criteria.
o Inspect - This performs Cisco IOS stateful packet inspection.
o Drop - This is analogous to a deny statement in an ACL. A log option is
available to log the rejected packets.
o Pass - This is analogous to a permit statement in an ACL. The pass action does
not track the state of connections or sessions within the traffic.
10.2.2 RULES FOR TRANSIT TRAFFIC
Traffic transiting through router interfaces is subject to several rules governing interface
behaviour. For the transit traffic example, refer to the topology shown in the figure.
Basic Security Zone Topology
The rules depend on whether or not the ingress and egress interfaces are members of the
same zone:
If neither interface is a zone member, then the resulting action is to pass the traffic.
If both interfaces are members of the same zone, then the resulting action is to pass the
traffic.
If one interface is a zone member, but the other is not, then the resulting action is to
drop the traffic regardless of whether a zone-pair exists.
If both interfaces belong to the same zone-pair and a policy exists, then the resulting
action is inspect, allow, or drop as defined by the policy.
The table summarises these rules:
Source
Interface Destination Interface Member of Zone-Pair Policy
Result
Member Zone? Exists? Exists?
of Zone?
NO NO N/A N/A PASS
YES NO N/A N/A DROP
NO YES N/A N/A DROP
YES
YES (private) N/A N/A PASS
(private)
YES
YES (public) NO N/A DROP
(private)
YES
YES (public) YES NO PASS
(private)
YES
YES (public) YES YES INSPECT
(private)
The self zone is the router itself and includes all of the IP addresses assigned to the
router interfaces.
This is traffic that originates at the router or is addressed to a router interface.
Specifically, the traffic is either for device management, for example SSH, or traffic
forwarding control, such as routing protocol traffic.
The rules for a ZPF are different for the self zone. For the self zone traffic example,
refer to the topology shown in the previous figure.
The rules depend on whether the router is the source or the destination of the traffic, as
shown in the table.
If the router is the source or the destination, then all traffic is permitted. The only
exception is if the source and destination are a zone-pair with a specific service-policy.
In that case, the policy is applied to all traffic.
Source
Interface Destination Interface Member of Zone-Pair Policy
Result
Member Zone? Exists? Exists?
of Zone?
YES (self
YES NO N/A PASS
zone)
YES (self
YES YES NO PASS
zone)
YES (self
YES YES YES INSPECT
zone)
YES YES (self zone) NO N/A PASS
YES YES (self zone) YES NO PASS
YES YES (self zone) YES YES INSPECT
The topology shown in the figure will be used throughout the remainder of this topic to
demonstrate ZPF configuration.
The sequence of steps is not required. However, some configurations must be
completed in order. For instance, you must configure a class-map before you assign a
class-map to a policy-map.
Similarly, you cannot assign a policy-map to a zone-pair until you have configured the
policy.
If you try to configure a section that relies on another portion of the configuration that
you have not yet configured, the router responds with an error message.
Zone-Based Policy Firewall Configuration Steps
The first step is to create the zones. However, before creating the zones answer a few
questions:
o What interfaces should be included in the zones?
o What will be the name for each zone?
o What traffic is necessary between the zones and in which direction?
In the example topology, we have two interfaces, two zones, and traffic flowing in one
direction. Traffic sourced from the public zone will not be allowed. Create the private
and public zones for the firewall with the zone security command, as shown here.
R1(config-sec-zone)# exit
R1(config-sec-zone)# exit
R1(config)#
The second step is to use a class-map to identify the traffic to which a policy will be
applied.
A class is a way of identifying a set of packets based on its contents using “match”
conditions.
Typically, you define a class so that you can apply an action to the identified traffic that
reflects a policy. A class is defined with class-maps.
The example below shows the syntax for the class-map command.
There are several types of class-maps. For a ZPF configuration, use
the inspect keyword to define a class-map.
Determine how packets are evaluated when multiple match criteria exist. Packets must
meet one of the match criteria (match-any) or all of the match criteria (match-all) to be
considered a member of the class.
Router(config)# class-map type inspect [match-any | match-all] class-map-
name
Parameter Description
Parameter Description
match access-group Configures the match criteria for a class-map based on the
specified ACL number or name.
match protocol Configures the match criteria for a class-map based on the
specified protocol.
match class-map Uses another class-map to identify traffic.
In the topology, HTTP traffic is being allowed to cross R1 from the PRIVATE to the
PUBLIC zone.
When allowing HTTP traffic, it is recommended to specifically include HTTPS and
DNS protocols, as shown in the example below. Traffic can match any of the statements
to become a member of the HTTP-TRAFFIC class.
R1(config)# class-map type inspect match-any HTTP-TRAFFIC
R1(config-cmap)# match protocol http
R1(config-cmap)# match protocol https
R1(config-cmap)# match protocol dns
The third step is to use a policy-map to define what action should be taken for traffic
that is a member of a class.
The example below shows the command syntax to configure a policy-map. An action is
a specific functionality. It is typically associated with a traffic class. For
example, inspect, drop, and pass are actions.
R1(config)# policy-map type inspect policy-map-name
R1(config-pmap)# class type inspect class-map-name
R1(config-pmap-c)# {inspect | drop | pass}
Parameter Description
An action that offers state−based traffic control. The router
inspect maintains session information for TCP and UDP and permits return
traffic.
drop Discards unwanted traffic
pass A stateless action that allows the router to forward traffic from one
Parameter Description
zone to another
inspect - This action offers state-based traffic control. For example, if traffic traveling
from the PRIVATE zone to the PUBLIC zone is inspected, the router maintains
connection or session information for TCP and UDP traffic. The router would then
permit return traffic sent from PUBLIC zone hosts in reply to PRIVATE zone
connection requests.
drop - This is the default action for all traffic. Similar to the implicit deny any at the
end of every ACL, there is an explicit drop applied by the IOS to the end of every
policy−map. It is listed as class class-default in the last section of any policy-map
configuration. Other class−maps within a policy−map can also be configured to drop
unwanted traffic. Unlike ACLs, traffic is silently dropped, and no ICMP unreachable
messages are sent to the source of the traffic.
pass - This action allows the router to forward traffic from one zone to another. The
pass action does not track the state of connections. Pass only allows the traffic in one
direction. A corresponding policy must be applied to allow return traffic to pass in the
opposite direction. The pass action is ideal for secure protocols with predictable
behaviour, such as IPsec. However, most application traffic is better handled in the ZPF
with the inspect action.
10.3.5 STEP 4. IDENTIFY A ZONE-PAIR AND MATCH TO A POLICY
The fourth step is to identify a zone pair and associate that zone pair to a policy-map.
The example below shows the command syntax.
Create a zone-pair with the zone-pair security command. Then use the service-policy
type inspect command to attach a policy-map and its associated action to the zone-pair.
Router(config)# zone-pair security zone-pair-name source {source-zone-
name | self} destination {destination-zone-name | self}
Router(config-sec-zone-pair)# service-policy type inspect policy-map-name
Parameter Description
source source-zone- Specifies the name of the zone from which traffic is
name originating.
Parameter Description
destination
destination-zone-name Specifies the name of the zone to which traffic is destined.
In the following example, GigabitEthernet 0/0 is assigned the PRIVATE zone, and
Serial 0/0/0 is assigned the PUBLIC zone.
R1(config)# interface GigabitEthernet 0/0
R1(config-if)# zone-member security PRIVATE
R1(config-if)# interface Serial 0/0/0
R1(config-if)# zone-member security PUBLIC
The service-policy is now active.
HTTP, HTTPS, and DNS traffic sourced from the PRIVATE zone and destined for the
PUBLIC zone will be inspected.
Traffic sourced from the PUBLIC zone and destined for the PRIVATE zone will only
be allowed if it is part of sessions originally initiated by PRIVATE zone hosts.
10.3.7 VERIFY A ZPF CONFIGURATION
The example below shows verification information after a test of the ZPF configuration.
A PRIVATE zone host 192.168.1.3 established an HTTPS session with a web server at
10.1.1.2.
Notice further down in the command output that four packets matched the class class-
default. This verification information was generated by having host 192.168.1.3 ping
the web server at 10.1.1.2.
Inspect
The example below shows four other ZPF verification commands that allow a view of
specific portions of the ZPF configuration..
R1# show class-map type inspect
Class Map type inspect match-any HTTP-TRAFFIC (id 1)
Match protocol http
Match protocol https
Match protocol dns
zone PRIVATE
Member Interfaces:
GigabitEthernet0/0
zone PUBLIC
Member Interfaces:
Serial0/0/0
When configuring a ZPF with the CLI, there are several factors to consider:
o The router never filters the traffic between interfaces in the same zone.
o An interface cannot belong to multiple zones. To create a union of security
zones, specify a new zone and appropriate policy map and zone pairs.
o ZPF can coexist with Classic Firewall although they cannot be used on the
same interface. Remove the ip inspect interface configuration command before
applying the zone-member security command.
o Traffic can never flow between an interface assigned to a zone and an interface
without a zone assignment. Applying the zone-member configuration command
always results in a temporary interruption of service until the other zone-
member is configured.
o The default inter-zone policy is to drop all traffic unless otherwise specifically
allowed by the service-policy configured for the zone-pair.
o The zone-member command does not protect the router itself (traffic to and
from the router is not affected) unless the zone- pairs are configured using the
predefined self zone.
The IOS ZPF provides a flexible and powerful replacement for the older Classic IOS
Firewall.
It provides a new configuration mode in which interfaces are assigned to security zones
and firewall policies are applied to traffic moving between the zones.
The ZPF provides a structured and simplified method of designing and implementing
network security on routers that are performing a firewall function.
ZPF Operation
ZPFs use user-defined policies to act on specific traffic that is travelling from a source
zone to a destination zone. Three actions can be specified:
o Inspect - The ZPF performs stateful packet inspection.
o Drop - The traffic is not permitted to travel to the destination. The rejected
packets can be logged.
o Pass - The traffic is permitted to travel to the destination zone. This does not
track the state of connections or sessions.
Default rules are applied to transit traffic based on the configuration of the ingress and
egress interfaces and the existence of policies.
For example, if neither ingress or egress interface is defined as member of a zone,
traffic is permitted to exit the egress interface.
Similarly, if both interfaces are members of the same zone, then traffic is allowed to
pass.
However, if one interface is a member of a zone and the other is not, traffic will be
dropped. It is important to understand these and the other rules covered in the module.
A special zone exists that is known as the self zone.
The self zone is the router itself.
In the self zone, the router interfaces serve as either the source or destination of the
traffic.
Self zone traffic is either for management of the device, or for traffic forwarding
control.
Similar to the rules for transit traffic, rules exist for how traffic in the self zone will be
handled.
Configure a ZPF
MODULE 11
11.1 IDS AND IPS CHARACTERISTICS
11.1.1 ZERO-DAY ATTACKS
Malware can spread across the world in a matter of minutes. A network must instantly
recognize and mitigate malware threats. Firewalls can only do so much and cannot
provide protection against all malware and zero-day attacks.
A zero-day attack, sometimes referred to as a zero-day threat, is a cyberattack that tries
to exploit software vulnerabilities that are unknown or undisclosed by the software
vendor, as shown in the figure. The term zero-day describes the moment when a
previously unknown threat is identified.
During the time it takes the software vendor to develop and release a patch, the network
is vulnerable to these exploits, as shown in the figure. Defending against these fast-
moving attacks requires network security professionals to adopt a more sophisticated
view of the network architecture. It is no longer possible to contain intrusions at a few
points in the network.
Microsoft Internet Explorer Zero-Day Vulnerability
Intrusion Detection Systems (IDS) were implemented to passively monitor the traffic on
a network. The figure shows that an IDS-enabled device copies the traffic stream and
analyses the copied traffic rather than the actual forwarded packets.
Working offline, the IDS compares the captured traffic stream with known malicious
signatures, similar to software that checks for viruses. Working offline means several
things:
o The IDS works passively.
o The IDS device is physically positioned in the network so that traffic must be
mirrored in order to reach it.
o Network traffic does not pass through the IDS unless it is mirrored.
o Very little latency is added to network traffic flow.
Although the traffic is monitored, logged, and perhaps reported, no action is taken on
packets by the IDS. This offline IDS implementation is referred to as promiscuous
mode.
The advantage of operating with a copy of the traffic is that the IDS does not negatively
affect the packet flow of the forwarded traffic. The disadvantage of operating on a copy
of the traffic is that the IDS cannot stop malicious single-packet attacks from reaching
the target. An IDS often requires assistance from other networking devices, such as
routers and firewalls, to respond to an attack.
A better solution is to use a device that can immediately detect and stop an attack. An
Intrusion Prevention System (IPS) performs this function.
11.1.3 INTRUSION PREVENTION AND DETECTION DEVICES
IDS and IPS technologies are both deployed as sensors. An IDS or IPS sensor can be in
the form of several different devices:
o A router configured with IPS software
o A device specifically designed to provide dedicated IDS or IPS services
o A hardware module installed in an adaptive security appliance (ASA), switch,
or router
IDS and IPS technologies use signatures to detect patterns in network traffic. A
signature is a set of rules that an IDS or IPS uses to detect malicious activity. Signatures
can be used to detect severe breaches of security, to detect common network attacks,
and to gather information. IDS and IPS technologies can detect atomic signature
patterns (single-packet) or composite signature patterns (multi-packet).
11.1.4 ADVANTAGES AND DISADVANTAGES OF IDS AND IPS
The table summarizes the advantages and disadvantages of IDS and IPS:
Advantages:
o An IPS sensor can be configured to drop the trigger packets, the packets
associated with a connection, or packets from a source IP address.
o Because IPS sensors are inline, they can use stream normalization. Stream
normalization is a technique used to reconstruct the data stream when the attack
occurs over multiple data segments.
Disadvantages:
o Because it is deployed inline, errors, failure, and overwhelming the IPS sensor
with too much traffic can have a negative effect on network performance.
o An IPS sensor can affect network performance by introducing latency and jitter.
o An IPS sensor must be appropriately sized and implemented so that time-
sensitive applications, such as VoIP, are not adversely affected.
Deployment Considerations
You can deploy both an IPS and an IDS. Using one of these technologies does not
negate the use of the other. In fact, IDS and IPS technologies can complement each
other.
For example, an IDS can be implemented to validate IPS operation because the IDS can
be configured for deeper packet inspection offline. This allows the IPS to focus on
fewer but more critical traffic patterns inline.
Deciding which implementation to use is based on the security goals of the organization
as stated in their network security policy.
There are two primary kinds of IPS available: host-based IPS and network-based IPS
Host-based IPS
Host-based IPS (HIPS) is software installed on a host to monitor and analyze suspicious
activity.
A significant advantage of HIPS is that it can monitor and protect operating system and
critical system processes that are specific to that host.
With detailed knowledge of the operating system, HIPS can monitor abnormal activity
and prevent the host from executing commands that do not match typical behavior. This
suspicious or malicious behavior might include unauthorized registry updates, changes
to the system directory, executing installation programs, and activities that cause buffer
overflows. Network traffic can also be monitored to prevent the host from participating
in a denial-of-service (DoS) attack or being part of an illicit FTP session.
HIPS can be thought of as a combination of antivirus software, antimalware software,
and a firewall. An example of a HIPS is Windows Defender. It provides a range of
protection measures for Windows hosts. Combined with a network-based IPS, HIPS is
an effective tool in providing additional protection for the host.
A disadvantage of HIPS is that it operates only at a local level. It does not have a
complete view of the network, or coordinated events that might be happening across the
network. To be effective in a network, HIPS must be installed on every host and have
support for every operating system. The table lists the advantages and disadvantages of
HIPS.
Advantages Disadvantages
Provides protection specific to a
host operating system
Provides operating system and Operating system dependent
application level protection Must be installed on all hosts
Protects the host after the
message is decrypted
Network-based IPS
A network-based IPS can be implemented using a dedicated or non-dedicated IPS
device such as a router. Network-based IPS implementations are a critical component of
intrusion prevention. Host-based IDS/IPS solutions must be integrated with a network-
based IPS implementation to ensure a robust security architecture.
Sensors detect malicious and unauthorized activity in real time and can take action
when required. As shown in the figure, sensors are deployed at designated network
points. This enables security managers to monitor network activity while it is occurring,
regardless of the location of the attack target.
Sample IPS Sensor Deployment
IDS and IPS sensors can operate in inline mode (also known as inline interface pair
mode) or promiscuous mode (also known as passive mode).
As shown in the figure, packets do not flow through the sensor in promiscuous mode.
The sensor analyses a copy of the monitored traffic, not the actual forwarded packet.
The advantage of operating in promiscuous mode is that the sensor does not affect the
packet flow with the forwarded traffic.
The disadvantage of operating in promiscuous mode is that the sensor cannot stop
malicious traffic from reaching its intended target for certain types of attacks, such as
atomic attacks (single-packet attacks).
The response actions implemented by promiscuous sensor devices are post-event
responses and often require assistance from other networking devices (for example,
routers and firewalls) to respond to an attack.
Such response actions can prevent some classes of attacks. However, in atomic attacks
the single packet has the chance of reaching the target system before the promiscuous-
based sensor can apply an ACL modification on a managed device (such as a firewall,
switch, or router). In the figure, Switched Port Analyzer (SPAN) is used to mirror the
traffic entering, going to, and coming from the host.
Promiscuous Mode
As shown in the figure below, operating in inline mode puts the IPS directly into the
traffic flow and makes packet-forwarding rates slower by adding latency. Inline mode
allows the sensor to stop attacks by dropping malicious traffic before it reaches the
intended target, thus providing a protective service.
Not only is the inline device processing information on Layers 3 and 4, but it is also
analysing the contents and payload of the packets for more sophisticated embedded
attacks (Layers 3 to 7).
This deeper analysis lets the system identify and stop or block attacks that would pass
through a traditional firewall device. An IDS sensor could also be deployed inline. The
IDS would be configured so that it only sends alerts and does not drop any packets.
Inline Mode
Many of the devices that supported Cisco IOS IPS are no longer available, or no longer
supported. The newer Cisco 4000 Series Integrated Services Routers (ISR) no longer
support IOS IPS. Instead, they provide IPS services using the Snort IPS feature. Snort
IPS complements existing network security features of the 4000 Series without the need
to deploy a second appliance at branch locations.
Snort is the most widely deployed IPS solution in the world. It is an open source
network IPS that performs real-time traffic analysis and generates alerts when threats
are detected on IP networks. It can also perform protocol analysis, content searching or
matching, and detect a variety of attacks and probes, such as buffer overflows, stealth
port scans, and so on.
The Snort engine runs in a virtual service container on Cisco 4000 Series ISRs. A
virtual service container is a virtual machine that runs on the ISR router operating
system. Service containers are applications that can be hosted directly on Cisco IOS XE
routing platforms. These apps use the Linux aspects of the IOS XE operating system to
host both Linux Virtual Containers (LXC) and Kernel virtual machines (KVM). The
Snort container is distributed as an Open Virtualization Appliance (OVA) file that is
installed on the router.
Unlike IOS IPS, Snort IPS can use the computer power of the service container to scale
security with the platform without affecting routing capabilities or other data plane
functionality. The virtual service supports three resource profiles that indicate how the
Snort container uses system CPU, RAM, and Flash or disk resources.
Snort IPS
Snort IPS signatures are delivered automatically to the ISR by Cisco Talos. There are
currently more than 30,000 signatures in the Snort rule set. It also supports the ability to
customize rule sets and provides centralized deployment and management capabilities
for 4000 Series ISRs.
Snort can be enabled in either of the following modes:
o IDS mode - Snort inspects the traffic and reports alerts, but does not take any
action to prevent attacks.
o IPS mode - In addition to intrusion detection, actions are taken to prevent
attacks.
In the network intrusion detection and prevention mode, Snort performs the following
actions:
o Monitors network traffic and analyses against a defined rule set.
o Performs attack classification.
o Invokes actions against matched rules.
The Snort IPS monitors the traffic and reports events to an external log server or the
IOS syslog. Enabling logging to the IOS syslog may impact performance due to the
potential volume of log messages. External third-party monitoring tools that support
Snort logs can be used for log collection and analysis.
11.3.5 SNORT FEATURES
Feature Benefit
Signature-based intrusion Snort open-source IPS, capable of performing real-time
detection system (IDS) and traffic analysis and packet logging on IP networks, runs on
intrusion prevention system the 4000 Series ISR service container without the need to
(IPS) deploy an additional device at the branch.
Snort rule set updates for 4000 Series ISRs are generated
by Cisco Talos, a group of leading-edge network security
Snort rule set updates experts who work around the clock to proactively discover,
assess, and respond to the latest trends in hacking
activities, intrusion attempts, malware, and vulnerabilities.
Feature Benefit
The router will be able to download rule sets directly from
Snort rule set pull cisco.com or snort.org to a local server, using one-time
commands or periodic automated updates.
A centralized management tool can push the rule sets
Snort rule set push based on preconfigured policy, instead of the router directly
downloading on its own.
Allowed listing allows the disabling of certain signatures
Signature allowed listing from the rule set. Disabled signatures can be reenabled at
any time.
To run the service container infrastructure with IDS/IPS functionality, Snort IPS
requires an ISR 4000 (i.e., 4300 or higher) with a minimum of 8 GB of memory
(DRAM) and 8 GB of flash.
Note: The Cisco 4200 series ISR does not support the default Snort IPS
implementation.
A security K9 license (SEC) is required to activate Snort IPS functionality. Customers
also need to purchase a yearly subscription for the signature package distributed on
cisco.com. To keep current with the latest threat protection, Snort rule sets are term-
based subscriptions, available for one or three years.
There are two types of term-based subscriptions:
o Community Rule Set - This set offers limited coverage against threats,
focusing on reactive response to security threats versus proactive research
work. There is 30-day delayed access to updated signatures in the Community
Rule Set, and this subscription does not entitle the customer to Cisco support.
o Subscriber Rule Set - This set offers the best protection against threats. It
includes coverage in advance of exploits by using the research work of the
Cisco Talos security experts. The Subscriber Rule Set also provides the fastest
access to updated signatures in response to a security incident or the proactive
discovery of a new threat. This subscription is fully supported by Cisco.
PulledPork is a rule management application that can be used to automatically
download Snort rule updates. In order to use PulledPork, you must obtain an
authorization code, called an oinkcode, from your snort.org account. The oinkcode is
free with registration.
Notice how the tap simultaneously sends both the transmit (TX) data stream from the
internal router and the receive (RX) data stream to the internal router on separate,
dedicated channels. This ensures that all data arrives at the monitoring device in real
time. Therefore, network performance is not affected or degraded by monitoring the
connection.
Taps are also typically fail-safe, which means if a tap fails or loses power, traffic
between the firewall and internal router is not affected.
Search the internet for information on NetScout Taps for copper UTP Ethernet, fiber
Ethernet, and serial links.
11.4.3 TRAFFIC MIRRORING AND SPAN
Network switches segment the network by design. This limits the amount of traffic that
is visible to network monitoring devices.
Because capturing data for network monitoring requires all traffic to be captured,
special techniques must be employed to bypass the network segmentation imposed by
network switches.
Port mirroring is one of these techniques. Supported by many enterprise switches, port
mirroring enables the switch to copy frames that are received on one or more ports to a
Switch Port Analyzer (SPAN) port that is connected to an analysis device.
The table identifies and describes terms used by the SPAN feature:
The figure shows a switch that interconnects two hosts and mirrors traffic to an
intrusion detection device (IDS) and network management server.
SPAN
The switch will forward ingress traffic on F0/1 and egress traffic on F0/2 to the
destination SPAN port G0/1 that connects to an IDS.
The association between source ports and a destination port is called a SPAN session. In
a single session, one or multiple ports can be monitored. On some Cisco switches,
session traffic can be copied to more than one destination port. Alternatively, a source
VLAN can be specified in which all ports in the source VLAN become sources of
SPAN traffic. Each SPAN session can have ports or VLANs as sources, but not both.
Note: A variation of SPAN called Remote SPAN (RSPAN) enables a network
administrator to use the flexibility of VLANs to monitor traffic on remote switches.
11.4.4 CONFIGURE CISCO SPAN
The SPAN feature on Cisco switches sends a copy of each frame entering the source
port out the destination port and toward the packet analyser or IDS.
A session number is used to identify a SPAN session. The examples show the monitor
session command, which is used to associate a source port and a destination port with a
SPAN session. A separate monitor session command is used for each session. A
VLAN can be specified instead of a physical port.
In the figure below, PCA is connected to F0/1 and an IDS is connected to F0/2. The
objective is to capture all the traffic that is sent or received by PCA on port F0/1 and
send a copy of those frames to the IDS (or a packet analyser) on port F0/2. The SPAN
session on the switch will copy all the traffic that it sends and receives on source port
F0/1 to the destination port F0/2.
Cisco SPAN Configuration
S1(config)# monitor session 1 source interface fastethernet 0/1
S1(config)# monitor session 1 destination interface fastethernet
0/2
The show monitor command is used to verify the SPAN session. The command
displays the type of the session, the source ports for each traffic direction, and the
destination port. In the example below, the session number is 1, the source port for both
traffic directions is F0/1, and the destination port is F0/2. The ingress SPAN is disabled
on the destination port, so only traffic that leaves the destination port is copied to that
port.
S1# show monitor
Session 1
---------
Type : Local Session
Source Ports :
Both : Fa0/1
Destination Ports : Fa0/2
Encapsulation : Native
Ingress : Disabled
S1#
Note: Remote SPAN (RSPAN) can be used when the packet analyser or IDS is on a
different switch than the traffic being monitored.
RSPAN extends SPAN by enabling remote monitoring of multiple switches across the
network. The traffic for each RSPAN session is carried over a user-specified RSPAN
VLAN that is dedicated (for that RSPAN session) in all participating switches.
NIPS can be implemented using a dedicated device or a router with IPS software.
Network-based IPS act in real time to block malicious software and network attacks.
Network-based IPS can be deployed in two modes.
In promiscuous mode, they function as IDS by monitoring mirrored traffic. While they
can’t stop network attacks, they can alert personnel and log information when attacks
occur.
An inline mode IPS processes all traffic that enters a network and checks that traffic at
Layers 3 to 7. IPS can also check the contents of payloads that are carried in network
traffic, such as email attachments. Because inline mode puts the IPS directly into the
traffic flow it makes packet-forwarding rates slower by adding latency. Inline mode
allows the sensor to stop attacks by dropping malicious traffic before it reaches the
intended target.
IPS on Cisco ISRs
MODULE 12
12.1 IPS SIGNATURES
12.1.1 IPS SIGNATURE ATTRIBUTES
The network must be able to identify incoming malicious traffic in order to stop it.
Fortunately, malicious traffic displays distinct characteristics or “signatures”.
Conceptually similar to the virus.dat file used by virus scanners, a signature is a set of
rules that an IDS and an IPS use to detect typical intrusion activity. Signatures uniquely
identify specific viruses, worms, protocol anomalies, and malicious traffic (e.g., a DoS
attacks).
A malicious packet flow has a specific type of activity and signature. IPS sensors must
be tuned to look for matching signatures or abnormal traffic patterns.
As sensors scan network packets, they use signatures to detect known attacks and
respond with predefined actions.
An IDS or IPS sensor examines the data flow using many different signatures. A sensor
takes action when it matches a signature with a data flow, such as logging the event or
sending an alarm to the IDS or IPS management software.
Signatures also have three distinctive attributes:
o Type - Atomic or Composite
o Trigger - Also called the alarm
o Action - What the IPS will do
Some threats can be identified in one packet while other threats may require many
packets and their state information (i.e., IP addresses, port numbers, and more) to
identify a threat.
There are two types of signatures:
o Atomic Signature - This is the simplest type of signature because a single
packet, activity, or event identifies an attack. The IPS does not need to maintain
state information and traffic analysis can usually be performed very quickly and
efficiently.
o Composite Signature - Also called a stateful signature because the IPS
requires several pieces of data to match an attack signature. The IPS must also
maintain state information, which is referred to as the event horizon. The length
of an event horizon varies from one signature to the next.
12.1.3 IPS SIGNATURE ALARMS
The heart of any IPS signature is the signature alarm, which is often referred to as the
signature trigger. The signature alarm (i.e., trigger) for an IPS sensor could be anything
that can reliably signal an intrusion or security policy violation. A network-based IPS
might trigger a signature action if it detects a packet with a payload containing a
specific string that is going to a specific TCP port, for example.
The IPS signature alarm is analogous to the alarm in a home security system. The
triggering mechanism for a burglar alarm could be a motion detector. When the burglar
alarm is enabled, the movement of an individual entering a room is detected. This
triggers the alarm.
These triggering mechanisms can be applied to atomic and composite signatures. The
triggering mechanisms can be simple or complex. Every IPS incorporates signatures
that use one or more of these basic triggering mechanisms to trigger signature actions.
There are four general IPS signature trigger categories as listed in the table.
When a signature detects the activity for which it is configured, the signature triggers
one or more actions.
Depending on the IPS sensor, various actions can be enabled. The table lists some
actions that an IPS sensor may provide.
Note: The available actions depend on the signature type and the platform.
Triggering mechanisms can generate alarms that are false positives or false negatives.
These alarms must be addressed when implementing an IPS sensor.
True positives and true negatives are desirable and indicate the IPS is functioning
properly. False positives and false negatives are undesirable and must be investigated.
The table summarizes the following four types of alarms:
Alarm
Network Activity IPS Activity Outcome
Type
True
Attack traffic Alarm generated Ideal setting
positive
True
Normal user traffic No alarm generated Ideal setting
negative
False
Normal user traffic Alarm generated Tune alarm
positive
False
Attack traffic No alarm generated Tune alarm
negative
NGIPSs are dedicated IPS appliances. They are built on Snort's core open technology
and use vulnerability-focused IPS rules and embedded IP-, URL-, and DNS-based
security intelligence provided by Cisco Talos.
NGIPS features include the following:
o IPS rules that identify and block attack traffic targeted at network
vulnerabilities.
o Tightly integrated defence against advanced malware by incorporating
advanced analysis of network and endpoint activity.
o Sandboxing technology that uses hundreds of behavioural indicators to identify
zero-day and evasive attacks.
o Also includes Application Visibility and Control (AVC), Cisco Advanced
Malware Protection (AMP) for Networks, and URL Filtering.
Note: Further discussion of NGIPS appliances is out of scope for this course.
12.2.3 SNORT IPS
Snort is an open-source network IPS that performs real-time traffic analysis and
generates alerts when threats are detected on IP networks. It can also perform protocol
analysis, content searching or matching, and detect a variety of attacks and probes (e.g.,
buffer overflows, stealth port scans, and more). Snort was inducted into the InfoWorld
Open Source Hall of Fame as one greatest pieces of open source software ever.
The Snort engine can now run as a virtual container service on Cisco 4000 ISRs and
Cisco Cloud Services Router 1000v Series. It is ideal for smaller organizations looking
for a cost-effective routing and threat defence solution. For instance, an ISR G2 can
provide advanced routing capabilities and integrated threat defence security using Snort
IPS.
Snort IPS can be implemented with other security features integrated into the 4000
Series ISRs, such as VPN, zone-based Cisco IOS firewalls, and Cisco Cloud Web
Security. This enables the ISR to provide comprehensive threat protection in a small
footprint. This is crucial for small branch locations that need to address security for the
local internet connection. Snort IPS integrated in an ISR is a cost-effective alternative
for branch office locations because a separate firewall device is not required.
Snort IPS on the 4000 Series ISR provides the following functionalities:
o IDS and IPS mode - Configure threat detection or prevention mode. In
prevention mode, attack traffic will be dropped.
o Three signature levels - Snort provides three levels of signature protection:
connectivity (least secure), balanced (middle option), and security (most
secure). The security level is the most secure as it enables the highest number of
signatures to be verified.
o An allowed list - This provides the ability to turn off certain signatures and
helps to avoid false positives such as legitimate traffic triggering an IPS action.
Up to 1000 entries can be supported in the allowed list.
o Snort health monitoring - Cisco IOS Software keeps track of the health of the
Snort engine that is running in the service container.
o Fail open and close - In the event of IPS engine failure, the router can be
configured to block the traffic flow or to bypass IPS checking until the Snort
engine recovers.
o Signature update - Automatic and manual updates are supported. Snort IPS
can download the signature package directly from cisco.com or a local resource
location over HTTP and HTTPS.
o Event logging - IPS logs can be sent to an independent log collector or
included along with the router syslog stream. Sending IPS logs separately helps
if the security event management tool is different from the regular syslog
server.
12.2.4 SNORT COMPONENTS AND RULES
Specifically, the Snort engine on the 4000 Series ISR runs as a container application.
The 4000 Series ISR uses a multi-core CPU, and the Cisco IOS-XE has the ability to
allocate these cores for control-plane or data-plane functions. Computing resources
unused by control plane functions can be used for running other services. A Linux
container infrastructure hosts these applications. Applications running in this container
infrastructure can have a tighter integration with Cisco IOS Software.
12.2.6 SNORT IPS RULE ALARMS
In Snort IPS, signatures are configured using “rules”. These rules serve as the signature
alarms by comparing incoming traffic to the Snort rules. Traffic matching a rule header
generates an action.
A rule header is conceptually similar to an access control list (ACL) statement. It is a
one line statement that identifies malicious traffic.
The basic rule header command syntax is:
o [action] [protocol] [sourceIP] [sourceport] -> [destIP] [destport] ([Rule
options])
Note: The Rule options contain additional rule information.
For example, the following sample header generates an alert whenever a TCP
connection for the hosts/ports identified in the rule header variables are going to the
identified destination hosts/ports variables:
o alert tcp $EXTERNAL_NET $HTTP_PORTS -> $HOME_NET any
Refer to the figure for a detailed explanation of this example.
A Snort rule header also contains rule options (fields) to provide additional information
for the rule. Options are separated by semicolons (;) and the rule option keywords are
separated from their arguments using colons (:).
The figure displays sample rule options for the alert tcp $EXTERNAL_NET
$HTTP_PORTS -> $HOME_NET any rule header.
The table describes the common general rule and the detection rule options in the
sample rule header.
Note: These are just a few of the different types of rule options. For more examples,
search the internet for "snort rule options"
The OVA file must be downloaded and saved in a file location available to the ISR
router (e.g., Flash).
To install the OVA file, use the virtual-service install name virtual-service-
name package file-url media file-system privilege EXEC command. The length of
the name is 20 characters and the complete path to the OVA file must be specified.
An example configuration is shown below.
R1# virtual-service install name MYIPS package flash:iosxe-
utd.16.09.06.1.0.10_SV29130_XE_16_9.ova
Installing package 'bootflash:/iosxe-
utd.16.09.06.1.0.10_SV29130_XE_16_9.ova' for virtual-service
'MYIPS'. Once the install has finished, the VM may be activated.
Use 'show virtual-service list' for progress.
R1#
*Oct 5 08:07:45.953: %VMAN-5-PACKAGE_SIGNING_LEVEL_ON_INSTALL:
R0/0: vman: Package 'iosxe-utd.16.09.06.1.0.10_SV29130_XE_16_9.ova'
for service container 'MYIPS' is 'Cisco signed', signing level
cached on original install is 'Cisco signed'
R1#
During the OVA file installation, the security license is checked and an error is reported
if the license is not present. Therefore, the Cisco IOS XE image must be enabled with
the security license. In the output, you can see that the OVA is Cisco signed.
Use the show virtual-service list command to display the status of the installation of all
applications installed on the virtual service container.
12.3.4 STEP 3: CONFIGURE VIRTUAL PORT GROUP INTERFACES
Two VirtualPortGroup (VPG) interfaces must then be configured along with their guest
IP addresses.
In our example, the VPG interfaces will be configured as follows:
o VGP0 - This is for management traffic to exchange information with IPS
servers. The guest IP address needs to be routable to connect to the signature
update server and external log server. It is also used to log traffic to log
collectors.
o VPG1 - This is for user traffic marked for inspections. This should not be
routable and therefore use a non-routable private IP address.
Note: Be sure to provide proper NAT and routing to enable the management VPG to
reach the log server as well as cisco.com to retrieve signature update files.
The following is a sample configuration of VPG0 and VPG1.
R1# configure terminal
R1(config)# interface VirtualPortGroup0
R1(config-if)# description Management interface
R1(config-if)# ip address 209.165.201.1 255.255.255.252
R1(config-if)# exit
R1(config)#
*Oct 5 08:13:10.970: %LINEPROTO-5-UPDOWN: Line protocol on
Interface VirtualPortGroup0, changed state to up
R1(config)# interface VirtualPortGroup1
R1(config-if)# description Data interface
R1(config-if)# ip address 192.168.0.1 255.255.255.252
R1(config-if)# exit
R1(config)#
*Oct 5 08:13:12.921: %LINEPROTO-5-UPDOWN: Line protocol on
Interface VirtualPortGroup1, changed state to up
R1#
The next step is to configure guest IPs on the same subnet for the container side and
activate the virtual service as shown in the output.
R1(config)# virtual-service MYIPS
R1(config-virt-serv)# vnic gateway VirtualPortGroup0
R1(config-virt-serv-vnic)# guest ip address 209.165.201.2
R1(config-virt-serv-vnic)# exit
R1(config-virt-serv)# vnic gateway VirtualPortGroup1
R1(config-virt-serv-vnic)# guest ip address 192.168.0.2
R1(config-virt-serv-vnic)# exit
R1(config-virt-serv)# activate
Next is to configure how Snort is to be deployed (i.e. IPS or IDS mode), where the
Snort logs should be sent, the policy and profile to configure for Snort, and more.
Refer to the sample command output.
R1(config)# utd engine standard
R1(config-utd-eng-std)# logging host 10.10.10.254
R1(config-utd-eng-std)# logging syslog
R1(config-utd-eng-std)#
R1(config-utd-eng-std)# threat-inspection
R1(config-utd-engstd-insp)# threat protection
R1(config-utd-engstd-insp)# policy balanced
R1(config-utd-engstd-insp)#
R1(config-utd-engstd-insp)# signature update occur-at daily 0 0
R1(config-utd-engstd-insp)# signature update server cisco username
Bob password class
R1(config-utd-engstd-insp)# logging level warning
R1(config-utd-engstd-insp)#
R1(config-utd-engstd-insp)# exit
R1(config-utd-eng-std)# exit
R1(config)#
The utd engine standard command configures the UTD standard engine and enters
UTD standard engine configuration mode.
The logging host and logging syslog commands enable the logging of emergency
messages to a server.
The threat-inspection command configures threat inspection for the Snort engine.
From here you can specify which mode Snort will be in:
o threat protection - Snort will be in IPS mode.
o threat detection - Snort will be in IDS mode.
The policy command specifies three security policies used by Snort and provided by
Cisco Talos, as shown in the following help facility example.
R1(config-utd-engstd-insp)# policy ?
balanced Set the policy to balanced (this is the default option)
connectivity Set the policy to connectivity (stresses on
connectivity over security)
security Set the policy to security (provide mode exhaustive
coverage)
R1(config-utd-engstd-insp)# policy
The three policy settings in order from least protection to most protection are:
o connectivity - This provides the least protection as it prioritizes connectivity
over security. Approximately 1,000 rules are pre-loaded using this policy.
o balanced - This is the default policy. It is recommended for initial
deployments. This policy attempts to balance security needs and performance
characteristics of the network. Approximately 8,000 rules are pre-loaded using
this policy.
o security - This provides the most protection. It is designed for organizations
that are exceptionally concerned about security. Customers deploy this policy in
protected networks, that have a lower bandwidth requirements, but much higher
security requirements. Approximately 12,000 rules are pre-loaded using this
policy.
Note: IPS system performance is negatively affected as more rules are enabled.
The signature update command configures the signature update interval parameters. In
our sample output, Snort will update its signatures every night at midnight.
The signature update server command configures the signature update server
parameters. You must specify the signature update parameters with the server details. If
you use Cisco.com for signature updates, you must provide the username and password.
If you use local server for signature updates, based on the server settings you can
provide the username and password. In our sample output, Snort updates its signature
file from cisco.com using the username Bob and password class.
Finally the logging level command specifies the types of syslog messages that will be
generated.
12.3.7 STEP 6: ENABLE IPS GLOBALLY OR ON DESIRED INTERFACES
Based on the organizational requirements, Snort can be enabled globally (i.e., on all the
interfaces) or on selected interfaces.
The example in the output enables UTD globally on all interfaces and defines what to
do if the Snort engine fails.
R1(config)# utd
R1(config-utd)# all-interfaces
R1(config-utd)#
R1(config-utd)# engine standard
R1(config-engine-std)# fail close
R1(config-engine-std)# exit
R1(config-utd)# exit
R1(config)#
The all-interfaces option configures unified threat defence (UTD) on all Layer 3
interfaces of the device.
The engine standard command configures the Snort-based UTD engine and enters
standard engine configuration mode. From this mode, we can specify how Snort will
behave if there is a UTD engine failure.
Specifically, Snort can be configured to:
o fail-open (default) - When there is a UTD engine failure, this option allows all
of the IPS/IDS traffic through without being inspected.
o fail-close - If enabled, this option drops all the IPS/IDS traffic when there is an
UTD engine failure. Therefore, no traffic will be allowed to leave.
Alternatively, Snort could be enabled only on select interfaces as shown.
Note: An error message will be displayed if the global configuration was first
configured.
R1(config)# interface G0/0/0
R1(config-if)# utd enable
R1(config-if)# exit
R1(config)# interface G0/0/1
R1(config-if)# utd enable
R1(config-if)# exit
R1(config)#
You can also enable the UTD allowed list feature. This enables you to identify IPS
signature IDs to be suppressed (not used).
For example, when an IPS is incorrectly identifying normal user traffic as a threat (i.e.,
a false positive), we can add those signatures to an allowed list. The IPS will not use
signatures in the allowlist.
To do so, enter UTD allowed list configuration mode and identify signature IDs to be
excluded from inspection. After the allowed list signature ID is configured, Snort will
allow the flow to pass through the device without any alerts and drops.
For example, assume that the IPS has incorrectly identified user traffic
from Branch1 as malicious and assigned it id 21555. This signature can be added to an
allowed list, as shown
R1(config)# utd threat-inspection whitelist
R1(config-utd-whitelist)# signature id 21555 comment traffic from
Branch 1
R1(config-utd-whitelist)#
To configure Snort IPS on an ISR 4000 device, you must download the latest OVA file,
install it on the router, configure VPG interfaces, activate the virtual services, configure
Snort IPS specifics, and enable UTD. After Snort is configured and activated, show
commands allow verification of its operation.
MODULE 13
13.1 ENDPOINT SECURITY OVERVIEW
13.1.1 LAN ELEMENTS SECURITY
News media commonly cover external network attacks on enterprise networks. These
are some examples of such attacks:
o DoS attacks on an organization’s network to degrade or even halt public access
to it
o Breach of an organization’s Web server to deface their web presence
o Breach of an organization’s data servers and hosts to steal confidential
information
Various network security devices are required to protect the network perimeter from
outside access.
As shown in the figure, these devices could include a hardened ISR that is providing
VPN services, an ASA firewall appliance, an IPS, and a AAA server.
Many attacks can, and do, originate from inside the network. Therefore, securing an
internal LAN is just as important as securing the outside network perimeter.
Without a secure LAN, users within an organization are still susceptible to network
threats and outages that can directly affect an organization’s productivity and profit
margin.
After an internal host is infiltrated, it can become a starting point for an attacker to gain
access to critical system devices, such as servers and the sensitive information they
contain.
Specifically, there are two internal LAN elements to secure:
o Endpoints - Hosts commonly consist of laptops, desktops, servers, and IP
phones which are susceptible to malware-related attacks. Endpoints also include
video cameras, point-of-sale devices, and devices on the Internet of Things.
o Network infrastructure - LAN infrastructure devices interconnect endpoints
and typically include switches, wireless devices, and IP telephony devices.
Most of these devices are susceptible to LAN-related attacks including MAC
address table overflow attacks, spoofing attacks, DHCP related attacks, LAN
storm attacks, STP manipulation attacks, and VLAN attacks.
This module focuses on security endpoints
The network has evolved to include traditional endpoints and new, lightweight,
portable, consumerized endpoints such as smartphones, tablets, wearables, and others.
The new bring-your-own-device (BYOD) needs of workers require a different way of
approaching endpoint security.
These new endpoints have blurred the network border because access to network
resources can be initiated by users from many locations using various connectivity
methods at any time.
There are some problems with the traditional method of securing endpoints.
In many networks, the network-based devices are disparate and typically do not share
information among themselves.
Additionally, new endpoint devices are not good candidates for the traditional host-
based endpoint security solutions because of the variety of devices and the variety of
operating systems available on those devices.
The challenge is allowing these heterogeneous devices to connect to enterprise
resources securely.
Larger organizations now require protection before, during, and after an attack. IT
administrators must be able to answer the following questions:
o Where did the attack come from?
o What was the exploit method and point of entry?
o What systems were affected?
o What did the exploit do?
o How do we recover from the exploit?
o How can we mitigate the vulnerability and root cause?
Organizations must also protect their endpoints from new threats and provide the
protection measures that are outlined in the table below.
Measure Purpose
antimalware software Protect endpoints from malware.
spam filtering Prevent spam emails from reaching endpoints.
Prevent endpoints from connecting to websites with bad
blocklisting reputations by immediately blocking connections based
on the latest reputation intelligence.
data loss prevention (DLP) Prevent sensitive information from being lost or stolen.
The following are examples of devices and techniques that implement host protections
at the network level.
o Advanced Malware Protection (AMP) – This provides endpoint protection
from viruses and malware.
o Email Security Appliance (ESA) – This provides filtering of SPAM and
potentially malicious emails before they reach the endpoint. An example is the
Cisco ESA.
o Web Security Appliance (WSA) – This provides filtering and blocking of
websites to prevent hosts from reaching dangerous locations on the web. The
Cisco WSA provides control over how users access the internet and can enforce
acceptable use policies, control access to specific sites and services, and scan
for malware.
o Network Admission Control (NAC) – This permits only authorized and
compliant systems to connect to the network.
These technologies work in concert with each other to give more protection than host-
based suites can provide, as shown in the figure.
Endpoints are also susceptible to data theft. For instance, if a corporate laptop is lost or
stolen, a thief could scour the hard drive for sensitive information, contact information,
personal information, and more.
The solution is to locally encrypt the disk drive with a strong encryption algorithm such
as 256-bit AES encryption. The encryption protects the confidential data from
unauthorized access. The encrypted disk volumes can only be mounted for normal
read/write access with the authorized password.
Operating systems such as MAC OSX natively provide encryption options. The
Microsoft Windows 10 operating system also provides encryption natively. Individual
files, folders, and drives can be configured to encrypt data. In Windows, BitLocker
provides drive encryption, as shown in the figure. Files can also be encrypted, but
because applications can create unencrypted back up files, the entire folder that the file
is stored in should be encrypted.
The goal of NAC systems is to ensure that only hosts that are authenticated and have
had their security posture examined and approved are permitted onto the network.
For example, company laptops used offsite for a period of time might not have received
current security updates or could have become infected from other systems. Those
systems cannot connect to the network until they are examined, updated, and approved.
Network access devices can function as the enforcement layer, as shown in the figure.
They force the clients to query a RADIUS server for authentication and authorization.
The RADIUS server can query other devices, such as an antivirus server, and reply to
the network enforcers.
The IEEE 802.1X standard defines a port-based access control and authentication
protocol that restricts unauthorized workstations from connecting to a LAN through
publicly accessible switch ports.
The authentication server authenticates each workstation that is connected to a switch
port before making available any services offered by the switch or the LAN.
The figure shows that with 802.1X port-based authentication, the devices in the network
have specific roles.
The 802.1x roles include:
o Supplicant (Client) - The device (workstation) that requests access to LAN
and switch services and then responds to requests from the switch. The
workstation must be running 802.1X-compliant client software. (The port that
the client is attached to is the supplicant [client] in the IEEE 802.1X
specification.)
o Authenticator (Switch) - This device controls physical access to the network
based on the authentication status of the client. The switch acts as an
intermediary (proxy) between the client (supplicant) and the authentication
server, requesting identifying information from the client, verifying that
information with the authentication server, and relaying a response to the client.
The switch uses a RADIUS software agent, which is responsible for
encapsulating and de-encapsulating the EAP (Extensible Authentication
Protocol) frames and interacting with the authentication server.
o Authentication server - This server performs the actual authentication of the
client. The authentication server validates the identity of the client and notifies
the switch whether the client is authorized to access the LAN and switch
services. Because the switch acts as the proxy, the authentication service is
transparent to the client. The RADIUS security system with EAP extensions is
the only supported authentication server.
Until the workstation is authenticated, 802.1X access control enables only Extensible
Authentication Protocol over LAN (EAPOL), Cisco Discovery Protocol (CDP), and
Spanning Tree Protocol (STP) traffic through the port to which the workstation is
connected. After authentication succeeds, normal traffic can pass through the port.
The switch port state determines whether the client is granted access to the network.
When configured for 802.1X port-based authentication, the port starts in the
unauthorized state. While in this state, the port disallows all ingress and egress traffic
except for 802.1X protocol, STP, and CDP packets.
When a client is successfully authenticated, the port transitions to the authorized state,
allowing all traffic for the client to flow normally. If the switch requests the client
identity (authenticator initiation) and the client does not support 802.1X, the port
remains in the unauthorized state, and the client is not granted access to the network.
In contrast, when an 802.1X-enabled client connects to a port and the client initiates the
authentication process (supplicant initiation) by sending the EAPOL-start frame to a
switch that is not running the 802.1X protocol, no response is received, and the client
begins sending frames as if the port is in the authorized state.
The figure shows the complete message exchange between the supplicant,
authenticator, and the authentication server. The encapsulation occurs as follows:
o Between the supplicant and the authenticator - EAP data is encapsulated in
EAPOL frames.
o Between the authenticator and the authentication server - EAP data is
encapsulated using RADIUS.
If the client is successfully authenticated (the switch receives an “accept” frame from
the authentication server), the port state changes to authorized, and all frames from the
authenticated client are enabled through the port.
If the authentication fails, the port remains in the unauthorized state, but authentication
can be retried. If the authentication server cannot be reached, the switch can retransmit
the request. If no response is received from the server after the specified number of
attempts, authentication fails, and network access is not granted.
When a client logs out, it sends an EAPOL-logout message, causing the switch port to
transition to the unauthorized state.
Parameter Description
Enables 802.1X port-based authentication and causes the
port to begin in the unauthorized state. During this time only
auto EAPOL, STP, and CDP frames are the only type of frames
that can be sent or received through the port until the client
device has been authenticated.
force-authorized The port sends and receives normal traffic without 802.1x-
based authentication of the client. This is the default setting.
Causes the port to remain in the unauthorized state,
force-unauthorized ignoring all attempts by the client to authenticate. The
switch cannot provide authentication services to the client
through the port.
802.1X provides a means by which authenticator network access switch can act as an
intermediary between a client and an authentication server.
The switch forwards authentication information from the client to the server. If
authentication is successful, the client will be allowed to access the network through the
connected switch port.
If authorization fails, the switch will not permit the client endpoint to connect to the
network.
The system uses the EAP and EAPOL to carry authentication traffic between the switch
and the authenticator switch.
The switch uses EAP and RADIUS to communicate with the authentication server.
The 802.1X authentication process can be control by configuring the authenticator port
with the authentication port-control command. The port can be set carryout the
authentication process, provide authorized access, or to be in unauthorized state. In this
state no device will be able to connect to the network.
802.1X port-based authentication is configured by first globally activating AAA and by
specifying the RADIUS server name, address, and ports. After that the authenticator
interface is configured with 802.1X parameters.
MODULE 14
14.1 LAYER 2 SECURITY THREATS
14.1.1 DESCRIBE LAYER 2 VULNERABILITES
The OSI reference model is divided into seven layers which work independently of each
other. As shown in the figure, each layer performs a specific function and has core
elements that can be exploited.
Security is only as strong as the weakest link in the system, and Layer 2 is considered to
be that weakest link. This is because traditionally LANs were under the administrative
control of a single organization. We inherently trusted all persons and devices
connected to our LAN. Today, with BYOD and more sophisticated attacks, our LANs
have become more vulnerable to penetration. Therefore, in addition to protecting Layer
3 to Layer 7, network security professionals must also mitigate attacks to the Layer 2
LAN infrastructure.
The first step in mitigating attacks on the Layer 2 infrastructure is to understand the
underlying operation of Layer 2 and the threats posed by the Layer 2 infrastructure.
Attacks against the Layer 2 LAN infrastructure are highlighted in the table.
Note: The focus of this module is on common Layer 2 attacks.
Type Description
Includes MAC table overflow (also called MAC Address
MAC Table Attacks
Flooding) Attacks.
Includes VLAN hopping and VLAN double-tagging attacks.
VLAN Attacks It also includes attacks between devices on a common
VLAN.
DHCP Attacks Includes DHCP starvation and DHCP spoofing attacks.
ARP Attacks Includes ARP spoofing and ARP poisoning attacks.
Address Spoofing Attacks Includes MAC Address and IP address spoofing attacks.
STP Attacks Includes Spanning Tree Protocol manipulation attacks.
The figure below provides an overview of Cisco solutions that help mitigate Layer 2
attacks.
Topic Title Topic Objective
Port security prevents many types of attacks
Port Security including MAC table overflow attacks and DHCP
starvation attacks.
DHCP Snooping prevents DHCP starvation and
DHCP Snooping
DHCP spoofing attacks by rogue DHCP servers.
DAI prevents ARP spoofing and ARP poisoning
Dynamic ARP Inspection (DAI)
attacks.
IP Source Guard prevents MAC and IP address
IP Source Guard (IPSG)
spoofing attacks.
These Layer 2 solutions will not be effective if the management protocols are not
secured. An example would be if attackers can easily telnet into a switch. Syslog,
SNMP, TFTP, telnet, FTP and most other common network management protocols are
insecure. Therefore, the following strategies are recommended:
o Always use secure variants of these protocols such as SSH, SCP, and SSL.
o Consider using out-of-band (OOB) management.
o Use a dedicated management VLAN where nothing but management traffic
resides.
o Use ACLs to filter unwanted access.
A switch uses MAC addresses to forward (or discard) frames to other devices on a
network. If a switch just forwarded every frame it received out all ports, your network
would be so congested that it would probably come to a complete halt.
A Layer 2 Ethernet switch uses Layer 2 MAC addresses to make forwarding decisions.
It is completely unaware of the data (protocol) being carried in the data portion of the
frame, such as an IPv4 packet, an ARP message, or an IPv6 ND packet. The switch
makes its forwarding decisions based solely on the Layer 2 Ethernet MAC addresses.
An Ethernet switch examines its MAC address table to make a forwarding decision for
each frame, unlike legacy Ethernet hubs that repeat bits out all ports except the
incoming port. In the figure, the four-port switch was just powered on. The table shows
the MAC Address Table which has not yet learned the MAC addresses for the four
attached PCs.
Note: MAC addresses are shortened throughout this topic for demonstration purposes.
The switch dynamically builds the MAC address table by examining the source MAC
address of the frames that are received on a port. The switch forwards frames by
searching for a match between the destination MAC address in the frame and an entry
in the MAC address table.
Learn
As a switch receives frames from different devices, it is able to populate its MAC
address table by examining the source MAC address of every frame. When the MAC
address table of the switch contains the destination MAC address, it is able to filter the
frame and forward out a single port.
PC-D to Switch
In the figure, PC-D is replying back to PC-A. The switch sees the MAC address of PC-
D in the incoming frame on port 4. The switch then puts the MAC address of PC-D into
the MAC Address Table associated with port 4.
Switch to PC-A
Next, because the switch has destination MAC address for PC-A in the MAC Address
Table, it will send the frame only out port 1, as shown in the figure.
PC-A to Switch to PC-D
Next, PC-A sends another frame to PC-D, as shown in the figure. The MAC address
table already contains the MAC address for PC-A; therefore, the five-minute refresh
timer for that entry is reset. Next, because the switch table contains the destination
MAC address for PC-D, it sends the frame only out port 4.
All MAC tables have a fixed size and consequently, a switch can run out of resources in
which to store MAC addresses. MAC address flooding attacks take advantage of this
limitation by bombarding the switch with fake source MAC addresses until the switch
MAC address table is full.
When this occurs, the switch treats the frame as an unknown unicast and begins to flood
all incoming traffic out all ports on the same VLAN without referencing the MAC table.
This condition now allows a threat actor to capture all of the frames sent from one host
to another on the local LAN or local VLAN.
Note: Traffic is flooded only within the local LAN or VLAN. The threat actor can only
capture traffic within the local LAN or VLAN to which the threat actor is connected.
The figure shows how a threat actor can easily use the network attack tool macof to
overflow a MAC address table.
If the threat actor stops macof from running or is discovered and stopped, the switch
eventually ages out the older MAC address entries from the table and begins to act like
a switch again.
What makes tools such as macof so dangerous is that an attacker can create a MAC
table overflow attack very quickly. For instance, a Catalyst 6500 switch can store
132,000 MAC addresses in its MAC address table. A tool such as macof can flood a
switch with up to 8,000 bogus frames per second; creating a MAC address table
overflow attack in a matter of a few seconds. The example shows a sample output of
the macof command on a Linux host.
# macof -i eth1
36:a1:48:63:81:70 15:26:8d:4d:28:f8 0.0.0.0.26413 > 0.0.0.0.49492:
S 1094191437:1094191437(0) win 512
16:e8:8:0:4d:9c da:4d:bc:7c:ef:be 0.0.0.0.61376 > 0.0.0.0.47523: S
446486755:446486755(0) win 512
18:2a:de:56:38:71 33:af:9b:5:a6:97 0.0.0.0.20086 > 0.0.0.0.6728: S
105051945:105051945(0) win 512
e7:5c:97:42:ec:1 83:73:1a:32:20:93 0.0.0.0.45282 > 0.0.0.0.24898: S
1838062028:1838062028(0) win 512
62:69:d3:1c:79:ef 80:13:35:4:cb:d0 0.0.0.0.11587 > 0.0.0.0.7723: S
1792413296:1792413296(0) win 512
c5:a:b7:3e:3c:7a 3a:ee:c0:23:4a:fe 0.0.0.0.19784 > 0.0.0.0.57433: S
1018924173:1018924173(0) win 512
88:43:ee:51:c7:68 b4:8d:ec:3e:14:bb 0.0.0.0.283 > 0.0.0.0.11466: S
727776406:727776406(0) win 512
b8:7a:7a:2d:2c:ae c2:fa:2d:7d:e7:bf 0.0.0.0.32650 > 0.0.0.0.11324:
S 605528173:605528173(0) win 512
e0:d8:1e:74:1:e 57:98:b6:5a:fa:de 0.0.0.0.36346 > 0.0.0.0.55700: S
2128143986:2128143986(0) win 512
Another reason why these attack tools are dangerous is because they not only affect the
local switch, they can also affect other connected Layer 2 switches. When the MAC
address table of a switch is full, it starts flooding out all ports including those connected
to other Layer 2 switches.
To mitigate MAC address table overflow attacks, network administrators must
implement port security. Port security will only allow a specified number of source
MAC addresses to be learned on the port. Port security is further discussed later in this
module.
The simplest and most effective method to prevent MAC address table overflow attacks
is to enable port security.
Port security limits the number of valid MAC addresses allowed on a port. It allows an
administrator to manually configure MAC addresses for a port or to permit the switch to
dynamically learn a limited number of MAC addresses. When a port that is configured
with port security receives a frame, the source MAC address of the frame is compared
to the list of secure source MAC addresses that were manually configured or
dynamically learned on the port.
By limiting the number of permitted MAC addresses on a port to one, port security can
be used to control unauthorized access to the network, as shown in the figure.
Notice in the example, the switchport port-security command was rejected. This is
because port security can only be configured on manually configured access ports or
manually configured trunk ports. By default, Layer 2 switch ports are set to dynamic
auto (trunking on). Therefore, in the example, the port is configured with
the switchport mode access interface configuration command.
Note: Trunk port security is beyond the scope of this course.
S1(config)# interface f0/1
S1(config-if)# switchport port-security
Command rejected: FastEthernet0/1 is a dynamic port.
S1(config-if)# switchport mode access
S1(config-if)# switchport port-security
S1(config-if)# end
S1#
Use the show port-security interface command to display the current port security
settings for FastEthernet 0/1, as shown in the example below. Notice that port security
is enabled, and the port status is Secure-down, which means there are no devices
attached and no violation has occurred. Also, the violation mode is Shutdown, and the
maximum number of MAC addresses allowed is 1. If a device is connected to the port,
the switch port status would display Secure-up and the switch will automatically add the
device’s MAC address as a secure MAC. In this example, no device is connected to the
port.
S1# show port-security interface f0/1
Port Security : Enabled
Port Status : Secure-down
Violation Mode : Shutdown
Aging Time : 0 mins
Aging Type : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 1
Total MAC Addresses : 0
Configured MAC Addresses : 0
Sticky MAC Addresses : 0
Last Source Address:Vlan : 0000.0000.0000:0
Security Violation Count : 0
S1#
Note: If an active port is configured with the switchport port-security command and
more than one device is connected to that port, the port will transition to the error-
disabled state. This condition is discussed later in this topic.
After port security is enabled, other port security specifics can be configured, as shown
in the example.
S1(config-if)# switchport port-security ?
aging Port-security aging commands
mac-address Secure mac address
maximum Max secure addresses
violation Security violation mode
S1(config-if)# switchport port-security
To set the maximum number of MAC addresses allowed on a port, use the following
command:
The default port security value is 1. The maximum number of secure MAC addresses
that can be configured depends on the switch and the IOS. In this example, the
maximum is 8192.
S1(config)# interface f0/1
S1(config-if)# switchport port-security maximum ?
<1-8192> Maximum addresses
S1(config-if)# switchport port-security maximum
The switch can be configured to learn about MAC addresses on a secure port in one of
three ways:
1. Manually Configured
The administrator manually configures a static MAC address(es) by using the following
command for each secure MAC address on the port:
2. Dynamically Learned
When the switchport port-security command is entered, the current source MAC for
the device connected to the port is automatically secured but is not added to the startup
configuration. If the switch is rebooted, the port will have to re-learn the device’s MAC
address.
3. Dynamically Learned – Sticky
The administrator can enable the switch to dynamically learn the MAC address and
“stick” them to the running configuration by using the following command:
Switch(config-if)# switchport port-security mac-address sticky
Saving the running configuration will commit the dynamically learned MAC address to
NVRAM.
The following example demonstrates a complete port security configuration for
FastEthernet 0/1 with a host connected to port Fa0/1. The administrator specifies a
maximum of 2 MAC addresses, manually configures one secure MAC address, and
then configures the port to dynamically learn additional secure MAC addresses up to
the 2 secure MAC address maximum. Use the show port-security interface and
the show port-security address command to verify the configuration.
*Mar 1 00:12:38.179: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to up
*Mar 1 00:12:39.194: %LINEPROTO-5-UPDOWN: Line protocol on
Interface FastEthernet0/1, changed state to up
S1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#
S1(config)# interface fa0/1
S1(config-if)# switchport mode access
S1(config-if)# switchport port-security
S1(config-if)# switchport port-security maximum 2
S1(config-if)# switchport port-security mac-address aaaa.bbbb.1234
S1(config-if)# switchport port-security mac-address sticky
S1(config-if)# end
S1# show port-security interface fa0/1
Port Security : Enabled
Port Status : Secure-up
Violation Mode : Shutdown
Aging Time : 0 mins
Aging Type : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 2
Total MAC Addresses : 2
Configured MAC Addresses : 1
Sticky MAC Addresses : 1
Last Source Address:Vlan : a41f.7272.676a:1
Security Violation Count : 0
S1# show port-security address
Secure Mac Address Table
-------------------------------------------------------------------
----------
Vlan Mac Address Type Ports
Remaining Age
(mins)
---- ----------- ---- -----
-------------
1 a41f.7272.676a SecureSticky Fa0/1 -
1 aaaa.bbbb.1234 SecureConfigured Fa0/1 -
-------------------------------------------------------------------
----------
Total Addresses in System (excluding one mac per port) : 1
Max Addresses limit in System (excluding one mac per port) : 8192
S1#
The output of the show port-security interface command verifies that port security is
enabled, there is a host connected to the port (i.e., Secure-up), a total of 2 MAC
addresses will be allowed, and S1 has learned one MAC address statically and one
MAC address dynamically (i.e., sticky).
The output of the show port-security address command lists the two learned MAC
addresses.
Port security aging can be used to set the aging time for static and dynamic secure
addresses on a port. Two types of aging are supported per port:
o Absolute - The secure addresses on the port are deleted after the specified
aging time.
o Inactivity - The secure addresses on the port are deleted only if they are
inactive for the specified aging time.
Use aging to remove secure MAC addresses on a secure port without manually deleting
the existing secure MAC addresses. Aging time limits can also be increased to ensure
past secure MAC addresses remain, even while new MAC addresses are added. Aging
of statically configured secure addresses can be enabled or disabled on a per-port basis.
Use the switchport port-security aging command to enable or disable static aging for
the secure port, or to set the aging time or type.
Switch(config-if)# switchport port-security aging { static | time
time | type {absolute | inactivity}}
Parameter Description
static Enable aging for statically configured secure addresses on this port.
time time Specify the aging time for this port. The range is 0 to 1440 minutes.
If the time is 0, aging is disabled for this port.
Set the absolute aging time. All the secure addresses on this port
type absolute age out exactly after the time (in minutes) specified and are
removed from the secure address list.
Set the inactivity aging type. The secure addresses on this port age
type inactivity out only if there is no data traffic from the secure source address for
the specified time period.
If the MAC address of a device that is attached to the port differs from the list of secure
addresses, then a port violation occurs. By default, the port enters the error-disabled
state.
To set the port security violation mode, use the following command:
Switch(config-if)# switchport port-security violation { protect |
restrict | shutdown}
The following table shows how a switch reacts based on the configured violation mode.
What happens when the port security violation is shutdown and a port violation occurs?
The port is physically shutdown and placed in the error-disabled state, and no traffic is
sent or received on that port.
In the example, the port security violation is changed back to the default shutdown
setting. Then the host with MAC address a41f.7272.676a is disconnected and a new
host is plugged into Fa0/1.
Notice that a series of port security related messages are generated on the console.
S1(config)# int fa0/1
S1(config-if)# switchport port-security violation shutdown
S1(config-if)# end
S1#
*Mar 1 00:24:15.599: %LINEPROTO-5-UPDOWN: Line protocol on
Interface FastEthernet0/1, changed state to down
*Mar 1 00:24:16.606: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to down
*Mar 1 00:24:19.114: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to up
*Mar 1 00:24:20.121: %LINEPROTO-5-UPDOWN: Line protocol on
Interface FastEthernet0/1, changed state to up
S1#
*Mar 1 00:24:32.829: %PM-4-ERR_DISABLE: psecure-violation error
detected on Fa0/1, putting Fa0/1 in err-disable state
*Mar 1 00:24:32.838: %PORT_SECURITY-2-PSECURE_VIOLATION: Security
violation occurred, caused by MAC address a41f.7273.018c on port
FastEthernet0/1.
*Mar 1 00:24:33.836: %LINEPROTO-5-UPDOWN: Line protocol on
Interface FastEthernet0/1, changed state to down
*Mar 1 00:24:34.843: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to down
S1#
Note: The port protocol and link status are changed to down and the port LED is turned
off.
In the example, the show interface command identifies the port status as err-disabled.
The output of the show port-security interface command now shows the port status as
Secure-shutdown instead of Secure-up. The Security Violation counter increments by 1.
S1# show interface fa0/1 | include down
FastEthernet0/18 is down, line protocol is down (err-disabled)
(output omitted)
S1# show port-security interface fa0/1
Port Security : Enabled
Port Status : Secure-shutdown
Violation Mode : Shutdown
Aging Time : 10 mins
Aging Type : Inactivity
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 2
Total MAC Addresses : 2
Configured MAC Addresses : 1
Sticky MAC Addresses : 1
Last Source Address:Vlan : a41f.7273.018c:1
Security Violation Count : 1
S1#
After configuring port security on a switch, check each interface to verify that the port
security is set correctly, and check to ensure that the static MAC addresses have been
configured correctly.
Port Security for All Interfaces
To display port security settings for the switch, use the show port-security command.
The example indicates that only one port is configured with the switchport port-security
command.
S1# show port-security
Secure Port MaxSecureAddr CurrentAddr SecurityViolation
Security Action
(Count) (Count) (Count)
-------------------------------------------------------------------
--------
Fa0/1 2 2 0
Shutdown
-------------------------------------------------------------------
--------
Total Addresses in System (excluding one mac per port) : 1
Max Addresses limit in System (excluding one mac per port) : 8192
S1#
Use the show port-security interface command to view details for a specific interface,
as shown previously and in this example.
S1# show port-security interface fastethernet 0/1
Port Security : Enabled
Port Status : Secure-up
Violation Mode : Shutdown
Aging Time : 10 mins
Aging Type : Inactivity
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 2
Total MAC Addresses : 2
Configured MAC Addresses : 1
Sticky MAC Addresses : 1
Last Source Address:Vlan : a41f.7273.018c:1
Security Violation Count : 0
S1#
To verify that MAC addresses are “sticking” to the configuration, use the show
run command as shown in the example for FastEthernet 0/19.
S1# show run interface fa0/1
Building configuration...
S1#
To display all secure MAC addresses that are manually configured or dynamically
learned on all switch interfaces, use the show port-security address command as
shown in the example.
S1# show port-security address
Secure Mac Address Table
-------------------------------------------------------------------
----------
Vlan Mac Address Type Ports
Remaining Age
(mins)
---- ----------- ---- -----
-------------
1 a41f.7272.676a SecureSticky Fa0/1
-
1 aaaa.bbbb.1234 SecureConfigured Fa0/1
-
-------------------------------------------------------------------
----------
Total Addresses in System (excluding one mac per port) : 1
Max Addresses limit in System (excluding one mac per port) : 8192
S1#
Network managers need a way of monitoring who is using the network and what their
location is. For example, if port Fa0/1 is secure on a switch, an SNMP trap is generated
when a MAC address entry for that port disappears from the MAC table.
The MAC address notification feature sends SNMP traps to the network management
station (NMS) whenever a new MAC address is added to, or an old address is deleted
from, the forwarding tables. MAC address notifications are generated only for dynamic
and secure MAC addresses.
MAC address notification allows the network administrator to monitor MAC addresses
that are learned, as well as MAC addresses that age out and are removed from the
switch. For example, in the figure, the laptop with MAC C has disconnected from the
network. The switch will eventually timeout port Fa0/3 and send an SNMP trap
notification to the NMS Server.
Use the mac address-table notification global configuration command to enable the
MAC address notification feature on a switch.
VLANs are used to create separate broadcast domains on switches. Endpoints that are
located in one VLAN are unable to communicate with endpoints that are on another
VLAN unless permitted to do so by a router or Layer 3 switch. VLANs can be used to
separate sensitive content from other network traffic. For example, a guest VLAN may
be created for guests to an organization. Those guests should not have access to
sensitive corporate content that is carried on other VLANs. VLAN attacks can
circumvent the intention of a VLAN design by allowing unauthorized users access to
VLANs that they should not be able access. Two types of VLAN attacks are VLAN
hopping attacks and VLAN double-tagging attacks.
A VLAN hopping attack enables traffic from one VLAN to be seen by another VLAN
without the aid of a router. In a basic VLAN hopping attack, the threat actor configures
a host to act like a switch to take advantage of the automatic trunking port feature
enabled by default on most switch ports.
The threat actor configures the host to spoof 802.1Q signaling and Cisco-proprietary
Dynamic Trunking Protocol (DTP) signaling to trunk with the connecting switch. If
successful, the switch establishes a trunk link with the host, as shown in the figure. Now
the threat actor can access all the VLANs on the switch. The threat actor can send and
receive traffic on any VLAN, effectively hopping between VLANs.
A threat actor in specific situations could embed a hidden 802.1Q tag inside the frame
that already has an 802.1Q tag. This tag allows the frame to go to a VLAN that the
original 802.1Q tag did not specify.
Step 1
The threat actor sends a double-tagged 802.1Q frame to the switch. The outer header
has the VLAN tag of the threat actor, which is the same as the native VLAN of the
trunk port. For the purposes of this example, assume that this is VLAN 10. The inner
tag is the victim VLAN, in this example, VLAN 20.
Step 2
The frame arrives on the first switch, which looks at the first 4-byte 802.1Q tag. The
switch sees that the frame is destined for VLAN 10, which is the native VLAN. The
switch forwards the packet out all VLAN 10 ports after stripping the VLAN 10 tag. The
frame is not retagged because it is part of the native VLAN. At this point, the VLAN 20
tag is still intact and has not been inspected by the first switch.
Step 3
The frame arrives at the second switch which has no knowledge that it was supposed to
be for VLAN 10. Native VLAN traffic is not tagged by the sending switch as specified
in the 802.1Q specification. The second switch looks only at the inner 802.1Q tag that
the threat actor inserted and sees that the frame is destined for VLAN 20, the target
VLAN. The second switch sends the frame on to the target or floods it, depending on
whether there is an existing MAC address table entry for the target.
The steps are complete — back to our regularly scheduled programming…
A VLAN double-tagging attack is unidirectional and works only when the attacker is
connected to a port residing in the same VLAN as the native VLAN of the trunk port.
The idea is that double tagging allows the attacker to send data to hosts or servers on a
VLAN that otherwise would be blocked by some type of access control configuration.
Presumably the return traffic will also be permitted, thus giving the attacker the ability
to communicate with devices on the normally blocked VLAN.
VLAN Attack Mitigation
FastEthernet ports 0/1 to 0/16 are access ports and therefore trunking is disabled by
explicitly making them access ports.
FastEthernet ports 0/17 to 0/20 are unused ports and are disabled and assigned to an
unused VLAN.
FastEthernet ports 0/21 to 0/24 are trunk links and are manually enabled as trunks with
DTP disabled. The native VLAN is also changed from the default VLAN 1 to VLAN
999.
VLANs are broadcast domains. However, in some situations, it may useful to break this
rule and allow only the minimum required L2 connectivity within the VLAN.
Private VLANs (PVLAN) provide Layer 2 isolation between ports within the same
broadcast domain. There are three types of PVLAN ports:
Promiscuous - A promiscuous port can talk to everyone. It can communicate with all
interfaces, including the isolated and community ports within a PVLAN.
Isolated - An isolated port can only talk to promiscuous ports. An isolated port has
complete Layer 2 separation from the other ports within the same PVLAN, but not from
the promiscuous ports. PVLANs block all traffic to isolated ports except traffic from
promiscuous ports. Traffic from an isolated port is forwarded only to promiscuous
ports.
Community - Community ports can talk to other community and promiscuous ports.
These interfaces are separated at Layer 2 from all other interfaces in other communities
or isolated ports within their PVLAN.
The example in the figure illustrates which ports can interconnect. The security
provided by a PVLAN can be bypassed by using the router as a proxy.
For example, in the figure below, PC-A and PC-B are isolated from each other.
However, PC-A can initiate an attack against PC-B by sending packets that have the
source IP address and MAC address of PC-A, the destination IP address of PC-B, but
the destination MAC address of R1. S1 will forward the frame to R1 because F0/5 is
configured as a promiscuous port. R1 rebuilds the frame with PC-B's MAC address and
forwards it to S1. S1 then forwards the frame to PC-B.
Note: PVLANs are used mainly in service provider co-location sites. Another typical
application can be found in hotels where each room would be connected on its own
isolated port.
To mitigate this type of attack, configure an ACL that will deny traffic with a source
and destination IP address that belongs to the same subnet, as shown in in the
configuration below.
R1(config)# ip access-list extended PVLAN
R1(config-ext-nacl)# deny ip 172.16.0.0 0.0.0.255 172.16.0.0
0.0.0.255
R1(config-ext-nacl)# permit ip any any
R1(config-ext-nacl)# interface g0/0
R1(config-if)# ip access-group PVLAN in
R1(config-if)#
14.4.6 PVLAN EDGE FEATURE
Some applications require that no traffic be forwarded at Layer 2 between ports on the
same switch so that one neighbour does not see the traffic generated by another
neighbour.
In such an environment, the use of the PVLAN Edge feature ensures that there is no
exchange of unicast, broadcast, or multicast traffic between PVLAN edge ports on the
switch, as shown in the figure. The PLVAN Edge feature is also called Protected Ports.
The PVLAN Edge feature has the following characteristics:
o A protected port does not forward any traffic, such as unicast, multicast, or
broadcast, to any other port that is also a protected port. Data traffic cannot be
forwarded between protected ports at Layer 2; only control traffic is forwarded
because these packets are processed by the CPU and forwarded in software. All
data traffic passing between protected ports must be forwarded through a Layer
3 device.
o Forwarding behaviour between a protected port and a non-protected port
proceeds as usual.
o The default is to have no protected ports defined.
To configure the PVLAN Edge feature, enter the switchport protected interface
configuration mode command.
The PVLAN Edge feature can be configured on a physical interface or an EtherChannel
group. When the PVLAN Edge feature is enabled for a port channel, it is enabled for all
ports in the port-channel group. To disable protected port, use the no switchport
protected interface configuration mode command.
To verify the configuration of the PVLAN Edge feature, use the show interfaces
interface-id switchport global configuration mode command, as shown in the example
below.
Switch# show interfaces gigabitethernet1/0/1 switchport
Name: G1/0/1
Switchport: Enabled
Administrative Mode: dynamic auto
Operational Mode: static access
Administrative Trunking Encapsulation: negotiate
Operational Trunking Encapsulation: native
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
(output omitted)
The PVLAN edge is a feature that has only local significance to the switch, and there is
no isolation provided between two protected ports located on different switches. A
protected port does not forward any traffic (unicast, multicast, or broadcast) to any other
port that is also a protected port on the same switch. Traffic cannot be forwarded
between protected ports at Layer 2 (L2); all traffic passing between protected ports must
be forwarded through a Layer 3 (L3) device.
Two types of DHCP attacks are DHCP starvation and DHCP spoofing. Both attacks are
mitigated by implementing DHCP snooping.
DHCP Starvation Attack
The goal of the DHCP starvation attack is DoS for connecting clients. DHCP starvation
attacks require an attack tool such as Gobbler.
Gobbler has the ability to look at the entire scope of leasable IP addresses and tries to
lease them all. Specifically, it creates DHCP discovery messages with bogus MAC
addresses.
DHCP Spoofing Attack
A DHCP spoofing attack occurs when a rogue DHCP server is connected to the
network and provides false IP configuration parameters to legitimate clients. A rogue
server can provide a variety of misleading information:
o Wrong default gateway - The rogue server provides an invalid gateway, or its
own IP address, to create a man-in-the-middle attack. This may go entirely
undetected as the intruder intercepts the data flow through the network and then
forwards it on to the real default gateway.
o Wrong DNS server - The rogue server provides an incorrect DNS server
address that points the user to a nefarious website.
o Wrong IP address - The rogue server provides an invalid IP address which
effectively creates a DoS attack on the DHCP client.
An example and explanation of a DHCP spoofing attack now follows…
Step 1
Threat Actor Connects Rogue DHCP Server
A threat actor successfully connects a rogue DHCP server to a switch port on the same
subnet and VLANs as the target clients. The goal of the rogue server is to provide
clients with false IP configuration information.
Step 2
Client Broadcasts DHCP Discovery Messages
The legitimate DHCP server responds with valid IP configuration parameters. However,
the rogue server also responds with a DHCP offer containing IP configuration
parameters defined by the threat actor. The client will reply to the first offer received.
Step 4
Client Accepts Rogue DHCP Offer
The rogue offer was received first, and therefore, the client broadcasts a DHCP request
accepting the IP parameters defined by the threat actor. The legitimate and rogue server
will receive the request.
Step 5
Rogue Server Acknowledges
The rogue server unicasts a reply to the client to acknowledge its request. The
legitimate server will cease communicating with the client.
14.5.2 DHCP ATTACKS MITIGATION
Note: In a large network, the DHCP binding table may take time to build after it is
enabled. For example, it could take 2 days for DHCP snooping to complete the table if
DHCP lease time is 4 days.
When DHCP snooping is enabled on an interface or VLAN, and a switch receives a
packet on an untrusted port, the switch compares the source packet information with
that held in the DHCP snooping binding table. The switch will deny packets containing
specific information:
o Unauthorized DHCP server messages from an untrusted port
o Unauthorized DHCP client messages not adhering to the snooping binding table
or rate limits
o DHCP relay-agent packets that include option-82 information on an untrusted
port
Note: To counter Gobbler using the same MAC address, DHCP snooping also makes
the switch check the Client Hardware Address (CHADDR) field in the DHCP request.
This ensures that it matches the hardware MAC address in the DHCP snooping binding
table and the MAC address in the MAC table. If there is no match, the request is
dropped.
Note: Similar mitigation techniques are available for DHCPv6 and IPv6 clients.
Because IPv6 devices can also receive their addressing information from the router’s
Router Advertisement (RA) message, there are also mitigation solutions to prevent any
rogue RA messages.
Use the show ip dhcp snooping privileged EXEC command to verify DHCP snooping
and show ip dhcp snooping binding to view the clients that have received DHCP
information, as shown in the example.
Note: DHCP snooping is also required by Dynamic ARP Inspection (DAI), which is the
next topic.
S1# show ip dhcp snooping
Switch DHCP snooping is enabled
DHCP snooping is configured on following VLANs:
5,10,50-52
DHCP snooping is operational on following VLANs:
none
DHCP snooping is configured on the following L3 Interfaces:
Insertion of option 82 is enabled
circuit-id default format: vlan-mod-port
remote-id: 0cd9.96d2.3f80 (MAC)
Option 82 on untrusted port is not allowed
Verification of hwaddr field is enabled
Verification of giaddr field is enabled
DHCP snooping trust/rate is configured on the following Interfaces:
Interface Trusted Allow option Rate limit
(pps)
----------------------- ------- ------------
----------------
FastEthernet0/1 yes yes unlimited
Custom circuit-ids:
FastEthernet0/5 no no 6
Custom circuit-ids:
FastEthernet0/6 no no 6
Custom circuit-ids:
S1# show ip dhcp snooping binding
MacAddress IpAddress Lease(sec) Type VLAN
Interface
------------------ --------------- ---------- ------------- ----
--------------------
00:03:47:B5:9F:AD 192.168.10.11 193185 dhcp-snooping 5
FastEthernet0/5
Recall that hosts broadcast ARP Requests to determine the MAC address of a host with
a particular IPv4 address. This is typically done to discover the MAC address of the
default gateway. All hosts on the subnet receive and process the ARP Request. The host
with the matching IPv4 address in the ARP Request sends an ARP Reply.
According to the ARP RFC, a client is allowed to send an unsolicited ARP Request
called a “gratuitous ARP.” When a host sends a gratuitous ARP, other hosts on the
subnet store the MAC address and IPv4 address contained in the gratuitous ARP in their
ARP tables.
The problem is that an attacker can send a gratuitous ARP message containing a
spoofed MAC address to a switch, and the switch would update its MAC table
accordingly. Therefore, any host can claim to be the owner of any IP and MAC address
combination they choose. In a typical attack, a threat actor can send unsolicited ARP
Replies to other hosts on the subnet with the MAC Address of the threat actor and the
IPv4 address of the default gateway.
There are many tools available on the internet to create ARP man-in-the-middle attacks
including dsniff, Cain & Abel, ettercap, Yersinia, and others. IPv6 uses ICMPv6
Neighbor Discovery Protocol for Layer 2 address resolution. IPv6 includes strategies to
mitigate Neighbor Advertisement spoofing, similar to the way IPv6 prevents a spoofed
ARP Reply.
ARP spoofing and ARP poisoning are mitigated by implementing Dynamic ARP
Inspection (DAI).
Now follows an example and explanation of ARP spoofing and ARP poisoning
Step 1
Normal State with Converged MAC Tables
Each device has an accurate MAC table with the correct IPv4 and MAC addresses for
the other devices on the LAN.
Step 2
ARP Spoofing Attack
The threat actor sends two spoofed gratuitous ARP Replies in an attempt to replace R1
as the default gateway:
o 1. The first one informs all devices on the LAN that the threat actor’s MAC
address (CC:CC:CC) maps to R1’s IPv4 address, 10.0.0.1.
o 2. The second one informs all devices on the LAN that the threat actor’s MAC
address (CC:CC:CC) maps to PC1’s IPv4 address, 10.0.0.11.
Step 3
ARP Poisoning Attack with Man-in-the-Middle Attack
R1 and PC1 remove the correct entry for each other’s MAC address and replace it with
PC2’s MAC address. The threat actor has now poisoned the ARP caches of all devices
on the subnet. ARP poisoning leads to various man-in-the-middle attacks, posing a
serious security threat to the network.
In a typical ARP attack, a threat actor can send unsolicited ARP requests to other hosts
on the subnet with the MAC Address of the threat actor and the IP address of the default
gateway. To prevent ARP spoofing and the resulting ARP poisoning, a switch must
ensure that only valid ARP Requests and Replies are relayed.
Dynamic ARP inspection (DAI) requires DHCP snooping and helps prevent ARP
attacks by:
o Not relaying invalid or gratuitous ARP Requests out to other ports in the same
VLAN
o Intercepting all ARP Requests and Replies on untrusted ports
o Verifying each intercepted packet for a valid IP-to-MAC binding
o Dropping and logging ARP Requests coming from invalid sources to prevent
ARP poisoning
o Error-disabling the interface if the configured DAI number of ARP packets is
exceeded
14.6.4 DAI IMPLEMENTATION GUIDELINES
To mitigate the chances of ARP spoofing and ARP poisoning, follow these DAI
implementation guidelines:
o Enable DHCP snooping globally.
o Enable DHCP snooping on selected VLANs.
o Enable DAI on selected VLANs.
o Configure trusted interfaces for DHCP snooping and ARP inspection.
It is generally advisable to configure all access switch ports as untrusted and to
configure all uplink ports that are connected to other switches as trusted.
The sample topology in the figure identifies trusted and untrusted ports.
DAI can also be configured to check for both destination or source MAC and IP
addresses:
o Destination MAC - Checks the destination MAC address in the Ethernet
header against the target MAC address in the ARP packet body
o Source MAC - Checks the source MAC address in the Ethernet header against
the sender MAC address in the ARP packet body
o IP address - Checks the ARP packet body for invalid and unexpected IP
addresses including addresses 0.0.0.0, 255.255.255.255, and all IP multicast
addresses
The ip arp inspection validate {src-mac [dst-mac] [ip]} global configuration
command is used to configure DAI to drop ARP packets when the IP addresses are
invalid. It can be used when the MAC addresses in the body of the ARP packets do not
match the addresses that are specified in the Ethernet header. Notice in the following
example how only one command can be configured. Therefore, entering multiple ip arp
inspection validate commands overwrites the previous command. To include more
than one validation method, enter them on the same command line as shown and
verified in the following output.
S1(config)# ip arp inspection validate ?
dst-mac Validate destination MAC address
ip Validate IP addresses
src-mac Validate source MAC address
S1(config)# ip arp inspection validate src-mac
S1(config)# ip arp inspection validate dst-mac
S1(config)# ip arp inspection validate ip
S1(config)# do show run | include validate
ip arp inspection validate ip
S1(config)# ip arp inspection validate src-mac dst-mac ip
S1(config)# do show run | include validate
ip arp inspection validate src-mac dst-mac ip
S1(config)#
When the switch receives the frame, it examines the source MAC address. The switch
overwrites the current MAC table entry and assigns the MAC address to the new port,
as shown in the figure below. It then inadvertently forwards frames destined for the
target host to the attacking host.
When the switch changes the MAC table, the target host does not receive any traffic
until it sends traffic. When the target host sends traffic, the switch receives and
examines the frame, resulting in the MAC table being rewritten once more, realigning
the MAC address to the original port. To stop the switch from returning the spoofed
MAC address port assignments to their correct state, the attacking host can create a
program or script that will constantly send frames to the switch so that the switch
maintains the incorrect or spoofed information. There is no security mechanism at
Layer 2 that allows a switch to verify the source of MAC addresses, which is what
makes it so vulnerable to spoofing.
IP address spoofing is when a rogue PC hijacks a valid IP address of a neighbor, or a
uses a random IP address. IP address spoofing is difficult to mitigate, especially when it
is used inside a subnet in which the IP belongs.
To protect against MAC and IP address spoofing, configure the IP Source Guard
(IPSG) security feature. IPSG operates just like DAI, but it looks at every packet, not
just the ARP packets. Like DAI, IPSG also requires that DHCP snooping be enabled.
Specifically, IPSG is deployed on untrusted Layer 2 access and trunk ports. IPSG
dynamically maintains per-port VLAN ACLs (PVACL) based on IP-to-MAC-to-
switch-port bindings. Initially, all IP traffic on the port is blocked, except for DHCP
packets that are captured by the DHCP snooping process. A PVACL is installed on the
port when a client receives a valid IP address from the DHCP server or when a static IP
source binding is configured by the user.
This process restricts the client IP traffic to those source IP addresses that are
configured in the binding. Any IP traffic with a source IP address other than that in the
IP source binding will be filtered out. This filtering limits the ability of a host to attack
the network by claiming the IP address of a neighbor host.
For each untrusted port, there are two possible levels of IP traffic security filtering:
o Source IP address filter - IP traffic is filtered based on its source IP address
and only IP traffic with a source IP address that matches the IP source binding
entry is permitted. When a new IP source entry binding is created or deleted on
the port, the PVACL automatically adjusts itself to reflect the IP source binding
change.
o Source IP and MAC address filter - IP traffic is filtered based on its source IP
address in addition to its MAC address. Only IP traffic with source IP and
MAC addresses that match the IP source binding entry are permitted.
Examine the IP Source Guard reference topology that is shown in the figure.
IP Source Guard is enabled on untrusted ports using the ip verify source command as
shown in the configuration below. Remember that the feature can only be configured on
a Layer 2 access or trunk port and that DHCP snooping is required to learn valid IP
address and MAC address pairs.
S1(config)# interface range fastethernet 0/1 - 2
S1(config-if-range)# ip verify source
S1(config-if-range)# end
S1#
Use the show ip verify source command to verify the IP Source Guard configuration,
as shown below. In the example, the F0/1 and F0/2 ports are configured with IP Source
Guard. Each interface has one valid DHCP binding
S1# show ip verify source
Interface Filter-type Filter-mode IP-address Mac-address
Vlan
--------- ----------- ----------- ---------------
----------------- ----
F0/1 ip active 192.168.10.10
10
F0/2 ip active 192.168.10.11
10
S1#
Spanning Tree Protocol (STP) is a loop-prevention network protocol that allows for
redundancy while creating a loop-free Layer 2 topology. IEEE 802.1D is the original
IEEE MAC Bridging standard for STP.
Watch the video to see STP in action.
14.8.2 STP RECALCULATION
Watch the video to view an animation of STP recalculation when a failure occurs.
Without STP enabled, Layer 2 loops can form, causing broadcast, multicast and
unknown unicast frames to loop endlessly. This can bring down a network within a very
short amount of time, sometimes in just a few seconds. For example, broadcast frames,
such as an ARP Request are forwarded out all of the switch ports, except the original
ingress port. This ensures that all devices in a broadcast domain are able to receive the
frame. If there is more than one path for the frame to be forwarded out of, an endless
loop can result. When a loop occurs, the MAC address table on a switch will constantly
change with the updates from the broadcast frames, which results in MAC database
instability. This can cause high CPU utilization, which makes the switch unable to
forward frames.
Broadcast frames are not the only type of frames that are affected by loops. Unknown
unicast frames sent onto a looped network can result in duplicate frames arriving at the
destination device. An unknown unicast frame is when the switch does not have the
destination MAC address in its MAC address table and must forward the frame out all
ports, except the ingress port.
There is an animation.
The spanning tree algorithm designates a single switch as the root bridge and uses it as
the reference point for all path calculations. In the figure, the root bridge (switch S1) is
chosen through an election process. All switches that participate in STP exchange
BPDU frames to determine which switch has the lowest bridge ID (BID) on the
network. The switch with the lowest BID automatically becomes the root bridge for the
spanning tree algorithm calculations.
Note: For simplicity, assume until otherwise indicated that all ports on all switches are
assigned to VLAN 1. The switches are configured with the default PVST+. Each switch
has a unique MAC address associated with VLAN 1.
A BPDU is a messaging frame that is exchanged by switches for STP. Each BPDU
contains a BID that identifies the switch that sent the BPDU. The BID contains a
priority value, the MAC address of the sending switch, and an optional extended system
ID. The lowest BID value is determined by the combination of these three fields.
After the root bridge has been determined, the spanning tree algorithm calculates the
shortest path to it. Each switch uses the spanning tree algorithm to determine which
ports to block. While the spanning tree algorithm determines the best paths to the root
bridge for all switch ports in the broadcast domain, traffic is prevented from being
forwarded through the network. The spanning tree algorithm considers both path and
port costs when determining which ports to block. The path costs are calculated using
port cost values associated with port speeds for each switch port along a given path. The
sum of the port cost values determines the overall path cost to the root bridge. If there is
more than one path to choose from, spanning tree algorithm chooses the path with the
lowest path cost.
When the spanning tree algorithm has determined which paths are most desirable
relative to each switch, it assigns port roles to the participating switch ports. The STP
port roles are:
o Alternate - Alternate or backup ports are configured to be in a blocking state to
prevent loops. Alternate ports are selected only on trunk links where neither end
is a root port.
o Root - Root ports are switch ports that are closest to the root bridge.
o Designated - Designated ports are all non-root ports that STP permits to
forward traffic on the network. Designated ports are selected on a per-trunk
basis. If one end of a trunk is a root port, then the other end is a designated port.
All ports on the root bridge are designated ports
The figure above shows the relationship of the port roles in the network to the root
bridge and whether they are allowed to forward traffic. In the figure, only one end of
Trunk2 is blocked. This allows for faster transition to a forwarding state when a change
in the network makes it necessary.
Note: A port that is administratively shut down is referred to as a disabled port.
As shown in the figure, every spanning tree instance (switched LAN or broadcast
domain) has a switch designated as the root bridge. The root bridge serves as a
reference point for all spanning tree calculations to determine which redundant paths to
block.
An election process determines which switch becomes the root bridge.
The figure below shows the BID fields. The BID is made up of a priority value, an
extended system ID, and the MAC address of the switch.
All switches in the broadcast domain participate in the election process. After a switch
boots, it begins to send out BPDU frames every two seconds. These BPDU frames
contain the switch BID and the root ID.
As the switches forward their BPDU frames, switches in the broadcast domain read the
root ID information from the BPDU frames. If the root ID from a BPDU that has been
received is lower than the root ID on the receiving switch, then the receiving switch
updates its root ID, which identifies the adjacent switch as the root bridge. The switch
then forwards new BPDU frames with the lower root ID to the other switches.
Eventually, the switch with the lowest BID ends up being identified as the root bridge
for the spanning tree instance.
There is a root bridge elected for each spanning tree instance. It is possible to have
multiple distinct root bridges. If all ports on all switches are members of VLAN 1, then
there is only one spanning tree instance. The extended system ID plays a role in how
spanning tree instances are determined.
When the root bridge has been elected for the spanning tree instance, the spanning tree
algorithm starts the process of determining the best paths to the root bridge from all
destinations in the broadcast domain. The path information is determined by summing
up the individual port costs along the path from the destination to the root bridge. Each
“destination” is actually a switch port.
The default port costs are defined by the speed at which the port operates. As shown in
the table, 10 Gb/s Ethernet ports have a port cost of 2, 1 Gb/s Ethernet ports have a port
cost of 4, 100 Mb/s Fast Ethernet ports have a port cost of 19, and 10 Mb/s Ethernet
ports have a port cost of 100.
Link
Speed
Cost (Revised IEEE Specification) Cost (Previous IEEE Specification)
and
Name
10
2 1
Gb/s
1 Gb/s 4 1
100
19 10
Mb/s
10
100 100
Mb/s
Note: As newer, faster Ethernet technologies become available, the path cost values
may change to accommodate the new speeds. The non-linear numbers in the table
accommodate some improvements to the older Ethernet standard. The values have
changed to accommodate the 10 Gb/s Ethernet standard. To illustrate the continued
change associated with high-speed networking, Catalyst 4500 and 6500 switches
support a longer path cost method; for example, 10 Gb/s has a 2000 path cost, 100 Gb/s
has a 200 path cost, and 1 Tb/s has a 20 path cost.
Although switch ports have a default port cost associated with them, the port cost is
configurable. The ability to configure individual port costs gives the administrator the
flexibility to manually control the spanning tree paths to the root bridge.
To configure the port cost of an interface enter the spanning-tree cost value command
in interface configuration mode. The value can be between 1 and 200,000,000.
In the example below, switch port F0/1 has been configured with a port cost of 25 using
the spanning-tree cost 25 interface configuration mode command on the F0/1
interface.
S2# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
S2(config)# interface f0/1
S2(config-if)# spanning-tree cost 25
S2(config-if# end
S2#
To restore the port cost back to the default value of 19, enter the no spanning-tree
cost interface configuration mode command.
S2# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
S2(config)# interface f0/1
S2(config-if)# no spanning-tree cost
S2(config-if)# end
S2#
The path cost is equal to the sum of all the port costs along the path to the root bridge.
Paths with the lowest cost become preferred, and all other redundant paths are blocked.
In the example below, the path cost from S2 to the root bridge S1, over Path 1 is 19
(based on the IEEE-specified individual port cost), while the path cost over Path 2 is
two times 19, or 38. Because Path 1 has a lower overall path cost to the root bridge, it is
the preferred path. STP then configures the redundant path to be blocked, preventing a
loop from occurring.
To verify the port and path cost to the root bridge, enter the show spanning-
tree command. The Cost field is the total path cost to the root bridge. This value
changes depending on how many switch ports must be traversed to get to the root
bridge. In the output below, each interface is also identified with an individual port cost
of 19.
S2# show spanning-tree
VLAN001
Spanning tree enabled protocol ieee
Root ID Priority 27577
Address 000A.0033.3333
Cost 19
Port 1
Hello Time 2 sec Max Age 20 sec Forward Delay 15
sec
When an administrator wants a specific switch to become a root bridge, the bridge
priority value must be adjusted to ensure it is lower than the bridge priority values of all
the other switches on the network. There are two different methods to configure the
bridge priority value on a Cisco Catalyst switch.
Now follow examples of the two methods of configuring bridge priority and how to verify that a
bridge is acting as root
Method 1
To ensure that the switch has the lowest bridge priority value, use the spanning-tree
vlan vlan-id root primary command in global configuration mode. The priority for the
switch is set to the predefined value of 24,576 or to the highest multiple of 4,096, less
than the lowest bridge priority detected on the network.
If an alternate root bridge is desired, use the spanning-tree vlan vlan-id root
secondary global configuration mode command. This command sets the priority for the
switch to the predefined value of 28,672. This ensures that the alternate switch becomes
the root bridge if the primary root bridge fails. This assumes that the rest of the switches
in the network have the default 32,768 priority value defined.
In this example, S1 has been assigned as the primary root bridge using the spanning-
tree vlan 1 root primary command, and S2 has been configured as the secondary root
bridge using the spanning-tree vlan 1 root secondary command.
S1(config)# spanning-tree VLAN 1 root primary
S1(config)# end
-----------------------
S2(config)# spanning-tree root secondary
S2(config)# end
Method 2
Another method for configuring the bridge priority value is using the spanning-tree
vlan vlan-id priority value global configuration mode command. This command gives
more granular control over the bridge priority value. The priority value is configured in
increments of 4,096 between 0 and 61,440.
In the example, S3 has been assigned a bridge priority value of 24,576 for VLAN 1
using the spanning-tree vlan 1 priority 24576 command. This is the equivalent value
of the root primary setting.
S3(config)# spanning-tree VLAN 1 priority 24576
To verify the bridge priority of a switch, use the show spanning-tree command. In
example in Method 2, the priority of the switch was set to 24,576. Also notice that the
switch is designated as the root bridge for the spanning tree instance.
S3# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 00A.0033.3333
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
Address 000A.0033.3333
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Threat actors can manipulate the Spanning Tree Protocol (STP) to conduct an attack by
spoofing the root bridge and changing the topology of a network. Attackers can make
their hosts appear as root bridges; and therefore, capture all traffic for the immediate
switched domain.
To conduct an STP manipulation attack, the attacking host broadcasts STP bridge
protocol data units (BPDUs) containing configuration and topology changes that will
force spanning-tree recalculations, as shown in the figure. The BPDUs that are sent by
the attacking host announce a lower bridge priority in an attempt to be elected as the
root bridge.
Note: These issues can occur when someone adds an Ethernet switch to the network
without any malicious intent.
If successful, the attacking host becomes the root bridge, as shown in the figure below,
and can now capture a variety of frames that would otherwise not be accessible.
This STP attack is mitigated by implementing BPDU Guard on all access ports.
To mitigate STP manipulation attacks, use the Cisco STP stability mechanisms to
enhance the overall performance of the switches and to reduce the time that is lost
during topology changes.
These are the STP stability mechanisms:
o PortFast - PortFast immediately brings an interface that is configured as an
access or trunk port to the forwarding state from a blocking state. This bypasses
the listening and learning states. It should be applied to all end-user ports.
PortFast should only be configured when there is a host attached to the port,
and not another switch.
o BPDU Guard - BPDU guard immediately error disables a port that receives a
BPDU. It is typically used on PortFast enabled ports. Apply to all end-user
ports.
o Root Guard - Root guard prevents an inappropriate switch from becoming the
root bridge. Root guard limits the switch ports out of which the root bridge may
be negotiated. Apply to all ports which should not become root ports.
o Loop Guard - Loop guard prevents alternate or root ports from becoming
designated ports because of a failure that leads to a unidirectional link. Apply to
all ports that are or can become non-designated.
These features enforce the placement of the root bridge in the network and enforce the
STP domain borders.
The figure highlights the ports on which these features should be implemented.
PortFast bypasses the STP listening and learning states to minimize the time that access
ports must wait for STP to converge. If PortFast is enabled on a port connecting to
another switch, there is a risk of creating a spanning-tree loop.
PortFast can be enabled on an interface by using the spanning-tree portfast interface
configuration command. Alternatively, Portfast can be configured globally on all access
ports by using the spanning-tree portfast default global configuration command.
To verify whether PortFast is enabled globally you can use either the show running-
config | begin span command or the show spanning-tree summary command. To
verify if PortFast is enabled on an interface, use the show running-config
interface type/number command, as shown in the following example.
The show spanning-tree interface type/number detail command can also be used for
verification.
Notice the warning messages that are displayed when PortFast is enabled.
S1(config)# interface fa0/1
S1(config-if)# switchport mode access
S1(config-if)# spanning-tree portfast
%Warning: portfast should only be enabled on ports connected to a
single
host. Connecting hubs, concentrators, switches, bridges, etc... to
this
interface when portfast is enabled, can cause temporary bridging
loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/1 but will only
have effect when the interface is in a non-trunking mode.
S1(config-if)# exit
S1(config)# spanning-tree portfast default
%Warning: this command enables portfast by default on all
interfaces. You
should now disable portfast explicitly on switched ports leading
to hubs,
switches and bridges as they may create temporary bridging loops.
S1(config)# exit
S1# show running-config | begin span
spanning-tree mode pvst
spanning-tree portfast default
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
(output omitted)
S1#
Even though PortFast is enabled, the interface will still listen for BPDUs. Unexpected
BPDUs might be accidental, or part of an unauthorized attempt to add a switch to the
network.
If any BPDUs are received on a BPDU Guard enabled port, that port is put into error-
disabled state. This means the port is shut down and must be manually re-enabled or
automatically recovered through the errdisable recovery cause bpduguard global
command.
BPDU Guard can be enabled on a port by using the spanning-tree bpduguard
enable interface configuration command. Alternatively, use the spanning-tree portfast
bpduguard default global configuration command to globally enable BPDU guard on
all PortFast-enabled ports.
To display information about the state of spanning tree, use the show spanning-tree
summary command. In the example, PortFast default and BPDU Guard are both
enabled as the default state for ports that are configured in access mode.
Note: Always enable BPDU Guard on all PortFast-enabled ports.
S1(config)# interface fa0/1
S1(config-if)# spanning-tree bpduguard enable
S1(config-if)# exit
S1(config)# spanning-tree portfast bpduguard default
S1(config)# end
S1# show spanning-tree summary
Switch is in pvst mode
Root bridge for: none
Extended system ID is enabled
Portfast Default is enabled
PortFast BPDU Guard Default is enabled
Portfast BPDU Filter Default is disabled
Loopguard Default is disabled
EtherChannel misconfig guard is enabled
UplinkFast is disabled
BackboneFast is disabled
Configured Pathcost method used is short
(output omitted)
S1#
There are some switches in a network that should never, under any circumstances,
become the STP root bridge. Root Guard provides a way to enforce the placement of
root bridges in the network by limiting which switch can become the root bridge.
Root guard is best deployed on ports that connect to switches that should not be the root
bridge. If a root-guard-enabled port receives BPDUs that are superior to those that the
current root bridge is sending, that port is moved to a root-inconsistent state. This is
effectively equal to an STP listening state, and no data traffic is forwarded across that
port. Recovery occurs as soon as the offending device ceases to send superior BPDUs.
Use the spanning-tree guard root interface configuration command to configure root
guard on an interface.
In the figure, D1 is the root bridge. If D1 fails, only D2 switch should become the root
bridge. To ensure that S1 never becomes a root bridge, the F0/1 interfaces of D1 and D2
should be enabled for Root guard.
To view Root Guard ports that have received superior BPDUs and are in a root-
inconsistent state, use the show spanning-tree inconsistent ports command.
Note: Root guard may seem unnecessary because an administrator can manually set the
bridge priority of a switch to zero. However, this does not guarantee that this switch
will be elected as the root bridge. Another switch may still become the root if it also has
a priority of zero and a lower MAC address.
Traffic on bidirectional links flows in both directions. If for some reason one-direction
traffic flow fails, this creates a unidirectional link which can result in a Layer 2 loop.
STP relies on continuous reception or transmission of BPDUs based on the port role.
The designated port transmits BPDUs, and the non-designated port receives BPDUs. A
Layer 2 loop is usually created when an STP port in a redundant topology stops
receiving BPDUs and erroneously transitions to the forwarding state.
The STP Loop Guard feature provides additional protection against Layer 2 loops. If
BPDUs are not received on a non-designated Loop Guard-enabled port, the port
transitions to a loop-inconsistent blocking state, instead of the listening / learning /
forwarding state. Without the Loop Guard feature, the port would assume a designated
port role and create a loop.
As shown here, Loop Guard is enabled on all non-Root Guard ports using
the spanning-tree guard loop interface configuration command.
Note: Loop Guard can also be enabled globally using the spanning-tree loopguard
default global configuration command. This enables Loop Guard on all point-to-point
links.
14.10 LAYER 2 SECURITY CONSIDERATIONS SUMMARY
14.10.1 WHAT DID I LEARN IN THIS MODULE?
Layer 2 Security Threats
Security is implemented at all layers of the OSI model. However, if Layer 2 is disrupted
by a cyber attack, all layers above it will be affected. There are a number of attacks that
can happen at Layer 2 including MAC table attacks, VLAN attacks, DHCP attacks,
ARP attacks, address spoofing attacks, and STP attacks. It is important to protect Layer
2 by always using secure variants of protocols such as SSH, SCP, and SSL. Using out-
of-band management whenever possible and creating a dedicated VLAN for
management traffic are also means to make successful Layer 2 attacks less likely. In
addition, ACLs should be used to filter unwanted access. Port security, DHCP
Snooping, DAI, and IP Source Guard are available on Cisco switches to directly
mitigate Layer 2 attacks.
MAC Table Attacks
Layer 2 switches use MAC addresses to make forwarding decisions. The switch uses a
MAC table that maps MAC addresses to switchports. The switch looks for the
destination MAC address in the MAC table for the frames that it receives. It then
forwards the traffic to the corresponding port. If the switch does not recognize a
destination MAC address, it floods the frames for the unknown destination out of all
ports except the port from which the frames originated. These are called unknown
unicast messages. The switch dynamically learns MAC addresses from the source
addresses of the frames that originate on its ports. One type of Layer 2 attack floods the
switch with frames with random MAC source addresses. The switch attempts to add all
of these frames to the MAC table until the table is full. Subsequent frames are then
treated as unknown unicast messages and sent out all but the receiving port. Since these
frames are flooded, a threat actor can receive all traffic that is sent on the network.
Threat actor tools such as macof can quickly overwhelm the MAC table of a switch
causing a MAC table overflow exploit. Because the flooding of unknown unicast
addresses can include trunk ports to other switches, the exploit can cause widespread
disruptions.
Mitigate MAC Table Attacks
VLANs may be used to separate sensitive traffic from other traffic. VLAN hopping and
VLAN double-tagging attacks enable threat actors to access VLANs that they are not
authorized to access. In VLAN hopping attacks, a threat actor connects a host computer
to a switch and then attempts to negotiate the switchport to become trunk using DTP.
The threat actor computer attempts to act as another switch that is connected by a trunk.
Trunks carry traffic for all VLANs by default, so if a threat actor can connect a
computer over a trunked link, all VLAN traffic can be intercepted. In VLAN double-
tagging attacks, a threat actor adds a false VLAN tag to malicious traffic in addition to
the legitimate tag. This can allow a threat actor to send unauthorized traffic into other
VLANs. VLAN hopping and double-tagging attacks can be mitigated by disabling
trunking and trunk negotiation on all switchports that are to be accessed by users, and
by ensuring that the native VLAN is only used on trunk links. Private VLAN
promiscuous ports can be vulnerable to PVLAN proxy attacks in which a threat actor
can spoof the destination MAC address of the default gateway router. The router will
then permit the unauthorized traffic to enter the target VLANs. PVLAN proxy attacks
can be mitigated through the use of access control lists.
Mitigate DHCP Attacks
Two types of DHCP attacks are DHCP starvation and DHCP spoofing. Both attacks are
mitigated by implementing DHCP snooping. The goal of the DHCP starvation attack is
DoS for connecting clients. DHCP starvation attacks require an attack tool such as
Gobbler. A DHCP spoofing attack occurs when a rogue DHCP server is connected to
the network and provides false IP configuration parameters to legitimate clients. It is
easy to mitigate DHCP starvation attacks by using port security. DHCP spoofing attacks
can be mitigated using DHCP snooping on trusted ports. DHCP snooping also helps
mitigate DHCP starvation attacks by rate limiting the number of DHCP discovery
messages that an untrusted port can receive. DHCP snooping builds and maintains a
DHCP snooping binding database that the switch can use to filter DHCP messages from
untrusted sources. DHCP snooping is globally activated. Ports that are connected to
legitimate DHCP servers are then configured as trusted. In addition, untrusted ports can
be configured to rate limit DHCP requests.
Mitigate ARP Attacks
According to the ARP RFC, a client can send gratuitous ARP requests. When other
hosts on the subnet receive a gratuitous ARP request, the hosts store the MAC address
and IPv4 address contained in the gratuitous ARP in their ARP tables. An attacker can
send a gratuitous ARP message containing a spoofed MAC address to a switch, and the
switch would update its MAC table accordingly. Therefore, any host can claim to be the
owner of any IP and MAC address. In a typical attack, a threat actor can send
unsolicited ARP Replies to other hosts on the subnet with the MAC Address of the
threat actor and the IPv4 address of the default gateway. Address spoofing attacks occur
when threat actors craft packets that contain false IP or MAC addresses. MAC address
spoofing attacks occur when threat actors alter the MAC address of their host to match
another known MAC address of a target host. A spoofed MAC address can cause a
switch to send packets that are intended for another host to the threat actor PC. This can
be especially problematic when the spoofed MAC address is that of the default
gateway. DAI can mitigate ARP spoofing by ensuring that only valid ARP Requests
and Replies are sent into the network. DAI requires that DHCP snooping is globally
configured. DAI can be configured on trusted interfaces and VLANs.
Mitigate Address Spoofing Attacks
Spoofing attacks occur when one host poses as another to receive otherwise
inaccessible data, or to circumvent security configurations. MAC address spoofing
attacks occur when attackers alter the MAC address of their host to match another
known MAC address of a target host. When a switch receives the spoofed frames, it
switch overwrites the current MAC table entry and assigns the MAC address to the new
port. A threat actor computer can now receive traffic that was intended for the host with
the spoofed address. IP address spoofing is when a rogue PC hijacks a valid IP address
of a neighbor, or a uses a random IP address. IP address spoofing is difficult to mitigate,
especially when it is used inside a subnet in which the IP belongs. To protect against
MAC and IP address spoofing, configure IPSG. IPSG operates like DAI, but it looks at
every packet, not just the ARP packets. Like DAI, IPSG also requires that DHCP
snooping be enabled. For each untrusted port, a source IP address or source IP and
MAC address filter can be configured.
Spanning Tree protocol
STP is a loop-prevention network protocol that allows for redundancy while creating a
loop-free Layer 2 topology. Without STP enabled, Layer 2 loops can form, causing
broadcast, multicast and unknown unicast frames to loop endlessly. This can bring
down a network within a very short amount of time, sometimes in just a few seconds.
The spanning tree algorithm designates a single switch as the root bridge and uses it as
the reference point for path calculations. Spanning tree algorithm calculates the shortest
path to the root bridge and enables forwarding on trunks that form the best path.
Alternate ports are blocked. Designated ports are all non-root ports that spanning tree
permits to forward traffic. If a path become unavailable, spanning tree then enables the
alternate ports to forward traffic. Spanning tree uses bridge protocol data units to
communicate between switches in a spanning tree topology.
Mitigating STP Attacks
Threat actors can manipulate the STP to conduct an attack by spoofing the root bridge
and changing the topology of a network. Attackers can make their hosts appear as root
bridges; and therefore, capture all traffic for the immediate switched domain. Cisco
switches have a number of STP stability mechanisms such as PortFast, BPDU Guard,
Root Guard, and Loop Guard. PortFast enables access ports to go to spanning-tree
forwarding state without go through the transitional spanning-tree states. BPDU guard
immediately error disables a port that receives a BPDU. This is configured on non-
trunking ports that typically have PortFast enabled. Root Guard prevents an
inappropriate switch from becoming the root bridge. Loop guard prevents alternate or
root ports from becoming designated ports because of a failure that leads to a
unidirectional link.
MODULE 15
15.1 SECURE COMMUNICATIONS
15.1.1 AUTHENTICATION, INTEGRITY, AND CONFIDENTIALITY
To ensure secure communications across both the public and private infrastructure, the
network administrator’s first goal is to secure the network infrastructure, including
routers, switches, servers, and hosts.
This can be accomplished using device hardening, AAA access control, ACLs,
firewalls, monitoring threats using IPS, securing endpoints using Advanced Malware
Protection (AMP), and enforcing email and web security using the Cisco Email Security
Appliance (ESA) and Cisco Web Security Appliance (WSA).
The figure shows an example of a secure network topology.
The next goal is to secure the data as it travels across various links. This may include
internal traffic, but of greater concern is protecting the data that travels outside of the
organization to branch sites, telecommuter sites, and partner sites.
There are three primary objectives of securing communications:
o Authentication - This guarantees that the message is not a forgery and actually
comes from the authentic source. Modern networks ensure authentication using
hash message authentication code (HMAC).
o Integrity - This guarantees that no one intercepted the message and altered it;
similar to a checksum function in a frame. This is provided by implementing
the SHA-2 or SHA-3 family of hash-generating algorithms.
o Confidentiality - This guarantees that if the message is captured, it cannot be
deciphered. This is provided using symmetric or asymmetric encryption
algorithms.
Note: These primary objectives are similar but not identical to the three primary issues
in securing and maintaining a computer network which are confidentiality, integrity,
and availability.
The most popular symmetric encryption algorithm is the Advanced Encryption
Standard (AES). Symmetric encryption algorithms are based on the premise that each
communicating party knows the pre-shared key.
Data confidentiality can also be ensured using asymmetric algorithms, including Rivest,
Shamir, and Adleman (RSA) and the public key infrastructure (PKI). Asymmetric
encryption algorithms are based on the assumption that the two communicating parties
have not previously shared a secret and must establish a secure method to do so.
15.1.2 AUTHENTICATION
There are two primary methods for validating a source in network communications:
authentication services and data nonrepudiation services.
Authentication guarantees that a message comes from the source that it claims to come
from. Authentication is similar to entering a secure personal identification number
(PIN) for banking at an ATM, as shown in the figure. The PIN should only be known to
the user and the financial institution. The PIN is a shared secret that helps protect
against forgeries.
Data integrity ensures that messages are not altered in transit. With data integrity, the
receiver can verify that the received message is identical to the sent message and that no
manipulation occurred.
European nobility ensured the data integrity of documents by creating a wax seal to
close an envelope, as shown in the figure. The seal was often created using a signet
ring. These bore the family crest, initials, a portrait, or a personal symbol or motto of
the owner of the signet ring. An unbroken seal on an envelope guaranteed the integrity
of its contents. It also guaranteed authenticity based on the unique signet ring
impression.
Data confidentiality ensures privacy so that only the receiver can read the message. This
can be achieved through encryption. Encryption is the process of scrambling data so
that it cannot be easily read by unauthorized parties.
When enabling encryption, readable data is called plaintext, or cleartext, while the
encrypted version is called encrypted text or ciphertext. In this course, we will use the
term ciphertext. The plaintext readable message is converted to ciphertext, which is the
unreadable, disguised message. Decryption reverses the process. A key is required to
encrypt and decrypt a message. The key is the link between the plaintext and ciphertext.
Historically, various encryption algorithms and methods have been used. Julius Caesar
is said to have secured messages by putting two sets of the alphabet, side-by-side, and
then shifting one of them by a specific number of places. The number of places in the
shift serves as the key. He converted plaintext into ciphertext using this key, and only
his generals, who also had the key, knew how to decipher the messages. This method is
now known as the Caesar cipher. An encoded message using the Caesar cipher is shown
in the figure.
Encoded Caesar Cipher Message
Using a hash function is another way to ensure data confidentiality. A hash function
transforms a string of characters into a usually shorter, fixed-length value or key that
represents the original string. The difference between hashing and encryption is in how
the data is stored. With encrypted text, the data can be decrypted with a key. With the
hash function, after the data is entered and converted using the hash function, the
plaintext is gone. The hashed data is simply there for comparison. For example, when a
user enters a password, the password is hashed and then compared to the stored hashed
value. If the user forgets the password, it is impossible to decrypt the stored value, and
the password must be reset.
The purpose of encryption and hashing is to guarantee confidentiality so that only
authorized entities can read the message
15.2 CRYPTOGRAPHY
15.2.1 CREATING CIPHER TEXT
The Caesar Cipher is a type of substitution cipher in which each letter is replaced by
another letter that is a set number of places away in the alphabet. That number of places
is the key. In the figure, the key is 3.
Vigenère Cipher
In transposition ciphers, no letters are replaced; they are simply rearranged. An example
of this type of cipher is taking the FLANK EAST ATTACK AT DAWN message and
transposing it to read NWAD TA KCATTA TSAE KNALF. In this example, the key is
to reverse the letters.
Another example of a transposition cipher is known as the rail fence cipher. In this
transposition, the words are spelled out as if they were a rail fence. They are staggered,
some in front, some in the middle and some in back, across several parallel lines.
Modern encryption block cipher algorithms, such as AES and the legacy 3DES, still use
transposition as part of the algorithm.
The use of a simple transposition cipher is now discussed and displayed:
Plaintext Message
The plaintext message will be encoded using a key of 3. This key value specifies that
three lines are required when creating the encrypted code.
Encryption Process
Substitution ciphers substitute one letter for another. In their simplest form, substitution
ciphers retain the letter frequency of the original message.
The Caesar cipher was a simple substitution cipher.
Because the entire message relied on the same single key shift, the Caesar cipher is
referred to as a monoalphabetic substitution cipher. It is also fairly easy to crack. For
this reason, polyalphabetic ciphers, such as the Vigenère cipher, were invented. The
method was originally described by Giovan Battista Bellaso in 1553, but the scheme
was later misattributed to the French diplomat and cryptographer, Blaise de Vigenère.
A process involving a substitution cipher is now discussed and displayed:
Plaintext Message
Shift the top scroll over by the three characters (a key of 3) and A becomes D, B
becomes E, and so on. If the key used was 8, then A becomes I, B becomes J, and so on.
Then Encrypted Message
The Vigenère cipher is based on the Caesar cipher, except that it encrypts text by using
a different polyalphabetic key shift for every plaintext letter. The different key shift is
identified using a shared key between sender and receiver. The plaintext message can be
encrypted and decrypted using the Vigenère Cipher Table that is shown in the figure.
To illustrate how the Vigenère Cipher Table works, suppose that a sender and receiver
have a shared secret key composed of these letters: SECRETKEY. The sender uses this
secret key to encode the plaintext FLANK EAST ATTACK AT DAWN:
o The F (FLANK) is encoded by looking at the intersection of column F and the
row starting with S (SECRETKEY), resulting in the cipher letter X.
o The L (FLANK) is encoded by looking at the intersection of column L and the
row starting with E (SECRETKEY), resulting in the cipher letter P.
o The A (FLANK) is encoded by looking at the intersection of column A and the
row starting with C (SECRETKEY), resulting in the cipher letter C.
o The N (FLANK) is encoded by looking at the intersection of column N and the
row starting with R (SECRETKEY), resulting in the cipher letter E.
o The K (FLANK) is encoded by looking at the intersection of column K and the
row starting with E (SECRETKEY), resulting in the cipher letter O.
The process continues until the entire text message FLANK EAST ATTACK AT
DAWN is encrypted. The process can also be reversed. For instance, the F is still the
cipher letter X if encoded by looking at the intersection of row F (FLANK) and the
column starting with S (SECRETKEY).
When using the Vigenère cipher, if the message is longer than the key, the key is
repeated. For example, SECRETKEYSECRETKEYSEC is required to encode FLANK
EAST ATTACK AT DAWN:
o Secret key: SECRETKEYSECRETKEYSEC
o Plaintext: FLANKEASTATTACKATDAWN
o Cipher text: XPCEOXKURSXVRGDKXBSAP
Although the Vigenère cipher uses a longer key, it can still be cracked. For this reason,
a better cipher method was required.
Gilbert Vernam was an AT&T Bell Labs engineer who, in 1917, invented, and later
patented, the stream cipher. He also co-invented the one-time pad cipher. Vernam
proposed a teletype cipher in which a prepared key consisting of an arbitrarily long,
non-repeating sequence of numbers was kept on paper tape, shown in the figure. It was
then combined character by character with the plaintext message to produce the
ciphertext.
To decipher the ciphertext, the same paper tape key was again combined character by
character, producing the plaintext. Each tape was used only once; hence, the name one-
time pad. As long as the key tape does not repeat or is not reused, this type of cipher is
immune to cryptanalytic attack. This is because the available ciphertext does not display
the pattern of the key.
Several difficulties are inherent in using one-time pads in the real world. One difficulty
is the challenge of creating random data. Computers, because they have a mathematical
foundation, are incapable of creating true random data. Additionally, if the key is used
more than once, it is easy to break. RC4 is an example of this type of cipher that is
widely used on the internet. Again, because the key is generated by a computer, it is not
truly random. In addition to these issues, key distribution is also challenging with this
type of cipher.
15.3 CRYPTANALYSIS
15.3.1 CRACKING CODE
For as long as there has been cryptography, there has been cryptanalysis. Cryptanalysis
is the practice and study of determining the meaning of encrypted information (cracking
the code), without access to the shared secret key. This is also known as codebreaking.
Throughout history, there have been many instances of cryptanalysis:
The Vigenère cipher had been absolutely secure until it was broken in the 19th century
by English cryptographer Charles Babbage.
Mary, Queen of Scots, was plotting to overthrow Queen Elizabeth I from the throne and
sent encrypted messages to her co-conspirators. The cracking of the code used in this
plot led to the beheading of Mary in 1587.
The Enigma-encrypted communications were used by the Germans to navigate and
direct their U-boats in the Atlantic. Polish and British cryptanalysts broke the German
Enigma code.
o Brute-force method - The attacker tries every possible key knowing that
eventually one of them will work.
o Ciphertext method - The attacker has the ciphertext of several encrypted
messages but no knowledge of the underlying plaintext.
o Known-Plaintext method - The attacker has access to the ciphertext of several
messages and knows something about the plaintext underlying that ciphertext.
o Chosen-Plaintext method - The attacker chooses which data the encryption
device encrypts and observes the ciphertext output.
o Chosen-Ciphertext method - The attacker can choose different ciphertext to
be decrypted and has access to the decrypted plaintext.
o Meet-in-the-Middle method - The attacker knows a portion of the plaintext
and the corresponding ciphertext.
Note: Details of how these methods are implemented is beyond the scope of this course.
The simplest method to understand is the brute-force method. For example, if a thief
attempted to steal a bicycle secured with the combination lock displayed in the figure,
they would have to attempt a maximum of 10,000 different possibilities (0000 to 9999).
All encryption algorithms are vulnerable to this attack. On average, a brute-force attack
succeeds about 50 percent of the way through the keyspace, which is the set of all
possible keys.
The objective of modern cryptographers is to have a keyspace large enough that it takes
too much time and money to accomplish a brute-force attack.
15.4 CRYPTOLOGY
15.4.1 MAKING AND BREAKING SECRET CODES
Cryptology is the science of making and breaking secret codes. As shown in the figure,
cryptology combines two separate disciplines:
o Cryptography - the development and use of codes
o Cryptanalysis - the breaking of those codes
There is a symbiotic relationship between the two disciplines because each makes the
other one stronger. National security organizations employ practitioners of both
disciplines and put them to work against each other.
There have been times when one of the disciplines has been ahead of the other. For
example, during the Hundred Years War between France and England, the cryptanalysts
were leading the cryptographers. France mistakenly believed that the Vigenère cipher
was unbreakable, and then the British cracked it. Some historians believe that the
successful cracking of encrypted codes and messages had a major impact on the
outcome of World War II. Currently, it is believed that cryptographers are in the lead.
15.4.2 CRYPTANALYSTS
Cryptanalysis is often used by governments in military and diplomatic surveillance, by
enterprises in testing the strength of security procedures, and by malicious hackers in
exploiting weaknesses in websites.
Cryptanalysts are individuals who perform cryptanalysis to crack secret codes. A
sample job description is displayed in the figure.
While cryptanalysis is often linked to mischievous purposes, it is actually a necessity. It
is an ironic fact of cryptography that it is impossible to prove that any algorithm is
secure. It can only be proven that it is not vulnerable to known cryptanalytic attacks.
Therefore, there is a need for mathematicians, scholars, and security forensic experts to
keep trying to break the encryption methods.
Old encryption algorithms, such as the Caesar cipher or the Enigma machine, were
based on the secrecy of the algorithm to achieve confidentiality. With modern
technology, where reverse engineering is often simple, public-domain algorithms are
frequently used. With most modern algorithms, successful decryption requires
knowledge of the appropriate cryptographic keys. This means that the security of
encryption lies in the secrecy of the keys, not the algorithm.
Cryptology
Cryptology is the science of making and breaking secret codes. It combines
cryptography and cryptanalysis. In the world of communications and networking,
authentication, integrity, and data confidentiality are implemented in many ways using
various protocols and algorithms. The choice of algorithm varies depending on the
security requirements, the hardware resources that are available for encryption and
decryption, and the acceptance of the algorithm in the security community. Public-
domain algorithms are frequently used. With most modern algorithms, successful
decryption requires knowledge of the appropriate cryptographic keys. This means that
the security of encryption lies in the secrecy of the keys, not the algorithm.
MODULE 16
16.1 INTEGRITY AND AUTHENTICITY
16.1.1 SECURE COMMUNICATIONS
Organizations must provide support to secure data as it travels across links. This may
include internal traffic, but it is even more important to protect data that travels outside
of the organization to branch sites, telecommuter sites, and partner sites.
These are the four elements of secure communications:
o Data Integrity - Guarantees that the message was not altered. Any changes to
data in transit will be detected. Integrity is ensured by implementing either of
the Secure Hash Algorithms (SHA-2 or SHA-3). The MD5 message digest
algorithm is still widely in use. However, it is inherently insecure and creates
vulnerabilities in a network. Note that MD5 should be avoided.
o Origin Authentication - Guarantees that the message is not a forgery and does
actually come from whom it states. Many modern networks ensure
authentication with algorithms such as hash-based message authentication code
(HMAC).
o Data Confidentiality - Guarantees that only authorized users can read the
message. If the message is intercepted, it cannot be deciphered within a
reasonable amount of time. Data confidentiality is implemented using
symmetric and asymmetric encryption algorithms.
o Data Non-Repudiation - Guarantees that the sender cannot repudiate, or
refute, the validity of a message sent. Nonrepudiation relies on the fact that only
the sender has the unique characteristics or signature for how that message is
treated.
Cryptography can be used almost anywhere that there is data communication. In fact,
the trend is toward all communication being encrypted.
Hashes are used to verify and ensure data integrity. They are also used to verify
authentication. Hashing is based on a one-way mathematical function that is relatively
easy to compute, but significantly harder to reverse.
Grinding coffee is a good analogy of a one-way function. It is easy to grind coffee
beans, but it is almost impossible to put all of the tiny pieces back together to rebuild
the original beans.
As shown in the figure, a hash function takes a variable block of binary data, called the
message, and produces a fixed-length, condensed representation, called the hash. The
resulting hash is also sometimes called the message digest, digest, or digital fingerprint.
With hash functions, it is computationally infeasible for two different sets of data to
come up with the same hash output. Furthermore, the hash value changes every time the
data is changed or altered. Because of this, cryptographic hash values are often called
“digital fingerprints”. These fingerprints can be used to detect duplicate data files, file
version changes, and similar applications. These values are used to guard against an
accidental or intentional change to the data, or accidental data corruption.
The cryptographic hash function is applied in many different situations for entity
authentication, data integrity, and data authenticity purposes.
Mathematically, the equation h= H(x) is used to explain how a hash algorithm operates.
As shown in the figure, a hash function H takes an input x and returns a fixed-size
string hash value h.
The example in the figure summarizes the mathematical process. A cryptographic hash
function should have the following properties:
o The input can be any length.
o The output is always a fixed length.
o H(x) is relatively easy to compute for any given x.
o H(x) is one way and not reversible.
o H(x) is collision free, meaning that two different input values will result in
different hash values.
If a hash function is hard to invert, it is considered a one-way hash. Hard to invert
means that given a hash value of h, it is computationally infeasible to find an input
for x such that h=H(x).
Hash functions are used to ensure the integrity of a message. They help ensure data has
not accidentally changed and that what was sent is indeed what was received.
Note: Deliberate changes can be made by a threat actor.
In the figure, the sender is sending a $100 money transfer to Alex. The sender wants to
ensure that the message is not accidentally altered on its way to the receiver.
As shown in the figure, an HMAC is calculated using any cryptographic algorithm that
combines a cryptographic hash function with a secret key. Hash functions are the basis
of the protection mechanism of HMACs.
Only the sender and the receiver know the secret key, and the output of the hash
function now depends on the input data and the secret key. Only parties who have
access to that secret key can compute the digest of an HMAC function. This defeats
man-in-the-middle attacks and provides authentication of the data origin.
If two parties share a secret key and use HMAC functions for authentication, a properly
constructed HMAC digest of a message that a party has received indicates that the other
party was the originator of the message. This is because the other party possesses the
secret key.
Creating the HMAC Value
As shown in the figure, the sending device inputs data (such as Terry Smith’s pay of
$100 and the secret key) into the hashing algorithm and calculates the fixed-length
HMAC digest. This authenticated digest is then attached to the message and sent to the
receiver.
Verifying the HMAC Value
In the figure, the receiving device removes the digest from the message and uses the
plaintext message with its secret key as input into the same hashing function. If the
digest that is calculated by the receiving device is equal to the digest that was sent, the
message has not been altered. Additionally, the origin of the message is authenticated
because only the sender possesses a copy of the shared secret key. The HMAC function
has ensured the authenticity of the message.
Cisco Router HMAC Example
The figure shows how HMACs are used by Cisco routers that are configured to use
Open Shortest Path First (OSPF) routing authentication.
R1 is sending a link state update (LSU) regarding a route to network 10.2.0.0/16:
1. R1 calculates the hash value using the LSU message and the secret key.
2. The resulting hash value is sent with the LSU to R2.
3. R2 calculates the hash value using the LSU and its secret key. R2
accepts the update if the hash values match. If they do not match, R2
discards the update.
Characteristic Description
Key Generation It was up to Caesar to choose the key of his
cipher. The Vigenère cipher key is also
chosen by the sender and receiver. In a
modern cryptographic system, key generation
is usually automated and not left to the end
user. The use of good random number
generators is needed to ensure that all keys
are equally generated so that the attacker
cannot predict which keys are more likely to
be used.
Key Verification Some keys are better than others. Almost all
cryptographic algorithms have some weak
keys that should not be used. With the help
of key verification procedures, weak keys
can be identified and regenerated to provide a
more secure encryption. With the Caesar
cipher, using a key of 0 or 25 does not
encrypt the message, so it should not be used.
Key Exchange Key management procedures should provide
a secure key exchange mechanism that
allows secure agreement on the keying
material with the other party, probably over
an untrusted medium.
Key Storage On a modern multi-user operating system
that uses cryptography, a key can be stored in
memory. This presents a possible problem
when that memory is swapped to the disk,
because a Trojan horse program installed on
the PC of a user could then have access to the
private keys of that user.
Key Lifetime Using short key lifetimes improves the
security of legacy ciphers that are used on
high-speed connections. In IPsec a 24-hour
lifetime is typical. However, changing the
lifetime to 30 minutes improves the security
of the algorithms.
Key Revocation and Destruction Revocation notifies all interested parties that
a certain key has been compromised and
should no longer be used. Destruction erases
old keys in a manner that prevents malicious
attackers from recovering them.
Characteristic Description
Algorithm Full Name Advanced Encryption Standard
Timeline Official standard since 2001
Type of Algorithm Symmetric
Key Size (in bits) 128, 192, and 256
Speed High
Time to Crack
(assuming a computer could try 255 149 trillion years
keys per second)
Resource Consumption Low
The keyspace of an algorithm is the set of all possible key values. A key that has n bits
produces a keyspace that has 2n possible key values. By adding one bit to the key, the
keyspace is effectively doubled.
As shown in the table, DES with its 56-bit keys has a keyspace of more than
72,000,000,000,000,000 (256) possible keys. By adding one bit to the key length, the
keyspace doubles, and an attacker needs twice the amount of time to search the
keyspace. Adding an additional bit to a 57-bit key size means that it would now take an
attacker four times the amount of time to search the keyspace. Adding 4 more bits to
56-bits would create a 60-bit key. A 60-bit key would take 16 times longer to crack than
a 56-bit key.
DES Key Keyspace Approximate Number of
Possible Keys
56-bit 256 ~72,000,000,000,000,000
11111111 11111111 11111111
11111111 11111111 11111111 11111111
Note: Longer keys are more secure; however, they are also more resource intensive.
Caution should be exercised when choosing longer keys because handling them could
add a significant load to the processor in lower-end products.
Almost every algorithm has some weak keys in its keyspace that enable an attacker to
break the encryption via a shortcut. Weak keys show the regularities in encryption. For
instance, DES has four keys for which encryption is the same as decryption. This means
that if one of these weak keys is used to encrypt plaintext, an attacker can use the weak
key to decrypt the ciphertext and reveal the plaintext.
The DES weak keys are those that produce 16 identical subkeys. This occurs when the
key bits are:
o Alternating ones and zeros (0101010101010101)
o Alternating F and E (FEFEFEFEFEFEFEFE)
o E0E0E0E0F1F1F1F1
o 1F1F1F1F0E0E0E0E
It is very unlikely that such keys would be chosen, but network administrators should
still verify all keys that are implemented and prevent weak keys from being used. With
manual key generation, take special care to avoid defining weak keys.
Note: DES is a legacy encryption algorithm and should not be used. It is used here to
illustrate the concept of keyspace only.
16.2.4 TYPES OF CRYPTOGRAPHIC KEYS
On average, an attacker has to search through half of the keyspace before the correct
key is found. The time that is needed to accomplish this search depends on the
computer power that is available to the attacker.
Current key lengths can easily make any attempt insignificant because it takes millions
or billions of years to complete the search when a sufficiently long key is used.
With modern algorithms that are trusted, the strength of protection depends solely on
the size of the key. Choose the key length so that it protects data confidentiality or
integrity for an adequate period of time. Data that is more sensitive and needs to be kept
secret longer must use longer keys.
Performance is another issue that can influence the choice of a key length. An
administrator must find a good balance between the speed and protective strength of an
algorithm, because some algorithms, such as the Rivest, Shamir, and Adleman (RSA)
algorithm, run slowly due to large key lengths. Strive for adequate protection, while
enabling communication over untrusted networks.
The estimated funding of the attacker should also affect the choice of key length. When
assessing the risk of someone breaking the encryption algorithm, estimate the resources
of the attacker and how long the data must be protected. For example, classic DES can
be broken by a $1 million machine in a couple of minutes. If the data that is being
protected is worth significantly more than the $1 million dollars needed to acquire a
cracking device, then another algorithm should be used. In fact, DES is now considered
too weak to use for any application.
Because of the rapid advances in technology and cryptanalytic methods, the key length
that is needed for a particular application is constantly increasing. Part of the strength of
the RSA algorithm is the difficulty of factoring large numbers. For example, the factors
of 12 would be 1 x 12, 2 x 6, and 3 x 4. Therefore, a 1024-bit number is a very large
number with many factors. Increasing that number to a 2048-bit number creates even
more factors. Of course, this advantage is lost if an easy way to factor large numbers is
found, but cryptographers consider this possibility unlikely.
The rule “the longer the key, the better” is valid, except for possible performance
reasons. Shorter keys equal faster processing, but are less secure. Longer keys equal
slower processing, but are more secure.
16.3 CONFIDENTIALITY
16.3.1 DATA CONFIDENTIALITY
Asymmetric and symmetric encryption are the two classes of encryption used to
provide data confidentiality. These two classes differ in how they use keys.
Symmetric encryption algorithms such as Data Encryption Standard (DES), 3DES, and
Advanced Encryption Standard (AES) are based on the premise that each
communicating party knows the pre-shared key. Data confidentiality can also be
ensured using asymmetric algorithms, including Rivest, Shamir, and Adleman (RSA)
and the public key infrastructure (PKI).
Note: DES is a legacy algorithm and should not be used. 3DES should be avoided if
possible.
The figure highlights some differences between symmetric and asymmetric encryption.
Symmetric algorithms use the same pre-shared key to encrypt and decrypt data. A pre-
shared key, also called a secret key, is known by the sender and receiver before any
encrypted communications can take place.
To help illustrate how symmetric encryption works, consider an example where Alice
and Bob live in different locations and want to exchange secret messages with one
another through the mail system. In this example, Alice wants to send a secret message
to Bob.
In the figure, Alice and Bob have identical keys to a single padlock. These keys were
exchanged prior to sending any secret messages. Alice writes a secret message and puts
it in a small box that she locks using the padlock with her key. She mails the box to
Bob. The message is safely locked inside the box as the box makes its way through the
post office system. When Bob receives the box, he uses his key to unlock the padlock
and retrieve the message. Bob can use the same box and padlock to send a secret reply
back to Alice.
Today, symmetric encryption algorithms are commonly used with VPN traffic. This is
because symmetric algorithms use less CPU resources than asymmetric encryption
algorithms. This allows the encryption and decryption of data to be fast when using a
VPN. When using symmetric encryption algorithms, like any other type of encryption,
the longer the key, the longer it will take for someone to discover the key. Most
encryption keys are between 112 and 256 bits. To ensure that the encryption is safe, a
minimum key length of 128 bits should be used. Use a longer key for more secure
communications.
Symmetric encryption algorithms are sometimes classified as either a block cipher or a
stream cipher. Click the buttons to learn about these two cipher modes.
Block Ciphers
Stream Ciphers
Stream ciphers encrypt plaintext one byte or one bit at a time. Stream ciphers are
basically a block cipher with a block size of one byte or bit. Stream ciphers are typically
faster than block ciphers because data is continuously encrypted. Examples of stream
ciphers include RC4 and A5 which is used to encrypt GSM cell phone communications.
Now back to the rest
Asymmetric algorithms, also called public-key algorithms, are designed so that the key
that is used for encryption is different from the key that is used for decryption, as shown
in the figure. The decryption key cannot, in any reasonable amount of time, be
calculated from the encryption key and vice versa.
Asymmetric algorithms use a public key and a private key. Both keys are capable of the
encryption process, but the complementary paired key is required for decryption. The
process is also reversible. Data that is encrypted with the public key requires the private
key to decrypt. Asymmetric algorithms achieve confidentiality and authenticity by
using this process.
Because neither party has a shared secret, very long key lengths must be used.
Asymmetric encryption can use key lengths between 512 to 4,096 bits. Key lengths
greater than or equal to 2,048 bits can be trusted, while key lengths of 1,024 or shorter
are considered insufficient.
Examples of protocols that use asymmetric key algorithms include:
o Internet Key Exchange (IKE) - This is a fundamental component of IPsec
VPNs.
o Secure Socket Layer (SSL) - This is now implemented as IETF standard
Transport Layer Security (TLS).
o Secure Shell (SSH) - This protocol provides a secure remote access connection
to network devices.
o Pretty Good Privacy (PGP) - This computer program provides cryptographic
privacy and authentication. It is often used to increase the security of email
communications.
Asymmetric algorithms are substantially slower than symmetric algorithms. Their
design is based on computational problems, such as factoring extremely large numbers
or computing discrete logarithms of extremely large numbers.
Because they are slow, asymmetric algorithms are typically used in low-volume
cryptographic mechanisms, such as digital signatures and key exchange. However, the
key management of asymmetric algorithms tends to be simpler than symmetric
algorithms, because usually one of the two encryption or decryption keys can be made
public.
Common examples of asymmetric encryption algorithms are described in the table.
Asymmetric
Key Length Description
Encryption Algorithm
Alice uses Bob’s public key to encrypt a message using an agreed-upon algorithm.
Alice sends the encrypted message to Bob.
Bob decrypts message with private key
Bob then uses his private key to decrypt the message. Since Bob is the only one with
the private key, Alice's message can only be decrypted by Bob and thus confidentiality
is achieved.
Alice encrypts a message using her private key. Alice sends the encrypted message to
Bob. Bob needs to authenticate that the message did indeed come from Alice.
Bob requests the public key
Alice wants to send a message to Bob ensuring that only Bob can read the document. In
other words, Alice wants to ensure message confidentiality. Alice uses the public key of
Bob to cipher the message. Only Bob will be able to decipher it using his private key.
Alice encrypts a hash using her private key
Alice also wants to ensure message authentication and integrity. Authentication ensures
Bob that the document was sent by Alice, and integrity ensures that it was not modified
Alice uses her private key to cipher a hash of the message. Alice sends the encrypted
message with its encrypted hash to Bob.
Bob uses Alice’s public key to decrypt the hash
Bob uses Alice’s public key to verify that the message was not modified. The received
hash is equal to the locally determined hash based on Alice’s public key. Additionally,
this verifies that Alice is definitely the sender of the message because nobody else has
Alice’s private key.
Bob uses his private key to decrypt the message
16.3.7 DIFFIE-HELLMAN
These are the four elements of secure communications: data integrity, origin
authentication, data confidentiality, and data non-repudiation. Cryptography can be
used almost anywhere that there is data communication. Hashes are used to verify and
ensure data integrity. Hashing is based on a one-way mathematical function that is
relatively easy to compute, but significantly harder to reverse. The cryptographic
hashing function can also be used to verify authentication. A hash function takes a
variable block of binary data, called the message, and produces a fixed-length,
condensed representation, called the hash. The resulting hash is also sometimes called
the message digest, digest, or digital fingerprint. Mathematically, the equation h=
H(x) is used to explain how a hash algorithm operates. A hash function H takes an
input x and returns a fixed-size string hash value h. A cryptographic hash function
should have the following properties:
o The input can be any length.
The output has a fixed length.
H(x) is relatively easy to compute for any given x.
H(x) is one way and not reversible.
H(x) is collision free, meaning that two different input values will result in
different hash values.
The four well-known hash functions are MD5 with 128 bit digest, SHA-1, SHA-2, and
SHA-3. While hashing can be used to detect accidental changes, it cannot be used to
guard against deliberate changes that are made by a threat actor in a man-in-the-middle
attack. Origin authentication is also required to provide protection.
To add origin authentication and integrity assurance, use a keyed-hash message
authentication code (HMAC). HMAC uses an additional secret key as input to the hash
function. Other Message Authentication Code (MAC) methods are also used. However,
HMAC is used in many systems including SSL, IPsec, and SSH.
Key Management
There are two classes of encryption used to provide data confidentiality: asymmetric
and symmetric. These two classes differ in how they use keys.
Symmetric encryption algorithms such as Data Encryption Standard (DES), 3DES, and
Advanced Encryption Standard (AES) are based on the premise that each
communicating party knows the pre-shared key. Data confidentiality can also be
ensured using asymmetric algorithms, including Rivest, Shamir, and Adleman (RSA)
and the public key infrastructure (PKI).
Symmetric algorithms use the same pre-shared key to encrypt and decrypt data. A pre-
shared key, also called a secret key, is known by the sender and receiver before any
encrypted communications can take place. Symmetric encryption algorithms are
commonly used with VPN traffic because symmetric algorithms use less CPU resources
than asymmetric encryption algorithms. To ensure that the encryption is safe, a
minimum key length of 128 bits should be used. Use a longer key for more secure
communications.
Symmetric encryption algorithms are sometimes classified as either a block cipher or a
stream cipher.
o Block ciphers transform a fixed-length block of plaintext into a common block
of ciphertext of 64 or 128 bits.
o Stream ciphers encrypt plaintext one byte or one bit at a time. Stream ciphers
are basically a block cipher with a block size of one byte or bit. Stream ciphers
are typically faster than block ciphers because data is continuously encrypted.
Asymmetric algorithms, also called public-key algorithms, are designed so that the key
that is used for encryption is different from the key that is used for decryption.
Asymmetric encryption can use key lengths between 512 to 4,096 bits. Key lengths
greater than or equal to 2,048 bits can be trusted, while key lengths of 1,024 or shorter
are considered insufficient. Examples of protocols that use asymmetric key algorithms
include Internet Key Exchange (IKE), Secure Socket Layer (SSL), Secure Shell (SSH),
and Pretty Good Privacy (PGP). The process can be summarized using the formula:
Private Key (Encrypt) + Public Key (Decrypt) = Authentication. Diffie-Hellman (DH)
is an asymmetric mathematical algorithm that allows two computers to generate an
identical shared secret without having communicated before. The new shared key is
never actually exchanged between the sender and receiver. DH is commonly used when
data is exchanged using an IPsec VPN and SSH data is exchanged.
MODULE 11
11.1 IDS AND IPS CHARACTERISTICS
11.1.1 ZERO-DAY ATTACKS
Malware can spread across the world in a matter of minutes. A network must instantly
recognize and mitigate malware threats. Firewalls can only do so much and cannot
provide protection against all malware and zero-day attacks.
A zero-day attack, sometimes referred to as a zero-day threat, is a cyberattack that tries
to exploit software vulnerabilities that are unknown or undisclosed by the software
vendor, as shown in the figure. The term zero-day describes the moment when a
previously unknown threat is identified.
During the time it takes the software vendor to develop and release a patch, the network
is vulnerable to these exploits, as shown in the figure. Defending against these fast-
moving attacks requires network security professionals to adopt a more sophisticated
view of the network architecture. It is no longer possible to contain intrusions at a few
points in the network.
Microsoft Internet Explorer Zero-Day Vulnerability
Intrusion Detection Systems (IDS) were implemented to passively monitor the traffic on
a network. The figure shows that an IDS-enabled device copies the traffic stream and
analyses the copied traffic rather than the actual forwarded packets.
Working offline, the IDS compares the captured traffic stream with known malicious
signatures, similar to software that checks for viruses. Working offline means several
things:
o The IDS works passively.
o The IDS device is physically positioned in the network so that traffic must be
mirrored in order to reach it.
o Network traffic does not pass through the IDS unless it is mirrored.
o Very little latency is added to network traffic flow.
Although the traffic is monitored, logged, and perhaps reported, no action is taken on
packets by the IDS. This offline IDS implementation is referred to as promiscuous
mode.
The advantage of operating with a copy of the traffic is that the IDS does not negatively
affect the packet flow of the forwarded traffic. The disadvantage of operating on a copy
of the traffic is that the IDS cannot stop malicious single-packet attacks from reaching
the target. An IDS often requires assistance from other networking devices, such as
routers and firewalls, to respond to an attack.
A better solution is to use a device that can immediately detect and stop an attack. An
Intrusion Prevention System (IPS) performs this function.
11.1.3 INTRUSION PREVENTION AND DETECTION DEVICES
IDS and IPS technologies are both deployed as sensors. An IDS or IPS sensor can be in
the form of several different devices:
o A router configured with IPS software
o A device specifically designed to provide dedicated IDS or IPS services
o A hardware module installed in an adaptive security appliance (ASA), switch,
or router
IDS and IPS technologies use signatures to detect patterns in network traffic. A
signature is a set of rules that an IDS or IPS uses to detect malicious activity. Signatures
can be used to detect severe breaches of security, to detect common network attacks,
and to gather information. IDS and IPS technologies can detect atomic signature
patterns (single-packet) or composite signature patterns (multi-packet).
11.1.4 ADVANTAGES AND DISADVANTAGES OF IDS AND IPS
The table summarizes the advantages and disadvantages of IDS and IPS:
Advantages:
o An IPS sensor can be configured to drop the trigger packets, the packets
associated with a connection, or packets from a source IP address.
o Because IPS sensors are inline, they can use stream normalization. Stream
normalization is a technique used to reconstruct the data stream when the attack
occurs over multiple data segments.
Disadvantages:
o Because it is deployed inline, errors, failure, and overwhelming the IPS sensor
with too much traffic can have a negative effect on network performance.
o An IPS sensor can affect network performance by introducing latency and jitter.
o An IPS sensor must be appropriately sized and implemented so that time-
sensitive applications, such as VoIP, are not adversely affected.
Deployment Considerations
You can deploy both an IPS and an IDS. Using one of these technologies does not
negate the use of the other. In fact, IDS and IPS technologies can complement each
other.
For example, an IDS can be implemented to validate IPS operation because the IDS can
be configured for deeper packet inspection offline. This allows the IPS to focus on
fewer but more critical traffic patterns inline.
Deciding which implementation to use is based on the security goals of the organization
as stated in their network security policy.
There are two primary kinds of IPS available: host-based IPS and network-based IPS
Host-based IPS
Host-based IPS (HIPS) is software installed on a host to monitor and analyze suspicious
activity.
A significant advantage of HIPS is that it can monitor and protect operating system and
critical system processes that are specific to that host.
With detailed knowledge of the operating system, HIPS can monitor abnormal activity
and prevent the host from executing commands that do not match typical behavior. This
suspicious or malicious behavior might include unauthorized registry updates, changes
to the system directory, executing installation programs, and activities that cause buffer
overflows. Network traffic can also be monitored to prevent the host from participating
in a denial-of-service (DoS) attack or being part of an illicit FTP session.
HIPS can be thought of as a combination of antivirus software, antimalware software,
and a firewall. An example of a HIPS is Windows Defender. It provides a range of
protection measures for Windows hosts. Combined with a network-based IPS, HIPS is
an effective tool in providing additional protection for the host.
A disadvantage of HIPS is that it operates only at a local level. It does not have a
complete view of the network, or coordinated events that might be happening across the
network. To be effective in a network, HIPS must be installed on every host and have
support for every operating system. The table lists the advantages and disadvantages of
HIPS.
Advantages Disadvantages
Provides protection specific to a
host operating system
Provides operating system and Operating system dependent
application level protection Must be installed on all hosts
Protects the host after the
message is decrypted
Network-based IPS
IDS and IPS sensors can operate in inline mode (also known as inline interface pair
mode) or promiscuous mode (also known as passive mode).
As shown in the figure, packets do not flow through the sensor in promiscuous mode.
The sensor analyses a copy of the monitored traffic, not the actual forwarded packet.
The advantage of operating in promiscuous mode is that the sensor does not affect the
packet flow with the forwarded traffic.
The disadvantage of operating in promiscuous mode is that the sensor cannot stop
malicious traffic from reaching its intended target for certain types of attacks, such as
atomic attacks (single-packet attacks).
The response actions implemented by promiscuous sensor devices are post-event
responses and often require assistance from other networking devices (for example,
routers and firewalls) to respond to an attack.
Such response actions can prevent some classes of attacks. However, in atomic attacks
the single packet has the chance of reaching the target system before the promiscuous-
based sensor can apply an ACL modification on a managed device (such as a firewall,
switch, or router). In the figure, Switched Port Analyzer (SPAN) is used to mirror the
traffic entering, going to, and coming from the host.
Promiscuous Mode
As shown in the figure below, operating in inline mode puts the IPS directly into the
traffic flow and makes packet-forwarding rates slower by adding latency. Inline mode
allows the sensor to stop attacks by dropping malicious traffic before it reaches the
intended target, thus providing a protective service.
Not only is the inline device processing information on Layers 3 and 4, but it is also
analysing the contents and payload of the packets for more sophisticated embedded
attacks (Layers 3 to 7).
This deeper analysis lets the system identify and stop or block attacks that would pass
through a traditional firewall device. An IDS sensor could also be deployed inline. The
IDS would be configured so that it only sends alerts and does not drop any packets.
Inline Mode
Many of the devices that supported Cisco IOS IPS are no longer available, or no longer
supported. The newer Cisco 4000 Series Integrated Services Routers (ISR) no longer
support IOS IPS. Instead, they provide IPS services using the Snort IPS feature. Snort
IPS complements existing network security features of the 4000 Series without the need
to deploy a second appliance at branch locations.
Snort is the most widely deployed IPS solution in the world. It is an open source
network IPS that performs real-time traffic analysis and generates alerts when threats
are detected on IP networks. It can also perform protocol analysis, content searching or
matching, and detect a variety of attacks and probes, such as buffer overflows, stealth
port scans, and so on.
The Snort engine runs in a virtual service container on Cisco 4000 Series ISRs. A
virtual service container is a virtual machine that runs on the ISR router operating
system. Service containers are applications that can be hosted directly on Cisco IOS XE
routing platforms. These apps use the Linux aspects of the IOS XE operating system to
host both Linux Virtual Containers (LXC) and Kernel virtual machines (KVM). The
Snort container is distributed as an Open Virtualization Appliance (OVA) file that is
installed on the router.
Unlike IOS IPS, Snort IPS can use the computer power of the service container to scale
security with the platform without affecting routing capabilities or other data plane
functionality. The virtual service supports three resource profiles that indicate how the
Snort container uses system CPU, RAM, and Flash or disk resources.
Snort IPS
Snort IPS signatures are delivered automatically to the ISR by Cisco Talos. There are
currently more than 30,000 signatures in the Snort rule set. It also supports the ability to
customize rule sets and provides centralized deployment and management capabilities
for 4000 Series ISRs.
Snort can be enabled in either of the following modes:
o IDS mode - Snort inspects the traffic and reports alerts, but does not take any
action to prevent attacks.
o IPS mode - In addition to intrusion detection, actions are taken to prevent
attacks.
In the network intrusion detection and prevention mode, Snort performs the following
actions:
o Monitors network traffic and analyses against a defined rule set.
o Performs attack classification.
o Invokes actions against matched rules.
The Snort IPS monitors the traffic and reports events to an external log server or the
IOS syslog. Enabling logging to the IOS syslog may impact performance due to the
potential volume of log messages. External third-party monitoring tools that support
Snort logs can be used for log collection and analysis.
11.3.5 SNORT FEATURES
Feature Benefit
Signature-based intrusion Snort open-source IPS, capable of performing real-time
detection system (IDS) and traffic analysis and packet logging on IP networks, runs on
intrusion prevention system the 4000 Series ISR service container without the need to
(IPS) deploy an additional device at the branch.
Snort rule set updates for 4000 Series ISRs are generated
by Cisco Talos, a group of leading-edge network security
Snort rule set updates experts who work around the clock to proactively discover,
assess, and respond to the latest trends in hacking
activities, intrusion attempts, malware, and vulnerabilities.
The router will be able to download rule sets directly from
Snort rule set pull cisco.com or snort.org to a local server, using one-time
commands or periodic automated updates.
A centralized management tool can push the rule sets
Snort rule set push based on preconfigured policy, instead of the router directly
downloading on its own.
Allowed listing allows the disabling of certain signatures
Signature allowed listing from the rule set. Disabled signatures can be reenabled at
any time.
To run the service container infrastructure with IDS/IPS functionality, Snort IPS
requires an ISR 4000 (i.e., 4300 or higher) with a minimum of 8 GB of memory
(DRAM) and 8 GB of flash.
Note: The Cisco 4200 series ISR does not support the default Snort IPS
implementation.
A security K9 license (SEC) is required to activate Snort IPS functionality. Customers
also need to purchase a yearly subscription for the signature package distributed on
cisco.com. To keep current with the latest threat protection, Snort rule sets are term-
based subscriptions, available for one or three years.
There are two types of term-based subscriptions:
o Community Rule Set - This set offers limited coverage against threats,
focusing on reactive response to security threats versus proactive research
work. There is 30-day delayed access to updated signatures in the Community
Rule Set, and this subscription does not entitle the customer to Cisco support.
o Subscriber Rule Set - This set offers the best protection against threats. It
includes coverage in advance of exploits by using the research work of the
Cisco Talos security experts. The Subscriber Rule Set also provides the fastest
access to updated signatures in response to a security incident or the proactive
discovery of a new threat. This subscription is fully supported by Cisco.
PulledPork is a rule management application that can be used to automatically
download Snort rule updates. In order to use PulledPork, you must obtain an
authorization code, called an oinkcode, from your snort.org account. The oinkcode is
free with registration.
Notice how the tap simultaneously sends both the transmit (TX) data stream from the
internal router and the receive (RX) data stream to the internal router on separate,
dedicated channels. This ensures that all data arrives at the monitoring device in real
time. Therefore, network performance is not affected or degraded by monitoring the
connection.
Taps are also typically fail-safe, which means if a tap fails or loses power, traffic
between the firewall and internal router is not affected.
Search the internet for information on NetScout Taps for copper UTP Ethernet, fiber
Ethernet, and serial links.
11.4.3 TRAFFIC MIRRORING AND SPAN
Network switches segment the network by design. This limits the amount of traffic that
is visible to network monitoring devices.
Because capturing data for network monitoring requires all traffic to be captured,
special techniques must be employed to bypass the network segmentation imposed by
network switches.
Port mirroring is one of these techniques. Supported by many enterprise switches, port
mirroring enables the switch to copy frames that are received on one or more ports to a
Switch Port Analyzer (SPAN) port that is connected to an analysis device.
The table identifies and describes terms used by the SPAN feature:
The figure shows a switch that interconnects two hosts and mirrors traffic to an
intrusion detection device (IDS) and network management server.
SPAN
The switch will forward ingress traffic on F0/1 and egress traffic on F0/2 to the
destination SPAN port G0/1 that connects to an IDS.
The association between source ports and a destination port is called a SPAN session. In
a single session, one or multiple ports can be monitored. On some Cisco switches,
session traffic can be copied to more than one destination port. Alternatively, a source
VLAN can be specified in which all ports in the source VLAN become sources of
SPAN traffic. Each SPAN session can have ports or VLANs as sources, but not both.
Note: A variation of SPAN called Remote SPAN (RSPAN) enables a network
administrator to use the flexibility of VLANs to monitor traffic on remote switches.
11.4.4 CONFIGURE CISCO SPAN
The SPAN feature on Cisco switches sends a copy of each frame entering the source
port out the destination port and toward the packet analyser or IDS.
A session number is used to identify a SPAN session. The examples show the monitor
session command, which is used to associate a source port and a destination port with a
SPAN session. A separate monitor session command is used for each session. A
VLAN can be specified instead of a physical port.
In the figure below, PCA is connected to F0/1 and an IDS is connected to F0/2. The
objective is to capture all the traffic that is sent or received by PCA on port F0/1 and
send a copy of those frames to the IDS (or a packet analyser) on port F0/2. The SPAN
session on the switch will copy all the traffic that it sends and receives on source port
F0/1 to the destination port F0/2.
Cisco SPAN Configuration
S1(config)# monitor session 1 source interface fastethernet 0/1
S1(config)# monitor session 1 destination interface fastethernet
0/2
The show monitor command is used to verify the SPAN session. The command
displays the type of the session, the source ports for each traffic direction, and the
destination port. In the example below, the session number is 1, the source port for both
traffic directions is F0/1, and the destination port is F0/2. The ingress SPAN is disabled
on the destination port, so only traffic that leaves the destination port is copied to that
port.
S1# show monitor
Session 1
---------
Type : Local Session
Source Ports :
Both : Fa0/1
Destination Ports : Fa0/2
Encapsulation : Native
Ingress : Disabled
S1#
Note: Remote SPAN (RSPAN) can be used when the packet analyser or IDS is on a
different switch than the traffic being monitored.
RSPAN extends SPAN by enabling remote monitoring of multiple switches across the
network. The traffic for each RSPAN session is carried over a user-specified RSPAN
VLAN that is dedicated (for that RSPAN session) in all participating switches.
IPS TECHNOLOGIES SUMMARY
11.5.1 WHAT DID I LEARN IN THIS MODULE?
IDS and IPS Characteristics
NIPS can be implemented using a dedicated device or a router with IPS software.
Network-based IPS act in real time to block malicious software and network attacks.
Network-based IPS can be deployed in two modes.
In promiscuous mode, they function as IDS by monitoring mirrored traffic. While they
can’t stop network attacks, they can alert personnel and log information when attacks
occur.
An inline mode IPS processes all traffic that enters a network and checks that traffic at
Layers 3 to 7. IPS can also check the contents of payloads that are carried in network
traffic, such as email attachments. Because inline mode puts the IPS directly into the
traffic flow it makes packet-forwarding rates slower by adding latency. Inline mode
allows the sensor to stop attacks by dropping malicious traffic before it reaches the
intended target.
IPS on Cisco ISRs
MODULE 12
12.1 IPS SIGNATURES
12.1.1 IPS SIGNATURE ATTRIBUTES
The network must be able to identify incoming malicious traffic in order to stop it.
Fortunately, malicious traffic displays distinct characteristics or “signatures”.
Conceptually similar to the virus.dat file used by virus scanners, a signature is a set of
rules that an IDS and an IPS use to detect typical intrusion activity. Signatures uniquely
identify specific viruses, worms, protocol anomalies, and malicious traffic (e.g., a DoS
attacks).
A malicious packet flow has a specific type of activity and signature. IPS sensors must
be tuned to look for matching signatures or abnormal traffic patterns.
As sensors scan network packets, they use signatures to detect known attacks and
respond with predefined actions.
An IDS or IPS sensor examines the data flow using many different signatures. A sensor
takes action when it matches a signature with a data flow, such as logging the event or
sending an alarm to the IDS or IPS management software.
Signatures also have three distinctive attributes:
o Type - Atomic or Composite
o Trigger - Also called the alarm
o Action - What the IPS will do
Some threats can be identified in one packet while other threats may require many
packets and their state information (i.e., IP addresses, port numbers, and more) to
identify a threat.
There are two types of signatures:
o Atomic Signature - This is the simplest type of signature because a single
packet, activity, or event identifies an attack. The IPS does not need to maintain
state information and traffic analysis can usually be performed very quickly and
efficiently.
o Composite Signature - Also called a stateful signature because the IPS
requires several pieces of data to match an attack signature. The IPS must also
maintain state information, which is referred to as the event horizon. The length
of an event horizon varies from one signature to the next.
12.1.3 IPS SIGNATURE ALARMS
The heart of any IPS signature is the signature alarm, which is often referred to as the
signature trigger. The signature alarm (i.e., trigger) for an IPS sensor could be anything
that can reliably signal an intrusion or security policy violation. A network-based IPS
might trigger a signature action if it detects a packet with a payload containing a
specific string that is going to a specific TCP port, for example.
The IPS signature alarm is analogous to the alarm in a home security system. The
triggering mechanism for a burglar alarm could be a motion detector. When the burglar
alarm is enabled, the movement of an individual entering a room is detected. This
triggers the alarm.
These triggering mechanisms can be applied to atomic and composite signatures. The
triggering mechanisms can be simple or complex. Every IPS incorporates signatures
that use one or more of these basic triggering mechanisms to trigger signature actions.
There are four general IPS signature trigger categories as listed in the table.
When a signature detects the activity for which it is configured, the signature triggers
one or more actions.
Depending on the IPS sensor, various actions can be enabled. The table lists some
actions that an IPS sensor may provide.
Note: The available actions depend on the signature type and the platform.
Triggering mechanisms can generate alarms that are false positives or false negatives.
These alarms must be addressed when implementing an IPS sensor.
True positives and true negatives are desirable and indicate the IPS is functioning
properly. False positives and false negatives are undesirable and must be investigated.
The table summarizes the following four types of alarms:
Alarm
Network Activity IPS Activity Outcome
Type
True
Attack traffic Alarm generated Ideal setting
positive
True
Normal user traffic No alarm generated Ideal setting
negative
False
Normal user traffic Alarm generated Tune alarm
positive
False
Attack traffic No alarm generated Tune alarm
negative
NGIPSs are dedicated IPS appliances. They are built on Snort's core open technology
and use vulnerability-focused IPS rules and embedded IP-, URL-, and DNS-based
security intelligence provided by Cisco Talos.
NGIPS features include the following:
o IPS rules that identify and block attack traffic targeted at network
vulnerabilities.
o Tightly integrated defence against advanced malware by incorporating
advanced analysis of network and endpoint activity.
o Sandboxing technology that uses hundreds of behavioural indicators to identify
zero-day and evasive attacks.
o Also includes Application Visibility and Control (AVC), Cisco Advanced
Malware Protection (AMP) for Networks, and URL Filtering.
Note: Further discussion of NGIPS appliances is out of scope for this course.
12.2.3 SNORT IPS
Snort is an open-source network IPS that performs real-time traffic analysis and
generates alerts when threats are detected on IP networks. It can also perform protocol
analysis, content searching or matching, and detect a variety of attacks and probes (e.g.,
buffer overflows, stealth port scans, and more). Snort was inducted into the InfoWorld
Open Source Hall of Fame as one greatest pieces of open source software ever.
The Snort engine can now run as a virtual container service on Cisco 4000 ISRs and
Cisco Cloud Services Router 1000v Series. It is ideal for smaller organizations looking
for a cost-effective routing and threat defence solution. For instance, an ISR G2 can
provide advanced routing capabilities and integrated threat defence security using Snort
IPS.
Snort IPS can be implemented with other security features integrated into the 4000
Series ISRs, such as VPN, zone-based Cisco IOS firewalls, and Cisco Cloud Web
Security. This enables the ISR to provide comprehensive threat protection in a small
footprint. This is crucial for small branch locations that need to address security for the
local internet connection. Snort IPS integrated in an ISR is a cost-effective alternative
for branch office locations because a separate firewall device is not required.
Snort IPS on the 4000 Series ISR provides the following functionalities:
o IDS and IPS mode - Configure threat detection or prevention mode. In
prevention mode, attack traffic will be dropped.
o Three signature levels - Snort provides three levels of signature protection:
connectivity (least secure), balanced (middle option), and security (most
secure). The security level is the most secure as it enables the highest number of
signatures to be verified.
o An allowed list - This provides the ability to turn off certain signatures and
helps to avoid false positives such as legitimate traffic triggering an IPS action.
Up to 1000 entries can be supported in the allowed list.
o Snort health monitoring - Cisco IOS Software keeps track of the health of the
Snort engine that is running in the service container.
o Fail open and close - In the event of IPS engine failure, the router can be
configured to block the traffic flow or to bypass IPS checking until the Snort
engine recovers.
o Signature update - Automatic and manual updates are supported. Snort IPS
can download the signature package directly from cisco.com or a local resource
location over HTTP and HTTPS.
o Event logging - IPS logs can be sent to an independent log collector or
included along with the router syslog stream. Sending IPS logs separately helps
if the security event management tool is different from the regular syslog
server.
12.2.4 SNORT COMPONENTS AND RULES
Snort IPS for 4000 Series ISRs consists of two components:
o Snort engine - This is the IPS detection and enforcement engine that is
included in the Security (SEC) license for 4000 Series ISRs.
o Snort rule software subscriptions for signature updates - Snort rule sets to
keep current with the latest threat protection are term-based subscriptions,
available for one or three years.
Routers were initially packet processing devices. However, over the years, they have
evolved to perform many computing functions. Routers have acquired so much
processing power that server applications can now be hosted inside the router using
virtual machines called service containers.
Applications such as Snort IPS can be uploaded and hosted on these routers. Service
containers are supported on most IOS XE platforms. IOS XE is based on the Linux
architecture and supports virtual machine hosting.
The Snort engine runs as a Linux Service Container application on the ISR 4000 as
shown in the figure. This provides it with dedicated computing resources that run
independently of the data plane CPU load. It also makes it easier for the Snort engine to
be regularly updated.
Specifically, the Snort engine on the 4000 Series ISR runs as a container application.
The 4000 Series ISR uses a multi-core CPU, and the Cisco IOS-XE has the ability to
allocate these cores for control-plane or data-plane functions. Computing resources
unused by control plane functions can be used for running other services. A Linux
container infrastructure hosts these applications. Applications running in this container
infrastructure can have a tighter integration with Cisco IOS Software.
12.2.6 SNORT IPS RULE ALARMS
In Snort IPS, signatures are configured using “rules”. These rules serve as the signature
alarms by comparing incoming traffic to the Snort rules. Traffic matching a rule header
generates an action.
A rule header is conceptually similar to an access control list (ACL) statement. It is a
one line statement that identifies malicious traffic.
The basic rule header command syntax is:
o [action] [protocol] [sourceIP] [sourceport] -> [destIP] [destport] ([Rule
options])
Note: The Rule options contain additional rule information.
For example, the following sample header generates an alert whenever a TCP
connection for the hosts/ports identified in the rule header variables are going to the
identified destination hosts/ports variables:
o alert tcp $EXTERNAL_NET $HTTP_PORTS -> $HOME_NET any
Refer to the figure for a detailed explanation of this example.
A Snort rule header also contains rule options (fields) to provide additional information
for the rule. Options are separated by semicolons (;) and the rule option keywords are
separated from their arguments using colons (:).
The figure displays sample rule options for the alert tcp $EXTERNAL_NET
$HTTP_PORTS -> $HOME_NET any rule header.
The table describes the common general rule and the detection rule options in the
sample rule header.
Note: These are just a few of the different types of rule options. For more examples,
search the internet for "snort rule options"
The OVA file must be downloaded and saved in a file location available to the ISR
router (e.g., Flash).
To install the OVA file, use the virtual-service install name virtual-service-
name package file-url media file-system privilege EXEC command. The length of
the name is 20 characters and the complete path to the OVA file must be specified.
An example configuration is shown below.
R1# virtual-service install name MYIPS package flash:iosxe-
utd.16.09.06.1.0.10_SV29130_XE_16_9.ova
Installing package 'bootflash:/iosxe-
utd.16.09.06.1.0.10_SV29130_XE_16_9.ova' for virtual-service
'MYIPS'. Once the install has finished, the VM may be activated.
Use 'show virtual-service list' for progress.
R1#
*Oct 5 08:07:45.953: %VMAN-5-PACKAGE_SIGNING_LEVEL_ON_INSTALL:
R0/0: vman: Package 'iosxe-utd.16.09.06.1.0.10_SV29130_XE_16_9.ova'
for service container 'MYIPS' is 'Cisco signed', signing level
cached on original install is 'Cisco signed'
R1#
During the OVA file installation, the security license is checked and an error is reported
if the license is not present. Therefore, the Cisco IOS XE image must be enabled with
the security license. In the output, you can see that the OVA is Cisco signed.
Use the show virtual-service list command to display the status of the installation of all
applications installed on the virtual service container.
12.3.4 STEP 3: CONFIGURE VIRTUAL PORT GROUP INTERFACES
Two VirtualPortGroup (VPG) interfaces must then be configured along with their guest
IP addresses.
In our example, the VPG interfaces will be configured as follows:
o VGP0 - This is for management traffic to exchange information with IPS
servers. The guest IP address needs to be routable to connect to the signature
update server and external log server. It is also used to log traffic to log
collectors.
o VPG1 - This is for user traffic marked for inspections. This should not be
routable and therefore use a non-routable private IP address.
Note: Be sure to provide proper NAT and routing to enable the management VPG to
reach the log server as well as cisco.com to retrieve signature update files.
The following is a sample configuration of VPG0 and VPG1.
R1# configure terminal
R1(config)# interface VirtualPortGroup0
R1(config-if)# description Management interface
R1(config-if)# ip address 209.165.201.1 255.255.255.252
R1(config-if)# exit
R1(config)#
*Oct 5 08:13:10.970: %LINEPROTO-5-UPDOWN: Line protocol on
Interface VirtualPortGroup0, changed state to up
R1(config)# interface VirtualPortGroup1
R1(config-if)# description Data interface
R1(config-if)# ip address 192.168.0.1 255.255.255.252
R1(config-if)# exit
R1(config)#
*Oct 5 08:13:12.921: %LINEPROTO-5-UPDOWN: Line protocol on
Interface VirtualPortGroup1, changed state to up
R1#
The next step is to configure guest IPs on the same subnet for the container side and
activate the virtual service as shown in the output.
R1(config)# virtual-service MYIPS
R1(config-virt-serv)# vnic gateway VirtualPortGroup0
R1(config-virt-serv-vnic)# guest ip address 209.165.201.2
R1(config-virt-serv-vnic)# exit
R1(config-virt-serv)# vnic gateway VirtualPortGroup1
R1(config-virt-serv-vnic)# guest ip address 192.168.0.2
R1(config-virt-serv-vnic)# exit
R1(config-virt-serv)# activate
Next is to configure how Snort is to be deployed (i.e. IPS or IDS mode), where the
Snort logs should be sent, the policy and profile to configure for Snort, and more.
Refer to the sample command output.
R1(config)# utd engine standard
R1(config-utd-eng-std)# logging host 10.10.10.254
R1(config-utd-eng-std)# logging syslog
R1(config-utd-eng-std)#
R1(config-utd-eng-std)# threat-inspection
R1(config-utd-engstd-insp)# threat protection
R1(config-utd-engstd-insp)# policy balanced
R1(config-utd-engstd-insp)#
R1(config-utd-engstd-insp)# signature update occur-at daily 0 0
R1(config-utd-engstd-insp)# signature update server cisco username
Bob password class
R1(config-utd-engstd-insp)# logging level warning
R1(config-utd-engstd-insp)#
R1(config-utd-engstd-insp)# exit
R1(config-utd-eng-std)# exit
R1(config)#
The utd engine standard command configures the UTD standard engine and enters
UTD standard engine configuration mode.
The logging host and logging syslog commands enable the logging of emergency
messages to a server.
The threat-inspection command configures threat inspection for the Snort engine.
From here you can specify which mode Snort will be in:
o threat protection - Snort will be in IPS mode.
o threat detection - Snort will be in IDS mode.
The policy command specifies three security policies used by Snort and provided by
Cisco Talos, as shown in the following help facility example.
R1(config-utd-engstd-insp)# policy ?
balanced Set the policy to balanced (this is the default option)
connectivity Set the policy to connectivity (stresses on
connectivity over security)
security Set the policy to security (provide mode exhaustive
coverage)
R1(config-utd-engstd-insp)# policy
The three policy settings in order from least protection to most protection are:
o connectivity - This provides the least protection as it prioritizes connectivity
over security. Approximately 1,000 rules are pre-loaded using this policy.
o balanced - This is the default policy. It is recommended for initial
deployments. This policy attempts to balance security needs and performance
characteristics of the network. Approximately 8,000 rules are pre-loaded using
this policy.
o security - This provides the most protection. It is designed for organizations
that are exceptionally concerned about security. Customers deploy this policy in
protected networks, that have a lower bandwidth requirements, but much higher
security requirements. Approximately 12,000 rules are pre-loaded using this
policy.
Note: IPS system performance is negatively affected as more rules are enabled.
The signature update command configures the signature update interval parameters. In
our sample output, Snort will update its signatures every night at midnight.
The signature update server command configures the signature update server
parameters. You must specify the signature update parameters with the server details. If
you use Cisco.com for signature updates, you must provide the username and password.
If you use local server for signature updates, based on the server settings you can
provide the username and password. In our sample output, Snort updates its signature
file from cisco.com using the username Bob and password class.
Finally the logging level command specifies the types of syslog messages that will be
generated.
12.3.7 STEP 6: ENABLE IPS GLOBALLY OR ON DESIRED INTERFACES
Based on the organizational requirements, Snort can be enabled globally (i.e., on all the
interfaces) or on selected interfaces.
The example in the output enables UTD globally on all interfaces and defines what to
do if the Snort engine fails.
R1(config)# utd
R1(config-utd)# all-interfaces
R1(config-utd)#
R1(config-utd)# engine standard
R1(config-engine-std)# fail close
R1(config-engine-std)# exit
R1(config-utd)# exit
R1(config)#
The all-interfaces option configures unified threat defence (UTD) on all Layer 3
interfaces of the device.
The engine standard command configures the Snort-based UTD engine and enters
standard engine configuration mode. From this mode, we can specify how Snort will
behave if there is a UTD engine failure.
Specifically, Snort can be configured to:
o fail-open (default) - When there is a UTD engine failure, this option allows all
of the IPS/IDS traffic through without being inspected.
o fail-close - If enabled, this option drops all the IPS/IDS traffic when there is an
UTD engine failure. Therefore, no traffic will be allowed to leave.
Alternatively, Snort could be enabled only on select interfaces as shown.
Note: An error message will be displayed if the global configuration was first
configured.
R1(config)# interface G0/0/0
R1(config-if)# utd enable
R1(config-if)# exit
R1(config)# interface G0/0/1
R1(config-if)# utd enable
R1(config-if)# exit
R1(config)#
You can also enable the UTD allowed list feature. This enables you to identify IPS
signature IDs to be suppressed (not used).
For example, when an IPS is incorrectly identifying normal user traffic as a threat (i.e.,
a false positive), we can add those signatures to an allowed list. The IPS will not use
signatures in the allowlist.
To do so, enter UTD allowed list configuration mode and identify signature IDs to be
excluded from inspection. After the allowed list signature ID is configured, Snort will
allow the flow to pass through the device without any alerts and drops.
For example, assume that the IPS has incorrectly identified user traffic
from Branch1 as malicious and assigned it id 21555. This signature can be added to an
allowed list, as shown
R1(config)# utd threat-inspection whitelist
R1(config-utd-whitelist)# signature id 21555 comment traffic from
Branch 1
R1(config-utd-whitelist)#
To configure Snort IPS on an ISR 4000 device, you must download the latest OVA file,
install it on the router, configure VPG interfaces, activate the virtual services, configure
Snort IPS specifics, and enable UTD. After Snort is configured and activated, show
commands allow verification of its operation.
MODULE 13
13.1 ENDPOINT SECURITY OVERVIEW
13.1.1 LAN ELEMENTS SECURITY
News media commonly cover external network attacks on enterprise networks. These
are some examples of such attacks:
o DoS attacks on an organization’s network to degrade or even halt public access
to it
o Breach of an organization’s Web server to deface their web presence
o Breach of an organization’s data servers and hosts to steal confidential
information
Various network security devices are required to protect the network perimeter from
outside access.
As shown in the figure, these devices could include a hardened ISR that is providing
VPN services, an ASA firewall appliance, an IPS, and a AAA server.
Many attacks can, and do, originate from inside the network. Therefore, securing an
internal LAN is just as important as securing the outside network perimeter.
Without a secure LAN, users within an organization are still susceptible to network
threats and outages that can directly affect an organization’s productivity and profit
margin.
After an internal host is infiltrated, it can become a starting point for an attacker to gain
access to critical system devices, such as servers and the sensitive information they
contain.
Specifically, there are two internal LAN elements to secure:
o Endpoints - Hosts commonly consist of laptops, desktops, servers, and IP
phones which are susceptible to malware-related attacks. Endpoints also include
video cameras, point-of-sale devices, and devices on the Internet of Things.
o Network infrastructure - LAN infrastructure devices interconnect endpoints
and typically include switches, wireless devices, and IP telephony devices.
Most of these devices are susceptible to LAN-related attacks including MAC
address table overflow attacks, spoofing attacks, DHCP related attacks, LAN
storm attacks, STP manipulation attacks, and VLAN attacks.
This module focuses on security endpoints
The network has evolved to include traditional endpoints and new, lightweight,
portable, consumerized endpoints such as smartphones, tablets, wearables, and others.
The new bring-your-own-device (BYOD) needs of workers require a different way of
approaching endpoint security.
These new endpoints have blurred the network border because access to network
resources can be initiated by users from many locations using various connectivity
methods at any time.
There are some problems with the traditional method of securing endpoints.
In many networks, the network-based devices are disparate and typically do not share
information among themselves.
Additionally, new endpoint devices are not good candidates for the traditional host-
based endpoint security solutions because of the variety of devices and the variety of
operating systems available on those devices.
The challenge is allowing these heterogeneous devices to connect to enterprise
resources securely.
13.1.4 SECURITY FOR ENDPOINTS IN THE BORDERLESS NETWORK
Larger organizations now require protection before, during, and after an attack. IT
administrators must be able to answer the following questions:
o Where did the attack come from?
o What was the exploit method and point of entry?
o What systems were affected?
o What did the exploit do?
o How do we recover from the exploit?
o How can we mitigate the vulnerability and root cause?
Organizations must also protect their endpoints from new threats and provide the
protection measures that are outlined in the table below.
Measure Purpose
antimalware software Protect endpoints from malware.
spam filtering Prevent spam emails from reaching endpoints.
Prevent endpoints from connecting to websites with bad
blocklisting reputations by immediately blocking connections based
on the latest reputation intelligence.
data loss prevention (DLP) Prevent sensitive information from being lost or stolen.
New security architectures for the borderless network address security challenges by
having endpoints use network scanning elements.
These devices provide many more layers of scanning than a single endpoint possibly
could. Network-based malware prevention devices are also capable of sharing
information among themselves to make better informed decisions.
Protecting endpoints in a borderless network can be accomplished using network-based,
as well as host-based techniques, as shown in the figure.
The following are examples of devices and techniques that implement host protections
at the network level.
o Advanced Malware Protection (AMP) – This provides endpoint protection
from viruses and malware.
o Email Security Appliance (ESA) – This provides filtering of SPAM and
potentially malicious emails before they reach the endpoint. An example is the
Cisco ESA.
o Web Security Appliance (WSA) – This provides filtering and blocking of
websites to prevent hosts from reaching dangerous locations on the web. The
Cisco WSA provides control over how users access the internet and can enforce
acceptable use policies, control access to specific sites and services, and scan
for malware.
o Network Admission Control (NAC) – This permits only authorized and
compliant systems to connect to the network.
These technologies work in concert with each other to give more protection than host-
based suites can provide, as shown in the figure.
Endpoints are also susceptible to data theft. For instance, if a corporate laptop is lost or
stolen, a thief could scour the hard drive for sensitive information, contact information,
personal information, and more.
The solution is to locally encrypt the disk drive with a strong encryption algorithm such
as 256-bit AES encryption. The encryption protects the confidential data from
unauthorized access. The encrypted disk volumes can only be mounted for normal
read/write access with the authorized password.
Operating systems such as MAC OSX natively provide encryption options. The
Microsoft Windows 10 operating system also provides encryption natively. Individual
files, folders, and drives can be configured to encrypt data. In Windows, BitLocker
provides drive encryption, as shown in the figure. Files can also be encrypted, but
because applications can create unencrypted back up files, the entire folder that the file
is stored in should be encrypted.
The purpose of network access control (NAC) is to allow only authorized and compliant
systems, whether managed or unmanaged, to access the network.
It unifies endpoint security technologies with user or device authentication and network
security policy enforcement.
A NAC system can deny network access to noncompliant devices, place them in a
quarantined area, or give them only restricted access to computing resources, thus
keeping insecure nodes from infecting the network.
NAC systems can have the following capabilities:
o Profiling and visibility - This recognizes and profiles users and their devices
before malicious code can cause damage.
o Guest network access - This manages guests through a customizable, self-
service portal that includes guest registration, guest authentication, guest
sponsoring, and a guest management portal.
o Security posture checking - This evaluates security-policy compliance by user
type, device type, and operating system.
o Incident response - This mitigates network threats by enforcing security
policies that block, isolate, and repair noncompliant machines without
administrator attention.
NAC systems should extend NAC to all network access methods, including access
through LANs, remote-access gateways, and wireless access points.
The Cisco Identity Services Engine (ISE) combines AAA and network device profiling
into a single system.
The goal of NAC systems is to ensure that only hosts that are authenticated and have
had their security posture examined and approved are permitted onto the network.
For example, company laptops used offsite for a period of time might not have received
current security updates or could have become infected from other systems. Those
systems cannot connect to the network until they are examined, updated, and approved.
Network access devices can function as the enforcement layer, as shown in the figure.
They force the clients to query a RADIUS server for authentication and authorization.
The RADIUS server can query other devices, such as an antivirus server, and reply to
the network enforcers.
The IEEE 802.1X standard defines a port-based access control and authentication
protocol that restricts unauthorized workstations from connecting to a LAN through
publicly accessible switch ports.
The authentication server authenticates each workstation that is connected to a switch
port before making available any services offered by the switch or the LAN.
The figure shows that with 802.1X port-based authentication, the devices in the network
have specific roles.
If the client is successfully authenticated (the switch receives an “accept” frame from
the authentication server), the port state changes to authorized, and all frames from the
authenticated client are enabled through the port.
If the authentication fails, the port remains in the unauthorized state, but authentication
can be retried. If the authentication server cannot be reached, the switch can retransmit
the request. If no response is received from the server after the specified number of
attempts, authentication fails, and network access is not granted.
When a client logs out, it sends an EAPOL-logout message, causing the switch port to
transition to the unauthorized state.
Parameter Description
Enables 802.1X port-based authentication and causes the
port to begin in the unauthorized state. During this time only
auto EAPOL, STP, and CDP frames are the only type of frames
that can be sent or received through the port until the client
device has been authenticated.
force-authorized The port sends and receives normal traffic without 802.1x-
based authentication of the client. This is the default setting.
Causes the port to remain in the unauthorized state,
force-unauthorized ignoring all attempts by the client to authenticate. The
switch cannot provide authentication services to the client
through the port.
802.1X provides a means by which authenticator network access switch can act as an
intermediary between a client and an authentication server.
The switch forwards authentication information from the client to the server. If
authentication is successful, the client will be allowed to access the network through the
connected switch port.
If authorization fails, the switch will not permit the client endpoint to connect to the
network.
The system uses the EAP and EAPOL to carry authentication traffic between the switch
and the authenticator switch.
The switch uses EAP and RADIUS to communicate with the authentication server.
The 802.1X authentication process can be control by configuring the authenticator port
with the authentication port-control command. The port can be set carryout the
authentication process, provide authorized access, or to be in unauthorized state. In this
state no device will be able to connect to the network.
802.1X port-based authentication is configured by first globally activating AAA and by
specifying the RADIUS server name, address, and ports. After that the authenticator
interface is configured with 802.1X parameters.
MODULE 14
14.1 LAYER 2 SECURITY THREATS
14.1.1 DESCRIBE LAYER 2 VULNERABILITES
The OSI reference model is divided into seven layers which work independently of each
other. As shown in the figure, each layer performs a specific function and has core
elements that can be exploited.
Security is only as strong as the weakest link in the system, and Layer 2 is considered to
be that weakest link. This is because traditionally LANs were under the administrative
control of a single organization. We inherently trusted all persons and devices
connected to our LAN. Today, with BYOD and more sophisticated attacks, our LANs
have become more vulnerable to penetration. Therefore, in addition to protecting Layer
3 to Layer 7, network security professionals must also mitigate attacks to the Layer 2
LAN infrastructure.
The first step in mitigating attacks on the Layer 2 infrastructure is to understand the
underlying operation of Layer 2 and the threats posed by the Layer 2 infrastructure.
Attacks against the Layer 2 LAN infrastructure are highlighted in the table.
Note: The focus of this module is on common Layer 2 attacks.
Type Description
Includes MAC table overflow (also called MAC Address
MAC Table Attacks
Flooding) Attacks.
Includes VLAN hopping and VLAN double-tagging attacks.
VLAN Attacks It also includes attacks between devices on a common
VLAN.
DHCP Attacks Includes DHCP starvation and DHCP spoofing attacks.
ARP Attacks Includes ARP spoofing and ARP poisoning attacks.
Address Spoofing Attacks Includes MAC Address and IP address spoofing attacks.
STP Attacks Includes Spanning Tree Protocol manipulation attacks.
The figure below provides an overview of Cisco solutions that help mitigate Layer 2
attacks.
These Layer 2 solutions will not be effective if the management protocols are not
secured. An example would be if attackers can easily telnet into a switch. Syslog,
SNMP, TFTP, telnet, FTP and most other common network management protocols are
insecure. Therefore, the following strategies are recommended:
o Always use secure variants of these protocols such as SSH, SCP, and SSL.
o Consider using out-of-band (OOB) management.
o Use a dedicated management VLAN where nothing but management traffic
resides.
o Use ACLs to filter unwanted access.
14.2 MAC TABLE ATTACKS
14.2.1 SWITCH FUNDAMENTALS
A switch uses MAC addresses to forward (or discard) frames to other devices on a
network. If a switch just forwarded every frame it received out all ports, your network
would be so congested that it would probably come to a complete halt.
A Layer 2 Ethernet switch uses Layer 2 MAC addresses to make forwarding decisions.
It is completely unaware of the data (protocol) being carried in the data portion of the
frame, such as an IPv4 packet, an ARP message, or an IPv6 ND packet. The switch
makes its forwarding decisions based solely on the Layer 2 Ethernet MAC addresses.
An Ethernet switch examines its MAC address table to make a forwarding decision for
each frame, unlike legacy Ethernet hubs that repeat bits out all ports except the
incoming port. In the figure, the four-port switch was just powered on. The table shows
the MAC Address Table which has not yet learned the MAC addresses for the four
attached PCs.
Note: MAC addresses are shortened throughout this topic for demonstration purposes.
The switch dynamically builds the MAC address table by examining the source MAC
address of the frames that are received on a port. The switch forwards frames by
searching for a match between the destination MAC address in the frame and an entry
in the MAC address table.
Learn
As a switch receives frames from different devices, it is able to populate its MAC
address table by examining the source MAC address of every frame. When the MAC
address table of the switch contains the destination MAC address, it is able to filter the
frame and forward out a single port.
PC-D to Switch
In the figure, PC-D is replying back to PC-A. The switch sees the MAC address of PC-
D in the incoming frame on port 4. The switch then puts the MAC address of PC-D into
the MAC Address Table associated with port 4.
Switch to PC-A
Next, because the switch has destination MAC address for PC-A in the MAC Address
Table, it will send the frame only out port 1, as shown in the figure.
PC-A to Switch to PC-D
Next, PC-A sends another frame to PC-D, as shown in the figure. The MAC address
table already contains the MAC address for PC-A; therefore, the five-minute refresh
timer for that entry is reset. Next, because the switch table contains the destination
MAC address for PC-D, it sends the frame only out port 4.
All MAC tables have a fixed size and consequently, a switch can run out of resources in
which to store MAC addresses. MAC address flooding attacks take advantage of this
limitation by bombarding the switch with fake source MAC addresses until the switch
MAC address table is full.
When this occurs, the switch treats the frame as an unknown unicast and begins to flood
all incoming traffic out all ports on the same VLAN without referencing the MAC table.
This condition now allows a threat actor to capture all of the frames sent from one host
to another on the local LAN or local VLAN.
Note: Traffic is flooded only within the local LAN or VLAN. The threat actor can only
capture traffic within the local LAN or VLAN to which the threat actor is connected.
The figure shows how a threat actor can easily use the network attack tool macof to
overflow a MAC address table.
If the threat actor stops macof from running or is discovered and stopped, the switch
eventually ages out the older MAC address entries from the table and begins to act like
a switch again.
What makes tools such as macof so dangerous is that an attacker can create a MAC
table overflow attack very quickly. For instance, a Catalyst 6500 switch can store
132,000 MAC addresses in its MAC address table. A tool such as macof can flood a
switch with up to 8,000 bogus frames per second; creating a MAC address table
overflow attack in a matter of a few seconds. The example shows a sample output of
the macof command on a Linux host.
# macof -i eth1
36:a1:48:63:81:70 15:26:8d:4d:28:f8 0.0.0.0.26413 > 0.0.0.0.49492:
S 1094191437:1094191437(0) win 512
16:e8:8:0:4d:9c da:4d:bc:7c:ef:be 0.0.0.0.61376 > 0.0.0.0.47523: S
446486755:446486755(0) win 512
18:2a:de:56:38:71 33:af:9b:5:a6:97 0.0.0.0.20086 > 0.0.0.0.6728: S
105051945:105051945(0) win 512
e7:5c:97:42:ec:1 83:73:1a:32:20:93 0.0.0.0.45282 > 0.0.0.0.24898: S
1838062028:1838062028(0) win 512
62:69:d3:1c:79:ef 80:13:35:4:cb:d0 0.0.0.0.11587 > 0.0.0.0.7723: S
1792413296:1792413296(0) win 512
c5:a:b7:3e:3c:7a 3a:ee:c0:23:4a:fe 0.0.0.0.19784 > 0.0.0.0.57433: S
1018924173:1018924173(0) win 512
88:43:ee:51:c7:68 b4:8d:ec:3e:14:bb 0.0.0.0.283 > 0.0.0.0.11466: S
727776406:727776406(0) win 512
b8:7a:7a:2d:2c:ae c2:fa:2d:7d:e7:bf 0.0.0.0.32650 > 0.0.0.0.11324:
S 605528173:605528173(0) win 512
e0:d8:1e:74:1:e 57:98:b6:5a:fa:de 0.0.0.0.36346 > 0.0.0.0.55700: S
2128143986:2128143986(0) win 512
Another reason why these attack tools are dangerous is because they not only affect the
local switch, they can also affect other connected Layer 2 switches. When the MAC
address table of a switch is full, it starts flooding out all ports including those connected
to other Layer 2 switches.
To mitigate MAC address table overflow attacks, network administrators must
implement port security. Port security will only allow a specified number of source
MAC addresses to be learned on the port. Port security is further discussed later in this
module.
14.3 MITIGATE MAC TABLE ATTACKS
14.3.1 SECURE UNUSED PORTS
The simplest and most effective method to prevent MAC address table overflow attacks
is to enable port security.
Port security limits the number of valid MAC addresses allowed on a port. It allows an
administrator to manually configure MAC addresses for a port or to permit the switch to
dynamically learn a limited number of MAC addresses. When a port that is configured
with port security receives a frame, the source MAC address of the frame is compared
to the list of secure source MAC addresses that were manually configured or
dynamically learned on the port.
By limiting the number of permitted MAC addresses on a port to one, port security can
be used to control unauthorized access to the network, as shown in the figure.
14.3.3 ENABLE PORT SECURITY
Notice in the example, the switchport port-security command was rejected. This is
because port security can only be configured on manually configured access ports or
manually configured trunk ports. By default, Layer 2 switch ports are set to dynamic
auto (trunking on). Therefore, in the example, the port is configured with
the switchport mode access interface configuration command.
Note: Trunk port security is beyond the scope of this course.
S1(config)# interface f0/1
S1(config-if)# switchport port-security
Command rejected: FastEthernet0/1 is a dynamic port.
S1(config-if)# switchport mode access
S1(config-if)# switchport port-security
S1(config-if)# end
S1#
Use the show port-security interface command to display the current port security
settings for FastEthernet 0/1, as shown in the example below. Notice that port security
is enabled, and the port status is Secure-down, which means there are no devices
attached and no violation has occurred. Also, the violation mode is Shutdown, and the
maximum number of MAC addresses allowed is 1. If a device is connected to the port,
the switch port status would display Secure-up and the switch will automatically add the
device’s MAC address as a secure MAC. In this example, no device is connected to the
port.
S1# show port-security interface f0/1
Port Security : Enabled
Port Status : Secure-down
Violation Mode : Shutdown
Aging Time : 0 mins
Aging Type : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 1
Total MAC Addresses : 0
Configured MAC Addresses : 0
Sticky MAC Addresses : 0
Last Source Address:Vlan : 0000.0000.0000:0
Security Violation Count : 0
S1#
Note: If an active port is configured with the switchport port-security command and
more than one device is connected to that port, the port will transition to the error-
disabled state. This condition is discussed later in this topic.
After port security is enabled, other port security specifics can be configured, as shown
in the example.
S1(config-if)# switchport port-security ?
aging Port-security aging commands
mac-address Secure mac address
maximum Max secure addresses
violation Security violation mode
S1(config-if)# switchport port-security
To set the maximum number of MAC addresses allowed on a port, use the following
command:
The default port security value is 1. The maximum number of secure MAC addresses
that can be configured depends on the switch and the IOS. In this example, the
maximum is 8192.
S1(config)# interface f0/1
S1(config-if)# switchport port-security maximum ?
<1-8192> Maximum addresses
S1(config-if)# switchport port-security maximum
The switch can be configured to learn about MAC addresses on a secure port in one of
three ways:
1. Manually Configured
The administrator manually configures a static MAC address(es) by using the following
command for each secure MAC address on the port:
2. Dynamically Learned
When the switchport port-security command is entered, the current source MAC for
the device connected to the port is automatically secured but is not added to the startup
configuration. If the switch is rebooted, the port will have to re-learn the device’s MAC
address.
3. Dynamically Learned – Sticky
The administrator can enable the switch to dynamically learn the MAC address and
“stick” them to the running configuration by using the following command:
Switch(config-if)# switchport port-security mac-address sticky
Saving the running configuration will commit the dynamically learned MAC address to
NVRAM.
The following example demonstrates a complete port security configuration for
FastEthernet 0/1 with a host connected to port Fa0/1. The administrator specifies a
maximum of 2 MAC addresses, manually configures one secure MAC address, and
then configures the port to dynamically learn additional secure MAC addresses up to
the 2 secure MAC address maximum. Use the show port-security interface and
the show port-security address command to verify the configuration.
*Mar 1 00:12:38.179: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to up
*Mar 1 00:12:39.194: %LINEPROTO-5-UPDOWN: Line protocol on
Interface FastEthernet0/1, changed state to up
S1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#
S1(config)# interface fa0/1
S1(config-if)# switchport mode access
S1(config-if)# switchport port-security
S1(config-if)# switchport port-security maximum 2
S1(config-if)# switchport port-security mac-address aaaa.bbbb.1234
S1(config-if)# switchport port-security mac-address sticky
S1(config-if)# end
S1# show port-security interface fa0/1
Port Security : Enabled
Port Status : Secure-up
Violation Mode : Shutdown
Aging Time : 0 mins
Aging Type : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 2
Total MAC Addresses : 2
Configured MAC Addresses : 1
Sticky MAC Addresses : 1
Last Source Address:Vlan : a41f.7272.676a:1
Security Violation Count : 0
S1# show port-security address
Secure Mac Address Table
-------------------------------------------------------------------
----------
Vlan Mac Address Type Ports
Remaining Age
(mins)
---- ----------- ---- -----
-------------
1 a41f.7272.676a SecureSticky Fa0/1 -
1 aaaa.bbbb.1234 SecureConfigured Fa0/1 -
-------------------------------------------------------------------
----------
Total Addresses in System (excluding one mac per port) : 1
Max Addresses limit in System (excluding one mac per port) : 8192
S1#
The output of the show port-security interface command verifies that port security is
enabled, there is a host connected to the port (i.e., Secure-up), a total of 2 MAC
addresses will be allowed, and S1 has learned one MAC address statically and one
MAC address dynamically (i.e., sticky).
The output of the show port-security address command lists the two learned MAC
addresses.
Port security aging can be used to set the aging time for static and dynamic secure
addresses on a port. Two types of aging are supported per port:
o Absolute - The secure addresses on the port are deleted after the specified
aging time.
o Inactivity - The secure addresses on the port are deleted only if they are
inactive for the specified aging time.
Use aging to remove secure MAC addresses on a secure port without manually deleting
the existing secure MAC addresses. Aging time limits can also be increased to ensure
past secure MAC addresses remain, even while new MAC addresses are added. Aging
of statically configured secure addresses can be enabled or disabled on a per-port basis.
Use the switchport port-security aging command to enable or disable static aging for
the secure port, or to set the aging time or type.
Switch(config-if)# switchport port-security aging { static | time
time | type {absolute | inactivity}}
Parameter Description
static Enable aging for statically configured secure addresses on this port.
time time Specify the aging time for this port. The range is 0 to 1440 minutes.
If the time is 0, aging is disabled for this port.
Set the absolute aging time. All the secure addresses on this port
type absolute age out exactly after the time (in minutes) specified and are
removed from the secure address list.
Set the inactivity aging type. The secure addresses on this port age
type inactivity out only if there is no data traffic from the secure source address for
the specified time period.
If the MAC address of a device that is attached to the port differs from the list of secure
addresses, then a port violation occurs. By default, the port enters the error-disabled
state.
To set the port security violation mode, use the following command:
Switch(config-if)# switchport port-security violation { protect |
restrict | shutdown}
Mode Description
The port transitions to the error-disabled state immediately, turns off
shutdown the port LED, and sends a syslog message. It increments the
violation counter. When a secure port is in the error-disabled state,
(default)
an administrator must re-enable it by entering
the shutdown and no shutdown commands.
The port drops packets with unknown source addresses until you
remove a sufficient number of secure MAC addresses to drop below
restrict the maximum value or increase the maximum value. This mode
causes the Security Violation counter to increment and generates a
syslog message.
This is the least secure of the security violation modes. The port
drops packets with unknown MAC source addresses until you
protect remove a sufficient number of secure MAC addresses to drop below
the maximum value or increase the maximum value. No syslog
message is sent.
The following table shows how a switch reacts based on the configured violation mode.
Violation Discards Offending Sends Syslog Increase Violation Shuts Down
Mode Traffic Message Counter Port
Protect Yes No No No
Restrict Yes Yes Yes No
Shutdown Yes Yes Yes Yes
What happens when the port security violation is shutdown and a port violation occurs?
The port is physically shutdown and placed in the error-disabled state, and no traffic is
sent or received on that port.
In the example, the port security violation is changed back to the default shutdown
setting. Then the host with MAC address a41f.7272.676a is disconnected and a new
host is plugged into Fa0/1.
Notice that a series of port security related messages are generated on the console.
S1(config)# int fa0/1
S1(config-if)# switchport port-security violation shutdown
S1(config-if)# end
S1#
*Mar 1 00:24:15.599: %LINEPROTO-5-UPDOWN: Line protocol on
Interface FastEthernet0/1, changed state to down
*Mar 1 00:24:16.606: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to down
*Mar 1 00:24:19.114: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to up
*Mar 1 00:24:20.121: %LINEPROTO-5-UPDOWN: Line protocol on
Interface FastEthernet0/1, changed state to up
S1#
*Mar 1 00:24:32.829: %PM-4-ERR_DISABLE: psecure-violation error
detected on Fa0/1, putting Fa0/1 in err-disable state
*Mar 1 00:24:32.838: %PORT_SECURITY-2-PSECURE_VIOLATION: Security
violation occurred, caused by MAC address a41f.7273.018c on port
FastEthernet0/1.
*Mar 1 00:24:33.836: %LINEPROTO-5-UPDOWN: Line protocol on
Interface FastEthernet0/1, changed state to down
*Mar 1 00:24:34.843: %LINK-3-UPDOWN: Interface FastEthernet0/1,
changed state to down
S1#
Note: The port protocol and link status are changed to down and the port LED is turned
off.
In the example, the show interface command identifies the port status as err-disabled.
The output of the show port-security interface command now shows the port status as
Secure-shutdown instead of Secure-up. The Security Violation counter increments by 1.
S1# show interface fa0/1 | include down
FastEthernet0/18 is down, line protocol is down (err-disabled)
(output omitted)
S1# show port-security interface fa0/1
Port Security : Enabled
Port Status : Secure-shutdown
Violation Mode : Shutdown
Aging Time : 10 mins
Aging Type : Inactivity
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 2
Total MAC Addresses : 2
Configured MAC Addresses : 1
Sticky MAC Addresses : 1
Last Source Address:Vlan : a41f.7273.018c:1
Security Violation Count : 1
S1#
After configuring port security on a switch, check each interface to verify that the port
security is set correctly, and check to ensure that the static MAC addresses have been
configured correctly.
Port Security for All Interfaces
To display port security settings for the switch, use the show port-security command.
The example indicates that only one port is configured with the switchport port-security
command.
S1# show port-security
Secure Port MaxSecureAddr CurrentAddr SecurityViolation
Security Action
(Count) (Count) (Count)
-------------------------------------------------------------------
--------
Fa0/1 2 2 0
Shutdown
-------------------------------------------------------------------
--------
Total Addresses in System (excluding one mac per port) : 1
Max Addresses limit in System (excluding one mac per port) : 8192
S1#
Use the show port-security interface command to view details for a specific interface,
as shown previously and in this example.
S1# show port-security interface fastethernet 0/1
Port Security : Enabled
Port Status : Secure-up
Violation Mode : Shutdown
Aging Time : 10 mins
Aging Type : Inactivity
SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 2
Total MAC Addresses : 2
Configured MAC Addresses : 1
Sticky MAC Addresses : 1
Last Source Address:Vlan : a41f.7273.018c:1
Security Violation Count : 0
S1#
To verify that MAC addresses are “sticking” to the configuration, use the show
run command as shown in the example for FastEthernet 0/19.
S1# show run interface fa0/1
Building configuration...
S1#
To display all secure MAC addresses that are manually configured or dynamically
learned on all switch interfaces, use the show port-security address command as
shown in the example.
S1# show port-security address
Secure Mac Address Table
-------------------------------------------------------------------
----------
Vlan Mac Address Type Ports
Remaining Age
(mins)
---- ----------- ---- -----
-------------
1 a41f.7272.676a SecureSticky Fa0/1
-
1 aaaa.bbbb.1234 SecureConfigured Fa0/1
-
-------------------------------------------------------------------
----------
Total Addresses in System (excluding one mac per port) : 1
Max Addresses limit in System (excluding one mac per port) : 8192
S1#
VLANs are used to create separate broadcast domains on switches. Endpoints that are
located in one VLAN are unable to communicate with endpoints that are on another
VLAN unless permitted to do so by a router or Layer 3 switch. VLANs can be used to
separate sensitive content from other network traffic. For example, a guest VLAN may
be created for guests to an organization. Those guests should not have access to
sensitive corporate content that is carried on other VLANs. VLAN attacks can
circumvent the intention of a VLAN design by allowing unauthorized users access to
VLANs that they should not be able access. Two types of VLAN attacks are VLAN
hopping attacks and VLAN double-tagging attacks.
A VLAN hopping attack enables traffic from one VLAN to be seen by another VLAN
without the aid of a router. In a basic VLAN hopping attack, the threat actor configures
a host to act like a switch to take advantage of the automatic trunking port feature
enabled by default on most switch ports.
The threat actor configures the host to spoof 802.1Q signaling and Cisco-proprietary
Dynamic Trunking Protocol (DTP) signaling to trunk with the connecting switch. If
successful, the switch establishes a trunk link with the host, as shown in the figure. Now
the threat actor can access all the VLANs on the switch. The threat actor can send and
receive traffic on any VLAN, effectively hopping between VLANs.
A threat actor in specific situations could embed a hidden 802.1Q tag inside the frame
that already has an 802.1Q tag. This tag allows the frame to go to a VLAN that the
original 802.1Q tag did not specify.
Step 1
The threat actor sends a double-tagged 802.1Q frame to the switch. The outer header
has the VLAN tag of the threat actor, which is the same as the native VLAN of the
trunk port. For the purposes of this example, assume that this is VLAN 10. The inner
tag is the victim VLAN, in this example, VLAN 20.
Step 2
The frame arrives on the first switch, which looks at the first 4-byte 802.1Q tag. The
switch sees that the frame is destined for VLAN 10, which is the native VLAN. The
switch forwards the packet out all VLAN 10 ports after stripping the VLAN 10 tag. The
frame is not retagged because it is part of the native VLAN. At this point, the VLAN 20
tag is still intact and has not been inspected by the first switch.
Step 3
The frame arrives at the second switch which has no knowledge that it was supposed to
be for VLAN 10. Native VLAN traffic is not tagged by the sending switch as specified
in the 802.1Q specification. The second switch looks only at the inner 802.1Q tag that
the threat actor inserted and sees that the frame is destined for VLAN 20, the target
VLAN. The second switch sends the frame on to the target or floods it, depending on
whether there is an existing MAC address table entry for the target.
The steps are complete — back to our regularly scheduled programming…
A VLAN double-tagging attack is unidirectional and works only when the attacker is
connected to a port residing in the same VLAN as the native VLAN of the trunk port.
The idea is that double tagging allows the attacker to send data to hosts or servers on a
VLAN that otherwise would be blocked by some type of access control configuration.
Presumably the return traffic will also be permitted, thus giving the attacker the ability
to communicate with devices on the normally blocked VLAN.
VLAN Attack Mitigation
FastEthernet ports 0/1 to 0/16 are access ports and therefore trunking is disabled by
explicitly making them access ports.
FastEthernet ports 0/17 to 0/20 are unused ports and are disabled and assigned to an
unused VLAN.
FastEthernet ports 0/21 to 0/24 are trunk links and are manually enabled as trunks with
DTP disabled. The native VLAN is also changed from the default VLAN 1 to VLAN
999.
VLANs are broadcast domains. However, in some situations, it may useful to break this
rule and allow only the minimum required L2 connectivity within the VLAN.
Private VLANs (PVLAN) provide Layer 2 isolation between ports within the same
broadcast domain. There are three types of PVLAN ports:
Promiscuous - A promiscuous port can talk to everyone. It can communicate with all
interfaces, including the isolated and community ports within a PVLAN.
Isolated - An isolated port can only talk to promiscuous ports. An isolated port has
complete Layer 2 separation from the other ports within the same PVLAN, but not from
the promiscuous ports. PVLANs block all traffic to isolated ports except traffic from
promiscuous ports. Traffic from an isolated port is forwarded only to promiscuous
ports.
Community - Community ports can talk to other community and promiscuous ports.
These interfaces are separated at Layer 2 from all other interfaces in other communities
or isolated ports within their PVLAN.
The example in the figure illustrates which ports can interconnect. The security
provided by a PVLAN can be bypassed by using the router as a proxy.
For example, in the figure below, PC-A and PC-B are isolated from each other.
However, PC-A can initiate an attack against PC-B by sending packets that have the
source IP address and MAC address of PC-A, the destination IP address of PC-B, but
the destination MAC address of R1. S1 will forward the frame to R1 because F0/5 is
configured as a promiscuous port. R1 rebuilds the frame with PC-B's MAC address and
forwards it to S1. S1 then forwards the frame to PC-B.
Note: PVLANs are used mainly in service provider co-location sites. Another typical
application can be found in hotels where each room would be connected on its own
isolated port.
To mitigate this type of attack, configure an ACL that will deny traffic with a source
and destination IP address that belongs to the same subnet, as shown in in the
configuration below.
R1(config)# ip access-list extended PVLAN
R1(config-ext-nacl)# deny ip 172.16.0.0 0.0.0.255 172.16.0.0
0.0.0.255
R1(config-ext-nacl)# permit ip any any
R1(config-ext-nacl)# interface g0/0
R1(config-if)# ip access-group PVLAN in
R1(config-if)#
Some applications require that no traffic be forwarded at Layer 2 between ports on the
same switch so that one neighbour does not see the traffic generated by another
neighbour.
In such an environment, the use of the PVLAN Edge feature ensures that there is no
exchange of unicast, broadcast, or multicast traffic between PVLAN edge ports on the
switch, as shown in the figure. The PLVAN Edge feature is also called Protected Ports.
The PVLAN Edge feature has the following characteristics:
o A protected port does not forward any traffic, such as unicast, multicast, or
broadcast, to any other port that is also a protected port. Data traffic cannot be
forwarded between protected ports at Layer 2; only control traffic is forwarded
because these packets are processed by the CPU and forwarded in software. All
data traffic passing between protected ports must be forwarded through a Layer
3 device.
o Forwarding behaviour between a protected port and a non-protected port
proceeds as usual.
o The default is to have no protected ports defined.
14.4.7 CONFIGURE PVLAN EDGE
To configure the PVLAN Edge feature, enter the switchport protected interface
configuration mode command.
The PVLAN Edge feature can be configured on a physical interface or an EtherChannel
group. When the PVLAN Edge feature is enabled for a port channel, it is enabled for all
ports in the port-channel group. To disable protected port, use the no switchport
protected interface configuration mode command.
To verify the configuration of the PVLAN Edge feature, use the show interfaces
interface-id switchport global configuration mode command, as shown in the example
below.
Switch# show interfaces gigabitethernet1/0/1 switchport
Name: G1/0/1
Switchport: Enabled
Administrative Mode: dynamic auto
Operational Mode: static access
Administrative Trunking Encapsulation: negotiate
Operational Trunking Encapsulation: native
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
(output omitted)
Protected: false
Unknown unicast blocked: disabled
Unknown multicast blocked: disabled
The PVLAN edge is a feature that has only local significance to the switch, and there is
no isolation provided between two protected ports located on different switches. A
protected port does not forward any traffic (unicast, multicast, or broadcast) to any other
port that is also a protected port on the same switch. Traffic cannot be forwarded
between protected ports at Layer 2 (L2); all traffic passing between protected ports must
be forwarded through a Layer 3 (L3) device.
The goal of the DHCP starvation attack is DoS for connecting clients. DHCP starvation
attacks require an attack tool such as Gobbler.
Gobbler has the ability to look at the entire scope of leasable IP addresses and tries to
lease them all. Specifically, it creates DHCP discovery messages with bogus MAC
addresses.
DHCP Spoofing Attack
A DHCP spoofing attack occurs when a rogue DHCP server is connected to the
network and provides false IP configuration parameters to legitimate clients. A rogue
server can provide a variety of misleading information:
o Wrong default gateway - The rogue server provides an invalid gateway, or its
own IP address, to create a man-in-the-middle attack. This may go entirely
undetected as the intruder intercepts the data flow through the network and then
forwards it on to the real default gateway.
o Wrong DNS server - The rogue server provides an incorrect DNS server
address that points the user to a nefarious website.
o Wrong IP address - The rogue server provides an invalid IP address which
effectively creates a DoS attack on the DHCP client.
An example and explanation of a DHCP spoofing attack now follows…
Step 1
Threat Actor Connects Rogue DHCP Server
A threat actor successfully connects a rogue DHCP server to a switch port on the same
subnet and VLANs as the target clients. The goal of the rogue server is to provide
clients with false IP configuration information.
Step 2
Client Broadcasts DHCP Discovery Messages
The legitimate DHCP server responds with valid IP configuration parameters. However,
the rogue server also responds with a DHCP offer containing IP configuration
parameters defined by the threat actor. The client will reply to the first offer received.
Step 4
Client Accepts Rogue DHCP Offer
The rogue offer was received first, and therefore, the client broadcasts a DHCP request
accepting the IP parameters defined by the threat actor. The legitimate and rogue server
will receive the request.
Step 5
Rogue Server Acknowledges
The rogue server unicasts a reply to the client to acknowledge its request. The
legitimate server will cease communicating with the client.
14.5.2 DHCP ATTACKS MITIGATION
Note: In a large network, the DHCP binding table may take time to build after it is
enabled. For example, it could take 2 days for DHCP snooping to complete the table if
DHCP lease time is 4 days.
When DHCP snooping is enabled on an interface or VLAN, and a switch receives a
packet on an untrusted port, the switch compares the source packet information with
that held in the DHCP snooping binding table. The switch will deny packets containing
specific information:
o Unauthorized DHCP server messages from an untrusted port
o Unauthorized DHCP client messages not adhering to the snooping binding table
or rate limits
o DHCP relay-agent packets that include option-82 information on an untrusted
port
Note: To counter Gobbler using the same MAC address, DHCP snooping also makes
the switch check the Client Hardware Address (CHADDR) field in the DHCP request.
This ensures that it matches the hardware MAC address in the DHCP snooping binding
table and the MAC address in the MAC table. If there is no match, the request is
dropped.
Note: Similar mitigation techniques are available for DHCPv6 and IPv6 clients.
Because IPv6 devices can also receive their addressing information from the router’s
Router Advertisement (RA) message, there are also mitigation solutions to prevent any
rogue RA messages.
The reference topology for this DHCP snooping example is shown in the figure. Notice
that F0/5 is an untrusted port because it connects to a PC. F0/1 is a trusted port because
it connects to the DHCP server.
The following is an example of how to configure DHCP snooping on S1. Notice how
DHCP snooping is first enabled. Then the upstream interface to the DHCP server is
explicitly trusted. Next, the range of FastEthernet ports from F0/5 to F0/24 are untrusted
by default, so a rate limit is set to six packets per second. Finally, DHCP snooping is
enabled on VLANS 5, 10, 50, 51, and 52.
S1(config)# ip dhcp snooping
S1(config)# interface f0/1
S1(config-if)# ip dhcp snooping trust
S1(config-if)# exit
S1(config)# interface range f0/5 - 24
S1(config-if-range)# ip dhcp snooping limit rate 6
S1(config-if-range)# exit
S1(config)# ip dhcp snooping vlan 5,10,50-52
S1(config)# end
S1#
Use the show ip dhcp snooping privileged EXEC command to verify DHCP snooping
and show ip dhcp snooping binding to view the clients that have received DHCP
information, as shown in the example.
Note: DHCP snooping is also required by Dynamic ARP Inspection (DAI), which is the
next topic.
S1# show ip dhcp snooping
Switch DHCP snooping is enabled
DHCP snooping is configured on following VLANs:
5,10,50-52
DHCP snooping is operational on following VLANs:
none
DHCP snooping is configured on the following L3 Interfaces:
Insertion of option 82 is enabled
circuit-id default format: vlan-mod-port
remote-id: 0cd9.96d2.3f80 (MAC)
Option 82 on untrusted port is not allowed
Verification of hwaddr field is enabled
Verification of giaddr field is enabled
DHCP snooping trust/rate is configured on the following Interfaces:
Interface Trusted Allow option Rate limit
(pps)
----------------------- ------- ------------
----------------
FastEthernet0/1 yes yes unlimited
Custom circuit-ids:
FastEthernet0/5 no no 6
Custom circuit-ids:
FastEthernet0/6 no no 6
Custom circuit-ids:
S1# show ip dhcp snooping binding
MacAddress IpAddress Lease(sec) Type VLAN
Interface
------------------ --------------- ---------- ------------- ----
--------------------
00:03:47:B5:9F:AD 192.168.10.11 193185 dhcp-snooping 5
FastEthernet0/5
Recall that hosts broadcast ARP Requests to determine the MAC address of a host with
a particular IPv4 address. This is typically done to discover the MAC address of the
default gateway. All hosts on the subnet receive and process the ARP Request. The host
with the matching IPv4 address in the ARP Request sends an ARP Reply.
According to the ARP RFC, a client is allowed to send an unsolicited ARP Request
called a “gratuitous ARP.” When a host sends a gratuitous ARP, other hosts on the
subnet store the MAC address and IPv4 address contained in the gratuitous ARP in their
ARP tables.
The problem is that an attacker can send a gratuitous ARP message containing a
spoofed MAC address to a switch, and the switch would update its MAC table
accordingly. Therefore, any host can claim to be the owner of any IP and MAC address
combination they choose. In a typical attack, a threat actor can send unsolicited ARP
Replies to other hosts on the subnet with the MAC Address of the threat actor and the
IPv4 address of the default gateway.
There are many tools available on the internet to create ARP man-in-the-middle attacks
including dsniff, Cain & Abel, ettercap, Yersinia, and others. IPv6 uses ICMPv6
Neighbor Discovery Protocol for Layer 2 address resolution. IPv6 includes strategies to
mitigate Neighbor Advertisement spoofing, similar to the way IPv6 prevents a spoofed
ARP Reply.
ARP spoofing and ARP poisoning are mitigated by implementing Dynamic ARP
Inspection (DAI).
Now follows an example and explanation of ARP spoofing and ARP poisoning
Step 1
Normal State with Converged MAC Tables
Each device has an accurate MAC table with the correct IPv4 and MAC addresses for
the other devices on the LAN.
Step 2
ARP Spoofing Attack
The threat actor sends two spoofed gratuitous ARP Replies in an attempt to replace R1
as the default gateway:
o 1. The first one informs all devices on the LAN that the threat actor’s MAC
address (CC:CC:CC) maps to R1’s IPv4 address, 10.0.0.1.
o 2. The second one informs all devices on the LAN that the threat actor’s MAC
address (CC:CC:CC) maps to PC1’s IPv4 address, 10.0.0.11.
Step 3
ARP Poisoning Attack with Man-in-the-Middle Attack
R1 and PC1 remove the correct entry for each other’s MAC address and replace it with
PC2’s MAC address. The threat actor has now poisoned the ARP caches of all devices
on the subnet. ARP poisoning leads to various man-in-the-middle attacks, posing a
serious security threat to the network.
In a typical ARP attack, a threat actor can send unsolicited ARP requests to other hosts
on the subnet with the MAC Address of the threat actor and the IP address of the default
gateway. To prevent ARP spoofing and the resulting ARP poisoning, a switch must
ensure that only valid ARP Requests and Replies are relayed.
Dynamic ARP inspection (DAI) requires DHCP snooping and helps prevent ARP
attacks by:
o Not relaying invalid or gratuitous ARP Requests out to other ports in the same
VLAN
o Intercepting all ARP Requests and Replies on untrusted ports
o Verifying each intercepted packet for a valid IP-to-MAC binding
o Dropping and logging ARP Requests coming from invalid sources to prevent
ARP poisoning
o Error-disabling the interface if the configured DAI number of ARP packets is
exceeded
14.6.4 DAI IMPLEMENTATION GUIDELINES
To mitigate the chances of ARP spoofing and ARP poisoning, follow these DAI
implementation guidelines:
o Enable DHCP snooping globally.
o Enable DHCP snooping on selected VLANs.
o Enable DAI on selected VLANs.
o Configure trusted interfaces for DHCP snooping and ARP inspection.
It is generally advisable to configure all access switch ports as untrusted and to
configure all uplink ports that are connected to other switches as trusted.
The sample topology in the figure identifies trusted and untrusted ports.
In the previous topology, S1 is connecting two users on VLAN 10. DAI will be
configured to mitigate against ARP spoofing and ARP poisoning attacks.
As shown in the example, DHCP snooping is enabled because DAI requires the DHCP
snooping binding table to operate. Next, DHCP snooping and ARP inspection are
enabled for the PCs on VLAN10. The uplink port to the router is trusted, and therefore,
is configured as trusted for DHCP snooping and ARP inspection.
S1(config)# ip dhcp snooping
S1(config)# ip dhcp snooping vlan 10
S1(config)# ip arp inspection vlan 10
S1(config)# interface fa0/24
S1(config-if)# ip dhcp snooping trust
S1(config-if)# ip arp inspection trust
DAI can also be configured to check for both destination or source MAC and IP
addresses:
o Destination MAC - Checks the destination MAC address in the Ethernet
header against the target MAC address in the ARP packet body
o Source MAC - Checks the source MAC address in the Ethernet header against
the sender MAC address in the ARP packet body
o IP address - Checks the ARP packet body for invalid and unexpected IP
addresses including addresses 0.0.0.0, 255.255.255.255, and all IP multicast
addresses
The ip arp inspection validate {src-mac [dst-mac] [ip]} global configuration
command is used to configure DAI to drop ARP packets when the IP addresses are
invalid. It can be used when the MAC addresses in the body of the ARP packets do not
match the addresses that are specified in the Ethernet header. Notice in the following
example how only one command can be configured. Therefore, entering multiple ip arp
inspection validate commands overwrites the previous command. To include more
than one validation method, enter them on the same command line as shown and
verified in the following output.
S1(config)# ip arp inspection validate ?
dst-mac Validate destination MAC address
ip Validate IP addresses
src-mac Validate source MAC address
S1(config)# ip arp inspection validate src-mac
S1(config)# ip arp inspection validate dst-mac
S1(config)# ip arp inspection validate ip
S1(config)# do show run | include validate
ip arp inspection validate ip
S1(config)# ip arp inspection validate src-mac dst-mac ip
S1(config)# do show run | include validate
ip arp inspection validate src-mac dst-mac ip
S1(config)#
MAC addresses and IP addresses can be spoofed for a variety of reasons. Spoofing
attacks occur when one host poses as another to receive otherwise inaccessible data, or
to circumvent security configurations.
The method used by switches to populate the MAC address table leads to a
vulnerability known as MAC address spoofing. MAC address spoofing attacks occur
when attackers alter the MAC address of their host to match another known MAC
address of a target host, as shown in the figure. The attacking host then sends a frame
throughout the network with the newly-configured MAC address.
When the switch receives the frame, it examines the source MAC address. The switch
overwrites the current MAC table entry and assigns the MAC address to the new port,
as shown in the figure below. It then inadvertently forwards frames destined for the
target host to the attacking host.
When the switch changes the MAC table, the target host does not receive any traffic
until it sends traffic. When the target host sends traffic, the switch receives and
examines the frame, resulting in the MAC table being rewritten once more, realigning
the MAC address to the original port. To stop the switch from returning the spoofed
MAC address port assignments to their correct state, the attacking host can create a
program or script that will constantly send frames to the switch so that the switch
maintains the incorrect or spoofed information. There is no security mechanism at
Layer 2 that allows a switch to verify the source of MAC addresses, which is what
makes it so vulnerable to spoofing.
IP address spoofing is when a rogue PC hijacks a valid IP address of a neighbor, or a
uses a random IP address. IP address spoofing is difficult to mitigate, especially when it
is used inside a subnet in which the IP belongs.
To protect against MAC and IP address spoofing, configure the IP Source Guard
(IPSG) security feature. IPSG operates just like DAI, but it looks at every packet, not
just the ARP packets. Like DAI, IPSG also requires that DHCP snooping be enabled.
Specifically, IPSG is deployed on untrusted Layer 2 access and trunk ports. IPSG
dynamically maintains per-port VLAN ACLs (PVACL) based on IP-to-MAC-to-
switch-port bindings. Initially, all IP traffic on the port is blocked, except for DHCP
packets that are captured by the DHCP snooping process. A PVACL is installed on the
port when a client receives a valid IP address from the DHCP server or when a static IP
source binding is configured by the user.
This process restricts the client IP traffic to those source IP addresses that are
configured in the binding. Any IP traffic with a source IP address other than that in the
IP source binding will be filtered out. This filtering limits the ability of a host to attack
the network by claiming the IP address of a neighbor host.
For each untrusted port, there are two possible levels of IP traffic security filtering:
o Source IP address filter - IP traffic is filtered based on its source IP address
and only IP traffic with a source IP address that matches the IP source binding
entry is permitted. When a new IP source entry binding is created or deleted on
the port, the PVACL automatically adjusts itself to reflect the IP source binding
change.
o Source IP and MAC address filter - IP traffic is filtered based on its source IP
address in addition to its MAC address. Only IP traffic with source IP and
MAC addresses that match the IP source binding entry are permitted.
Examine the IP Source Guard reference topology that is shown in the figure.
IP Source Guard is enabled on untrusted ports using the ip verify source command as
shown in the configuration below. Remember that the feature can only be configured on
a Layer 2 access or trunk port and that DHCP snooping is required to learn valid IP
address and MAC address pairs.
S1(config)# interface range fastethernet 0/1 - 2
S1(config-if-range)# ip verify source
S1(config-if-range)# end
S1#
Use the show ip verify source command to verify the IP Source Guard configuration,
as shown below. In the example, the F0/1 and F0/2 ports are configured with IP Source
Guard. Each interface has one valid DHCP binding
S1# show ip verify source
Interface Filter-type Filter-mode IP-address Mac-address
Vlan
--------- ----------- ----------- ---------------
----------------- ----
F0/1 ip active 192.168.10.10
10
F0/2 ip active 192.168.10.11
10
S1#
Spanning Tree Protocol (STP) is a loop-prevention network protocol that allows for
redundancy while creating a loop-free Layer 2 topology. IEEE 802.1D is the original
IEEE MAC Bridging standard for STP.
Watch the video to see STP in action.
Watch the video to view an animation of STP recalculation when a failure occurs.
Without STP enabled, Layer 2 loops can form, causing broadcast, multicast and
unknown unicast frames to loop endlessly. This can bring down a network within a very
short amount of time, sometimes in just a few seconds. For example, broadcast frames,
such as an ARP Request are forwarded out all of the switch ports, except the original
ingress port. This ensures that all devices in a broadcast domain are able to receive the
frame. If there is more than one path for the frame to be forwarded out of, an endless
loop can result. When a loop occurs, the MAC address table on a switch will constantly
change with the updates from the broadcast frames, which results in MAC database
instability. This can cause high CPU utilization, which makes the switch unable to
forward frames.
Broadcast frames are not the only type of frames that are affected by loops. Unknown
unicast frames sent onto a looped network can result in duplicate frames arriving at the
destination device. An unknown unicast frame is when the switch does not have the
destination MAC address in its MAC address table and must forward the frame out all
ports, except the ingress port.
There is an animation.
The spanning tree algorithm designates a single switch as the root bridge and uses it as
the reference point for all path calculations. In the figure, the root bridge (switch S1) is
chosen through an election process. All switches that participate in STP exchange
BPDU frames to determine which switch has the lowest bridge ID (BID) on the
network. The switch with the lowest BID automatically becomes the root bridge for the
spanning tree algorithm calculations.
Note: For simplicity, assume until otherwise indicated that all ports on all switches are
assigned to VLAN 1. The switches are configured with the default PVST+. Each switch
has a unique MAC address associated with VLAN 1.
A BPDU is a messaging frame that is exchanged by switches for STP. Each BPDU
contains a BID that identifies the switch that sent the BPDU. The BID contains a
priority value, the MAC address of the sending switch, and an optional extended system
ID. The lowest BID value is determined by the combination of these three fields.
After the root bridge has been determined, the spanning tree algorithm calculates the
shortest path to it. Each switch uses the spanning tree algorithm to determine which
ports to block. While the spanning tree algorithm determines the best paths to the root
bridge for all switch ports in the broadcast domain, traffic is prevented from being
forwarded through the network. The spanning tree algorithm considers both path and
port costs when determining which ports to block. The path costs are calculated using
port cost values associated with port speeds for each switch port along a given path. The
sum of the port cost values determines the overall path cost to the root bridge. If there is
more than one path to choose from, spanning tree algorithm chooses the path with the
lowest path cost.
When the spanning tree algorithm has determined which paths are most desirable
relative to each switch, it assigns port roles to the participating switch ports. The STP
port roles are:
o Alternate - Alternate or backup ports are configured to be in a blocking state to
prevent loops. Alternate ports are selected only on trunk links where neither end
is a root port.
o Root - Root ports are switch ports that are closest to the root bridge.
o Designated - Designated ports are all non-root ports that STP permits to
forward traffic on the network. Designated ports are selected on a per-trunk
basis. If one end of a trunk is a root port, then the other end is a designated port.
All ports on the root bridge are designated ports
The figure above shows the relationship of the port roles in the network to the root
bridge and whether they are allowed to forward traffic. In the figure, only one end of
Trunk2 is blocked. This allows for faster transition to a forwarding state when a change
in the network makes it necessary.
Note: A port that is administratively shut down is referred to as a disabled port.
As shown in the figure, every spanning tree instance (switched LAN or broadcast
domain) has a switch designated as the root bridge. The root bridge serves as a
reference point for all spanning tree calculations to determine which redundant paths to
block.
An election process determines which switch becomes the root bridge.
The figure below shows the BID fields. The BID is made up of a priority value, an
extended system ID, and the MAC address of the switch.
All switches in the broadcast domain participate in the election process. After a switch
boots, it begins to send out BPDU frames every two seconds. These BPDU frames
contain the switch BID and the root ID.
As the switches forward their BPDU frames, switches in the broadcast domain read the
root ID information from the BPDU frames. If the root ID from a BPDU that has been
received is lower than the root ID on the receiving switch, then the receiving switch
updates its root ID, which identifies the adjacent switch as the root bridge. The switch
then forwards new BPDU frames with the lower root ID to the other switches.
Eventually, the switch with the lowest BID ends up being identified as the root bridge
for the spanning tree instance.
There is a root bridge elected for each spanning tree instance. It is possible to have
multiple distinct root bridges. If all ports on all switches are members of VLAN 1, then
there is only one spanning tree instance. The extended system ID plays a role in how
spanning tree instances are determined.
When the root bridge has been elected for the spanning tree instance, the spanning tree
algorithm starts the process of determining the best paths to the root bridge from all
destinations in the broadcast domain. The path information is determined by summing
up the individual port costs along the path from the destination to the root bridge. Each
“destination” is actually a switch port.
The default port costs are defined by the speed at which the port operates. As shown in
the table, 10 Gb/s Ethernet ports have a port cost of 2, 1 Gb/s Ethernet ports have a port
cost of 4, 100 Mb/s Fast Ethernet ports have a port cost of 19, and 10 Mb/s Ethernet
ports have a port cost of 100.
Link
Speed
Cost (Revised IEEE Specification) Cost (Previous IEEE Specification)
and
Name
10 2 1
Link
Speed
Cost (Revised IEEE Specification) Cost (Previous IEEE Specification)
and
Name
Gb/s
1 Gb/s 4 1
100
19 10
Mb/s
10
100 100
Mb/s
Note: As newer, faster Ethernet technologies become available, the path cost values
may change to accommodate the new speeds. The non-linear numbers in the table
accommodate some improvements to the older Ethernet standard. The values have
changed to accommodate the 10 Gb/s Ethernet standard. To illustrate the continued
change associated with high-speed networking, Catalyst 4500 and 6500 switches
support a longer path cost method; for example, 10 Gb/s has a 2000 path cost, 100 Gb/s
has a 200 path cost, and 1 Tb/s has a 20 path cost.
Although switch ports have a default port cost associated with them, the port cost is
configurable. The ability to configure individual port costs gives the administrator the
flexibility to manually control the spanning tree paths to the root bridge.
To configure the port cost of an interface enter the spanning-tree cost value command
in interface configuration mode. The value can be between 1 and 200,000,000.
In the example below, switch port F0/1 has been configured with a port cost of 25 using
the spanning-tree cost 25 interface configuration mode command on the F0/1
interface.
S2# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
S2(config)# interface f0/1
S2(config-if)# spanning-tree cost 25
S2(config-if# end
S2#
To restore the port cost back to the default value of 19, enter the no spanning-tree
cost interface configuration mode command.
S2# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
S2(config)# interface f0/1
S2(config-if)# no spanning-tree cost
S2(config-if)# end
S2#
The path cost is equal to the sum of all the port costs along the path to the root bridge.
Paths with the lowest cost become preferred, and all other redundant paths are blocked.
In the example below, the path cost from S2 to the root bridge S1, over Path 1 is 19
(based on the IEEE-specified individual port cost), while the path cost over Path 2 is
two times 19, or 38. Because Path 1 has a lower overall path cost to the root bridge, it is
the preferred path. STP then configures the redundant path to be blocked, preventing a
loop from occurring.
To verify the port and path cost to the root bridge, enter the show spanning-
tree command. The Cost field is the total path cost to the root bridge. This value
changes depending on how many switch ports must be traversed to get to the root
bridge. In the output below, each interface is also identified with an individual port cost
of 19.
S2# show spanning-tree
VLAN001
Spanning tree enabled protocol ieee
Root ID Priority 27577
Address 000A.0033.3333
Cost 19
Port 1
Hello Time 2 sec Max Age 20 sec Forward Delay 15
sec
When an administrator wants a specific switch to become a root bridge, the bridge
priority value must be adjusted to ensure it is lower than the bridge priority values of all
the other switches on the network. There are two different methods to configure the
bridge priority value on a Cisco Catalyst switch.
Now follow examples of the two methods of configuring bridge priority and how to verify that a
bridge is acting as root
Method 1
To ensure that the switch has the lowest bridge priority value, use the spanning-tree
vlan vlan-id root primary command in global configuration mode. The priority for the
switch is set to the predefined value of 24,576 or to the highest multiple of 4,096, less
than the lowest bridge priority detected on the network.
If an alternate root bridge is desired, use the spanning-tree vlan vlan-id root
secondary global configuration mode command. This command sets the priority for the
switch to the predefined value of 28,672. This ensures that the alternate switch becomes
the root bridge if the primary root bridge fails. This assumes that the rest of the switches
in the network have the default 32,768 priority value defined.
In this example, S1 has been assigned as the primary root bridge using the spanning-
tree vlan 1 root primary command, and S2 has been configured as the secondary root
bridge using the spanning-tree vlan 1 root secondary command.
S1(config)# spanning-tree VLAN 1 root primary
S1(config)# end
-----------------------
S2(config)# spanning-tree root secondary
S2(config)# end
Method 2
Another method for configuring the bridge priority value is using the spanning-tree
vlan vlan-id priority value global configuration mode command. This command gives
more granular control over the bridge priority value. The priority value is configured in
increments of 4,096 between 0 and 61,440.
In the example, S3 has been assigned a bridge priority value of 24,576 for VLAN 1
using the spanning-tree vlan 1 priority 24576 command. This is the equivalent value
of the root primary setting.
S3(config)# spanning-tree VLAN 1 priority 24576
To verify the bridge priority of a switch, use the show spanning-tree command. In
example in Method 2, the priority of the switch was set to 24,576. Also notice that the
switch is designated as the root bridge for the spanning tree instance.
S3# show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 00A.0033.3333
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
Address 000A.0033.3333
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Threat actors can manipulate the Spanning Tree Protocol (STP) to conduct an attack by
spoofing the root bridge and changing the topology of a network. Attackers can make
their hosts appear as root bridges; and therefore, capture all traffic for the immediate
switched domain.
To conduct an STP manipulation attack, the attacking host broadcasts STP bridge
protocol data units (BPDUs) containing configuration and topology changes that will
force spanning-tree recalculations, as shown in the figure. The BPDUs that are sent by
the attacking host announce a lower bridge priority in an attempt to be elected as the
root bridge.
Note: These issues can occur when someone adds an Ethernet switch to the network
without any malicious intent.
If successful, the attacking host becomes the root bridge, as shown in the figure below,
and can now capture a variety of frames that would otherwise not be accessible.
This STP attack is mitigated by implementing BPDU Guard on all access ports.
To mitigate STP manipulation attacks, use the Cisco STP stability mechanisms to
enhance the overall performance of the switches and to reduce the time that is lost
during topology changes.
These are the STP stability mechanisms:
o PortFast - PortFast immediately brings an interface that is configured as an
access or trunk port to the forwarding state from a blocking state. This bypasses
the listening and learning states. It should be applied to all end-user ports.
PortFast should only be configured when there is a host attached to the port,
and not another switch.
o BPDU Guard - BPDU guard immediately error disables a port that receives a
BPDU. It is typically used on PortFast enabled ports. Apply to all end-user
ports.
o Root Guard - Root guard prevents an inappropriate switch from becoming the
root bridge. Root guard limits the switch ports out of which the root bridge may
be negotiated. Apply to all ports which should not become root ports.
o Loop Guard - Loop guard prevents alternate or root ports from becoming
designated ports because of a failure that leads to a unidirectional link. Apply to
all ports that are or can become non-designated.
These features enforce the placement of the root bridge in the network and enforce the
STP domain borders.
The figure highlights the ports on which these features should be implemented.
14.9.3 CONFIGURE PORTFAST
PortFast bypasses the STP listening and learning states to minimize the time that access
ports must wait for STP to converge. If PortFast is enabled on a port connecting to
another switch, there is a risk of creating a spanning-tree loop.
PortFast can be enabled on an interface by using the spanning-tree portfast interface
configuration command. Alternatively, Portfast can be configured globally on all access
ports by using the spanning-tree portfast default global configuration command.
To verify whether PortFast is enabled globally you can use either the show running-
config | begin span command or the show spanning-tree summary command. To
verify if PortFast is enabled on an interface, use the show running-config
interface type/number command, as shown in the following example.
The show spanning-tree interface type/number detail command can also be used for
verification.
Notice the warning messages that are displayed when PortFast is enabled.
S1(config)# interface fa0/1
S1(config-if)# switchport mode access
S1(config-if)# spanning-tree portfast
%Warning: portfast should only be enabled on ports connected to a
single
host. Connecting hubs, concentrators, switches, bridges, etc... to
this
interface when portfast is enabled, can cause temporary bridging
loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/1 but will only
have effect when the interface is in a non-trunking mode.
S1(config-if)# exit
S1(config)# spanning-tree portfast default
%Warning: this command enables portfast by default on all
interfaces. You
should now disable portfast explicitly on switched ports leading
to hubs,
switches and bridges as they may create temporary bridging loops.
S1(config)# exit
S1# show running-config | begin span
spanning-tree mode pvst
spanning-tree portfast default
spanning-tree extend system-id
!
interface FastEthernet0/1
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
(output omitted)
S1#
Even though PortFast is enabled, the interface will still listen for BPDUs. Unexpected
BPDUs might be accidental, or part of an unauthorized attempt to add a switch to the
network.
If any BPDUs are received on a BPDU Guard enabled port, that port is put into error-
disabled state. This means the port is shut down and must be manually re-enabled or
automatically recovered through the errdisable recovery cause bpduguard global
command.
BPDU Guard can be enabled on a port by using the spanning-tree bpduguard
enable interface configuration command. Alternatively, use the spanning-tree portfast
bpduguard default global configuration command to globally enable BPDU guard on
all PortFast-enabled ports.
To display information about the state of spanning tree, use the show spanning-tree
summary command. In the example, PortFast default and BPDU Guard are both
enabled as the default state for ports that are configured in access mode.
Note: Always enable BPDU Guard on all PortFast-enabled ports.
S1(config)# interface fa0/1
S1(config-if)# spanning-tree bpduguard enable
S1(config-if)# exit
S1(config)# spanning-tree portfast bpduguard default
S1(config)# end
S1# show spanning-tree summary
Switch is in pvst mode
Root bridge for: none
Extended system ID is enabled
Portfast Default is enabled
PortFast BPDU Guard Default is enabled
Portfast BPDU Filter Default is disabled
Loopguard Default is disabled
EtherChannel misconfig guard is enabled
UplinkFast is disabled
BackboneFast is disabled
Configured Pathcost method used is short
(output omitted)
S1#
There are some switches in a network that should never, under any circumstances,
become the STP root bridge. Root Guard provides a way to enforce the placement of
root bridges in the network by limiting which switch can become the root bridge.
Root guard is best deployed on ports that connect to switches that should not be the root
bridge. If a root-guard-enabled port receives BPDUs that are superior to those that the
current root bridge is sending, that port is moved to a root-inconsistent state. This is
effectively equal to an STP listening state, and no data traffic is forwarded across that
port. Recovery occurs as soon as the offending device ceases to send superior BPDUs.
Use the spanning-tree guard root interface configuration command to configure root
guard on an interface.
In the figure, D1 is the root bridge. If D1 fails, only D2 switch should become the root
bridge. To ensure that S1 never becomes a root bridge, the F0/1 interfaces of D1 and D2
should be enabled for Root guard.
To view Root Guard ports that have received superior BPDUs and are in a root-
inconsistent state, use the show spanning-tree inconsistent ports command.
Note: Root guard may seem unnecessary because an administrator can manually set the
bridge priority of a switch to zero. However, this does not guarantee that this switch
will be elected as the root bridge. Another switch may still become the root if it also has
a priority of zero and a lower MAC address.
Traffic on bidirectional links flows in both directions. If for some reason one-direction
traffic flow fails, this creates a unidirectional link which can result in a Layer 2 loop.
STP relies on continuous reception or transmission of BPDUs based on the port role.
The designated port transmits BPDUs, and the non-designated port receives BPDUs. A
Layer 2 loop is usually created when an STP port in a redundant topology stops
receiving BPDUs and erroneously transitions to the forwarding state.
The STP Loop Guard feature provides additional protection against Layer 2 loops. If
BPDUs are not received on a non-designated Loop Guard-enabled port, the port
transitions to a loop-inconsistent blocking state, instead of the listening / learning /
forwarding state. Without the Loop Guard feature, the port would assume a designated
port role and create a loop.
As shown here, Loop Guard is enabled on all non-Root Guard ports using
the spanning-tree guard loop interface configuration command.
Note: Loop Guard can also be enabled globally using the spanning-tree loopguard
default global configuration command. This enables Loop Guard on all point-to-point
links.
14.10 LAYER 2 SECURITY CONSIDERATIONS SUMMARY
14.10.1 WHAT DID I LEARN IN THIS MODULE?
Layer 2 Security Threats
Security is implemented at all layers of the OSI model. However, if Layer 2 is disrupted
by a cyber attack, all layers above it will be affected. There are a number of attacks that
can happen at Layer 2 including MAC table attacks, VLAN attacks, DHCP attacks,
ARP attacks, address spoofing attacks, and STP attacks. It is important to protect Layer
2 by always using secure variants of protocols such as SSH, SCP, and SSL. Using out-
of-band management whenever possible and creating a dedicated VLAN for
management traffic are also means to make successful Layer 2 attacks less likely. In
addition, ACLs should be used to filter unwanted access. Port security, DHCP
Snooping, DAI, and IP Source Guard are available on Cisco switches to directly
mitigate Layer 2 attacks.
MAC Table Attacks
Layer 2 switches use MAC addresses to make forwarding decisions. The switch uses a
MAC table that maps MAC addresses to switchports. The switch looks for the
destination MAC address in the MAC table for the frames that it receives. It then
forwards the traffic to the corresponding port. If the switch does not recognize a
destination MAC address, it floods the frames for the unknown destination out of all
ports except the port from which the frames originated. These are called unknown
unicast messages. The switch dynamically learns MAC addresses from the source
addresses of the frames that originate on its ports. One type of Layer 2 attack floods the
switch with frames with random MAC source addresses. The switch attempts to add all
of these frames to the MAC table until the table is full. Subsequent frames are then
treated as unknown unicast messages and sent out all but the receiving port. Since these
frames are flooded, a threat actor can receive all traffic that is sent on the network.
Threat actor tools such as macof can quickly overwhelm the MAC table of a switch
causing a MAC table overflow exploit. Because the flooding of unknown unicast
addresses can include trunk ports to other switches, the exploit can cause widespread
disruptions.
Mitigate MAC Table Attacks
VLANs may be used to separate sensitive traffic from other traffic. VLAN hopping and
VLAN double-tagging attacks enable threat actors to access VLANs that they are not
authorized to access. In VLAN hopping attacks, a threat actor connects a host computer
to a switch and then attempts to negotiate the switchport to become trunk using DTP.
The threat actor computer attempts to act as another switch that is connected by a trunk.
Trunks carry traffic for all VLANs by default, so if a threat actor can connect a
computer over a trunked link, all VLAN traffic can be intercepted. In VLAN double-
tagging attacks, a threat actor adds a false VLAN tag to malicious traffic in addition to
the legitimate tag. This can allow a threat actor to send unauthorized traffic into other
VLANs. VLAN hopping and double-tagging attacks can be mitigated by disabling
trunking and trunk negotiation on all switchports that are to be accessed by users, and
by ensuring that the native VLAN is only used on trunk links. Private VLAN
promiscuous ports can be vulnerable to PVLAN proxy attacks in which a threat actor
can spoof the destination MAC address of the default gateway router. The router will
then permit the unauthorized traffic to enter the target VLANs. PVLAN proxy attacks
can be mitigated through the use of access control lists.
Mitigate DHCP Attacks
Two types of DHCP attacks are DHCP starvation and DHCP spoofing. Both attacks are
mitigated by implementing DHCP snooping. The goal of the DHCP starvation attack is
DoS for connecting clients. DHCP starvation attacks require an attack tool such as
Gobbler. A DHCP spoofing attack occurs when a rogue DHCP server is connected to
the network and provides false IP configuration parameters to legitimate clients. It is
easy to mitigate DHCP starvation attacks by using port security. DHCP spoofing attacks
can be mitigated using DHCP snooping on trusted ports. DHCP snooping also helps
mitigate DHCP starvation attacks by rate limiting the number of DHCP discovery
messages that an untrusted port can receive. DHCP snooping builds and maintains a
DHCP snooping binding database that the switch can use to filter DHCP messages from
untrusted sources. DHCP snooping is globally activated. Ports that are connected to
legitimate DHCP servers are then configured as trusted. In addition, untrusted ports can
be configured to rate limit DHCP requests.
Mitigate ARP Attacks
According to the ARP RFC, a client can send gratuitous ARP requests. When other
hosts on the subnet receive a gratuitous ARP request, the hosts store the MAC address
and IPv4 address contained in the gratuitous ARP in their ARP tables. An attacker can
send a gratuitous ARP message containing a spoofed MAC address to a switch, and the
switch would update its MAC table accordingly. Therefore, any host can claim to be the
owner of any IP and MAC address. In a typical attack, a threat actor can send
unsolicited ARP Replies to other hosts on the subnet with the MAC Address of the
threat actor and the IPv4 address of the default gateway. Address spoofing attacks occur
when threat actors craft packets that contain false IP or MAC addresses. MAC address
spoofing attacks occur when threat actors alter the MAC address of their host to match
another known MAC address of a target host. A spoofed MAC address can cause a
switch to send packets that are intended for another host to the threat actor PC. This can
be especially problematic when the spoofed MAC address is that of the default
gateway. DAI can mitigate ARP spoofing by ensuring that only valid ARP Requests
and Replies are sent into the network. DAI requires that DHCP snooping is globally
configured. DAI can be configured on trusted interfaces and VLANs.
Mitigate Address Spoofing Attacks
Spoofing attacks occur when one host poses as another to receive otherwise
inaccessible data, or to circumvent security configurations. MAC address spoofing
attacks occur when attackers alter the MAC address of their host to match another
known MAC address of a target host. When a switch receives the spoofed frames, it
switch overwrites the current MAC table entry and assigns the MAC address to the new
port. A threat actor computer can now receive traffic that was intended for the host with
the spoofed address. IP address spoofing is when a rogue PC hijacks a valid IP address
of a neighbor, or a uses a random IP address. IP address spoofing is difficult to mitigate,
especially when it is used inside a subnet in which the IP belongs. To protect against
MAC and IP address spoofing, configure IPSG. IPSG operates like DAI, but it looks at
every packet, not just the ARP packets. Like DAI, IPSG also requires that DHCP
snooping be enabled. For each untrusted port, a source IP address or source IP and
MAC address filter can be configured.
Spanning Tree protocol
STP is a loop-prevention network protocol that allows for redundancy while creating a
loop-free Layer 2 topology. Without STP enabled, Layer 2 loops can form, causing
broadcast, multicast and unknown unicast frames to loop endlessly. This can bring
down a network within a very short amount of time, sometimes in just a few seconds.
The spanning tree algorithm designates a single switch as the root bridge and uses it as
the reference point for path calculations. Spanning tree algorithm calculates the shortest
path to the root bridge and enables forwarding on trunks that form the best path.
Alternate ports are blocked. Designated ports are all non-root ports that spanning tree
permits to forward traffic. If a path become unavailable, spanning tree then enables the
alternate ports to forward traffic. Spanning tree uses bridge protocol data units to
communicate between switches in a spanning tree topology.
Mitigating STP Attacks
Threat actors can manipulate the STP to conduct an attack by spoofing the root bridge
and changing the topology of a network. Attackers can make their hosts appear as root
bridges; and therefore, capture all traffic for the immediate switched domain. Cisco
switches have a number of STP stability mechanisms such as PortFast, BPDU Guard,
Root Guard, and Loop Guard. PortFast enables access ports to go to spanning-tree
forwarding state without go through the transitional spanning-tree states. BPDU guard
immediately error disables a port that receives a BPDU. This is configured on non-
trunking ports that typically have PortFast enabled. Root Guard prevents an
inappropriate switch from becoming the root bridge. Loop guard prevents alternate or
root ports from becoming designated ports because of a failure that leads to a
unidirectional link.
MODULE 15
15.1 SECURE COMMUNICATIONS
15.1.1 AUTHENTICATION, INTEGRITY, AND CONFIDENTIALITY
To ensure secure communications across both the public and private infrastructure, the
network administrator’s first goal is to secure the network infrastructure, including
routers, switches, servers, and hosts.
This can be accomplished using device hardening, AAA access control, ACLs,
firewalls, monitoring threats using IPS, securing endpoints using Advanced Malware
Protection (AMP), and enforcing email and web security using the Cisco Email Security
Appliance (ESA) and Cisco Web Security Appliance (WSA).
The figure shows an example of a secure network topology.
The next goal is to secure the data as it travels across various links. This may include
internal traffic, but of greater concern is protecting the data that travels outside of the
organization to branch sites, telecommuter sites, and partner sites.
There are three primary objectives of securing communications:
o Authentication - This guarantees that the message is not a forgery and actually
comes from the authentic source. Modern networks ensure authentication using
hash message authentication code (HMAC).
o Integrity - This guarantees that no one intercepted the message and altered it;
similar to a checksum function in a frame. This is provided by implementing
the SHA-2 or SHA-3 family of hash-generating algorithms.
o Confidentiality - This guarantees that if the message is captured, it cannot be
deciphered. This is provided using symmetric or asymmetric encryption
algorithms.
Note: These primary objectives are similar but not identical to the three primary issues
in securing and maintaining a computer network which are confidentiality, integrity,
and availability.
The most popular symmetric encryption algorithm is the Advanced Encryption
Standard (AES). Symmetric encryption algorithms are based on the premise that each
communicating party knows the pre-shared key.
Data confidentiality can also be ensured using asymmetric algorithms, including Rivest,
Shamir, and Adleman (RSA) and the public key infrastructure (PKI). Asymmetric
encryption algorithms are based on the assumption that the two communicating parties
have not previously shared a secret and must establish a secure method to do so.
15.1.2 AUTHENTICATION
There are two primary methods for validating a source in network communications:
authentication services and data nonrepudiation services.
Authentication guarantees that a message comes from the source that it claims to come
from. Authentication is similar to entering a secure personal identification number
(PIN) for banking at an ATM, as shown in the figure. The PIN should only be known to
the user and the financial institution. The PIN is a shared secret that helps protect
against forgeries.
Data integrity ensures that messages are not altered in transit. With data integrity, the
receiver can verify that the received message is identical to the sent message and that no
manipulation occurred.
European nobility ensured the data integrity of documents by creating a wax seal to
close an envelope, as shown in the figure. The seal was often created using a signet
ring. These bore the family crest, initials, a portrait, or a personal symbol or motto of
the owner of the signet ring. An unbroken seal on an envelope guaranteed the integrity
of its contents. It also guaranteed authenticity based on the unique signet ring
impression.
Data confidentiality ensures privacy so that only the receiver can read the message. This
can be achieved through encryption. Encryption is the process of scrambling data so
that it cannot be easily read by unauthorized parties.
When enabling encryption, readable data is called plaintext, or cleartext, while the
encrypted version is called encrypted text or ciphertext. In this course, we will use the
term ciphertext. The plaintext readable message is converted to ciphertext, which is the
unreadable, disguised message. Decryption reverses the process. A key is required to
encrypt and decrypt a message. The key is the link between the plaintext and ciphertext.
Historically, various encryption algorithms and methods have been used. Julius Caesar
is said to have secured messages by putting two sets of the alphabet, side-by-side, and
then shifting one of them by a specific number of places. The number of places in the
shift serves as the key. He converted plaintext into ciphertext using this key, and only
his generals, who also had the key, knew how to decipher the messages. This method is
now known as the Caesar cipher. An encoded message using the Caesar cipher is shown
in the figure.
Encoded Caesar Cipher Message
Using a hash function is another way to ensure data confidentiality. A hash function
transforms a string of characters into a usually shorter, fixed-length value or key that
represents the original string. The difference between hashing and encryption is in how
the data is stored. With encrypted text, the data can be decrypted with a key. With the
hash function, after the data is entered and converted using the hash function, the
plaintext is gone. The hashed data is simply there for comparison. For example, when a
user enters a password, the password is hashed and then compared to the stored hashed
value. If the user forgets the password, it is impossible to decrypt the stored value, and
the password must be reset.
The purpose of encryption and hashing is to guarantee confidentiality so that only
authorized entities can read the message
15.2 CRYPTOGRAPHY
15.2.1 CREATING CIPHER TEXT
The Caesar Cipher is a type of substitution cipher in which each letter is replaced by
another letter that is a set number of places away in the alphabet. That number of places
is the key. In the figure, the key is 3.
Vigenère Cipher
The Enigma machine was an electromechanical encryption device that was developed
and used by Nazi Germany during World War II. The device depended on the
distribution of pre-shared keys that were used to encrypt and decrypt messages. The
Enigma ciphers were broken by the Allies, and numerous Enigma-encoded messages
were decoded during the war. This provided a significant advantage to the Allies and is
estimated to have greatly shortened the war and saved many lives.
In transposition ciphers, no letters are replaced; they are simply rearranged. An example
of this type of cipher is taking the FLANK EAST ATTACK AT DAWN message and
transposing it to read NWAD TA KCATTA TSAE KNALF. In this example, the key is
to reverse the letters.
Another example of a transposition cipher is known as the rail fence cipher. In this
transposition, the words are spelled out as if they were a rail fence. They are staggered,
some in front, some in the middle and some in back, across several parallel lines.
Modern encryption block cipher algorithms, such as AES and the legacy 3DES, still use
transposition as part of the algorithm.
The use of a simple transposition cipher is now discussed and displayed:
Plaintext Message
The plaintext message will be encoded using a key of 3. This key value specifies that
three lines are required when creating the encrypted code.
Encryption Process
Substitution ciphers substitute one letter for another. In their simplest form, substitution
ciphers retain the letter frequency of the original message.
The Caesar cipher was a simple substitution cipher.
Because the entire message relied on the same single key shift, the Caesar cipher is
referred to as a monoalphabetic substitution cipher. It is also fairly easy to crack. For
this reason, polyalphabetic ciphers, such as the Vigenère cipher, were invented. The
method was originally described by Giovan Battista Bellaso in 1553, but the scheme
was later misattributed to the French diplomat and cryptographer, Blaise de Vigenère.
A process involving a substitution cipher is now discussed and displayed:
Plaintext Message
Shift the top scroll over by the three characters (a key of 3) and A becomes D, B
becomes E, and so on. If the key used was 8, then A becomes I, B becomes J, and so on.
Then Encrypted Message
The Vigenère cipher is based on the Caesar cipher, except that it encrypts text by using
a different polyalphabetic key shift for every plaintext letter. The different key shift is
identified using a shared key between sender and receiver. The plaintext message can be
encrypted and decrypted using the Vigenère Cipher Table that is shown in the figure.
To illustrate how the Vigenère Cipher Table works, suppose that a sender and receiver
have a shared secret key composed of these letters: SECRETKEY. The sender uses this
secret key to encode the plaintext FLANK EAST ATTACK AT DAWN:
o The F (FLANK) is encoded by looking at the intersection of column F and the
row starting with S (SECRETKEY), resulting in the cipher letter X.
o The L (FLANK) is encoded by looking at the intersection of column L and the
row starting with E (SECRETKEY), resulting in the cipher letter P.
o The A (FLANK) is encoded by looking at the intersection of column A and the
row starting with C (SECRETKEY), resulting in the cipher letter C.
o The N (FLANK) is encoded by looking at the intersection of column N and the
row starting with R (SECRETKEY), resulting in the cipher letter E.
o The K (FLANK) is encoded by looking at the intersection of column K and the
row starting with E (SECRETKEY), resulting in the cipher letter O.
The process continues until the entire text message FLANK EAST ATTACK AT
DAWN is encrypted. The process can also be reversed. For instance, the F is still the
cipher letter X if encoded by looking at the intersection of row F (FLANK) and the
column starting with S (SECRETKEY).
When using the Vigenère cipher, if the message is longer than the key, the key is
repeated. For example, SECRETKEYSECRETKEYSEC is required to encode FLANK
EAST ATTACK AT DAWN:
o Secret key: SECRETKEYSECRETKEYSEC
o Plaintext: FLANKEASTATTACKATDAWN
o Cipher text: XPCEOXKURSXVRGDKXBSAP
Although the Vigenère cipher uses a longer key, it can still be cracked. For this reason,
a better cipher method was required.
Gilbert Vernam was an AT&T Bell Labs engineer who, in 1917, invented, and later
patented, the stream cipher. He also co-invented the one-time pad cipher. Vernam
proposed a teletype cipher in which a prepared key consisting of an arbitrarily long,
non-repeating sequence of numbers was kept on paper tape, shown in the figure. It was
then combined character by character with the plaintext message to produce the
ciphertext.
To decipher the ciphertext, the same paper tape key was again combined character by
character, producing the plaintext. Each tape was used only once; hence, the name one-
time pad. As long as the key tape does not repeat or is not reused, this type of cipher is
immune to cryptanalytic attack. This is because the available ciphertext does not display
the pattern of the key.
Several difficulties are inherent in using one-time pads in the real world. One difficulty
is the challenge of creating random data. Computers, because they have a mathematical
foundation, are incapable of creating true random data. Additionally, if the key is used
more than once, it is easy to break. RC4 is an example of this type of cipher that is
widely used on the internet. Again, because the key is generated by a computer, it is not
truly random. In addition to these issues, key distribution is also challenging with this
type of cipher.
15.3 CRYPTANALYSIS
15.3.1 CRACKING CODE
For as long as there has been cryptography, there has been cryptanalysis. Cryptanalysis
is the practice and study of determining the meaning of encrypted information (cracking
the code), without access to the shared secret key. This is also known as codebreaking.
Throughout history, there have been many instances of cryptanalysis:
The Vigenère cipher had been absolutely secure until it was broken in the 19th century
by English cryptographer Charles Babbage.
Mary, Queen of Scots, was plotting to overthrow Queen Elizabeth I from the throne and
sent encrypted messages to her co-conspirators. The cracking of the code used in this
plot led to the beheading of Mary in 1587.
The Enigma-encrypted communications were used by the Germans to navigate and
direct their U-boats in the Atlantic. Polish and British cryptanalysts broke the German
Enigma code.
o Brute-force method - The attacker tries every possible key knowing that
eventually one of them will work.
o Ciphertext method - The attacker has the ciphertext of several encrypted
messages but no knowledge of the underlying plaintext.
o Known-Plaintext method - The attacker has access to the ciphertext of several
messages and knows something about the plaintext underlying that ciphertext.
o Chosen-Plaintext method - The attacker chooses which data the encryption
device encrypts and observes the ciphertext output.
o Chosen-Ciphertext method - The attacker can choose different ciphertext to
be decrypted and has access to the decrypted plaintext.
o Meet-in-the-Middle method - The attacker knows a portion of the plaintext
and the corresponding ciphertext.
Note: Details of how these methods are implemented is beyond the scope of this course.
The simplest method to understand is the brute-force method. For example, if a thief
attempted to steal a bicycle secured with the combination lock displayed in the figure,
they would have to attempt a maximum of 10,000 different possibilities (0000 to 9999).
All encryption algorithms are vulnerable to this attack. On average, a brute-force attack
succeeds about 50 percent of the way through the keyspace, which is the set of all
possible keys.
The objective of modern cryptographers is to have a keyspace large enough that it takes
too much time and money to accomplish a brute-force attack.
15.3.3 CRACKING CODE EXAMPLE
When choosing a cryptanalysis method, consider the Caesar cipher encrypted code. The
best way to crack the code is to use brute force. Because there are only 25 possible
rotations, the effort is relatively small to try all possible rotations and see which one
returns something that makes sense.
A more scientific approach is to use the fact that some characters in the English
alphabet are used more often than others. This method is called frequency analysis. For
example, the graph in the figure below shows the frequency of letters in the English
language. The letters E, T, and A are the most popular letters used in the English
language. The letters J, Q, X, and Z are the least popular. Understanding this pattern can
help discover which letters are probably included in the cipher message.
In the Caesar ciphered message IODQN HDVW DWWDFN DW GDZQ, shown in the
figure, the cipher letter D appears six times while the cipher letter W appears four times.
There is a good possibility that the cipher letters D and W represent either the plaintext
E, T or A. In this case, the D represents the letter A, and the W represents the letter T.
An attacker would only have to replace the cipher letter D first with popular plaintext
letters including E, T, and finally A. Trying A would reveal the shift pattern of 3, and
the attacker could then decipher the entire message.
15.4 CRYPTOLOGY
15.4.1 MAKING AND BREAKING SECRET CODES
Cryptology is the science of making and breaking secret codes. As shown in the figure,
cryptology combines two separate disciplines:
o Cryptography - the development and use of codes
o Cryptanalysis - the breaking of those codes
There is a symbiotic relationship between the two disciplines because each makes the
other one stronger. National security organizations employ practitioners of both
disciplines and put them to work against each other.
There have been times when one of the disciplines has been ahead of the other. For
example, during the Hundred Years War between France and England, the cryptanalysts
were leading the cryptographers. France mistakenly believed that the Vigenère cipher
was unbreakable, and then the British cracked it. Some historians believe that the
successful cracking of encrypted codes and messages had a major impact on the
outcome of World War II. Currently, it is believed that cryptographers are in the lead.
15.4.2 CRYPTANALYSTS
Cryptanalysis is often used by governments in military and diplomatic surveillance, by
enterprises in testing the strength of security procedures, and by malicious hackers in
exploiting weaknesses in websites.
Cryptanalysts are individuals who perform cryptanalysis to crack secret codes. A
sample job description is displayed in the figure.
While cryptanalysis is often linked to mischievous purposes, it is actually a necessity. It
is an ironic fact of cryptography that it is impossible to prove that any algorithm is
secure. It can only be proven that it is not vulnerable to known cryptanalytic attacks.
Therefore, there is a need for mathematicians, scholars, and security forensic experts to
keep trying to break the encryption methods.
Old encryption algorithms, such as the Caesar cipher or the Enigma machine, were
based on the secrecy of the algorithm to achieve confidentiality. With modern
technology, where reverse engineering is often simple, public-domain algorithms are
frequently used. With most modern algorithms, successful decryption requires
knowledge of the appropriate cryptographic keys. This means that the security of
encryption lies in the secrecy of the keys, not the algorithm.
Cryptology
Cryptology is the science of making and breaking secret codes. It combines
cryptography and cryptanalysis. In the world of communications and networking,
authentication, integrity, and data confidentiality are implemented in many ways using
various protocols and algorithms. The choice of algorithm varies depending on the
security requirements, the hardware resources that are available for encryption and
decryption, and the acceptance of the algorithm in the security community. Public-
domain algorithms are frequently used. With most modern algorithms, successful
decryption requires knowledge of the appropriate cryptographic keys. This means that
the security of encryption lies in the secrecy of the keys, not the algorithm.
MODULE 16
16.1 INTEGRITY AND AUTHENTICITY
16.1.1 SECURE COMMUNICATIONS
Organizations must provide support to secure data as it travels across links. This may
include internal traffic, but it is even more important to protect data that travels outside
of the organization to branch sites, telecommuter sites, and partner sites.
These are the four elements of secure communications:
o Data Integrity - Guarantees that the message was not altered. Any changes to
data in transit will be detected. Integrity is ensured by implementing either of
the Secure Hash Algorithms (SHA-2 or SHA-3). The MD5 message digest
algorithm is still widely in use. However, it is inherently insecure and creates
vulnerabilities in a network. Note that MD5 should be avoided.
o Origin Authentication - Guarantees that the message is not a forgery and does
actually come from whom it states. Many modern networks ensure
authentication with algorithms such as hash-based message authentication code
(HMAC).
o Data Confidentiality - Guarantees that only authorized users can read the
message. If the message is intercepted, it cannot be deciphered within a
reasonable amount of time. Data confidentiality is implemented using
symmetric and asymmetric encryption algorithms.
o Data Non-Repudiation - Guarantees that the sender cannot repudiate, or
refute, the validity of a message sent. Nonrepudiation relies on the fact that only
the sender has the unique characteristics or signature for how that message is
treated.
Cryptography can be used almost anywhere that there is data communication. In fact,
the trend is toward all communication being encrypted.
Hashes are used to verify and ensure data integrity. They are also used to verify
authentication. Hashing is based on a one-way mathematical function that is relatively
easy to compute, but significantly harder to reverse.
Grinding coffee is a good analogy of a one-way function. It is easy to grind coffee
beans, but it is almost impossible to put all of the tiny pieces back together to rebuild
the original beans.
As shown in the figure, a hash function takes a variable block of binary data, called the
message, and produces a fixed-length, condensed representation, called the hash. The
resulting hash is also sometimes called the message digest, digest, or digital fingerprint.
With hash functions, it is computationally infeasible for two different sets of data to
come up with the same hash output. Furthermore, the hash value changes every time the
data is changed or altered. Because of this, cryptographic hash values are often called
“digital fingerprints”. These fingerprints can be used to detect duplicate data files, file
version changes, and similar applications. These values are used to guard against an
accidental or intentional change to the data, or accidental data corruption.
The cryptographic hash function is applied in many different situations for entity
authentication, data integrity, and data authenticity purposes.
Mathematically, the equation h= H(x) is used to explain how a hash algorithm operates.
As shown in the figure, a hash function H takes an input x and returns a fixed-size
string hash value h.
The example in the figure summarizes the mathematical process. A cryptographic hash
function should have the following properties:
o The input can be any length.
o The output is always a fixed length.
o H(x) is relatively easy to compute for any given x.
o H(x) is one way and not reversible.
o H(x) is collision free, meaning that two different input values will result in
different hash values.
If a hash function is hard to invert, it is considered a one-way hash. Hard to invert
means that given a hash value of h, it is computationally infeasible to find an input
for x such that h=H(x).
Hash functions are used to ensure the integrity of a message. They help ensure data has
not accidentally changed and that what was sent is indeed what was received.
Note: Deliberate changes can be made by a threat actor.
In the figure, the sender is sending a $100 money transfer to Alex. The sender wants to
ensure that the message is not accidentally altered on its way to the receiver.
As shown in the figure, an HMAC is calculated using any cryptographic algorithm that
combines a cryptographic hash function with a secret key. Hash functions are the basis
of the protection mechanism of HMACs.
Only the sender and the receiver know the secret key, and the output of the hash
function now depends on the input data and the secret key. Only parties who have
access to that secret key can compute the digest of an HMAC function. This defeats
man-in-the-middle attacks and provides authentication of the data origin.
If two parties share a secret key and use HMAC functions for authentication, a properly
constructed HMAC digest of a message that a party has received indicates that the other
party was the originator of the message. This is because the other party possesses the
secret key.
Creating the HMAC Value
As shown in the figure, the sending device inputs data (such as Terry Smith’s pay of
$100 and the secret key) into the hashing algorithm and calculates the fixed-length
HMAC digest. This authenticated digest is then attached to the message and sent to the
receiver.
Verifying the HMAC Value
In the figure, the receiving device removes the digest from the message and uses the
plaintext message with its secret key as input into the same hashing function. If the
digest that is calculated by the receiving device is equal to the digest that was sent, the
message has not been altered. Additionally, the origin of the message is authenticated
because only the sender possesses a copy of the shared secret key. The HMAC function
has ensured the authenticity of the message.
Cisco Router HMAC Example
The figure shows how HMACs are used by Cisco routers that are configured to use
Open Shortest Path First (OSPF) routing authentication.
R1 is sending a link state update (LSU) regarding a route to network 10.2.0.0/16:
1. R1 calculates the hash value using the LSU message and the secret key.
2. The resulting hash value is sent with the LSU to R2.
3. R2 calculates the hash value using the LSU and its secret key. R2
accepts the update if the hash values match. If they do not match, R2
discards the update.
Characteristic Description
Key Generation It was up to Caesar to choose the key of his
cipher. The Vigenère cipher key is also
chosen by the sender and receiver. In a
modern cryptographic system, key generation
is usually automated and not left to the end
user. The use of good random number
generators is needed to ensure that all keys
are equally generated so that the attacker
cannot predict which keys are more likely to
be used.
Key Verification Some keys are better than others. Almost all
cryptographic algorithms have some weak
keys that should not be used. With the help
of key verification procedures, weak keys
can be identified and regenerated to provide a
more secure encryption. With the Caesar
cipher, using a key of 0 or 25 does not
encrypt the message, so it should not be used.
Key Exchange Key management procedures should provide
a secure key exchange mechanism that
allows secure agreement on the keying
material with the other party, probably over
an untrusted medium.
Key Storage On a modern multi-user operating system
that uses cryptography, a key can be stored in
memory. This presents a possible problem
when that memory is swapped to the disk,
because a Trojan horse program installed on
the PC of a user could then have access to the
private keys of that user.
Key Lifetime Using short key lifetimes improves the
security of legacy ciphers that are used on
high-speed connections. In IPsec a 24-hour
lifetime is typical. However, changing the
lifetime to 30 minutes improves the security
of the algorithms.
Key Revocation and Destruction Revocation notifies all interested parties that
a certain key has been compromised and
should no longer be used. Destruction erases
old keys in a manner that prevents malicious
attackers from recovering them.
Characteristic Description
Algorithm Full Name Advanced Encryption Standard
Timeline Official standard since 2001
Type of Algorithm Symmetric
Key Size (in bits) 128, 192, and 256
Speed High
Time to Crack
(assuming a computer could try 255 149 trillion years
keys per second)
Resource Consumption Low
The keyspace of an algorithm is the set of all possible key values. A key that has n bits
produces a keyspace that has 2n possible key values. By adding one bit to the key, the
keyspace is effectively doubled.
As shown in the table, DES with its 56-bit keys has a keyspace of more than
72,000,000,000,000,000 (256) possible keys. By adding one bit to the key length, the
keyspace doubles, and an attacker needs twice the amount of time to search the
keyspace. Adding an additional bit to a 57-bit key size means that it would now take an
attacker four times the amount of time to search the keyspace. Adding 4 more bits to
56-bits would create a 60-bit key. A 60-bit key would take 16 times longer to crack than
a 56-bit key.
Note: Longer keys are more secure; however, they are also more resource intensive.
Caution should be exercised when choosing longer keys because handling them could
add a significant load to the processor in lower-end products.
Almost every algorithm has some weak keys in its keyspace that enable an attacker to
break the encryption via a shortcut. Weak keys show the regularities in encryption. For
instance, DES has four keys for which encryption is the same as decryption. This means
that if one of these weak keys is used to encrypt plaintext, an attacker can use the weak
key to decrypt the ciphertext and reveal the plaintext.
The DES weak keys are those that produce 16 identical subkeys. This occurs when the
key bits are:
o Alternating ones and zeros (0101010101010101)
o Alternating F and E (FEFEFEFEFEFEFEFE)
o E0E0E0E0F1F1F1F1
o 1F1F1F1F0E0E0E0E
It is very unlikely that such keys would be chosen, but network administrators should
still verify all keys that are implemented and prevent weak keys from being used. With
manual key generation, take special care to avoid defining weak keys.
Note: DES is a legacy encryption algorithm and should not be used. It is used here to
illustrate the concept of keyspace only.
16.2.4 TYPES OF CRYPTOGRAPHIC KEYS
On average, an attacker has to search through half of the keyspace before the correct
key is found. The time that is needed to accomplish this search depends on the
computer power that is available to the attacker.
Current key lengths can easily make any attempt insignificant because it takes millions
or billions of years to complete the search when a sufficiently long key is used.
With modern algorithms that are trusted, the strength of protection depends solely on
the size of the key. Choose the key length so that it protects data confidentiality or
integrity for an adequate period of time. Data that is more sensitive and needs to be kept
secret longer must use longer keys.
Performance is another issue that can influence the choice of a key length. An
administrator must find a good balance between the speed and protective strength of an
algorithm, because some algorithms, such as the Rivest, Shamir, and Adleman (RSA)
algorithm, run slowly due to large key lengths. Strive for adequate protection, while
enabling communication over untrusted networks.
The estimated funding of the attacker should also affect the choice of key length. When
assessing the risk of someone breaking the encryption algorithm, estimate the resources
of the attacker and how long the data must be protected. For example, classic DES can
be broken by a $1 million machine in a couple of minutes. If the data that is being
protected is worth significantly more than the $1 million dollars needed to acquire a
cracking device, then another algorithm should be used. In fact, DES is now considered
too weak to use for any application.
Because of the rapid advances in technology and cryptanalytic methods, the key length
that is needed for a particular application is constantly increasing. Part of the strength of
the RSA algorithm is the difficulty of factoring large numbers. For example, the factors
of 12 would be 1 x 12, 2 x 6, and 3 x 4. Therefore, a 1024-bit number is a very large
number with many factors. Increasing that number to a 2048-bit number creates even
more factors. Of course, this advantage is lost if an easy way to factor large numbers is
found, but cryptographers consider this possibility unlikely.
The rule “the longer the key, the better” is valid, except for possible performance
reasons. Shorter keys equal faster processing, but are less secure. Longer keys equal
slower processing, but are more secure.
16.3 CONFIDENTIALITY
16.3.1 DATA CONFIDENTIALITY
Asymmetric and symmetric encryption are the two classes of encryption used to
provide data confidentiality. These two classes differ in how they use keys.
Symmetric encryption algorithms such as Data Encryption Standard (DES), 3DES, and
Advanced Encryption Standard (AES) are based on the premise that each
communicating party knows the pre-shared key. Data confidentiality can also be
ensured using asymmetric algorithms, including Rivest, Shamir, and Adleman (RSA)
and the public key infrastructure (PKI).
Note: DES is a legacy algorithm and should not be used. 3DES should be avoided if
possible.
The figure highlights some differences between symmetric and asymmetric encryption.
Symmetric algorithms use the same pre-shared key to encrypt and decrypt data. A pre-
shared key, also called a secret key, is known by the sender and receiver before any
encrypted communications can take place.
To help illustrate how symmetric encryption works, consider an example where Alice
and Bob live in different locations and want to exchange secret messages with one
another through the mail system. In this example, Alice wants to send a secret message
to Bob.
In the figure, Alice and Bob have identical keys to a single padlock. These keys were
exchanged prior to sending any secret messages. Alice writes a secret message and puts
it in a small box that she locks using the padlock with her key. She mails the box to
Bob. The message is safely locked inside the box as the box makes its way through the
post office system. When Bob receives the box, he uses his key to unlock the padlock
and retrieve the message. Bob can use the same box and padlock to send a secret reply
back to Alice.
Today, symmetric encryption algorithms are commonly used with VPN traffic. This is
because symmetric algorithms use less CPU resources than asymmetric encryption
algorithms. This allows the encryption and decryption of data to be fast when using a
VPN. When using symmetric encryption algorithms, like any other type of encryption,
the longer the key, the longer it will take for someone to discover the key. Most
encryption keys are between 112 and 256 bits. To ensure that the encryption is safe, a
minimum key length of 128 bits should be used. Use a longer key for more secure
communications.
Symmetric encryption algorithms are sometimes classified as either a block cipher or a
stream cipher. Click the buttons to learn about these two cipher modes.
Block Ciphers
Stream Ciphers
Stream ciphers encrypt plaintext one byte or one bit at a time. Stream ciphers are
basically a block cipher with a block size of one byte or bit. Stream ciphers are typically
faster than block ciphers because data is continuously encrypted. Examples of stream
ciphers include RC4 and A5 which is used to encrypt GSM cell phone communications.
Now back to the rest
Asymmetric algorithms, also called public-key algorithms, are designed so that the key
that is used for encryption is different from the key that is used for decryption, as shown
in the figure. The decryption key cannot, in any reasonable amount of time, be
calculated from the encryption key and vice versa.
Asymmetric algorithms use a public key and a private key. Both keys are capable of the
encryption process, but the complementary paired key is required for decryption. The
process is also reversible. Data that is encrypted with the public key requires the private
key to decrypt. Asymmetric algorithms achieve confidentiality and authenticity by
using this process.
Because neither party has a shared secret, very long key lengths must be used.
Asymmetric encryption can use key lengths between 512 to 4,096 bits. Key lengths
greater than or equal to 2,048 bits can be trusted, while key lengths of 1,024 or shorter
are considered insufficient.
Examples of protocols that use asymmetric key algorithms include:
o Internet Key Exchange (IKE) - This is a fundamental component of IPsec
VPNs.
o Secure Socket Layer (SSL) - This is now implemented as IETF standard
Transport Layer Security (TLS).
o Secure Shell (SSH) - This protocol provides a secure remote access connection
to network devices.
o Pretty Good Privacy (PGP) - This computer program provides cryptographic
privacy and authentication. It is often used to increase the security of email
communications.
Asymmetric algorithms are substantially slower than symmetric algorithms. Their
design is based on computational problems, such as factoring extremely large numbers
or computing discrete logarithms of extremely large numbers.
Because they are slow, asymmetric algorithms are typically used in low-volume
cryptographic mechanisms, such as digital signatures and key exchange. However, the
key management of asymmetric algorithms tends to be simpler than symmetric
algorithms, because usually one of the two encryption or decryption keys can be made
public.
Common examples of asymmetric encryption algorithms are described in the table.
Asymmetric
Key Length Description
Encryption Algorithm
The Diffie-Hellman algorithm allows two parties
to agree on a key that they can use to encrypt
messages they want to send to each other. The
security of this algorithm depends on the
Diffie-Hellman (DH) 512, 1024, 2048, 3072, 4096
assumption that it is easy to raise a number to a
certain power, but difficult to compute which
power was used given the number and the
outcome.
Digital Signature 512 - 1024 DSS specifies DSA as the algorithm for digital
Standard (DSS) and signatures. DSA is a public key algorithm based
Digital Signature on the ElGamal signature scheme. Signature
Algorithm (DSA) creation speed is similar to RSA, but is 10 to 40
Asymmetric
Key Length Description
Encryption Algorithm
times slower for verification.
RSA is for public-key cryptography that is based
on the current difficulty of factoring very large
numbers. It is the first algorithm known to be
Rivest, Shamir, and
suitable for signing, as well as encryption. It is
Adleman encryption 512 to 2048
widely used in electronic commerce protocols
algorithms (RSA)
and is believed to be secure given sufficiently
long keys and the use of up-to-date
implementations.
An asymmetric key encryption algorithm for
public-key cryptography which is based on the
Diffie-Hellman key agreement. A disadvantage
of the ElGamal system is that the encrypted
EIGamal 512 - 1024
message becomes very big, about twice the
size of the original message and for this reason
it is only used for small messages such as
secret keys.
Elliptic curve cryptography can be used to adapt
many cryptographic algorithms, such as Diffie-
Elliptic curve
224 or higher Hellman or ElGamal. The main advantage of
techniques
elliptic curve cryptography is that the keys can
be much smaller.
Alice uses Bob’s public key to encrypt a message using an agreed-upon algorithm.
Alice sends the encrypted message to Bob.
Bob decrypts message with private key
Bob then uses his private key to decrypt the message. Since Bob is the only one with
the private key, Alice's message can only be decrypted by Bob and thus confidentiality
is achieved.
Alice encrypts a message using her private key. Alice sends the encrypted message to
Bob. Bob needs to authenticate that the message did indeed come from Alice.
Bob requests the public key
Alice wants to send a message to Bob ensuring that only Bob can read the document. In
other words, Alice wants to ensure message confidentiality. Alice uses the public key of
Bob to cipher the message. Only Bob will be able to decipher it using his private key.
Alice encrypts a hash using her private key
Alice also wants to ensure message authentication and integrity. Authentication ensures
Bob that the document was sent by Alice, and integrity ensures that it was not modified
Alice uses her private key to cipher a hash of the message. Alice sends the encrypted
message with its encrypted hash to Bob.
Bob uses Alice’s public key to decrypt the hash
Bob uses Alice’s public key to verify that the message was not modified. The received
hash is equal to the locally determined hash based on Alice’s public key. Additionally,
this verifies that Alice is definitely the sender of the message because nobody else has
Alice’s private key.
Bob uses his private key to decrypt the message
16.3.7 DIFFIE-HELLMAN
These are the four elements of secure communications: data integrity, origin
authentication, data confidentiality, and data non-repudiation. Cryptography can be
used almost anywhere that there is data communication. Hashes are used to verify and
ensure data integrity. Hashing is based on a one-way mathematical function that is
relatively easy to compute, but significantly harder to reverse. The cryptographic
hashing function can also be used to verify authentication. A hash function takes a
variable block of binary data, called the message, and produces a fixed-length,
condensed representation, called the hash. The resulting hash is also sometimes called
the message digest, digest, or digital fingerprint. Mathematically, the equation h=
H(x) is used to explain how a hash algorithm operates. A hash function H takes an
input x and returns a fixed-size string hash value h. A cryptographic hash function
should have the following properties:
o The input can be any length.
The output has a fixed length.
H(x) is relatively easy to compute for any given x.
H(x) is one way and not reversible.
H(x) is collision free, meaning that two different input values will result in
different hash values.
The four well-known hash functions are MD5 with 128 bit digest, SHA-1, SHA-2, and
SHA-3. While hashing can be used to detect accidental changes, it cannot be used to
guard against deliberate changes that are made by a threat actor in a man-in-the-middle
attack. Origin authentication is also required to provide protection.
To add origin authentication and integrity assurance, use a keyed-hash message
authentication code (HMAC). HMAC uses an additional secret key as input to the hash
function. Other Message Authentication Code (MAC) methods are also used. However,
HMAC is used in many systems including SSL, IPsec, and SSH.
Key Management
There are two classes of encryption used to provide data confidentiality: asymmetric
and symmetric. These two classes differ in how they use keys.
Symmetric encryption algorithms such as Data Encryption Standard (DES), 3DES, and
Advanced Encryption Standard (AES) are based on the premise that each
communicating party knows the pre-shared key. Data confidentiality can also be
ensured using asymmetric algorithms, including Rivest, Shamir, and Adleman (RSA)
and the public key infrastructure (PKI).
Symmetric algorithms use the same pre-shared key to encrypt and decrypt data. A pre-
shared key, also called a secret key, is known by the sender and receiver before any
encrypted communications can take place. Symmetric encryption algorithms are
commonly used with VPN traffic because symmetric algorithms use less CPU resources
than asymmetric encryption algorithms. To ensure that the encryption is safe, a
minimum key length of 128 bits should be used. Use a longer key for more secure
communications.
Symmetric encryption algorithms are sometimes classified as either a block cipher or a
stream cipher.
o Block ciphers transform a fixed-length block of plaintext into a common block
of ciphertext of 64 or 128 bits.
o Stream ciphers encrypt plaintext one byte or one bit at a time. Stream ciphers
are basically a block cipher with a block size of one byte or bit. Stream ciphers
are typically faster than block ciphers because data is continuously encrypted.
Asymmetric algorithms, also called public-key algorithms, are designed so that the key
that is used for encryption is different from the key that is used for decryption.
Asymmetric encryption can use key lengths between 512 to 4,096 bits. Key lengths
greater than or equal to 2,048 bits can be trusted, while key lengths of 1,024 or shorter
are considered insufficient. Examples of protocols that use asymmetric key algorithms
include Internet Key Exchange (IKE), Secure Socket Layer (SSL), Secure Shell (SSH),
and Pretty Good Privacy (PGP). The process can be summarized using the formula:
Private Key (Encrypt) + Public Key (Decrypt) = Authentication. Diffie-Hellman (DH)
is an asymmetric mathematical algorithm that allows two computers to generate an
identical shared secret without having communicated before. The new shared key is
never actually exchanged between the sender and receiver. DH is commonly used when
data is exchanged using an IPsec VPN and SSH data is exchanged.
MODULE 18
18.1 VPN OVERVIEW
18.1.1 VIRTUAL PRIVATE NETWORKS
To secure network traffic between sites and users, organizations use virtual private
networks (VPNs) to create end-to-end private network connections. A VPN is virtual in
that it carries information within a private network, but that information is actually
transported over a public network. A VPN is private in that the traffic is encrypted to
keep the data confidential while it is transported across the public network.
The figure shows a collection of various types of VPNs managed by an enterprise’s
main site. The tunnel enables remote sites and users to access the main site’s network
resources securely.
The first types of VPNs were strictly IP tunnels that did not include authentication or
encryption of the data. For example, Generic Routing Encapsulation (GRE) is a
tunnelling protocol developed by Cisco and which does not include encryption services.
It is used to encapsulate IPv4 and IPv6 traffic inside an IP tunnel to create a virtual
point-to-point link.
Modern VPNs now support encryption features, such as Internet Protocol Security
(IPsec) and Secure Sockets Layer (SSL) to secure network traffic between sites.
Major benefits of VPNs are shown in the table.
Benefit Description
With the advent of cost-effective, high-bandwidth technologies,
Cost Savings organizations can use VPNs to reduce their connectivity costs while
simultaneously increasing remote connection bandwidth.
VPNs provide the highest level of security available, by using
Security advanced encryption and authentication protocols that protect data
from unauthorized access.
VPNs allow organizations to use the internet, making it easy to add
Scalability
new users without adding significant infrastructure.
VPNs can be implemented across a wide variety of WAN link
options including all the popular broadband technologies. Remote
Compatibility
workers can take advantage of these high-speed connections to
gain secure access to their corporate networks.
18.2 VPN TOPOLOGIES
18.2.1 SITE-TO-SITE AND REMOTE-ACCESS VPNs
A site-to-site VPN is created when VPN terminating devices, also called VPN
gateways, are preconfigured with information to establish a secure tunnel. VPN traffic
is only encrypted between these devices. Internal hosts have no knowledge that a VPN
is being used.
Remote-Access VPN
In the previous topic you learned about the basics of a VPN. Here you will learn about
the types of VPNs.
VPNs have become the logical solution for remote-access connectivity for many
reasons. As shown in the figure, remote-access VPNs let remote and mobile users
securely connect to the enterprise by creating an encrypted tunnel. Remote users can
securely replicate their enterprise security access including email and network
applications. Remote-access VPNs also allow contractors and partners to have limited
access to the specific servers, web pages, or files as required. This means that these
users can contribute to business productivity without compromising network security.
Remote-access VPNs are typically enabled dynamically by the user when required.
Remote access VPNs can be created using either IPsec or SSL. As shown in the figure,
a remote user must initiate a remote access VPN connection.
The figure displays two ways that a remote user can initiate a remote access VPN
connection: clientless VPN and client-based VPN.
When a client negotiates an SSL VPN connection with the VPN gateway, it actually
connects using Transport Layer Security (TLS). TLS is the newer version of SSL and is
sometimes expressed as SSL/TLS. However, both terms are often used interchangeably.
SSL uses the public key infrastructure and digital certificates to authenticate peers. Both
IPsec and SSL VPN technologies offer access to virtually any network application or
resource. However, when security is an issue, IPsec is the superior choice. If support
and ease of deployment are the primary issues, consider SSL. The type of VPN method
implemented is based on the access requirements of the users and the organization’s IT
processes. The table compares IPsec and SSL remote access deployments.
It is important to understand that IPsec and SSL VPNs are not mutually exclusive.
Instead, they are complementary; both technologies solve different problems, and an
organization may implement IPsec, SSL, or both, depending on the needs of its
telecommuters.
Site-to-site VPNs are used to connect networks across another untrusted network such
as the internet. In a site-to-site VPN, end hosts send and receive normal unencrypted
TCP/IP traffic through a VPN-terminating device. The VPN-terminating device is
typically called a VPN gateway. A VPN gateway device could be a router or a firewall,
as shown in the figure. For example, the Cisco Adaptive Security Appliance (ASA)
shown on the right side of the figure is a standalone firewall device that combines
firewall, VPN concentrator, and intrusion prevention functionality into one software
image.
The VPN gateway encapsulates and encrypts outbound traffic. It then sends the traffic
through a VPN tunnel over the internet to a VPN gateway at the target site. Upon
receipt, the receiving VPN gateway strips the headers, decrypts the content, and relays
the packet toward the target host inside its private network.
Site-to-site VPNs are typically created and secured using IP security (IPsec).
IPsec is an IETF standard (RFC 2401-2412) that defines how a VPN can be secured
across IP networks. IPsec protects and authenticates IP packets between source and
destination. IPsec can protect traffic from Layer 4 through Layer 7.
Using the IPsec framework, IPsec provides these essential security functions:
o Confidentiality - IPsec uses encryption algorithms to prevent cybercriminals
from reading the packet contents.
o Integrity - IPsec uses hashing algorithms to ensure that packets have not been
altered between source and destination.
o Origin authentication - IPsec uses the Internet Key Exchange (IKE) protocol
to authenticate source and destination. Methods of authentication include the
use of pre-shared keys (passwords), digital certificates, or RSA certificates.
o Diffie-Hellman - Secure key exchange typically using various groups of the
DH algorithm.
IPsec is not bound to any specific rules for secure communications. This flexibility of
the framework allows IPsec to easily integrate new security technologies without
updating the existing IPsec standards. The currently available technologies are aligned
to their specific security function. The open slots shown in the IPsec framework in the
figure can be filled with any of the choices that are available for that IPsec function to
create a unique security association (SA).
The security functions are listed in the table.
The figure shows examples of SAs for two different implementations. An SA is the
basic building block of IPsec. When establishing a VPN link, the peers must share the
same SA to negotiate key exchange parameters, establish a shared key, authenticate
each other, and negotiate the encryption parameters. Notice that SA Example 1 is using
no encryption.
Choosing the IPsec protocol encapsulation is the first building block of the framework.
IPsec encapsulates packets using Authentication Header (AH) or Encapsulation
Security Protocol (ESP). The choice of AH or ESP establishes which other building
blocks are available.
18.3.4 CONFIDENTIALITY
Confidentiality is achieved by encrypting the data, as shown in the figure. The degree of
confidentiality depends on the encryption algorithm and the length of the key used in
the encryption algorithm. If someone tries to hack the key through a brute-force attack,
the number of possibilities to try is a function of the length of the key. The time to
process all the possibilities is a function of the computer power of the attacking device.
The shorter the key, the easier it is to break. A 64-bit key can take approximately one
year to break with a relatively sophisticated computer. A 128-bit key with the same
machine can take roughly 1019 or 10 quintillion years to decrypt.
The encryption algorithms highlighted in the figure are all symmetric key
cryptosystems.
18.3.5 INTEGRITY
Data integrity means that the data that is received is exactly the same data that was sent.
Potentially, data could be intercepted and modified. For example, in the figure, assume
that a check for $100 is written to Alex. The check is then mailed to Alex, but it is
intercepted by a threat actor. The threat actor changes the name on the check to Jeremy
and the amount on the check to $1,000 and attempts to cash it. Depending on the quality
of the forgery in the altered check, the attacker could be successful.
Because VPN data is transported over the public internet, a method of proving data
integrity is required to guarantee that the content has not been altered. A hashing
algorithm guarantees the integrity of the message using a hash value. The figure
highlights the two most common hashing algorithms.
Note: Cisco now rates SHA-1 as legacy and recommends at least SHA-256 for
integrity.
18.3.6 AUTHENTICATION
When conducting business long distance, you must know who is at the other end of the
phone, email, or fax. The same is true of VPN networks. The device on the other end of
the VPN tunnel must be authenticated before the communication path is considered
secure. The figure highlights the two peer authentication methods.
The figure shows an example of PSK authentication. At the local device, the
authentication key and the identity information are sent through a hash algorithm to
form the hash for the local peer (Hash_L). One-way authentication is established by
sending Hash_L to the remote device. If the remote device can independently create the
same hash, the local device is authenticated. After the remote device authenticates the
local device, the authentication process begins in the opposite direction, and all steps
are repeated from the remote device to the local device.
The figure below shows an example of RSA authentication. At the local device, the
authentication key and identity information are sent through the hash algorithm to form
the hash for the local peer (Hash_L). Then the Hash_L is encrypted using the local
device’s private encryption key. This creates a digital signature. The digital signature
and a digital certificate are forwarded to the remote device. The public encryption key
for decrypting the signature is included in the digital certificate. The remote device
verifies the digital signature by decrypting it using the public encryption key. The result
is Hash_L. Next, the remote device independently creates Hash_L from stored
information. If the calculated Hash_L equals the decrypted Hash_L, the local device is
authenticated. After the remote device authenticates the local device, the authentication
process begins in the opposite direction and all steps are repeated from the remote
device to the local device.
Encryption algorithms require a symmetric, shared secret key to perform encryption and
decryption. How do the encrypting and decrypting devices get the shared secret key?
The easiest key exchange method is to use a public key exchange method, such as
Diffie-Hellman (DH), as shown in the figure.
DH provides a way for two peers to establish a shared secret key that only they know,
even though they are communicating over an insecure channel. Variations of the DH
key exchange are specified as DH groups:
o DH groups 1, 2, and 5 should no longer be used. These groups support a key
size of 768 bits, 1024 bits, and 1536 bits, respectively.
o DH groups 14, 15, and 16 use larger key sizes with 2048 bits, 3072 bits, and
4096 bits, respectively, and are recommended for use until 2030.
o DH groups 19, 20, 21 and 24 with respective key sizes of 256 bits, 384 bits, 521
bits, and 2048 bits support Elliptical Curve Cryptography (ECC), which
reduces the time needed to generate keys. DH group 24 is the preferred next
generation encryption.
The DH group you choose must be strong enough, or have enough bits, to protect the
IPsec keys during negotiation. For example, if you choose AES 128-bit key, use group
14, 19, 20 or 24. However, if you choose AES-256 or higher, use the DH group 21 or
24.
The two main IPsec protocols are Authentication Header (AH) and Encapsulation
Security Protocol (ESP). The IPsec protocol is the first building block of the
framework. The choice of AH or ESP establishes which other building blocks are
available.
AH uses IP protocol 51 and is appropriate only when confidentiality is not required or
permitted. It provides data authentication and integrity, but it does not provide data
confidentiality (encryption). All text is transported unencrypted.
ESP uses IP protocol 50 and provides both confidentiality and authentication. It
provides confidentiality by performing encryption on the IP packet. ESP provides
authentication for the inner IP packet and ESP header. Authentication provides data
origin authentication and data integrity. Although both encryption and authentication
are optional in ESP, at a minimum, one of them must be selected.
If ESP is selected as the IPsec protocol, an encryption algorithm must also be selected.
Cisco products support 3DES, AES, and SEAL. However, 3DES should be avoided. If
3DES must be implemented, then configure short key lifetimes.
ESP can also provide integrity and authentication. First, the payload is encrypted. Next,
the encrypted payload is sent through a hash algorithm, such as SHA-256 or higher. The
hash provides authentication and data integrity for the data payload. Note that MD5 and
SHA-1 should be avoided.
Optionally, ESP can also enforce anti-replay protection. Anti-replay protection verifies
that each packet is unique and is not duplicated. This protection ensures that a hacker
cannot intercept packets and insert changed packets into the data stream. Anti-replay
works by keeping track of packet sequence numbers and using a sliding window on the
destination end.
When a connection is established between a source and destination, their counters are
initialized at zero. Each time a packet is sent, a sequence number is appended to the
packet by the source. The destination uses the sliding window to determine which
sequence numbers are expected. The destination verifies that the sequence number of
the packet is not duplicated and is received in the correct order.
For example, if the sliding window on the destination is set to one, the destination is
expecting to receive the packet with the sequence number one. After it is received, the
sliding window moves to two. When detection of a replayed packet occurs, such as the
destination receiving a second packet with the sequence number of one, an error
message is sent, the replayed packet is discarded, and the event is logged.
Anti-replay is typically used in ESP, but it is also supported in AH.
18.4.4 ESP ENCRYPTS AND AUTHENTICATES
When both authentication and encryption are selected, encryption is performed first.
One reason for this order of processing is that it facilitates rapid detection and rejection
of replayed or bogus packets by the receiving device. Prior to decrypting the packet, the
receiver can authenticate inbound packets. By doing this, it can quickly detect problems
and potentially reduce the impact of DoS attacks. To reiterate, ESP provides
confidentiality with encryption and provides integrity with authentication.
Up to this point, the discussion of IPsec has focused on IPv4. However, IPsec was
initially established to provide security for IPv6 packets. Therefore, the IPsec
implementations for IPv4 and IPv6 are similar as far as the standards are concerned. In
IPv4, AH and ESP are IP protocol headers. IPv6 uses the extension headers with a next-
header value of 50 for ESP and 51 for AH.
ESP and AH can be applied to IP packets in two different modes, transport mode and
tunnel mode, as shown in the figure below.
Transport Mode
In transport mode, security is provided only for the transport layer of the OSI model and
above. Transport mode protects the payload of the packet but leaves the original IP
address in plaintext. The original IP address is used to route the packet through the
internet. ESP transport mode is used between hosts.
Tunnel Mode
Tunnel mode provides security for the complete original IP packet. The original IP
packet is encrypted and then it is encapsulated in another IP packet. This is known as
IP-in-IP encryption. The IP address on the outside IP packet is used to route the packet
through the internet.
Back to regularly scheduled programming
ESP tunnel mode is used between a host and a security gateway, or between two
security gateways, as shown in the figure.
For host-to-gateway applications, a home office might not have a router to perform the
IPsec encapsulation and encryption. In this case, an IPsec client running on the PC
performs the IPsec IP-in-IP encapsulation and encryption. For gateway-to-gateway
applications, rather than load IPsec on all of the computers at the remote and corporate
offices, it is easier to have the security gateways perform the IP-in-IP encryption and
encapsulation. At the corporate office, the router de-encapsulates and decrypts the
packet.
As shown in the figure, AH transport mode provides authentication and integrity for the
entire packet. It does not encrypt the data, but it is protected from modification. AH
tunnel mode encapsulates the IP packet with an AH and a new IP header, and signs the
entire packet for integrity and authentication.
18.5 INTERNET KEY EXCHANGE
18.5.1 THE IKE PROTOCOL
The Internet Key Exchange (IKE) protocol is a key management protocol standard. IKE
is used in conjunction with the IPsec standard. As shown in the figure, IKE
automatically negotiates IPsec security associations and enables IPsec secure
communications. IKE enhances IPsec by adding features and simplifies configuration
for the IPsec standard. Without IKE in place, IPsec configuration would be a complex,
manual configuration process that would not scale well.
IKE is a hybrid protocol that implements key exchange protocols inside the Internet
Security Association Key Management Protocol (ISAKMP) framework. ISAKMP
(pronounced “Ice-a-camp”) defines the message format, the mechanics of a key
exchange protocol, and the negotiation process to build an SA for IPsec.
Instead of transmitting keys directly across a network, IKE calculates shared keys based
on the exchange of a series of data packets. This disables a third party from decrypting
the keys even if the third party captured all of the exchanged data that was used to
calculate the keys. IKE uses UDP port 500 to exchange IKE information between the
security gateways. UDP port 500 packets must be permitted on any IP interface that is
connecting a security gateway peer.
IKE uses ISAKMP for phase 1 and phase 2 of key negotiation. Phase 1 negotiates a
security association (a key) between two IKE peers. The key negotiated in phase 1
enables IKE peers to communicate securely in phase 2. During phase 2 negotiation, IKE
establishes keys (security associations) for other applications, such as IPsec.
In Phase 1, two IPsec peers perform the initial negotiation of SAs. The basic purpose of
Phase 1 is to negotiate ISAKMP policy, authenticate the peers, and set up a secure
tunnel between the peers. This tunnel will then be used in Phase 2 to negotiate the IPsec
policy, as shown in the figure.
Note: The phrases IKE policy and ISAKMP policy are equivalent. The phrase ISAKMP
policy is used in this course to better match the commands (crypto isakmp
policy, show isakmp policy, etc.) as well as to clarify that the ISAKMP policy applies
to the IKE Phase 1 tunnel.
Phase 1 can be implemented in main mode or aggressive mode. When main mode is
used, the identities of the two IKE peers are hidden. Aggressive mode takes less time
than main mode to negotiate keys between peers. However, since the authentication
hash is sent unencrypted before the tunnel is established, aggressive mode is vulnerable
to brute-force attacks.
Note: In Cisco IOS software, the default action for IKE authentication is to initiate main
mode. However, Cisco IOS software will respond in aggressive mode to an IKE peer
that initiates aggressive mode.
18.5.3 PHASE 2: NEGOTIATING SAs
The purpose of IKE Phase 2 is to negotiate the IPsec security parameters that will be
used to secure the IPsec tunnel, as shown in the figure. IKE Phase 2 is called quick
mode and can only occur after IKE has established a secure tunnel in Phase 1. SAs are
negotiated by the IKE process ISAKMP on behalf of IPsec, which needs encryption
keys for operation. Quick mode negotiates the IKE Phase 2 SAs. In this phase, the SAs
that IPsec uses are unidirectional; therefore, a separate key exchange is required for
each data flow.
Quick mode also renegotiates a new IPsec SA when the IPsec SA lifetime expires.
Basically, quick mode refreshes the keying material that creates the shared secret key.
This is based on the keying material that is derived from the DH exchange in Phase 1.
IKE version 2, a next-generation key management protocol based on RFC 5996, is an
enhancement of the IKE protocol. IKE version 2 supports NAT detection and NAT
Traversal (NAT-T) during Phase 1. If both VPN devices are NAT-T capable, and if they
detect that they are connecting to each other through a NAT device, NAT-T is auto
detected and auto negotiated. NAT-T encapsulates ESP packets inside UDP and assigns
both the Source and Destination ports as 4500. Now ESP packets can traverse NAT.
Organizations use virtual private networks (VPNs) to create end-to-end private network
connections that are transported over a public network. A VPN is private in that the
traffic is encrypted to keep the data confidential while it is transported across the public
network.
Modern VPNs now support encryption features, such as Internet Protocol Security
(IPsec) and Secure Sockets Layer (SSL) to secure network traffic between sites.
Benefits include:
o Cost savings
o Security
o Scalability
o Compatibility
VPN Topologies
IPsec is a framework used to define how a VPN connection will ensure confidentiality,
integrity, and origin authentication. It is not bound to any specific protocols enabling it
to integrate using new security technologies. When establishing a VPN link, the peers
must share the same SA to negotiate key exchange parameters, establish a shared key,
authenticate each other, and negotiate the encryption parameters.
IPsec provides:
o Confidentiality - Using symmetric encryption protocols (i.e., AES, SEAL,
3DES, and DES).
o Integrity – Using Hashed Message Authentication Code (HMAC) hashing
algorithms (i.e., SHA or MD5).
o Authentication – Using a pre-shared secret or RSA.
DH provides a way for two peers to establish a shared secret key that only they know,
even though they are communicating over an insecure channel.
IPsec Protocols
The Internet Key Exchange (IKE) protocol is a key management protocol standard that
is used to automatically negotiate IPsec security associations and enable IPsec secure
communications. IKE uses UDP port 500 to exchange IKE information between the
security gateways.
IKE uses ISAKMP for phase 1 and phase 2 of key negotiation. Phase 1 negotiates a
security association (a key) between two IKE peers. The key negotiated in phase 1
enables IKE peers to communicate securely in phase 2. During phase 2 negotiation, IKE
establishes keys (security associations) for other applications, such as IPsec.
MODULE 19
19.1 CONFIGURE A SITE-TO-SITE IPsec VPN
19.1.1 IPsec NEGOTIATION
In order for an IPsec VPN tunnel to become operational, IPsec negotiation must first
occur. The IPsec negotiation process to establish a VPN involves five steps, which
include IKE Phase 1 and Phase 2.
Step 1
IKE Phase 1 begins. The peers negotiate the ISAKMP SA policy. When the peers agree
on the policy and are authenticated, a secure tunnel is created.
Step 3
IKE Phase 2 begins. The IPsec peers use the authenticated secure tunnel to negotiate the
IPsec SA policy. The negotiation of the shared policy determines how the IPsec tunnel
is established.
Step 4
The IPsec tunnel is created, and data is transferred between the IPsec peers based on the
IPsec SAs.
Step 5
The IPsec tunnel terminates when the IPsec SAs are manually deleted, or when their
lifetime expires.
Implementing a site-to-site VPN requires configuring settings for both IKE Phase 1 and
Phase 2. In the phase 1 configuration, the two sites are configured with the necessary
ISAKMP security associations to ensure that an ISAKMP tunnel can be created. In the
phase 2 configuration, the two sites are configured with the IPsec security associations
to ensure that an IPsec tunnel is created within the ISAKMP tunnel. Both tunnels will
be created only when interesting traffic is detected.
The topology in the figure for XYZCORP will be used in this section to demonstrate a
site-to-site IPsec VPN implementation. Both routers are configured with IP addressing
and static routing. An extended ping on R1 verifies that routing between the LANs is
operational.
The interface and default routing configurations for R1 and R2 are shown in the
example.
R1# show run
<output omitted>
!
interface GigabitEthernet0/0
ip address 10.0.1.1 255.255.255.0
!
interface Serial0/0/0
ip address 172.30.2.1 255.255.255.0
!
ip route 192.168.1.0 255.255.255.0 Serial0/0/0
!=========================================
<output omitted>
!
interface GigabitEthernet0/0
ip address 192.168.1.1 255.255.255.0
!
interface Serial0/0/0
ip address 172.30.2.2 255.255.255.0
!
ip route 10.0.1.0 255.255.255.0 Serial0/0/0
!
All XYZCORP VPNs should be implemented using the following security policy:
o Encrypt traffic with AES 256 and SHA.
o Authenticate with PSK.
o Exchange keys with DH group 14.
o ISAKMP tunnel lifetime is 1 hour.
o IPsec tunnel uses ESP with a 15-minute lifetime.
Configure Tasks:
The configuration tasks required to meet this policy are:
o Task 1: Configure the ISAKMP Policy for IKE Phase 1
o Task 2: Configure the IPsec Policy for IPsec Phase 2
o Task 3: Configure a Crypto Map for the IPsec Policy
o Task 4: Apply the IPsec Policy
o Task 5: Verify that the IPsec Tunnel is Operational
Although XYZCORP does not have an existing ACL configuration, this would not be
the case in a production network. Perimeter routers typically implement a restrictive
security policy, blocking all traffic except for traffic specifically allowed. Prior to
implementing a site-to-site IPsec VPN, ensure that the existing ACLs do not block
traffic necessary for IPsec negotiations. The ACL command syntax to permit ISAKMP,
ESP, and AH traffic is shown here.
Router(config)# ip access-list extended name
Router(config-ext-nacl)# permit udp source wildcard destination
wildcard eq isakmp
Router(config-ext-nacl)# permit esp source wildcard destination
wildcard
Router(config-ext-nacl)# permit ahp source wildcard destination
wildcard
The example below demonstrates an ACL configuration that allows the traffic
necessary for IPsec negotiations. R2 would have a similar configuration.
R1(config)# ip access-list extended INBOUND
R1(config-ext-nacl)# permit ip 192.168.1.0 0.0.0.255 10.0.1.0
0.0.0.255
R1(config-ext-nacl)# permit icmp host 172.30.2.2 host 172.30.2.1
R1(config-ext-nacl)# permit udp host 172.30.2.2 host 172.30.2.1 eq
isakmp
R1(config-ext-nacl)# permit esp host 172.30.2.2 host 172.30.2.1
R1(config-ext-nacl)# permit ahp host 172.30.2.2 host 172.30.2.1
R1(config-ext-nacl)# deny ip any any
R1(config-ext-nacl)# exit
R1(config)# interface serial0/0/0
R1(config-if)# ip access-group INBOUND in
The XYZCORP topology uses static routing, so there is no multicast or broadcast traffic
that needs to be routed through the tunnel. But what if XYZCORP decided to
implement EIGRP or OSPF? These routing protocols use multicast addresses to
exchange routing information with neighbors. IPsec only supports unicast traffic. To
enable routing protocol traffic, the peers in a site-to-site IPsec VPN implementation
would need to be configured with a Generic Routing Encapsulation (GRE) tunnel for
the multicast traffic.
GRE supports multiprotocol tunneling, as shown in the figure. It can encapsulate
multiple OSI Layer 3 protocol packet types inside an IP tunnel. Adding an additional
GRE header between the payload and the tunneling IP header provides the
multiprotocol functionality. GRE also supports IP multicast tunneling. Routing
protocols that are used across the tunnel enable dynamic exchange of routing
information in the virtual network. GRE does not provide encryption. GRE
configuration is beyond the scope of this course.
The first task is to configure the ISAKMP policy for IKE Phase 1. The ISAKMP policy
lists the SAs that the router is willing to use to establish the IKE Phase 1 tunnel. The
Cisco IOS comes with default ISAKMP policies already in place. To view the default
policies, enter the show crypto isakmp default policy command, as shown in the
example after the figure.
R1# show crypto isakmp default policy
R1 has eight default ISAKMP policies ranging from the most secure (policy 65507) to
the least secure (policy 65514). If no other policy has been defined by the administrator,
R1 will attempt to use the most secure default policy. If R2 has a matching policy, then
R1 and R2 can successfully negotiate the IKE Phase 1 ISAKMP tunnel without any
configuration by the administrator. Eight default policies allow for flexibility in the
negotiations. If there is no agreement to use the most secure default policy, R1 will
attempt to use the next most secure policy.
In this example, none of the default policies match the security policy for XYZCORP.
So a new ISAKMP policy will have to be configured.
To configure a new ISAKMP policy, use the crypto isakmp policy command, as
shown in the figure. The only argument for the command is to set a priority for the
policy (from 1 to 10000). Peers will attempt to negotiate using the policy with the
lowest number (highest priority). Peers do not require matching priority numbers.
When in ISAKMP policy configuration mode, the SAs for the IKE Phase 1 tunnel can
be configured. Use the mnemonic HAGLE to remember the five SAs to configure:
o Hash
o Authentication
o Group
o Lifetime
o Encryption
R1(config)# crypto isakmp policy ?
<1-1000> Priority of protection suite
R1(config)# crypto isakmp policy 1
R1(config-isakmp)# ?
ISAKMP commands:
authentication Set authentication method for protection suite
default Set a command to its defaults
encryption Set encryption algorithm for protection suite
exit Exit from ISAKMP protection suite configuration
mode
group Set the Diffie-Hellman group
hash Set hash algorithm for protection suite
lifetime Set lifetime for ISAKMP security association
no Negate a command or set its defaults]]>
To meet the security policy requirements for XYZCORP, configure the ISAKMP policy
with the following SAs:
o Hash is SHA
o Authentication is pre-shared key
o Group is 14
o Lifetime is 3600 seconds
o Encryption is AES
The example shows the ISAKMP policy configuration. Use the show crypto isakmp
policy command to verify the configuration. R2 has an equivalent configuration.
R1(config)# crypto isakmp policy 1
R1(config-isakmp)# encryption aes 256
R1(config-isakmp)# hash sha
R1(config-isakmp)# authentication pre-share
R1(config-isakmp)# group 24
R1(config-isakmp)# lifetime 3600
R1(config-isakmp)# end
R1# show crypto isakmp policy
The XYZCORP security policy requires that a pre-shared key be used for authentication
between the peers. The administrator can either specify a host name or an IP address for
the peer. The command syntax is shown below.
Router(config)# crypto isakmp key keystring address peer-address
Router(config)# crypto isakmp key keystring hostname peer-hostname
XYZCORP uses the key phrase cisco12345 and the IP address of the peer as shown in
the examples after the figure.
R1# conf t
R1(config)# crypto isakmp key cisco12345 address 172.30.2.2
R1(config)#
R2# conf t
R2(config)# crypto isakmp key cisco12345 address 172.30.2.1
R2(config)#
Although the ISAKMP policy for the IKE Phase 1 tunnel is configured, the tunnel does
not yet exist. This is verified with the show crypto isakmp sa command in the figure
below. Interesting traffic must be detected before IKE Phase 1 negotiations can begin.
For the XYXCORP site-to-site VPN, interesting traffic is any permitted
communications between the Site 1 and Site 2 LANs.
R1# show crypto isakmp sa
IPv4 Crypto ISAKMP SA
dst src state conn-id status
R1#
To define interesting traffic, configure each router with an ACL to permit traffic from
the local LAN to the remote LAN, as shown in the following examples for R1 and R2.
The ACL will be used in the crypto map configuration to specify what traffic will
trigger the start of IKE Phase 1.
R1# conf t
R1(config)# access-list 101 permit ip 10.0.1.0 0.0.0.255
192.168.1.0 0.0.0.255
R1(config)#
R2# conf t
R2(config)# access-list 102 permit ip 192.168.1.0 0.0.0.255
10.0.1.0 0.0.0.255
R2(config)#
After the transform set is named, the encryption and hashing algorithm can be
configured in either order. The examples show the transform set configuration for R1
and R2.
R1(config)# crypto ipsec transform-set R1-R2 esp-aes esp-sha-hmac
R1(config)#
Now that the interesting traffic is defined, and an IPsec transform set is configured, it is
time to bind those configurations with the rest of the IPsec policy in a crypto map. The
syntax to start a crypto map set is shown below. The sequence number is important
when configuring multiple crypto map entries. XYZCORP will only need one crypto
map entry to match traffic and account for the remaining SAs. Although the ipsec-
manual option is shown, its use is beyond the scope of this course.
Router(config)# crypto map map-name seq-num { ipsec-isakmp | ipsec-
manual }
Parameter Description
map-name Identifies the crypto map set.
Sequence number you assign to the crypto map entry. Use
seq-num the crypto map map-name seq-num command without any
keyword to modify the existing crypto map entry or profile.
ipsec-isakmp Indicates that IKE will be used to establish the IPsec for protecting
the traffic specified by this crypto map entry.
ipsec-manual Indicates that IKE will not be used to establish the IPsec SAs for
protecting the traffic specified by this crypto map entry.
The available configurations for a crypto map entry when you are in crypto map
configuration mode are shown below. The map name is R1-R2_MAP, and the sequence
number is 10.
R1(config)# crypto map R1-R2_MAP 10 ipsec-isakmp
% NOTE: This new crypto map will remain disabled until a peer
and a valid access list have been configured.
R1(config-crypto-map)# ?
Crypto Map configuration commands:
default Set a command to its defaults
description Description of the crypto map statement policy
dialer Dialer related commands
disable Disable this crypto-map-statement.
exit Exit from crypto map configuration mode
match Match values.
no Negate a command or set its defaults
qos Quality of Service related commands
reverse-route Reverse Route Injection.
set Set values for encryption/decryption
To finish the configuration to meet the IPsec security policy for XYZCORP, complete
the following:
o Step 1. Bind the ACL and the transform set to the map.
o Step 2. Specify the peer’s IP address.
o Step 3. Configure the DH group.
o Step 4. Configure the IPsec tunnel lifetime.
The crypto map configurations for R1 and R2 are shown below.
R1(config)# crypto map R1-R2_MAP 10 ipsec-isakmp
% NOTE: This new crypto map will remain disabled until a peer
and a valid access list have been configured.
R1(config-crypto-map)# match address 101
R1(config-crypto-map)# set transform-set R1-R2
R1(config-crypto-map)# set peer 172.30.2.2
R1(config-crypto-map)# set pfs group24
R1(config-crypto-map)# set security-association lifetime seconds
900
R1(config-crypto-map)# exit
R1(config)#
Use the show crypto map command to verify the crypto map configuration, as shown
below for R1. All the required SAs should be in place. Notice that the output shows that
no interfaces are currently using the crypto map.
R1# show crypto map
Crypto Map IPv4 "R1-R2_MAP" 10 ipsec-isakmp
Peer = 172.30.2.2
Extended IP access list 101
access-list 101 permit ip 10.0.1.0 0.0.0.255 192.168.1.0
0.0.0.255
Security association lifetime: 4608000 kilobytes/900 seconds
Responder-Only (Y/N): N
PFS (Y/N): Y
DH group: group24
Mixed-mode : Disabled
Transform sets={
R1-R2: { esp-aes esp-sha-hmac } ,
}
Interfaces using crypto map R1-R2_MAP:
R1#
To apply the crypto map, enter interface configuration mode for the outbound interface
and configure the crypto map map-name command. Below is the configuration for
XYZCORP. Notice the show crypto map output now displays that the Serial 0/0/0
interface is using the crypto map. R2 is configured with the same command on its Serial
0/0/0 interface.
R1(config)# interface serial0/0/0
R1(config-if)# crypto map R1-R2_MAP
R1(config-if)#
*Mar 19 19:36:36.273: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON
R1(config-if)# end
R1# show crypto map
Crypto Map IPv4 "R1-R2_MAP" 10 ipsec-isakmp
Peer = 172.30.2.2
Extended IP access list 101
access-list 101 permit ip 10.0.1.0 0.0.0.255
192.168.1.0 0.0.0.255
Security association lifetime: 4608000 kilobytes/900
seconds
Responder-Only (Y/N): N
PFS (Y/N): Y
DH group: group24
Mixed-mode : Disabled
Transform sets={
R1-R2: { esp-aes esp-sha-hmac } ,
}
Interfaces using crypto map R1-R2_MAP:
Serial0/0/0
Now that both the ISAKMP and IPsec policies are configured, and the crypto map is
applied to the appropriate outbound interfaces, test the two tunnels by sending
interesting traffic across the link.
Traffic from the LAN interface on R1 that is destined for the LAN interface on R2 is
considered interesting traffic because it matches the ACLs configured on both routers.
An extended ping from R1 will effectively test the VPN configuration. The
extended ping command syntax and results are shown below. The first ping failed
because it takes a few milliseconds to establish the ISAKMP and IPsec tunnels.
R1# ping 192.168.1.1 source 10.0.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2
seconds:
Packet sent with a source address of 10.0.1.1
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/2/4 ms
R1#
Sending interesting traffic does not actually mean that the tunnels are established. R1
and R2 will route traffic between the two LANs even if the ISAKMP and IPsec policy
configurations are wrong. To verify that tunnels have been established, use the show
crypto isakmp sa and show crypto ipsec sa commands. In the output below, notice
that the tunnel is active between the two peers, 172.30.2.1 and 172.30.2.2, and that they
are using the R1-R2_MAP crypto map.
R1# show crypto isakmp sa
IPv4 Crypto ISAKMP SA
dst src state conn-id status
172.30.2.2 172.30.2.1 QM_IDLE 1005 ACTIVE
R1#
interface: Serial0/0/0
Crypto map tag: R1-R2_MAP, local addr 172.30.2.1
inbound ah sas:
outbound ah sas:
IPsec negotiation to establish a VPN involves five steps, which include IKE Phase 1
and Phase 2.
An ISAKMP tunnel is initiated when host A sends “interesting” traffic to host B.
Traffic is considered interesting when it travels between the peers and meets the criteria
that are defined in an ACL. IKE Phase 1 begins. The peers negotiate the ISAKMP SA
policy.
When the peers agree on the policy and are authenticated, and a secure tunnel is created.
IKE Phase 2 begins.
The IPsec peers use the authenticated secure tunnel to negotiate the IPsec SA policy.
The negotiation of the shared policy determines how the IPsec tunnel is established.
The IPsec tunnel is created, and data is transferred between the IPsec peers based on the
IPsec SAs. The IPsec tunnel terminates when the IPsec SAs are manually deleted, or
when their lifetime expires. Implementing a site-to-site VPN requires configuring
settings for both IKE Phase 1 and Phase 2. In the Phase 1 configuration, the two sites
are configured with the necessary ISAKMP security associations to ensure that an
ISAKMP tunnel can be created. In the Phase 2 configuration, the two sites are
configured with the IPsec security associations to ensure that an IPsec tunnel is created
within the ISAKMP tunnel.
Both tunnels will be created only when interesting traffic is detected. IPsec only
supports unicast traffic. To enable multicast routing protocol traffic, the peers in a site-
to-site IPsec VPN implementation would need to be configured with a Generic Routing
Encapsulation (GRE) tunnel for the multicast traffic. GRE supports multiprotocol
tunneling. It can encapsulate multiple OSI Layer 3 protocol packet types inside an IP
tunnel. The addition of an additional GRE header between the payload and the
tunneling IP header provides the multiprotocol functionality. GRE also supports IP
multicast tunneling. Routing protocols that are used across the tunnel enable dynamic
exchange of routing information in the virtual network. GRE does not provide
encryption.
ISAKMP Policy
The ISAKMP policy lists the SAs that the router is willing to use to establish the IKE
Phase 1 tunnel. The Cisco IOS comes with default ISAKMP policies already in place.
To view the default policies, enter the show crypto isakmp default policy command.
The router will attempt to use the most secure default policy if no other policy was
defined by the administrator. To configure a new ISAKMP policy, use the crypto
isakmp policy command. The five SAs to configure are hash, authentication, group,
lifetime, and encryption (HAGLE).
IPsec Policy
Although the ISAKMP policy for the IKE Phase 1 tunnel is configured, the tunnel does
not yet exist. This is verified with the show crypto isakmp sa command. To define
interesting traffic, configure each router with an ACL to permit traffic from the local
LAN to the remote LAN. The ACL will be used in the crypto map configuration to
specify what traffic will trigger the start of IKE Phase 1. Configure the set of encryption
and hashing algorithms that will be used to transform the data that is sent through the
IPsec tunnel. Configure a transform set using the crypto ipsec transform-
set command.
Crypto Map
Now that the interesting traffic is defined, and an IPsec transform set is configured, it is
time to bind those configurations with the rest of the IPsec policy in a crypto map. To
finish the configuration to meet the IPsec security policy you must bind the ACL and
the transform set to the map, specify the peer’s IP address, configure the DH group, and
configure the IPsec tunnel lifetime. Use the show crypto map command to verify the
crypto map configuration. To apply the crypto map, enter interface configuration mode
for the outbound interface and configure the crypto map map-name command.
IPsec VPN
After the ISAKMP and IPsec policies are configured, and the crypto map is applied to
the appropriate outbound interfaces, test the two tunnels by sending interesting traffic
across the link. An extended ping will effectively test the VPN configuration. To verify
that tunnels have been established, use the show crypto isakmp sa and show crypto
ipsec sa commands.
MODULE 20: INTRODUCTION TO THE ASA
20.1 ASA SOLUTIONS
20.1.1 ASA FIREWALL MODELS
An IOS router firewall solution is appropriate for small branch deployments and for
administrators who are experienced with Cisco IOS. However, an IOS firewall solution
does not scale well and typically cannot meet the needs of a large enterprise.
The Cisco ASA with FirePOWER Services family of products provides dedicated
firewall services in one device. These are next-generation firewall (NGFW) devices that
deliver integrated threat defence across the entire attack continuum.
There are several ASA models addressing the needs of various organizations. Cisco
ASA devices scale to meet a range of requirements and network sizes. The choice of
ASA model depends on an organization’s requirements, such as maximum throughput,
maximum connections per second, and budget.
The following figures display these models and their stateful inspection throughput.
All models provide advanced stateful firewall features and VPN functionality. The
biggest difference between the models is the maximum traffic throughput handled by
each model and the number and types of interfaces.
o Cisco Firepower 1000: This model is suitable for small office and home office
(SOHO) and small business.
o Cisco Firepower 2100: These models that are intended for the Internet edge of
medium to large businesses.
o Cisco Firepower 4100: This figure displays a 4100 series ASA that is intended
for large campus and data center use.
o Cisco Firepower 9300: Designed for service providers and high-performance
data centres, the 9300 appliance delivers carrier-grade performance in a
modular chassis. It creates separate logical firewalls for deployment flexibility,
quickly inspects encrypted traffic, gains application visibility, detects and
blocks network intrusions, deploys scalable VPNs, and provides integrated
protection against DDoS attacks. Devices can be clustered for performance and
high availability.
Cisco also supports the virtualization of computing infrastructure by taking advantage
of the increased power availability of modern x86 servers. The Cisco Adaptive Security
Virtual Appliance (ASAv) brings the power of ASA appliances to the virtual domain. A
server hypervisor can create a virtual switch capable of supporting many types of virtual
machines (VMs). The Cisco ASAv operates as a VM using the server’s interfaces to
process traffic.
Like the physical Cisco ASA devices, the ASAv also supports site-to-site VPN, remote-
access VPN, and clientless VPN functionalities.
Note: The ASAv does not support clustering and multiple contexts.
To provide a suitable fit for customer needs, Cisco ASAv is available in five models:
o Cisco ASAv5 - This appliance requires 2 GB of memory and delivers up to 100
Mbps of stateful inspection throughput.
o Cisco ASAv10 - This appliance requires 4 GB of memory and delivers up to 1
Gbps of stateful inspection throughput.
o Cisco ASAv30 - This appliance requires 8 GB of memory and delivers up to 2
Gbps of stateful inspection throughput.
o Cisco ASAv50 - This appliance requires 16 GB of memory and delivers up to
10 Gbps of stateful inspection throughput.
o Cisco ASAv100 - This appliance requires 32 GB of memory and delivers up to
20 Gbps of stateful inspection throughput.
Note: The focus of this module will be on the ASA 5506-X which is designed for small
business, branch office, and enterprise teleworker implementations.
As illustrated, a single ASA can be partitioned into multiple virtual devices. Each
virtual device is called a security context. Each context is an independent device, with
its own security policy, interfaces, and administrators. Multiple contexts are similar to
having multiple standalone devices. Many features are supported in multiple context
modes, including routing tables, firewall features, IPS, and management. Some features
are not supported, including VPN and dynamic routing protocols.
High availability with failover
As shown here, two identical ASAs can be paired into an active / standby failover
configuration to provide device redundancy. Both platforms must be identical in
software, licensing, memory, and interfaces, including the Security Services Module
(SSM). In the example, ASA-1 is the primary/active forwarding device and traffic
leaving PC-1 takes the preferred path using ASA-1. ASA-1 and ASA-2 monitor each
other using the LAN failover link. If ASA-1 fails, then ASA-2 would immediately
assume the primary role and become active.
Identity Firewall
All ASA models support basic IPS features. However, advanced IPS features can only
be provided by integrating special hardware modules with the ASA architecture. IPS
capability is available using the Advanced Inspection and Prevention (AIP) modules.
Antimalware capabilities can be deployed by integrating the Content Security and
Control (CSC) module. The Cisco Advanced Inspection and Prevention Security
Services Module (AIP-SSM) and Cisco Advanced Inspection and Prevention Security
Services Card (AIP-SSC) deliver protection against tens of thousands of known
exploits. They also protect against millions of other unknown exploit variants using
specialized IPS detection engines and thousands of signatures. Cisco Services for IPS
provides signature updates through a global intelligence team that is working 24 hours a
day to help ensure protection against the latest threats.
Traditionally, organizations used dedicated devices to protect their network. The Cisco
next-generation firewall (NGFW) combines proven firewall technology with advanced
threat and malware detection capabilities.
These NGFWs consolidate multiple security layers into a single platform, eliminating
the cost of buying and managing multiple solutions. This integrated approach combines
best-in-class security technology with multilayer protection that is integrated into a
single device.
The Cisco ASA 5500-X with FirePOWER Services devices are part of the new Cisco
NGFWs. Designed for small to medium branch offices, the ASA 5500-X with
FirePOWER Services merges the ASA 5500 stateful firewall features with some of the
following advanced threat and malware detection capabilities:
o Next-generation IPS (NGIPS)
o Advanced Malware Protection (AMP)
o Application control and URL filtering
Note: “FirePOWER” refers to the Firepower services running on an ASA while
“Firepower” refers to Cisco Firepower series of NGFW devices.
When discussing networks that are connected to a firewall, there are some general terms
to consider:
o Outside network - The network/zone that is outside the protection of the
firewall.
o Inside network - The network/zone that is protected and behind the firewall.
o DMZ - The demilitarized zone that allows both inside and outside users access
to protected network resources.
Firewalls protect inside networks from unauthorized access by users who are on an
outside network. They also protect inside network users from each other. For example,
by creating zones, an administrator can keep the network that is hosting the accounting
servers separate from other networks in an organization.
The figure illustrates how these zones interact for permitted traffic:
o Traffic originating from the inside network going to the outside network is
permitted.
o Traffic originating from the inside network going to the DMZ network is
permitted.
o Traffic originating from the outside network going to the DMZ network is
selectively permitted.
The figure below illustrates how these zones interact for denied traffic:
o Traffic originating from the outside network going to the inside network is
denied.
o Traffic originating from the DMZ network going to the inside network is
denied.
Cisco ISRs can provide firewall features by using either the Zone-Based Policy Firewall
(ZPF) or by using the older context-based access control (CBAC) feature. An ASA
provides the same features, but the configuration differs considerably from the IOS
router configuration of the ZPF.
The ASA is a dedicated firewall appliance. By default, it treats a defined inside
interface as the trusted network and any defined outside interfaces as untrusted
networks.
Each interface has an associated security level. These security levels enable the ASA to
implement security policies. For example, inside users can access outside networks
based on certain addresses, by requiring authentication or authorization, or by
coordinating with an external URL filtering server.
Note: Security levels are sometimes called trust levels. In this course, we will use the
term security levels.
Network resources that are needed by outside users, such as a web or FTP server, can
be located in a DMZ. The firewall allows limited access to the DMZ while protecting
the inside network from outside users.
There are two firewall interface modes of operation available on ASA devices: routed
mode and transparent mode.
Routed Mode
In routed mode, two or more interfaces separate Layer 3 networks (i.e., domains). In the
figure, the ASA is considered to be a router hop in the network and can perform NAT
between connected networks. Routed mode supports multiple interfaces. Each interface
is on a different subnet and requires an IP address on that subnet. The ASA applies
policies to flows as they transit the firewall.
Note: The focus of this module is on the routed mode.
Transparent Mode
A license specifies the options that are enabled on a given ASA. Most ASA appliances
come pre-installed with either a Base license or a Security Plus license. For example,
the Cisco ASA 5506-X model comes with a Base license and the option to upgrade to
the Security Plus license. The Security Plus upgrade license enables the Cisco ASA
5506-X to scale to support a higher connection capacity and up to 50 IPsec VPN users.
It adds full DMZ support and integrates into switched network environments through
VLAN trunking support. Furthermore, the Security Plus license enables support for
redundant ISP connections and stateless active/standby high-availability services. This
feature helps to ensure business continuity.
To provide more features to the ASA, additional time-based or optional licenses can be
purchased. For example, an administrator can install a Botnet Traffic Filter time-based
license that is valid for one year. Another example would be if the ASA must handle a
short-term surge in the number of concurrent SSL VPN users. In this case, an optional
AnyConnect Premium license can be purchased.
Combining these additional licenses to the pre-installed licenses creates a permanent
license. The permanent license is then activated by installing a permanent activation key
using the activation-key command. The permanent activation key includes all licensed
features in a single key. A product activation key can be purchased from a Cisco
account representative.
Note: Only one permanent license key can be installed. After it is installed, it is referred
to as the running license.
To verify the license information on an ASA device, use the show activation-key
command, as shown below, or the show version command.
NETSEC-ASA# show activation-key
The Cisco ASA 5506-X is a full-featured security appliance for small businesses,
branch offices, and enterprise teleworker environments. It delivers a high-performance
firewall, SSL VPN, IPsec VPN, and rich networking services in a modular, plug-and-
play appliance.
The figure illustrates the front panel of the ASA 5506-X.
The figure below illustrates the back panel of the Cisco ASA 5506-X. The default
DRAM memory is 4 GB and the default internal flash memory is 8 GB. In a failover
configuration, the two units must be identical models with the same hardware
configuration, the same number and types of interfaces, and the same amount of RAM.
Failover is available with the Security Plus license.
The figure below shows the inside components of the Cisco ASA 5506-X.
Note: Unlike the ASA 5506-X that uses routed interfaces and IP addresses, the ASA
5505 used switchports and VLANs similar to a Layer 2 switch.
20.2.2 ASA SECURITY LEVELS
The ASA assigns security levels to distinguish between inside and outside networks.
Security levels define the level of trustworthiness of an interface. The higher the level,
the more trusted the interface. The security level numbers range from 0 (untrustworthy)
to 100 (very trustworthy). Each operational interface must have a name and a security
level from 0 (lowest) to 100 (highest) assigned.
As shown in the figure below, level 100 should be assigned to the most secure network,
such as the inside network. Level 0 can be assigned to the outside network, which is
connected to the Internet. DMZs and other networks can be assigned a security level
between 0 and 100. When traffic moves from an interface with a higher security level to
an interface with a lower security level, it is considered outbound traffic. Conversely,
traffic moving from an interface with a lower security level to an interface with a higher
security level is considered inbound traffic.
Security levels help to control many aspects of network traffic as shown in the table
below.
Aspect Effect
By default, there is an implicit permit from a higher security interface
to a lower security interface (outbound). Hosts on the higher
security interface can access hosts on a lower security interface.
Network Access
Multiple interfaces can be assigned the same security level. If
communication is enabled for interfaces with the same security
level, there is an implicit permit for traffic between the interfaces.
Some application inspection engines are dependent on the security
Inspection Engines level. When interfaces have the same security level, the ASA
inspects traffic in either direction.
Application Filtering HTTPS and FTP filtering applies only for outbound connections that
are from a higher level to a lower level. If communication is enabled
Aspect Effect
for interfaces with the same security level, traffic can be filtered in
either direction.
The ASA 5506-X is commonly used as an edge security device. It connects a small
business to an ISP device, such as a DSL or cable modem, for access to the internet. It
can be deployed to interconnect and protect several workstations, network printers, and
IP phones.
In a small branch, a common deployment would include an inside network with security
level 100 and an outside network with security level 0, as shown in the figure below.
In the small business, as shown below, the ASA 5506-X can be deployed with two
different protected network segments. One segment is the inside network, which
connects workstations and IP phones. The other segment is the DMZ, which connects a
company web server. The outside interface is used to connect to the internet.
The Cisco ASA with FirePOWER Services family of products provides dedicated
firewall services in one device. These are NGFW devices that deliver integrated threat
defence across the entire attack continuum. The choice of ASA model depends on an
organization’s requirements, such as maximum throughput, maximum connections per
second, and budget. The Cisco ASAv brings the power of ASA appliances to the virtual
domain. When discussing networks connected to a firewall, there are some general
terms to consider: outside network, inside network, and the DMZ.
There are two firewall interface modes of operation available on ASA devices: routed
mode and transparent mode. In routed mode, two or more interfaces separate Layer 3
networks, i.e. domains. An ASA in transparent mode is often referred to as a “bump in
the wire,” or a “stealth firewall” because the ASA functions like a Layer 2 device and is
not considered a router hop. Advanced ASA firewall features include ASA
virtualization, high availability with failover, identity firewall, and threat control and
containment services. Most ASA appliances come pre-installed with either a Base
license or a Security Plus license.
The ASA 5506-X with FirePOWER Services
The Cisco ASA 5506-X is a full-featured security appliance for small businesses,
branch offices, and enterprise teleworker environments. It delivers a high-performance
firewall, SSL VPN, IPsec VPN, and rich networking services in a plug-and-play
appliance. The ASA assigns security levels to distinguish between inside and outside
networks. The security level numbers range from 0 (untrustworthy) to 100 (very
trustworthy). Outbound traffic is allowed and inspected by default. Returning traffic is
allowed because of stateful packet inspection. The ASA 5506-X is commonly used as
an edge security device. It connects a small business to an ISP device, such as a DSL or
cable modem, for access to the internet.
The ASA command line interface (CLI) is a proprietary OS, which has a similar look
and feel to the router IOS. For example, the ASA CLI contains command prompts
similar to that of a Cisco IOS router, as shown in the figure. Also, like the IOS CLI, the
ASA CLI also recognizes the following:
o Abbreviation of commands and keywords
o Use of the Tab key to complete a partial command
o Use of the help key (?) after a command to view additional syntax
However, the ASA CLI also has different commands. The table contrasts common IOS
router and ASA commands:
ASA CLI commands can be executed regardless of the current configuration mode
prompt. The IOS command do is not required nor recognized. The following examples
display some features unique to the ASA.
Note: All ASA models can be configured and managed using either the CLI or the
Adaptive Security Device Manager (ASDM). The focus of this module is on ASA CLI.
ASDM is discussed in an optional topic at the end of this module.
The ASA 5506-X with FirePOWER Services ships with a default configuration that, in
most instances, is sufficient for a basic SOHO deployment.
Note: The ASA can be restored to its factory default configuration by using the
configure factory-default global configuration mode command.
The default hostname is ciscoasa. By default, the privileged EXEC and console line
passwords are not configured. All interfaces are shutdown and unnamed. The default
configuration is partially displayed in the example. These settings can be changed by:
o Manually using the CLI
o Interactively using the CLI Setup Initialization wizard
o Using the ASDM Startup wizard
hostname ciscoasa
enable password 8Ry2YjIyt7RRXU24 encrypted
names
no mac-address auto
!
interface GigabitEthernet1/1
shutdown
no nameif
no security-level
no ip address
!
interface GigabitEthernet1/2
shutdown
no nameif
no security-level
no ip address
!
<output omitted>
interface Management1/1
management-only
shutdown
no nameif
no security-level
no ip address
!
ftp mode passive
pager lines 24
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
no arp permit-nonconnected
arp rate-limit 16384
timeout xlate 3:00:00
timeout pat-xlate 0:00:30
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 sctp 0:02:00
icmp 0:00:02
<output omitted>
The ASA provides an interactive setup initialization wizard to simplify the initial
configuration of the device. The wizard guides the administrator to configure basic
settings using interactive prompts.
The wizard is displayed when there is no startup configuration, or if the startup
configuration is erased and the ASA is rebooted using the write
erase and reload privileged EXEC commands.
When the device is rebooted, the ASA wizard displays the prompt “Pre-configure
Firewall now through interactive prompts [yes]?” To cancel and display the ASA
default user EXEC mode prompt, enter no. Otherwise, enter yes or simply
press Enter to accept the default [yes]. This initiates the wizard and the ASA
interactively guides an administrator to configure the default settings.
The following shows an example of an interactive configuration.
Note: The security appliance displays the default values in brackets ([ ]) before
prompting the user to accept or change them. To accept the default input, press Enter.
Pre-configure Firewall now through interactive prompts [yes]?
<Enter>
Firewall Mode [Routed]: <Enter>
Enable password [<use current password>]: cisco
Allow password recovery [yes]? <Enter>
Clock (UTC):
Year [2021]:
Month [Feb]:
Day [9]:
Time [11:21:11]:
Management IP address: 192.168.1.1
Management network mask: 255.255.255.0
Host name: NETSEC-ASA
Domain name: netsec.com
IP address of host running Device Manager: 192.168.1.100
After the interactive portion of the wizard is completed, the security appliance displays
the summary of the new configuration and prompts the user to save or reject the
settings. Answering yes saves the configuration to flash and displays the configured
hostname prompt. Answering no restarts the Setup Initialization wizard from the
beginning with any changes that had been made as the new default settings. This
enables the administrator to correct a misconfigured setting.
Although the wizard provides the basic configuration settings, most administrators
prefer to manually configure the device using the CLI commands.
The default ASA user prompt of ciscoasa> is displayed when an ASA configuration is
erased, the device is rebooted, and the user does not use the interactive setup wizard.
To enter privileged EXEC mode, use the enable user EXEC mode command. Initially,
an ASA does not have a password configured; therefore, when prompted, leave the
enable password prompt blank and press Enter.
The ASA date and time should be set either manually or by using Network Time
Protocol (NTP). To set the date and time, use the clock set privileged EXEC command.
Enter global configuration mode using the configure terminal privileged EXEC
command. The first time that global configuration mode is accessed, a message
pertaining to the Smart Call Home feature appears. This allows activation of the
anonymous error reporting to Cisco regarding the status and health of device. Other
Smart Call Home features are accessed in call-home configuration mode. These
features offer proactive diagnostics and real-time alerts on select Cisco devices, which
provides higher network availability and increased operational efficiency. To
participate, a cisco.com ID is required, and the ASA device must be registered under a
Cisco SMARTnet Service contract.
Search the internet to learn more about Cisco Smart Call Home.
An example of entering privileged EXEC and global configuration mode is shown
below. A simple configuration is entered, and the anonymous Smart Call Home prompt
is shown.
ciscoasa> enable
Password:
ciscoasa#
ciscoasa# clock set 12:00:00 1 April 2020
ciscoasa#
ciscoasa# configure terminal
ciscoasa(config)#
ciscoasa(config)#
An ASA must be configured with basic management settings. The table displays the
commands to accomplish this task.
Logoff
---------------------------------------------------------
Authorized access only!
You have logged into a secure device.
---------------------------------------------------------
The example displays a sample configuration for encrypting all user passwords.
To change the Primary passphrase, use the key config-key password-
encryption command. To determine if password encryption is enabled, use the show
password encryption command.
NETSEC-ASA> enable
Password: *********
NETSEC-ASA# show password encryption
Password Encryption: Disabled
Master key hash: Not set(saved)
NETSEC-ASA#
NETSEC-ASA# configure terminal
NETSEC-ASA(config)# key config-key password-encryption cisco123
NETSEC-ASA(config)# password encryption aes
NETSEC-ASA(config)# exit
NETSEC-ASA#
NETSEC-ASA# show password encryption
Password Encryption: Enabled
Master key hash: 0x45ebef8e 0x77a0f287 0x90247f80 0x2a184246
0xe85cbcc4(not saved)
NETSEC-ASA# write
Building configuration...
Cryptochecksum: c2cb4c42 66ed8038 c81a3d7f c5df996e
Each interface must have a security level from 0 (lowest) to 100 (highest). For example,
you should assign your most secure network, such as the inside host network, to level
100. While the outside network connected to the Internet can be level 0. Other
networks, such as DMZs can be in between. You can assign interfaces to the same
security level.
The example displays a sample configuration. Notice how default security level values
are assigned to the inside interface and outside interfaces. Note that the DMZ interface
is assigned the same security level as the outside untrusted network. Therefore, the
security-level command is really only required if an administrator chooses to change
those values. Any other interface should be assigned a security level value.
The security level default behaviour is to implicitly permit traffic from a higher security
interface to a lower security interface outbound. Traffic is implicitly permitted between
interfaces with the same security level if the ASA has been configured to globally
permit this behaviour. Traffic from interfaces with lower security levels is implicitly
denied to interfaces with higher security levels.
In the example, the outside interface is manually configured with an IP address.
However, many ISPs use DHCP to provide addresses to customer networks. In that case
use the ip address dhcp command to configure the outside interface.
The commands below are used to configure basic interface parameters:
security-level value Sets the security level, where number is an integer between
0 (lowest) and 100 (highest).
no shutdown Activate the interface.
If an ASA is configured as a DHCP client, then it can receive and install a default route
from the upstream device. Otherwise, a default static route must be configured using
the route interface-name 0.0.0.0 0.0.0.0 next-hop-ip-address command. To verify the
route entry, use the show route command.
The example shows the configuration and verification of a default static route.
NETSEC-ASA(config)# route OUTSIDE 0.0.0.0 0.0.0.0 209.165.200.226
NETSEC-ASA(config)#
NETSEC-ASA(config)# show route | begin Gateway
Gateway of last resort is 209.165.200.226 to network 0.0.0.0
NETSEC-ASA(config)#
Telnet or SSH is required to manage the ASA 5506-X remotely, using the CLI. To
enable the Telnet service, use the commands listed in the table.
Note: The aaa authentication telnet console LOCAL command overrides the
password set with the password command and authenticates the Telnet access against
the local database.
clear configure telnet Removes the Telnet connection from the configuration.
The configuration in the example enables Telnet on an ASA 5506-X. In the example,
only the inside host with IP address 192.168.1.3 would be permitted to access the ASA.
The ASA will close the Telnet session if it is left idle for three minutes.
NETSEC-ASA(config)# password cisco
NETSEC-ASA(config)# telnet 192.168.1.3 255.255.255.255 INSIDE
NETSEC-ASA(config)# telnet timeout 3
NETSEC-ASA(config)#
NETSEC-ASA(config)# show run telnet
telnet 192.168.1.3 255.255.255.255 INSIDE
telnet timeout 3
NETSEC-ASA(config)#
ssh timeout minutes Alters the default exec timeout of five minutes.
clear configure ssh Removes the SSH connection from the configuration.
Network Time Protocol (NTP) services can be enabled on an ASA to obtain the date
and time from an NTP server. To enable NTP, use the global configuration mode
commands listed in the table.
To verify the NTP configuration and status, use the show ntp status and show ntp
associations commands.
The example shows how to enable NTP with authentication on an ASA 5506-X. The
configuration assumes that the NTP server has been configured with an authentication
key.
NETSEC-ASA(config)# ntp authenticate
NETSEC-ASA(config)# ntp trusted-key 1
NETSEC-ASA(config)# ntp authentication-key 1 sha-256 cisco123
NETSEC-ASA(config)# ntp server 192.168.1.254
NETSEC-ASA(config)#
dhcpd dns dns1 [ dns2 ] (Optional) Specifies the IP address(es) of the DNS
server(s).
(Optional) Changes the lease length
granted to the client which is the amount of
time in seconds that the client can use its
allocated IP address before the lease
dhcpd lease lease_length expires.
The lease_length defaults to 3600 seconds
(1 hour) but can be a value from 0 to
1,048,575 seconds.
dhcpd enable if_name Enables the DHCP server service (daemon) on the
interface (typically the inside interface) of the ASA.
The example enables the DHCP service for inside clients on an ASA 5506-X.
Note: If the ASA outside interface was configured as a DHCP client, then the dhcpd
auto_config OUTSIDE global configuration mode command can be used to pass the
DHCP-obtained information to the DHCP inside clients.
To verify DHCP settings, use the following commands:
o show dhcpd state - Displays the current DHCP state for inside and outside
interfaces.
o show dhcpd binding - Displays the current DHCP bindings of inside users.
o show dhcpd statistics - Displays the current DHCP statistics.
To clear the DHCP bindings or statistics, use the clear dhcpd binding or clear dhcpd
statistics command.
NETSEC-ASA(config)# dhcpd address 10.0.0.1-10.0.1.255 INSIDE
Warning, DHCP pool range is limited to 256 addresses, set address
range as: 10.0.0.1-10.0.1.0
Address range subnet 10.0.0.1 or 10.0.1.0 is not the same as INSIDE
interface subnet 192.168.1.1
NETSEC-ASA(config)# dhcpd address 192.168.1.10-192.168.1.250 INSIDE
NETSEC-ASA(config)# dhcpd lease 1800
NETSEC-ASA(config)#
Objects are reusable components for use in configurations. Objects can be defined and
used in Cisco ASA configurations in the place of inline IP addresses, services, names,
and so on. Objects make it easy to maintain configurations because an object can be
modified in one place and the change will be reflected in all other places that are
referencing it. Without objects, the parameters for every feature would need to be
modified instead of just once. For example, if a network object defines an IP address
and subnet mask, and you want to change the address, you only need to change it in the
object definition, not in every feature that refers to that IP address. The advantage is that
when an object is modified, the change is automatically applied to all rules that use the
specified object. Therefore, objects make it easy to maintain configurations.
There are two types of objects that can be configured:
o Network object - A network object can contain a host, a network IP address, a
range of IP addresses, or a fully qualified domain name (FQDN). A network
object is configured using the object network command.
o Service object - Contains a protocol and optional source and/or destination
port. A service object is configured using the object service command.
Note: A network object is required to configure NAT in ASA image versions 8.3 and
higher.
Network object groups can contain multiple network objects as well as inline networks
or hosts. Network object groups can include a mix of both IPv4 and IPv6 addresses.
Objects can be attached or detached from one or more object groups when needed,
ensuring that the objects are not duplicated, but can be re-used wherever needed. These
objects can be used in NAT, access lists, and object groups. Network objects are a vital
part of configuring NAT and can greatly simplify ACLs.
The ASA supports objects and object groups, as shown in the output in the following
example.
NETSEC-ASA(config)# object ?
To create a network object, use the object network object-name global configuration
mode command. The prompt changes to network object configuration mode.
Network objects can consist of the following:
o host - a host address
o fqdn - a fully-qualified domain name
o range - a range of IP addresses
o subnet - an entire IP network or subnet
Commands available in network object configuration mode are shown in the table.
Use the no form of any of these commands to remove a network object value. To erase
all network objects, use the clear config object network command. This command
clears all network objects.
The example displays a sample network object configuration. To verify, use the show
running-config object command. Notice that the configuration of range overwrites the
previous configuration of host.
NetSec-ASA(config)# object network EXAMPLE-1
NetSec-ASA(config-network-object)# host 192.168.1.3
NetSec-ASA(config-network-object)# exit
NetSec-ASA(config)# show run object
object network EXAMPLE-1
host 192.168.1.3
NetSec-ASA(config)# object network EXAMPLE-1
NetSec-ASA(config-network-object)# range 192.168.1.10 192.168.1.20
NetSec-ASA(config-network-object)# exit
NetSec-ASA(config)# show run object
object network EXAMPLE-1
range 192.168.1.10 192.168.1.20
NetSec-ASA(config)#
To create a service object, use the object service object-name global configuration
mode command. The prompt changes to service object configuration mode. The service
object can contain a protocol, ICMP, ICMPv6, TCP, or UDP port (or port ranges).
The example displays service options available.
NETSEC-ASA(config)# object service EXAMPLE-2
NETSEC-ASA(config-service-object)#
NETSEC-ASA(config-service-object)# service ?
The example displays a sample service object configuration. A service object name can
only be associated with one protocol and port (or ports). If an existing service object is
configured with a different protocol and port, the new configuration replaces the
existing protocol and port with the new ones.
To verify, use the show running-config object service command.
NETSEC-ASA(config)# object service SERV-1
NETSEC-ASA(config-service-object)# service tcp destination eq ftp
NETSEC-ASA(config-service-object)# service tcp destination eq www
NETSEC-ASA(config-service-object)# exit
NETSEC-ASA(config)# show run object service
object service SERV-1
service tcp destination eq www
NETSEC-ASA(config)#
Objects can be grouped together to create an object group. By grouping like objects
together, an object group can be used in an access control entry (ACE) instead of
having to enter an ACE for each object separately.
Note: A protocol object group can also be created. However, it is not recommended,
and the use of a service object-group should be used instead.
The following guidelines and limitations apply to object groups:
o Objects and object groups share the same name space.
o Object groups must have unique names.
o An object group cannot be removed or emptied if it is used in a command.
o The ASA does not support IPv6 nested object groups.
There are five types of object groups.
o Network - A network-based object group specifies a list of IP host, subnet, or
network addresses.
o User - Locally created, as well as imported Active Directory user groups can be
defined for use in features that support the identity firewall.
o Service - A service-based object group is used to group TCP, UDP, or TCP and
UDP ports into an object. The ASA enables the creation of a service object
group that can contain a mix of TCP services, UDP services, ICMP-type
services, and any protocol, such as ESP, GRE, and TCP.
o ICMP-Type - The ICMP protocol uses unique types to send control messages
(RFC 792). The ICMP-type object group can group the necessary types
required to meet an organization’s security needs, such as to create an object
group called ECHO to group echo and echo-reply.
o Security - A security group object group can be used in features that support
Cisco TrustSec by including the group in an extended ACL, which in turn can
be used in an access rule.
To configure a network object group, use the object-group network grp-name global
configuration mode command. After entering the command, add network objects to the
network group using the network-object and group-object commands.
Note: A network object group cannot be used to implement NAT. A network object is
required to implement NAT.
To configure an ICMP object group, use the object-group icmp-type grp-name global
configuration mode command. After entering the command, add ICMP objects to the
ICMP object group using the icmp-object and group-object commands.
The example displays a sample network object group configuration.
NETSEC-ASA(config)# object-group network ADMIN-HOST
NETSEC-ASA(config-network-object-group)# description Administrative
hosts
NETSEC-ASA(config-network-object-group)# network-object host
192.168.1.3
NETSEC-ASA(config-network-object-group)# network-object host
192.168.1.4
NETSEC-ASA(config-network-object-group)# exit
NETSEC-ASA(config)# object-group network ALL-HOSTS
NETSEC-ASA(config-network-object-group)# description All inside
hosts
NETSEC-ASA(config-network-object-group)# network-object
192.168.1.32 255.255.255.240
NETSEC-ASA(config-network-object-group)# group-object ADMIN-HOST
NETSEC-ASA(config-network-object-group)# exit
NETSEC-ASA(config)# show run object-group
object-group network ADMIN-HOST
description Administrative host IP addresses
network-object host 192.168.1.3
network-object host 192.168.1.4
object-group network ALL-HOSTS
network-object 192.168.1.32 255.255.255.240
group-object ADMIN-HOST
NETSEC-ASA(config)#
To configure a service object group, use the object-group service grp-name global
configuration mode command. The service object group can define a mix of TCP
services, UDP services, ICMP-type services, and any protocol. After entering
the object-group service command, add service objects to the service group using
the service-object and group-object commands.
To configure a service object group for TCP, UDP, or TCP and UDP, specify the option
in the object-group service grp-name [tcp | udp | tcp-udp] global configuration mode
command. When tcp, udp, or tcp-udp is optionally specified on the command line,
service defines a standard service object group of TCP/UDP port specifications, such as
"eq smtp" and "range 2000 2010." After entering the command, add port objects to the
service group with the port-object and group-object commands.
To remove all the object groups from the configuration, use the clear configure object-
group global configuration mode command.
To verify group object configurations, use the show running-config object-
group command.
Practical examples of object groups will be presented when configuring ACLs and
NAT. The ASA does not support IPv6 nested object groups.
The example displays a sample service object group configuration.
NETSEC-ASA(config)# object-group service SERVICES-1
NETSEC-ASA(config-service-object-group)# service-object tcp
destination eq www
NETSEC-ASA(config-service-object-group)# service-object tcp
destination eq https
NETSEC-ASA(config-service-object-group)# service-object tcp
destination eq pop3
NETSEC-ASA(config-service-object-group)# service-object udp
destination eq ntp
NETSEC-ASA(config-service-object-group)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# object-group service SERVICES-2 tcp
NETSEC-ASA(config-service-object-group)# port-object eq www
NETSEC-ASA(config-service-object-group)# port-object eq smtp
NETSEC-ASA(config-service-object-group)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# object-group service SERVICES-3 tcp
NETSEC-ASA(config-service-object-group)# group-object SERVICES-2
NETSEC-ASA(config-service-object-group)# port-object eq ftp
NETSEC-ASA(config-service-object-group)# port-object range 2000
2005
NETSEC-ASA(config-service-object-group)# exit
NETSEC-ASA(config)#
The Cisco ASA 5506-X provides basic traffic filtering capabilities with ACLs. ACLs
control access in a network by preventing defined traffic from entering or exiting. In
addition, an ACL can be used to select traffic to which a feature will apply, thereby
performing a matching service rather than a control service.
There are many similarities between ASA ACLs and IOS ACLs. For example, both are
made up of ACEs, processed sequentially from the top down, and there is an implicit
deny any at the bottom. Additionally, the rule of only one ACL per interface, per
protocol, per direction, still applies.
ASA ACLs differ from IOS ACLs in that they use a network mask (e.g., 255.255.255.0)
instead of a wildcard mask (e.g. 0.0.0.255). Also most ASA ACLs are named instead of
numbered.
These are the similarities between ASA ACLs and IOS ACLs:
o ACLs are made up of one or more ACEs. ACEs are applied to a protocol, a
source and destination IP address, a network, or the source and destination
ports.
o ACLs are processed sequentially from top down.
o A criteria match will cause the ACL to be exited.
o There is an implicit deny any at the bottom.
o Remarks can be added per ACE or ACL.
o Only one access list can be applied per interface, per protocol, per direction.
o ACLs can be enabled/disabled based on time ranges.
These the differences between ASA ACLs and IOS ACLs:
o The ASA uses a network mask (e.g., 255.255.255.0) and not a wildcard mask
(e.g. 0.0.0.255).
o ACLs are always named instead of numbered.
o By default, interface security levels apply access control without an ACL
configured.
ACLs on a security appliance can be used not only to filter packets that are passing
through the appliance but also to filter packets destined for the appliance.
o Through-traffic filtering - Traffic that is passing through the security
appliance from one interface to another interface. The configuration is
completed in two steps. The first step is to set up an ACL. The second step is to
apply that ACL to an interface.
o To-the-box-traffic filtering - Also known as a management access rule, to-the-
box-traffic filtering applies to traffic that terminates at the ASA. They are
created to filter traffic that is destined for the control plane of the ASA. They
are completed in one step but require an additional set of rules to implement
access control.
ASA devices differ from their router counterparts because of interface security levels.
By default, security levels apply access control without an ACL configured. For
instance, traffic from a more secure interface, such as security level 100, is allowed to
access less secure interfaces, such as level 0. Traffic from a less secure interface is
blocked from accessing more secure interfaces.
For example, a host from the inside network with security level 100 can access the
outside interface with security level 0 as shown below.
However, a host from an outside interface with security level 0 cannot access the inside
higher-level interface, as shown below. Less secure interfaces are blocked from
accessing more secure interfaces. If required, an ACL would have to be explicitly
configured to permit traffic from a lower security level to a higher security level.
To allow connectivity between interfaces with the same security levels, the same-
security-traffic permit inter-interface global configuration mode command is
required. To enable traffic to enter and exit the same interface, such as when encrypted
traffic enters an interface and is then routed out the same interface unencrypted, use
the same-security-traffic permit intra-interface global configuration mode command
The ACL configuration syntax options for the ASA can be a little overwhelming
considering the number of parameters supported, as shown in the partial output of
the help access-list command output shown in the example. These parameters not only
give an administrator full control over what to inspect, but also provide full logging
capabilities in order to analyse traffic flows at a later time.
NETSEC-ASA(config)# help access-list
USAGE:
IOS and ASA ACLs have similar elements, but some options vary with the ASA. The
table describes elements of an ASA ACL.
Note: Explanation of all ACL syntax is beyond the scope of this module and is not
explored further.
Element Description
The name of the ACL. It can be any alphanumeric name up
ACL id
to 241 characters.
Action Can be permit or deny.
Can be IP for all traffic, or the name / IP protocol number (0-
Protocol number - Source 250) including icmp ( 1), tcp ( 6), udp ( 17), or a protocol
object-group.
Identifies the source and can be any, a host, a
network, or a network object group.
Source For to-the-box-traffic filtering, the interface keyword
is used to specify the source interface of the ASA.
After the ACL is configured, the next step is to apply it to an interface in either the
inbound or the outbound direction. Applying an ACL is done in global configuration
mode.
The example displays the command syntax and parameter description for applying the
ACL to an interface using the access-group command syntax.
Syntax Description
access-group Keyword used to apply an ACL to an interface.
id The name of the actual ACL to be applied to an interface.
in The ACL will filter inbound packets.
out The ACL will filter outbound packets.
interface Keyword to specify the interface to which to apply the ACL.
if_name The name of the interface to which to apply an ACL.
per-user- Option that allows downloadable ACLs to override the entries on the
override interface ACL.
control-plane Keyword to specify whether the applied ACL analyzes traffic destined to
ASA for management purposes.
To verify ACLs, use the show access-list and show running-config access-
list commands.
To erase a configured ACL, use the clear configure access-list id command.
ACL allows all hosts on the inside network to go through the ASA.
By default, all other traffic is denied unless explicitly permitted.
ACL Example #2
NETSEC-ASA(config)# access-list ACL-IN extended deny ip 192.168.1.0
255.255.255.0 209.165.201.0 255.255.255.224
NETSEC-ASA(config)# access-list ACL-IN extended permit ip any any
NETSEC-ASA(config)# access-group ACL-IN in interface INSIDE
ACL prevents all inside hosts from accessing a web service at 209.165.201.29.
Internal hosts are permitted to access all other services at 209.165.201.29.
Internal hosts are permitted access to all other addresses.
All other traffic is implicitly denied.
The ACL displayed in the example below would require two ACEs for each PC to
accomplish the task. The implicit deny any drops and logs any packets that do not
match email or web services. As shown in the example, ACLs should always be
thoroughly documented using the remark command.
NETSEC-ASA(config)# access-list ACL-IN remark Permit PC-1 -> Server
A for HTTP / SMTP
NETSEC-ASA(config)# access-list ACL-IN extended permit tcp host
209.165.201.1 host 209.165.202.131 eq http
NETSEC-ASA(config)# access-list ACL-IN extended permit tcp host
209.165.201.1 host 209.165.202.131 eq smtp
NETSEC-ASA(config)# access-list ACL-IN remark Permit PC-1 -> Server
B for HTTP / SMTP
NETSEC-ASA(config)# access-list ACL-IN extended permit tcp host
209.165.201.1 host 209.165.202.132 eq http
NETSEC-ASA(config)# access-list ACL-IN extended permit tcp host
209.165.201.1 host 209.165.202.132 eq smtp
NETSEC-ASA(config)# access-list ACL-IN remark Permit PC-2 -> Server
A for HTTP / SMTP
NETSEC-ASA(config)# access-list ACL-IN extended permit tcp host
209.165.201.2 host 209.165.202.131 eq http
NETSEC-ASA(config)# access-list ACL-IN extended permit tcp host
209.165.201.2 host 209.165.202.131 eq smtp
NETSEC-ASA(config)# access-list ACL-IN remark Permit PC-2 -> Server
B for HTTP / SMTP
NETSEC-ASA(config)# access-list ACL-IN extended permit tcp host
209.165.201.2 host 209.165.202.132 eq http
NETSEC-ASA(config)# access-list ACL-IN extended permit tcp host
209.165.201.2 host 209.165.202.132 eq smtp
NETSEC-ASA(config)# access-list ACL-IN extended deny ip any any log
NETSEC-ASA(config)# access-group ACL-IN in interface OUTSIDE
To verify the ACL syntax, use the show running-config access-list and show access-
list commands, as shown in the example.
NETSEC-ASA(config)# show running-config access-list
access-list ACL-IN remark Permit PC-1 -> Server A for HTTP / SMTP
access-list ACL-IN extended permit tcp host 209.165.201.1 host
209.165.202.131 eq www
access-list ACL-IN extended permit tcp host 209.165.201.1 host
209.165.202.131 eq smtp
access-list ACL-IN remark Permit PC-1 -> Server B for HTTP / SMTP
access-list ACL-IN extended permit tcp host 209.165.201.1 host
209.165.202.132 eq www
access-list ACL-IN extended permit tcp host 209.165.201.1 host
209.165.202.132 eq smtp
access-list ACL-IN remark Permit PC-2 -> Server A for HTTP / SMTP
access-list ACL-IN extended permit tcp host 209.165.201.2 host
209.165.202.131 eq www
access-list ACL-IN extended permit tcp host 209.165.201.2 host
209.165.202.131 eq smtp
access-list ACL-IN remark Permit PC-2 -> Server B for HTTP / SMTP
access-list ACL-IN extended permit tcp host 209.165.201.2 host
209.165.202.132 eq www
access-list ACL-IN extended permit tcp host 209.165.201.2 host
209.165.202.132 eq smtp
access-list ACL-IN extended deny ip any any log
NETSEC-ASA(config)#
NETSEC-ASA(config)# show access-list ACL-IN brief
access-list ACL-IN; 9 elements; name hash: 0x44d1c580
NETSEC-ASA(config)#
Object grouping is a way to group similar items together to reduce the number of ACEs.
By grouping like objects together, object groups can be used in an ACL instead of
having to enter an ACE for each object separately. Without object grouping, the
security appliance configuration may contain thousands of lines of ACEs, which can
become difficult to manage.
The example displays a condensed ACL syntax to use with the object groups example
on this page.
The security appliance follows the multiplication factor rule when ACEs are defined.
For example, if two outside hosts need to access two internal servers running HTTP and
SMTP services, the ASA will have eight host-based ACEs. They should be calculated
as follows:
Number of ACEs = (2 outside hosts) x (2 internal servers) x (2 services) = 8
Object grouping can cluster network objects into one group and outside hosts into
another, as shown in the following syntax. The security appliance can also combine
both TCP services into a service object group.
ciscoasa(config)# access-list id extended { deny | permit }
protocol object-group source_net-obj-grp_id object-group dest_net-
obj-grp_id object-group service-obj-grp_id
For example, consider the reference topology in the figure below. In the extended ACL
example on the previous page, this topology required a total of nine ACL ACEs, the
eight permit ACEs, and the implicit deny ACE. Creating the following objects can help
simplify the actual ACL to one ACE. For example, the following object groups are
created:
o Network object group named NET-HOSTS - Identifies two external hosts.
o Network object group named SERVERS - Identifies servers providing email
and web services.
o Service object group HTTP-SMTP - Identifies SMTP and HTTP protocols.
The example displays the configuration that accomplishes the same result as the
extended ACL on the previous page using object groups.
Note The previous ACL-IN ACE statements have been removed with the no access-
list command.
NETSEC-ASA(config)# object-group network NET-HOSTS
NETSEC-ASA(config-network-object-group)# description OG matches PC-
A and PC-B
NETSEC-ASA(config-network-object-group)# network-object host
209.165.201.1
NETSEC-ASA(config-network-object-group)# network-object host
209.165.201.2
NETSEC-ASA(config-network-object-group)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# object-group network SERVERS
NETSEC-ASA(config-network-object-group)# description OG matches Web
/ Email Servers
NETSEC-ASA(config-network-object-group)# network-object host
209.165.202.131
NETSEC-ASA(config-network-object-group)# network-object host
209.165.202.132
NETSEC-ASA(config-network-object-group)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# object-group service HTTP-SMTP tcp
NETSEC-ASA(config-service-object-group)# description OG matches
SMTP / WEB traffic
NETSEC-ASA(config-service-object-group)# port-object eq smtp
NETSEC-ASA(config-service-object-group)# port-object eq www
NETSEC-ASA(config-service-object-group)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# access-list ACL-IN remark Only permit PC-A /
PC-B -> Internal Servers
NETSEC-ASA(config)# access-list ACL-IN extended permit tcp object-
group NET-HOSTS object-group SERVERS object-group HTTP-SMTP
After object groups have been configured, they can be used in any ACL and multiple
ACLs. A single ACE could be used to allow trusted hosts to make specific service
requests to a group of internal servers.
Although the configuration of object groups may seem tedious, the advantage is that
these objects can be reused in other ASA commands, and they can easily be altered. For
instance, if a new internal mail server needs to be added, then all that is required is to
edit the SERVERS object group.
Note: Object groups can also be nested in other object groups.
The example displays the final ACL configuration in the running configuration.
NETSEC-ASA(config)# show running-config access-list
access-list ACL-IN remark Only permit PC-A / PC-B -> Internal
Servers
access-list ACL-IN extended permit tcp object-group NET-HOSTS
object-group SERVERS object-group HTTP-SMTP
Like IOS routers, the ASA supports Network Address Translation (NAT). NAT is
typically used to translate private IP network addresses into public IP addresses.
NAT can be deployed using one of the methods:
Inside NAT - The typical NAT deployment method is when a host from a higher-
security interface has traffic destined for a lower-security interface and the ASA
translates the internal host address into a global address. The ASA then restores the
original inside IP address for return traffic.
Outside NAT - This method is used when traffic from a lower-security interface that is
destined for a host on the higher-security interface must be translated. This method may
be useful to make an enterprise host located on the outside of the internal network
appear as one from a known internal IP address.
Bidirectional NAT - Indicates that both inside NAT and outside NAT are used
together.
The figure illustrates how inside NAT and outside NAT flow.
Specifically, the Cisco ASA supports the following common types of NAT:
o Dynamic PAT - This is a many-to-one translation. This is also known as NAT
with overload. Usually an inside pool of private addresses overloading an
outside interface or outside address.
o Static NAT - This is a one-to-one translation. Usually an outside address
mapping to an internal server.
o Policy NAT - Policy-based NAT is based on a set of rules. These rules can
specify that only certain source addresses that are intended for specific
destination addresses and/or specific ports will be translated.
o Identity NAT - A real address is statically translated to itself, essentially
bypassing NAT. You might want to configure NAT this way when you want to
translate a large group of addresses, but then want to exempt a smaller subset of
addresses.
These types of NAT are referred to as network object NAT because the configuration
requires network objects to be configured.
Note: Another ASA NAT feature is called Twice-NAT. Twice-NAT identifies both the
source and destination address in a single rule (nat command). Twice-NAT is used
when configuring remote-access IPsec and SSL VPNs. Twice-NAT is beyond the scope
of the module and is not explored further.
To configure network object dynamic NAT, two network objects are required:
o A network object identifying the pool of public IP addresses into which internal
addresses are translated. These are identified using range or subnet network
object commands.
o The second network object identifies the internal addresses to be translated and
then binds the two objects together. These are identified using the range or
subnet network object commands.
The two network objects are then bound together
using nat [(real_if_name,mapped_if_name)] dynamic mapped_obj [interface [ipv6]] [
dns] network object command. The real_if_name is the prenat interface.
The mapped_if_name is the postnat interface. Notice that there is no space after the
comma in the command syntax.
For example, the figure displays the NAT reference topology that will be used to
configure dynamic NAT, dynamic PAT, and static NAT.
In this dynamic NAT example, the inside hosts on the 192.168.1.0/27 network will be
dynamically assigned a range of public IP addresses from 209.165.200.240 to
209.165.200.248.
The example displays a sample dynamic NAT configuration to accomplish this task.
The PUBLIC network object identifies the public IP addresses to be translated to while
the DYNAMIC-NAT object identifies the internal addresses to be translated and is
bound to the PUBLIC network object with the nat command.
NETSEC-ASA(config)# object network PUBLIC
NETSEC-ASA(config-network-object)# range 209.165.200.240
209.165.200.248
NETSEC-ASA(config-network-object)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# object network DYNAMIC-NAT
NETSEC-ASA(config-network-object)# subnet 192.168.1.0
255.255.255.224
NETSEC-ASA(config-network-object)# nat (INSIDE,OUTSIDE) dynamic
PUBLIC
NETSEC-ASA(config-network-object)# end
NETSEC-ASA#
To allow inside hosts to ping outside hosts, you can use a policy map to permit ICMP
messages to return through the external interface. The example shows the configuration
to allow return ICMP traffic from outside hosts through the OUTSIDE interface.
NETSEC-ASA(config)# policy-map global_policy
NETSEC-ASA(config-pmap)# class inspection_default
NETSEC-ASA(config-pmap-c)# access-list ICMPACL extended permit icmp
any any
NETSEC-ASA(config)# access-group ICMPACL in interface OUTSIDE
NETSEC-ASA(config)#
After the inside host pings the outside host, verify the network address translation using
the show xlate command, as shown in the example. Additional information can be
gathered using the show nat and show nat detail commands.
NETSEC-ASA(config)# show xlate
1 in use, 1 most used
Flags: D - DNS, e - extended, I - identity, I - dynamic, r -
portmap,
s - static, T - twice, N - net-to-net
After the inside host pings the outside host, verify the network address translation using
the show xlate command. The example displays the resulting translation.
NETSEC-ASA# show xlate
1 in use, 1 most used
Flags: D - DNS, e - extended, I - identity, I - dynamic, r -
portmap,
s - static, T - twice, N - net-to-net
Static NAT is configured when an inside address is mapped to an outside address. For
instance, static NAT can be used when a server must be accessible from the outside.
To configure static NAT, use the nat [(real_if_name,mapped_if_name)] static mapped-
inline-host-ip network object command.
The figure displays the NAT reference topology that will be used to configure the DMZ
interface and static NAT.
The example below displays the configuration that is used to enable static NAT. In this
example, outside hosts can reach the internal server with the IP address 192.168.2.3
using the external IP address 209.165.200.227.
An ACL is required for the translation to be successful.
NETSEC-ASA(config)# object network DMZ-SERVER
NETSEC-ASA(config-network-object)# host 192.168.2.3
NETSEC-ASA(config-network-object)# nat (DMZ,OUTSIDE) static
209.165.200.227
NETSEC-ASA(config-network-object)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# access-list OUTSIDE-DMZ extended permit ip any
host 192.168.2.3
NETSEC-ASA(config)# access-group OUTSIDE-DMZ in interface OUTSIDE
NETSEC-ASA(config)#
NETSEC-ASA(config)# policy-map global_policy
NETSEC-ASA(config-pmap)# class inspection_default
NETSEC-ASA(config-pmap-c)# access-list ICMPACL extended permit icmp
any any
NETSEC-ASA(config)# access-group ICMPACL in interface DMZ
NETSEC-ASA(config)#
Use the show xlate and show nat detail commands to verify translations, as shown in
the example. It may be necessary to use the clear nat counters command when testing
NAT.
NETSEC-ASA(config)# show xlate
2 in use, 2 most used
Flags: D - DNS, e - extended, I - identity, I - dynamic, r -
portmap,
s - static, T - twice, N - net-to-net
NAT from DMZ:192.168.2.3 to OUTSIDE:209.165.200.227
flags s idle 0:00:21 timeout 0:00:00
21.6 AAA
21.6.1 AAA REVIEW
Cisco ASA can be configured to authenticate using a local user database or an external
server for authentication or both.
Local AAA uses a local database for authentication. This method stores usernames and
passwords locally on the ASA, and users authenticate against the local database. Local
AAA is ideal for small networks that do not need a dedicated AAA server.
Note: Unlike the ISR, ASA devices do not support local authentication without using
AAA.
Use the username name password password [privilege priv-level] command to create
local user accounts. To erase a user from the local database, use the clear config
username [name] command. To view all user accounts, use the show running-config
username command.
Server-based AAA authentication is a far more scalable method than local AAA
authentication. Server-based AAA authentication uses an external database server by
leveraging the RADIUS or TACACS+ protocols. If there are multiple networking
devices, server-based AAA is more appropriate.
To configure a TACACS+ or RADIUS server, use the commands listed in the table.
ASA
Description
Command
aaa-server
server-tag
protocol Creates a TACACS+ or RADIUS AAA server group.
protocol
aaa-server Configures a AAA server as part of a AAA server group.
ASA
Description
Command
server-tag
[(if_name)]
host Also configures AAA server parameters that are host-specific.
{server-ip
| name } [
key ]
To erase all AAA server configurations, use the clear config aaa-server command. To
view all user accounts, use the show running-config aaa-server command.
The example shows configuration of a AAA TACACS+ server on an ASA 5506-X.
NETSEC-ASA(config)# username Admin password class privilege 15
NETSEC-ASA(config)# show run username
username Admin password ***** pbkdf2 privilege 15
NETSEC-ASA(config)# aaa-server TACACS-SVR protocol tacacs+
NETSEC-ASA(config-aaa-server-group)# aaa-server TACACS-SVR (DMZ)
host 192.168.2.3
NETSEC-ASA(config-aaa-server-host)# exit
NETSEC-ASA(config)# show run aaa-server
aaa-server TACACS-SVR protocol tacacs+
aaa-server TACACS-SVR (DMZ) host 192.168.2.3
NETSEC-ASA(config)#
To authenticate users who access the ASA CLI over a console (serial), SSH, HTTPS
(ASDM), or Telnet connection, or to authenticate users who access privileged EXEC
mode using the enable command, use the aaa authentication enable
console command in global configuration mode. The command syntax is as follows:
To erase all AAA parameters, use the clear config aaa command. To view all user
accounts, use the show running-config username command.
The example provides a sample AAA configuration that is then verified and tested.
NETSEC-ASA(config)# aaa authentication serial console TACACS-SVR
LOCAL
NETSEC-ASA(config)# aaa authentication ssh console TACACS-SVR LOCAL
NETSEC-ASA(config)# aaa authentication http console TACACS-SVR
LOCAL
NETSEC-ASA(config)# aaa authentication telnet console TACACS-SVR
LOCAL
NETSEC-ASA(config)# aaa authentication enable console TACACS-SVR
LOCAL
NETSEC-ASA(config)#
NETSEC-ASA(config)# show run aaa
aaa authentication serial console TACACS-SVR LOCAL
aaa authentication ssh console TACACS-SVR LOCAL
aaa authentication http console TACACS-SVR LOCAL
aaa authentication telnet console TACACS-SVR LOCAL
aaa authentication enable console TACACS-SVR LOCAL
aaa authentication login-history
NETSEC-ASA(config)# exit
NETSEC-ASA# exit
Logoff
Username: Admin
Password: *****
-----------------------------------------------
Authorized access only!
You have logged into a secure device.
-----------------------------------------------
A Modular Policy Framework (MPF) configuration defines a set of rules for applying
firewall features, such as traffic inspection and QoS, to the traffic that traverses the
ASA. MPF allows granular classification of traffic flows, which enables the application
of different advanced policies to different flows. MPF is used with hardware modules to
redirect traffic granularly from the ASA to the modules that use Cisco MPF. MPF can
be used for advanced application layer inspection of traffic by classifying at Layers 5
through 7. Rate limiting and QoS features can also be implemented using MPF.
Cisco MPF uses three configuration objects to define modular, object-oriented,
hierarchical policies.
Class Maps
Policy Maps
Service Policy
Where do we do it?
o Activate the policy map on interfaces.
o Create a service policy that applies a policy map to an interface or all interfaces.
ciscoasa(config)# service-policy serv-name [ global | interface if-
name ]
Although the MPF syntax is similar to the ISR IOS Cisco Modular QoS CLI (MQC)
syntax or the Cisco Common Classification Policy Language (C3PL) syntax, the
configurable parameters differ. The ASA platform provides more configurable actions
as compared to an ISR for Cisco IOS ZPF. The ASA supports Layer 5 to Layer 7
inspections using a richer set of criteria for application-specific parameters. For
instance, the ASA MPF feature can be used to match HTTP URLs and request methods,
prevent users from surfing to specific sites during specific times, or even prevent users
from downloading music (MP3) and video files via HTTP/FTP or HTTPS/SFTP.
There are four steps to configure MPF on an ASA:
o Step 1. (Optional) Configure extended ACLs to identify granular traffic that
can be specifically referenced in the class map. For example, ACLs can be used
to match TCP traffic, UDP traffic, HTTP traffic, or all traffic to a specific
server.
o
o Step 2. Configure the class map to identify traffic.
o
o Step 3. Configure a policy map to apply actions to those class maps.
o
o Step 4. Configure a service policy to attach the policy map to an interface.
Class maps are configured to identify Layer 3 and 4 traffic (also called layer 3/4). To
create a class map and enter class-map configuration mode, use the class-map class-
map-name global configuration mode command. The names “class-default” and any
name that begins with “_internal” or “_default” are reserved. The class map name must
be unique and can be up to 40 characters in length. The name should also be
descriptive.
Note: A variation of the class-map command is used for management traffic that is
destined for the ASA. In this case, use the class-map type management class-map-
name command.
When in class-map configuration mode, a description explaining the purpose of the
class map should be configured using the description command.
Next, traffic to match should be identified using the match any (matches all traffic)
or match access-list access-list-name commands to match traffic specified by an
extended access list.
Note: Unless otherwise specified, only include one match command in the class map.
The example provides a sample class map configuration.
NETSEC-ASA(config)# access-list UDP permit udp any any
NETSEC-ASA(config)# access-list TCP permit tcp any any
NETSEC-ASA(config)# access-list SERVER permit ip any host 10.1.1.1
NETSEC-ASA(config)#
NETSEC-ASA(config)# class-map ALL-TCP
NETSEC-ASA(config-cmap)# description This class-map matches all TCP
traffic
NETSEC-ASA(config-cmap)# match access-list TCP
NETSEC-ASA(config-cmap)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# class-map ALL-UDP
NETSEC-ASA(config-cmap)# description This class-map matches all UDP
traffic
NETSEC-ASA(config-cmap)# match access-list UDP
NETSEC-ASA(config-cmap)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# class-map ALL-HTTP
NETSEC-ASA(config-cmap)# description This class-map matches all
HTTP traffic
NETSEC-ASA(config-cmap)# match port TCP eq http
NETSEC-ASA(config-cmap)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# class-map TO-SERVER
NETSEC-ASA(config-cmap)# description Class map matches traffic
10.1.1.1
NETSEC-ASA(config-cmap)# match access-list SERVER
NETSEC-ASA(config-cmap)# exit
NETSEC-ASA(config)#
The ASA also automatically defines a default Layer 3/4 class map identified in the
configuration by class-map inspection_default. Identified in this class map is
the match default-inspection-traffic which matches the default ports for all
inspections. When used in a policy map, this class map ensures that the correct
inspection is applied to each packet, based on the destination port of the traffic. For
example, when UDP traffic for port 69 reaches the ASA, the ASA applies the TFTP
inspection. In this case only, multiple inspections can be configured for the same class
map. Normally, the ASA does not use the port number to determine which inspection to
apply. This provides flexibility to apply inspections to non-standard ports.
To display information about the class map configuration, use the show running-config
class-map command.
To remove all class maps, use the clear configure class-map command in global
configuration mode.
21.7.3 DEFINE AND ACTIVATE A POLICY
Policy maps are used to bind class maps with actions. Use the policy-map policy-map-
name global configuration mode command, to apply actions to the Layer 3 and 4 traffic.
The policy map name must be unique and up to 40 characters in length. The name
should also be descriptive.
In policy-map configuration mode, config-pmap, use the following commands:
o description - Add description text.
o class class-map-name - Identify a specific class map on which to perform
actions.
The maximum number of policy maps is 64. There can be multiple Layer ¾ class maps
in one policy map, and multiple actions can be assigned from one or more feature types
to each class map.
Note: The configuration includes a default Layer ¾ policy map that the ASA uses in the
default global policy. It is called global_policy and performs an inspection on the
default inspection traffic. There can only be one global policy. Therefore, to alter the
global policy, either edit it or replace it.
These are the three most common commands available in policy map configuration
mode:
o set connection - Sets connection values.
o inspect - Provides protocol inspection servers.
o police - Sets rate limits for traffic in this class.
Actions are applied to traffic bidirectionally or unidirectionally depending on the
feature.
To display information about the policy map configuration, use the show running-
config policy-map command.
Use the clear configure policy-map command in global configuration mode, to remove
all policy maps.
Configure the Service Policy
To activate a policy map globally on all interfaces or on a targeted interface, use
the service-policy policy-map-name [ global | interface intf ] global configuration
mode command to enable a set of policies on an interface.
The example configures the policy map. Its associated service policy is applied
globally.
NETSEC-ASA(config)# access-list TFTP-TRAFFIC permit udp any any eq
69
NETSEC-ASA(config)#
NETSEC-ASA(config)# class-map CLASS-TFTP
NETSEC-ASA(config-cmap)# match access-list TFTP-TRAFFIC
NETSEC-ASA(config-cmap)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# policy-map POLICY-TFTP
NETSEC-ASA(config-pmap)# class CLASS-TFTP
NETSEC-ASA(config-pmap-c)# inspect tftp
NETSEC-ASA(config-pmap-c)# exit
NETSEC-ASA(config-pmap)# exit
NETSEC-ASA(config)#
NETSEC-ASA(config)# service-policy POLICY-TFTP global
NETSEC-ASA(config)#
The ASA command line interface (CLI) is a proprietary OS, which has a similar look
and feel to the router IOS. For example, the ASA CLI contains command prompts
similar to that of a Cisco IOS router. Also, like the IOS CLI, the ASA CLI also supports
abbreviation of commands and keywords, use of the Tab key to complete a partial
command, and use of the help key (?) after a command to view additional syntax. Many
commands are similar to those in other versions of IOS, however many differences also
exist.
The ASA 5506-X with FirePOWER Services ships with a default configuration that, in
most instances, is sufficient for a basic SOHO deployment. Configuration changes can
be made manually using the CLI, interactively using the CLI Setup Initialization
wizard, and by using the Adaptive Security Device Manager (ASDM) setup wizard.
The ASA can be restored to its factory default configuration by using the configure
factory-default global configuration mode command.
Configure Management Services and Settings
The ASA 5506-X is configured by entering privileged EXEC mode with the enable
command and then using configure terminal to enter global configuration mode. When
entering global configuration mode for the first time, you are offered the option of
participating in the Cisco Smart Call Home program. When approved and other
qualifications are met, the ASA will communicate with Cisco in order to send and
receive proactive diagnostics and real-time alerts.
The privileged EXEC password is automatically encrypted using MD5. However,
stronger encryption using AES should be enabled. To do so, a primary passphrase must
be configured, and AES encryption must be enabled. To change the primary passphrase,
use the key config-key password-encryption command.
The ASA 5506-X has eight Gigabit Ethernet interfaces that can be configured to carry
traffic on different Layer 3 networks. The G1/1 interface is frequently configured as the
outside interface to the ISP. Basic configuration of interfaces includes IP addressing,
naming, and setting the security level. Interfaces can be grouped together as bridged
virtual interfaces (BVI). A BVI can be configured with a single name and IP address
although other settings may need to be configured on the individual component
interfaces. Interfaces can be configured with addresses manually, by DHCP, or over
PPPoE. If the interface is configured with DHCP, a default route from an upstream
device can automatically be configured on the ASA. Otherwise, a default route must be
manually configured.
For remote management, the ASA can be configured to accept connections over Telnet
or SSH. SSH is strongly preferred. Authorization can be made from the local user
database.
Other network services such as NTP and DHCP can be configured on the ASA. The
ASA can be configured to receive NTP information from authenticated servers. DHCP
services can also be configured to provide addresses to internal hosts.
Object Groups
Objects are reusable components for use in configurations. Objects can be defined and
used in Cisco ASA configurations in the place of inline IP addresses, services, names,
and so on. Objects make it easy to maintain configurations because an object can be
modified in one place and the change will be reflected in all other places that are
referencing it. For example, a network object can be created to hold the IP address of a
syslog server. If the address of the server changes, the object can be changed, and that
change will be reflected in every configuration command that references the object.
There are two types of objects, network objects and service objects. Network objects
can include host addresses, subnets, ranges of addresses, and FQDNs. Service objects
can refer to different network services and protocols. Object groups are collections of
objects that are related. Network object groups can also be used in configurations
including ACLs and NAT. There are five types of object groups. Where objects can
hold only one value, object groups can hold multiple values including in-line values as
well as previously created objects.
ASA ACLs
The Cisco ASA 5506-X provides basic traffic filtering capabilities with ACLs. ACLs
control access in a network by preventing defined traffic from entering or exiting. In
addition, an ACL can be used to select traffic to which a feature will apply, thereby
performing a matching service rather than a control service. ASA ACLs differ from IOS
ACLs in that they use a network mask (e.g., 255.255.255.0) instead of a wildcard mask
(e.g. 0.0.0.255). There are five types of ASA ACLs including the familiar standard and
extended types. All ASA ACLs are named. ASA standard and extended ACL syntax is
similar to that used on ISRs. ASA ACLs must be grouped with an interface in order to
go into effect. Object groups can be used with ASA ACLs to limit the number of ACEs
that are required in a list.
NAT Services on an ASA
NAT can be configured on ASAs as is done with routers. For ASAs there are three
deployment methods. The first is inside NAT which is used for translating inside
addresses on secure networks to outside addresses on less secure networks. In outside
NAT, traffic from a lower security network is translated for a higher security network.
This is used to make internal enterprise hosts available to outside users. Bidirectional
NAT uses both inside and outside NAT together. The ASA supports four types of NAT,
dynamic NAT with overload, static NAT, policy NAT, and identity NAT. Network
objects must be used to configure NAT. They are used to represent pools of IP
addresses to be used in translation and the internal IP addresses that are permitted to be
translated.
AAA
Cisco ASAs can be configured to authenticate access using a local user database or an
external server for authentication or both. Unlike the ISR, ASA devices do not support
local authentication without using AAA. Server-based AAA authentication uses an
external database server by leveraging the RADIUS or TACACS+ protocols.
To authenticate users who access the ASA CLI over a console, SSH, HTTPS (ASDM),
or Telnet connection, or to authenticate users who access privileged EXEC mode using
the enable command, use the aaa authentication enable console command in global
configuration mode.
Service Policies on an ASA
A Modular Policy Framework (MPF) configuration defines a set of rules for applying
firewall features, such as traffic inspection and QoS, to the traffic that traverses the
ASA. MPF allows granular classification of traffic flows, to apply different advanced
policies to different flows. Cisco MPF uses three configuration objects to define
modular, object-oriented, hierarchical policies. Class maps are used to identify the
traffic that will be processed by MPF. Policy maps define what will be done to the
identified traffic. Service policies identify which interfaces the policy map should be
applied to.
The ASA supports Layer 5 to Layer 7 inspections using a richer set of criteria for
application-specific parameters. For instance, the ASA MPF feature can be used to
match HTTP URLs and request methods, prevent users from surfing to specific sites
during specific times, or even prevent users from downloading music (MP3) and video
files via HTTP/FTP or HTTPS/SFTP.
The Cisco ASA can be configured and managed using either the command line
interface (CLI) or by using the graphical user interface (GUI) Adaptive Security Device
Manager (ASDM). The CLI is fast, but requires more time to learn. ASDM is intuitive
and simplifies the ASA configuration.
Specifically, Cisco ASDM is a Java-based GUI tool that facilitates the setup,
configuration, monitoring, and troubleshooting of Cisco ASAs. The application hides
the complexity of commands from administrators and allows streamlined configurations
without requiring extensive knowledge of the ASA CLI. It works with SSL to ensure
secure communication with the ASA. It also provides quick-configuration wizards and
logging and monitoring functionality that is not available using the CLI.
In order to access the advanced features of the Cisco ASA FirePOWER module that is
included with the ASA 5506-X, Firepower Management Center (FMC) is
recommended.
Note: Cisco Adaptive Security Manager (ASDM) requires Java to be installed on the
host that is used for ASDM configuration of the ASA. Because of changes to the Oracle
Java License, we can no longer require download and installation of a Java runtime
environment (JRE) in order to run the ASDM labs.
21.9.2 PREPARE FOR ASDM
To enable access to the ASDM, the ASA requires some minimal configuration.
Specifically, ASDM is accessed using a Secure Socket Layer (SSL) web browser
connection to the ASA Web Server. SSL encrypts the traffic between the client and the
ASA Web Server.
At a minimum, the ASA requires that a management interface be configured in order to
run ASDM. The management interface depends on the model of ASA. On an ASA
5506-X, the management interface can be any inside interface (G1/2 - G1/8).
Specifically, to prepare for ASDM access on an ASA 5506-X, the following must be
configured, as shown in the example:
o Selected inside physical port - complete a basic configuration on the port
including a management IP address and security level
o Enable the ASA Web Server - Enable the ASA HTTP server.
o Permit access to the ASA Web Server - By default, the ASA operates in a
closed policy; therefore, all connections to the HTTP server are denied. A
network statement that specifies the hosts that are permitted to access the HTTP
server must be configured.
The example configures the chosen management inside interface (G1/2) with IP address
192.168.1.1. It enables the interface, enables the ASA HTTP server, and permits access
from any inside host on the 192.168.1.0/24 network.
After configuring the ASA, verify connectivity by pinging it from the authorized host.
ciscoasa# conf t
ciscoasa(config)# interface g1/2
ciscoasa(config-if)# ip address 192.168.1.1 255.255.255.0
ciscoasa(config-if)# nameif INSIDE
INFO: Security level for "INSIDE" set to 100 by default.
ciscoasa(config-if)# no shutdown
ciscoasa(config)# exit
ciscoasa(config)#
ciscoasa(config)# http server enable
ciscoasa(config)# http 192.168.1.0 255.255.255.0 inside
ciscoasa(config)#
To start ASDM, enter the management IP address of the ASA in a web browser from a
permitted host. The permitted host must establish a connection through a browser to the
inside interface IP address using the HTTPS protocol.
Click to disregard the initial security certificate warning and to launch the ASDM
window.
The initial ASDM window is displayed, as shown in the figure. It provides two options
for preparing your computer to access the ASDM GUI:
o Run Cisco ASDM as a local application - This provides the Install ASDM
Launcher option to connect to the ASA from the host’s desktop using SSL.
The advantage of doing so is that one application can be used to manage several
ASA devices, and a web browser is not required to start ASDM.
o Run Cisco ASDM as a Java Web Start application - This provides the
Install Java Web Start option to enable a browser to run launch ASDM. A web
browser is required to establish a connection. ASDM is not installed on the
local host.
After selecting an option, the installation process will begin. Note: Your computer
requires a version of the Java runtime in order for either of these options to work.
In this example, Install ASDM Launcher is selected. The application installer will
download to your computer. Run the installer and follow the prompts to install the
software. When installation is complete, the Cisco ASDM-IDM Launcher window will
appear as shown in the figure. Provide the enable password and click OK.
Finally, the ASDM Home page displays, as shown in the figure.
MODULE 22
22.1 NETWORK SECURITY TESTING TECHNIQUES
22.1.1 OPERATIONS SECURITY
Operations security is concerned with the day-to-day practices necessary to first deploy
and later maintain a secure system. All networks are vulnerable to attack if the
planning, implementation, operations, and maintenance of the network do not adhere to
operational security practices.
Operations security starts with the planning and implementation process of a network.
During these phases, the operations team analyses designs, identifies risks and
vulnerabilities, and makes the necessary adaptations. The actual operational tasks begin
after the network is set up and include the continual maintenance of the environment.
These activities enable the environment, systems, and applications to continue to run
correctly and securely.
Some security testing techniques are predominantly manual, and others are highly
automated. Regardless of the type of testing, the staff that sets up and conducts the
security testing should have significant security and networking knowledge in these
areas:
o Operating systems
o Basic programming
o Networking protocols, such as TCP/IP
o Network vulnerabilities and risk mitigation
o Device hardening
o Firewalls
o IPSs
The effectiveness of an operations security solution can be tested without waiting for a
real threat to take place. Network security testing makes this possible. Network security
testing is performed on a network to ensure all security implementations are operating
as expected. Typically, network security testing is conducted during the implementation
and operational stages, after the system has been developed, installed, and integrated.
Security testing provides insight into various administrative tasks, such as risk analysis
and contingency planning. It is important to document the results of security testing and
make them available for staff involved in other IT areas.
During the implementation stage, security testing is conducted on specific parts of the
network. After a network is fully integrated and operational, a Security Test and
Evaluation (ST&E) is performed. An ST&E is an examination of the protective
measures that are placed on an operational network.
Objectives of ST&E include the following:
o Uncover design, implementation, and operational flaws that could lead to the
violation of the security policy.
o Determine the adequacy of security mechanisms, assurances, and device
properties to enforce the security policy.
o Assess the degree of consistency between the system documentation and its
implementation.
Tests should be repeated periodically and whenever a change is made to the system. For
security systems that protect critical information or protect hosts that are exposed to
constant threat, security testing should be conducted more frequently.
After a network is operational, you must access its security status. Many security tests
can be conducted to assess the operational status of the network:
o Penetration testing - Network penetration tests, or pen testing, simulate attacks
from malicious sources. The goal is to determine the feasibility of an attack and
possible consequences if one were to occur. Some pen testing may involve
accessing a client’s premises and using social engineering skills to test their
overall security posture.
o Network scanning - Includes software that can ping computers, scan for
listening TCP ports, and display which types of resources are available on the
network. Some scanning software can also detect usernames, groups, and
shared resources. Network administrators can use this information to strengthen
their networks.
o Vulnerability scanning - This includes software that can detect potential
weaknesses in the tested systems. These weaknesses can include
misconfiguration, blank or default passwords, or potential targets for DoS
attacks. Some software allows administrators to attempt to crash the system
through the identified vulnerability.
o Password cracking - This includes software that is used to test and detect weak
passwords that should be changed. Password policies must include guidelines to
prevent weak passwords.
o Log review - System administrators should review security logs to identify
potential security threats. Filtering software to scan lengthy log files should be
used to help discover abnormal activity to investigate.
o Integrity checkers - An integrity checking system detects and reports on
changes in the system. Most of the monitoring is focused on the file system.
However, some checking systems can report on login and logout activities.
o Virus detection - Virus or antimalware detection software should be used to
identify and remove computer viruses and other malware.
Note: Other tests, including Wardialing and Wardriving, are considered to be legacy,
but should still be accounted for in network testing.
There are many tools available to test the security of systems and networks. Some of
these tools are open source while others are commercial tools that require licensing.
Software tools that can be used to perform network testing include:
o Nmap/Zenmap - This is used to discover computers and their services on a
network, therefore creating a map of the network.
o SuperScan - This port scanning software is designed to detect open TCP and
UDP ports, determine what services are running on those ports, and to run
queries, such as whois, ping, traceroute, and hostname lookups.
o SIEM (Security Information Event Management) - This is a technology used
in enterprise organizations to provide real time reporting and long-term analysis
of security events.
o GFI LANguard - This is a network and security scanner which detects
vulnerabilities.
o Tripwire - This tool assesses and validates IT configurations against internal
policies, compliance standards, and security best practices.
o Nessus - This is a vulnerability scanning software, focusing on remote access,
misconfigurations, and DoS against the TCP/IP stack.
o L0phtCrack - This is a password auditing and recovery application.
o Metasploit - This tool provides information about vulnerabilities and aids in
penetration testing and IDS signature development.
Note: Network testing tools evolve at a rapid pace. The preceding list includes legacy
tools, and its intent is to provide an awareness of the different types of tools available.
Nmap is a commonly used, low-level scanner that is available to the public. It has an
array of excellent features which can be used for network mapping and reconnaissance.
The basic functionality of Nmap allows the user to accomplish several tasks, as follows:
o Classic TCP and UDP port scanning -This searches for different services on
one host.
o Classic TCP and UDP port sweeping - This searches for the same service on
multiple hosts.
o Stealth TCP and UDP port scans and sweeps - This is similar to classic scans
and sweeps, but harder to detect by the target host or IPS.
o Remote operating system identification - This is also known as OS
fingerprinting.
Advanced features of Nmap include protocol scanning, known as Layer 3 port
scanning. This feature identifies Layer 3 protocol support on a host. Examples of
protocols that can be identified include GRE and OSPF.
While Nmap can be used for security testing, it can also be used for malicious purposes.
Nmap has an additional feature that allows it to use decoy hosts on the same LAN as the
target host, to mask the source of the scan.
Nmap has no application layer features and runs on UNIX, Linux, Windows, and OS X.
Both console and graphical versions are available. The Nmap program and Zenmap
GUI can be downloaded from the internet.
22.2.3 SUPERSCAN
22.2.4 SIEM
Operations security starts with the planning and implementation process of a network.
During these phases, the operations team analyzes designs, identifies risks and
vulnerabilities, and makes the necessary adaptations.
The actual operational tasks begin after the network is set up and include the continual
maintenance of the environment.
The staff that sets up and conducts the security testing should have significant security
and networking knowledge in these areas: device hardening, firewalls, IPSs, operating
systems, basic programming, networking protocols, such as TCP/IP, and network
vulnerabilities and risk mitigation.
An ST&E is an examination of the protective measures that are placed on an
operational network.
Many security tests can be conducted to assess the operational status of the network and
include: penetration testing, network scanning, vulnerability scanning, password
cracking, log review, integrity checkers, and virus detection.
Network Security Testing Tools
There are many tools available to test the security of systems and networks including:
Nmap/Zenmap, SuperScan, SIEM, GFI LANguard, Tripwire, Nessus, L0phtCrack, and
Metasploit. Nmap and Zenmap (its graphical frontend) are commonly used and free
low-level scanners.
SuperScan is also a free Microsoft Windows port scanning tool.
Security Information Event Management (SIEM) is a technology used in enterprise
organizations to provide real time reporting and long-term analysis of security events.
SIEMs provide correlation, aggregation, forensic analysis, and retention.