Sunday, 23 November 2014

Securing the device management

Secure Management


First let's nail down a definition of what our management traffic is before we attempt to make it secure.

Management traffic is any traffic that allows a user to control a device.

We'll keep this in mind throughout this post. Saying any traffic that terminates on a device is too broad, as that includes control section traffic.

The reason we want to keep this secure should be fairly obvious, we don't want any malicious users to gain control of our devices, because once they have control of our devices, they've got control of our network.

When we first receive an IOS device, we connect to it using the console port directly plugged into our computer. Management this way is inherently secure, as someone has to have physical access to our device in order to control it. However whilst this works well for initial setup, ongoing support of a device via the console can be very inconvenient, as they are often housed in different buildings, locations or even countries. We need a way of obtaining a secure connection to a device, without being physically near it.

Best Practices


  • Strong password policy
  • User authentication and AAA – being able to verify exactly which users are logging on, rather than just having a device password
  • Role-based access – 1st line support engineers may require access to issue show commands, but may never need access to configure a device.
  • Encrypted management protocols – SSH, HTTPS, management VPNs
  • Logging
  • NTP
  • Secure system files – make it difficult to delete startup configuration files

Using AAA


There are many ways to implement AAA on Cisco devices, many of which use centralised servers, which we will refer to as authentication servers. Some of these options are AAA servers, RADIUS servers, TACACS servers, or ACS servers. All of these essentially refer to a server which holds a database of usernames and passwords to verify who is connecting to a device. You can also implement device only authentication, where the device itself holds a database of usernames and passwords to authenticate users.

AAA method lists


We can create a list of AAA methods to be used, and make that list specific for authentication, authorisation and accounting. The default list will be applied to the entire device. If we use a custom list it must be specifically reference in the configuration of a line or interface.

R1(config)#aaa authentication login default local

This command would set the default method to login to the device to the local database.

R1(config)#aaa authentication login CONSOLE krb5

However this command would set the login method to krb5, and then we could reference this new list on the console like so:

R1(config)#line console 0
R1(config-line)#login authentication CONSOLE

 

Role-based access and custom privilege levels

We've spoken before about the need for role-based access and only granting the minimum required access required. To put this into place we create a privilege level for each user that we define. The privilege levers run between 1 and 15, with 1 being user access only, and 15 being full administrator access. With these access levels we can assign commands which normally reside at level 15 to a lower security level so that lower privilege level administrators can access what they require for their role.

Encrypted Management Protocols


As has been spoken about before, SSH and HTTPS should really be the only methods used to manage a device remotely, unless you are configuring a VPN to access the device. Within SSH, version 2 should always be used if possible.

R1(config)#ip ssh version 2

Logging


Logging is extremely important as it provides us a way to see what is happening with the device and the network without watching it in real time. It gives us the opportunity to see if hardware fails or a failover occurs between clustered devices, and much more information.

Cisco devices can output logs to a variety of places:

  • Console
  • vty lines
  • buffer
  • SNMP server
  • syslog server
Syslog servers and SNMP servers are both popular options and often used in conjunction with each other.

Secure passwords


Now that we've gone over the best practices, we can see some practical examples.

R1(config)#username insecure password cisco
R1(config)#username secure secret sf$%sd129&d

Here are two different ways of assigning a password to a user. They might not seem obvious right now, but if we run a command to see what users are enabled on a device we can see the difference:

R1#show run | inc username
username insecure password 0 cisco
username secure secret 5 $1$YBo/$1.JF.FtDmz8YZ44kPzXdM.

The difference is obvious here, the when we issue the secret command instead of the password command the secret is hashed with the MD5 algorithm to create what is seen above. Even if someone was able to view the configuration of the device, they wouldn't be able to retrieve the users password.

We can also define passwords on the console and vty ports:

R1(config)#line con 0
R1(config-line)#password 89skjh&^@lhasd
R1(config-line)#login
R1(config-line)#exit
R1(config)#line vty 0 4
R1(config-line)#password o872394uhjkhdsf7^
R1(config-line)#login

If we now issue a show run command and view the configuration for the console and vty ports, we can still see the passwords in clear text. There is no secret option available for configuring these passwords so we need another command to ensure that they are no longer visible.

R1(config-line)#do show run | beg con 0
line con 0
exec-timeout 0 0
privilege level 15
password 89skjh&^@lhasd
logging synchronous
login
stopbits 1
--------------------------------
line vty 0 4
password o872394uhjkhdsf7^
login
!

What we can do is the service password-encryption command, which will encrypt all the passwords on the device.

R1(config)#service password-encryption
R1(config)#do show run | beg con 0
line con 0
exec-timeout 0 0
privilege level 15
password 7 005C4A150F51034031014046080A01
logging synchronous
login
stopbits 1
-------------------------------------
line vty 0 4
password 7 011C5E5309585F5B34444402110104145C32
login
!

Note that this also encrypts the users whose passwords were specified with the password commands, but does not encrypt the users whose passwords were already hashed with the secret command:

R1#show run | inc username
username insecure password 7 104D000A0618
username secure secret 5 $1$YBo/$1.JF.FtDmz8YZ44kPzXdM.

Using AAA and method lists


First we need to enable aaa if it's not already in place on the device

R1(config)#aaa new-model

We can use a tacacs server to authenticate users, but first we must define the tacacs server itself:

R1(config)#tacacs-server host 1.1.1.1
R1(config)#tacacs-server key tacacspassword

Now we can use a default aaa method list to authenticate users:

R1(config)#aaa authentication login default local enable

This specifies that when a user is logging in they must authorise against the local user database, and if that fails then to use the enable secret which has been specified. Because this is a default list, this will apply to all logins, whether they are from console, aux ports or vty ports, unless those particular ports have a different authentication method specified.

R1(config)#aaa authentication login MY_LIST group tacacs+ local enable

This is a custom list which will first use the tacacs server to authenticate, if that is not responding then it will use the local database and then the enable password.

Now we can create authorisation lists which we can use to specify the privilege levels of the users who login:

R1(config)#aaa authorization commands 1 priv1 group tacacs+ local
R1(config)#aaa authorization commands 15 priv15 group tacacs+ local

Here we have defined two authorisation lists, one for users to login at the user level (level 1) and the other for administrators (level 15). These lists wont be used until they are specified at a line level.

R1(config)#aaa accounting commands 1 ACCT1 start-stop group tacacs+
R1(config)#aaa accounting commands 15 ACCT15 start-stop group tacacs+

It's alwas a good idea to have an admin account with privilege 15 present on the device, in the case that the remote server is unreachable, so long as the local database is specified as a backup

R1(config)#username admin privilege 15 secret 298hef8&&sdfh\

In the example below, we now apply our newly created aaa method lists to the vty ports, to be applied when users login remotely. First we set the authentication to come from MY_LIST, specified above. Then we set the authorisation commands for the list of users in prvi1 and priv15, and the accounting methods for the same users.

R1(config)#line vty 0 4
R1(config-line)#login authentication MY_LIST
R1(config-line)#authorization commands 1 priv1
R1(config-line)#authorization commands 15 priv15
R1(config-line)#accounting commands 1 ACCT1
R1(config-line)#accounting commands 15 ACCT15

Debugging Authentication


Now that we've got our aaa parameters, we can use the debug aaa command to see it in action.

First we need to put an IP address on our device so we can connect to it.

R1(config)#int loopback 0
R1(config-if)#ip address 10.0.0.1 255.255.255.0

We also need to set the logging to the buffer so we can see what happens:

R1(config)#logging buffered 7

R1#debug aaa authentication

R1#telnet 10.0.0.1
Trying 10.0.0.1 ... Open


User Access Verification

Username: insecure
*Nov 22 19:39:20.238: AAA/BIND(0000000E): Bind i/f
*Nov 22 19:39:20.242: AAA/AUTHEN/LOGIN (0000000E): Pick method list 'MY_LIST' ure
Password:

R1>who
Line User Host(s) Idle Location
0 con 0 10.0.0.1 00:00:00
* 2 vty 0 insecure idle 00:00:00 10.0.0.1


Here we can see that Bob is connected to line vty 0, and from the debug output we see that MY_LIST is to be used to authenticate.

What we can now to test the correct parameters are being used is to remove all the users from the local database and set the enable secret. What should happen when we try to connect as a local user is the authentication method should fall back to the enable password.

Remove users with the 'no username username' command

R1(config)#enable secret lasdjf*7SKJ

Now with no users defined, let's see what happens when we try to connect:

R1#telnet 10.0.0.1
Trying 10.0.0.1 ... Open


User Access Verification

Username:
*Nov 22 19:46:59.990: AAA/BIND(00000012): Bind i/f
*Nov 22 19:46:59.994: AAA/AUTHEN/LOGIN (00000012): Pick method list 'MY_LIST'
Username: myusername
Password: enable secret password set above
*Nov 22 19:47:04.846: AAA/AUTHEN/ENABLE(00000012): Processing request action LOGIN
*Nov 22 19:47:04.846: AAA/AUTHEN/ENABLE(00000012): Done status GET_PASSWORD

R1>
*Nov 22 19:47:11.154: AAA/AUTHEN/ENABLE(00000012): Processing request action LOGIN
*Nov 22 19:47:11.202: AAA/AUTHEN/ENABLE(00000012): Done status PASS

So even with no users specified on the device, we can still login with the enable password. Note that if we added none to MY_LIST, then we could still login without any password at all.

Next post we'll do learn how to do some troubleshooting.

Saturday, 22 November 2014

Logical Network Sections

The Three Sections of the Networks




We're almost through the theory and into some real configuration, but first we need to define the three key areas of our networks that need defending. And no it's not the typical, internal, DMZ, outside structure we will be talking about here, instead we're dividing the network up into three logical areas.



  • Management: This is the area where we control our devices, for example using SSH to connect to a router or firewall
  • Control: The networks and protocols which devices use to control the traffic flow. For exampe, routing protocols and information that is shared between routers would exist in this section.
  • Data: The area where all the data flows across the networks, it is essentially anything that doesn't fit into the two previous categories.



These sections all link together in certain ways, but for the most part we like to keep them separate. However there are certain obvious examples where they will have an effect on each other; if a routing protocol fails (control) then nothing in the data section will be able to move as the devices won't know where to send it.

Management Section




We must first be able to manage a device before we can use it to forward or block traffic for us. In order to do this we must ensure that the management of the device is secure so that it cannot be accessed by rogue users to subvert our traffic.



  • Enforce password policy, such as a minimum length and password rotation policy
  • Role-based access, ensuring that only those users who require access have got it, and that each user is only given as much control as they require to perform their task.
  • AAA (authentication, authorisation and accounting), ensuring that each user is authenticated, authorised and an audit log is kept of access.
  • Use NTP to keep an accurate time on each device
  • Use encrypted SNMP (Simple Network Management Protocol).
  • Lock down the networks able to manage the device
  • Be very careful with syslog as it is sent in cleartext. Encryption is a difficult one to enforce due to the size of the data, but ensuring a separate VLAN or separate physical network even is used.

Control Section




One of the common ways for a network device to be abused is when it gets overloaded. When a device receives a packet which needs to be forwarded it keeps a copy of the route in its cache so that it doesn't need to expend as many CPU cycles next time that route comes up. However when the traffic is destined for the device itself, it must go through the logical process of identifying and verifying that the traffic is allowed each time. This can make it open to overloading if it has to spend all its CPU cycle just in the control section.



  • CoPP or Control Plane Policing. Policing the traffic destined for the device itself, for example a threshold can be set for this traffic, and excess traffic is ignored.
  • CPPr or Control Plane Protection. A more detailed classification of traffic than CoPP, and might allow us for example to set exceptions to the rate limiting above for important packets such as packets with time-to-live (TTL) options that are near expiration. In this case we might limit SSH traffic to a certain level, but allow routing protocol information to flow unimpeded.
  • Routing protocol authentication. This allows us to authenticate the devices which are providing routing information to us, and stop rogue devices from subverting our network.

Data Section




This is where we will spend most of our time, and most of us think about when we think of network security. Locking down the data so that it only goes to who it is meant to go and doesn't get intercepted on the way. We also employ techniques to proactively monitor the data section to ensure that there is no unauthorised access.



  • Access Control Lists (ACLs). Filtering traffic based on a set of parameters, for example only letting SSH traffic to a certain port, or only allowing inbound traffic from the internet to your web server on https.
  • IOS firewall support. Zone-based firewall on IOS, more details later.
  • IOS IPS. Using signatures to look for malicious traffic, the router can prevent the packets from traversing the network.
  • TCP intercept. Checking the number of partially-formed TCP sessions and intercepting on behalf of the receiving device. Can be used to mitigate DoS attacks and SYN floods.
  • Unicast Reverse Path Forwarding (uRPF). Verifying that the source address of a packet matches the direction with which came from, this can be used to prevent IP spoofing.



Most of these techniques live at layers 3 and 4 of the OSI network model, but we can also employ some various other tools to help secure our network even further.



  • Switch port-security. To protect against MAC address flooding and content-addressable memory (CAM) overflow attacks. If a switch's memory becomes overloaded it may lead to it broadcasting packets to all ports in the VLAN, potentially allowing an attacker to eavesdrop.
  • Dynamic Host Control Protocol (DHCP) snooping, to prevent unwanted DHCP servers from dispensing malicious gateway information.
  • Dynamic ARP Inspection (DAI). Protects against Address Resolution Protocol (ARP) spoofing and ARP poisoning.
  • IP source guard, verifies that IP spoofing is not occurring on devices attached to that switch.



That gives you a brief overview of topics we will spend a lot more time on later, and something to think about when we are configuring our devices.



More soon

Cisco security products

The new network model


Gone are the days of the single ingress/egress point for the corporate network, where all the data was housed on site and staff only worked when they were in the office.

These days we have a much more challenging security environment. Servers are often housed in the cloud, remote sites are connected over the internet, staff can access their data from their phone or laptop outside of the office, and all of this needs to be managed in a secure way. However the underlying principles of the last two blogs don't need to change, we just need to adapt our methods.

Cisco SecureX model


This is the model which Cisco describe as their architecture, I won't go into any detail but you can find more details here: http://www.cisco.com/web/about/ac49/ac0/ac1/ac259/docs/email_web_security_services.pdf

  • Context awareness
  • AnyConnect client
  • TrustSec
  • Secure Intelligence Operations

Cisco products

Here is a list of Cisco products which we will talk about more in later posts, but these are all tools which are used to mitigate threats and monitor networks.

  • ASA firewalls
  • Integrated Service Routers (ISRs)
  • Intrusion prevention systems (IPS)
  • IronPort Email Security Appliances and IronPort Web Security Appliances (WSA)
  • ScanSafe

Virtual Private Networks (VPN)

I'm sure you have used VPNs and probably know how they work; they are used to secure traffic flowing over an unsecured network. Typically they are used in a couple of scenarios, connecting remote sites over the internet, and staff connecting to the network from home or on the road. They provide a means of connecting places over third party networks, whilst maintaining a secure connection. The majority of VPNs you encounter will either be IPSec or SSL (HTTPS).

Secure Management


The last topic for today is on secure management, ensuring that the connections which we maintain to our network devices are secure and not open to manipulation. In the past connections were almost exclusively made over telnet, however telnet is completely insecure and sends all its data in cleartext. These days Secure Shell (SSH) will be used to control the command line interface (CLI) and https will be used to control the web interface, or in Cisco's case, the Adaptive Security Device Manager (ASDM). There are also a number of other products available to interact with our security devices and to control them from a central application – more in this later.

Friday, 21 November 2014

More basics

The Secure Network Lifecycle


I won’t go into all the details of this as the information exists in a myriad of places, however these are the five stages of the lifecycle:

•    Initiation
•    Acquisition and development
•    Implementation
•    Operations and maintenance
•    Disposition

More details can be found out here: http://www.ciscopress.com/articles/article.asp?p=1998559&seqNum=4
or here: http://honim.typepad.com/biasc/2014/10/secure-network-life-cycle.html
Risk Analysis
One of the most important tasks in laying out your network security policy is to determine the impact of risk on our assets.  This is no simple tasks as we need to evaluate the costs associated with a failure of our security.  This includes not just downtime and loss of data, but a company’s reputation, potential legal liability, loss of customers etc.  The analysis is usually performed by a combination of qualitative and quantitative methods.  We do this to ensure that adequate security exists for the value of our assets, we wouldn’t spend $50,000 protecting a $10,000 asset, but we might spend $100,000 protecting a $10,000,000 one.

Here are 5 points to consider when you are analysing the risk of a certain asset:

•    Asset value
•    Vulnerabilities
•    Potential threats
•    Compliance issues
•    Business requirements.

Whilst compliance issues are only one of the 5 points considered above, it should be noted that this is generally a non-negotiable aspect and must be factored in at all times.

If we have a detailed risk analysis in place for our assets then adding new assets shouldn’t be a big job, because most of the points above will be able to be transferred from other assets.

Security Policies


What’s the deal with security policies you ask.  Well they’re generally set by senior management as they are responsible for the whole company, including the data and networks which it owns.
Typically they will set a high level policy which the management teams and staff will interpret and put into the place the technical controls to achieve what the high level policy is aiming for.  Then it is down to the end users to abide by that policy.

There are a few reasons as to why we have security policies.  The number one goal for them is to effectively manage risk throughout the organisation.  Without an overall policy then security will be haphazardly managed and hard to enforce in a large organisation.  They are also used for education and awareness, so that staff and users are aware of the risks and what expectations are on them.

Testing


Now that we’ve got our security in place, we need to be able to verify that it is acting in the manner which it should.  We can achieve this in a multiple of ways:

•    Network scanning
•    Vulnerability scanning
•    Password cracking
•    Penetration testing
•    Social Engineering

Of course, the key element to testing is to use the results to rectify any problems raised and identify potential weaknesses that need improving on.

There are a couple more things to explore in this area of network security but they are fairly self-explanatory and will be covered later on anyway so I will just list them here:

•    Incident response
•    Evidence collection
•    Liability
•    Disaster recovery and Business continuity planning

Thursday, 20 November 2014

The Basics!


Network Security Basics



There are three basic concepts that define what we mean when we talk about network security:


Confidentiality: Confidentiality means that only the people who are supposed to view data are the ones who are able to access that data.  What this means for us is that we need to stop unauthorised access to data, whether it be in motion (going from computer to computer) or at rest (residing on a hard drive).  The primary way of ensuring confidentiality for data in motion is encryption – protocols such as SSL/TLS, SSH and VPNs are all ways to encrypt data in transit.  For data at rest we have encryption as an option, as well as strict access controls on both the computer and any network devices in between (routers, switches, firewalls etc)
Integrity: Integrity means that the data that is sent is the same that is received, meaning that it is not tampered with in between, and that only authorised users can modify the data.
Availability: Meaning that the data is available to those authorised when it is needed.  Typically this means that we need to ensure we have a reliable network, and also mitigate the effects of Denial of Service attacks.


Now is a good time to lay out some of the key terms that will be referred to throughout this blog:

Asset: Anything that is of value to a company.  Includes both tangible items (people, hardware etc) and intangible items (intellectual property, data etc)
Vulnerability: A weakness.  Typically described in terms of software (Shellshock, Heartbleed….), it can also refer to a weakness in policy or physical security as well.
Threat: Any unauthorised attempt to access, manipulate or destroy an asset.  What we are protecting against.
Risk: The potential for unauthorised attempt to access, manipulate or destroy an asset.  When we deploy countermeasures to threats, we are lowering our risk.
Countermeasure: Any action taken to mitigate a threat.



Classifications
One of the earliest steps we must take to protect our networks is to classify what is we are protecting (assets), what we are protecting against (vulnerabilities and threats) and what we are going to do to protect ourselves (countermeasures).
You’ll no doubt be familiar with classification of assets which are often  organised into groups such as: Secret, Top Secret, Confidential etc…
We also need to classify our vulnerabilities in order to describe what we are protecting against.  This may include some or all of these: hardware and software vulnerabilities, policy flaws, physical access security, errors in design, protocol flaws etc..
Lastly, the countermeasures need to be classified, and they come in three forms.  Administrative, which is generally policy, physical, which is physical access to hardware, and logical, which is where we will spend most of our time, configuring network controls and firewall rules.



Network Security Principles
These are the basic principles to keep in mind when you are configuring the network:


Rule of least privilege: Always configure your network to allow only the minimum access that is required.  For example you would configure access to a web server from the internet to only allow http and https, instead of all ports.
Defence in depth: Instead of relying on a single layer of security (such as a perimeter firewall), we now typically filter at many levels, from a perimeter router, to an access firewall, access-lists on internal routers, host-protection on end servers, as well as IPS devices deployed inside the network.
Auditing: The most obvious way of auditing is keeping network logs so we can find out what access is granted to whom, and to verify that our security is acting appropriately.  We may also employ internal or external testers to simulate an attack and identify potential weaknesses.

These are the basics to keep in mind as we progress further, it might not be particularly exciting, but it gives us the grounding to understand why certain technologies exist and why we employ them when we do.

Tuesday, 18 November 2014

Introduction

Welcome to my CCNA Security study blog!


The aim of this blog is to help you (and me) get to learn what is necessary to pass the CCNA Security exam.

The outline of this blog will follow closely with what is in the Cisco Press study guide, but taken into my own words and thoughts.

Before we get started, here are some links that might help you along the way:

GNS3 - Software you can use to emulate Cisco IOS and ASA images.

CCNA Security Information - Cisco's information about the exam.

http://ciscoiseasy.blogspot.co.uk/ - fantastic blog for CCNA Routing and Switching



Stay tuned for more