Understanding Network Security Basics
Understanding Network Security Basics
Instructor
K-K-C
CCIE#44634
Basic-Concept-Of-Network-Security
Plain-Text
The name it self indicates its normal text which can be read by user.
Cipher-Text
The name it self indicates its not normal text which can not be read by user.
Note= To provide the security the user should convert plain text to cipher.
Encryption
The process converting plain text to cipher text is called encryption. Done by Sender.
Decryption
The process converting cipher text to plain text is called decryption. Done by Receiver.
Cryptography
The study of encryption is called cryptography.
Cryptanalysis
The study of decryption is called cryptanalysis.
Cryptology
The study of both encryption and decryption is called cryptology.
What is Key ?
We can say key is group of bits. which has the major rule in encryption and in
decryption.
1 Stream cipher= Mean here the encryption and decryption is done bit by bit. It is
used for short length messages.
2 Block cipher= Blocks mean group of bits. here encryption and decryption is done
by block by block.
Mean in Block cipher first process is blocking and the second process is conversion.
There is size for the block depend upon by algorithm mean first will divide the data or
bits block and then it will be convert to either Plain text and cipher text.
Encryption
Encryption can be done by two mechanism.
1 Symmetric 2 Asymmetric
What is symmetric encryption?
In this mechanism the same key will be used for both encryption and decryption
Process.
The key may be a single key or a group of keys. that key is called (SECERT-KEY) and
it is denoted by Ks.
What is Asymmetric encryption?
In this mechanism their will, be used two independent keys. One for Encryption and
Another one for Decryption. And that two independent keys are also called pair.
1 Public Key 2 Private key
Public key is denoted by Ku Private key is denoted by Kr
Every user should have that pair of keys for encryption and decryption.
Process-OF-Encryption&Decryption
P E C C D P
L N I I E L
A C P P C A
I R H H R I
N Y E E Y N
P R R P
T T T T
E I T T I E
X O E E O X
T N X X N T
T T
Attacks
What is Attack?
An attack is gaining the access of data by an unauthorized person or user
The word gaining mean is Accessing Data Modifying Data Destroying Data
A useful means of classifying security attacks are classified into two types
Active attacks involve some modification of the data stream or the creation of
a false stream and can be subdivided into four categories:
Masquerade
Replay
Modification of Messages
Denial of Service
Masquerade Attack
A 'masquerade' takes place when one entity pretends to be a different entity. A
Masquerade attack usually includes one of the other forms of active attack. For
Example, authentication sequence has taken place, thus enabling few privilege to
Obtain extra privilege by pretending an entity that has those privileges.
Replay Attack
Replay involve the passive capture of a data unit and its subsequent retransmission
To produce an authorized effect.
Modification of Messages Attack
It simply means that some portion of a authorized message is altered, or that
Messages are delayed or reordered, to produce an unauthorized effect. For example,
A, message meaning "Allow UserA to read confidential file accounts" is changed to
"Allow UserB to read confidential file accounts".
Denial of Service Attack
It prevents or inhibits the normal use or management of communication facilities.
This attack may have a specific target; for example, an entity may suppress all
messages directed to a particular destination. Another form of service denial is the
disruption of an entire network, either by disabling the network or by overloading it
with messages so as to degrade performance.
Security Services
1 Access-Control
2 Authentication
3 Confidentiality
4 Integrity
Access-Control
Confidentiality
Confidentiality is roughly equivalent to privacy. Measures undertaken to ensure
Confidentiality are designed to prevent sensitive information from reaching the
Wrong people, while making sure that the right people can in fact get it: Access must be
restricted to those authorized to view the data in question
Integrity
Integrity involves maintaining the consistency, accuracy, and trustworthiness of Data
over its entire life cycle. Data must not be changed in transit, and steps must Be taken
to ensure that data cannot be altered by unauthorized people
Don’t Be Confused
Authorization=> mean what the user wants to do?
ATM Example
Authentication=> when I am using ATM it will prompt from me a pin while I am doing
transaction
Encryption Technique
Sample Encryption technique and also called conventional Encryption
technique
1 Substitution Techniques
2 Transposition Techniques
Substitution Technique
The name it self indicates that it will replace the plain text character into cipher
text character.
Both plain text character and cipher text character will be in the form of
character mean here the complete plain text character will be replace or
substituted in cipher text.
We will discussed here the two basic Substitution technique and there is more
Techniques
Caesar Cipher
Play-fair Cipher
Note=>First of all, the main drawback of this type of encryption is that it is used
just for short length messages. And other words its too vulnerable mean its very
easy for a hacker to decrypt the data which is encrypted by these methods.
Caesar Cipher
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Suppose we want to find a cipher Text so we should use a key and key can be any numerical number
Remember here the same key will be used both for Encryption and Decryption
Key – Numerical (K)
1< K < 26
Formula to find the cipher Text of a plain text
C=(P+K)mod 26
Suppose we use key 4 for encryption and decryption and our plain text is JAN
C(J)= (10+4) mod26 C(A)= (1+4) mod26
C(N)= (14+4) mod26
if you want to study security mean encryption and decryption so you should
know about MOD Operator.
The plain text characters will be substituted with cipher characters this will
be done sample adding the value of Palin text character to the given key and
the corresponding character of the result will be the cipher characters
The main draw back this technique is only we are using 26 keys and there is
an attack by name of brute-force attack which check each and every
possibility and to find out the actual data.
Play-fair Cipher
Here first we should consider the key and 5 by 5 table.
First Fill the 5 by 5 table with the given key with out any repeated Character.
Second fill all the remaining boxes in the table with the alphabets which are not
available in our key.
As we know 5X5 table will give 25 boxes so we should write I/J in one box to
complete the 26 alphabets. Mean we will Marge I/J in one box.
If our Key have Repeated Letters ignore them.
Divide the plain-text in pair of letters.
If any Pair Consist of Repeated letters just differentiate those repeated letters
with any dummy letters.
If pair of Plain-Text letters are in same ROW replace them with right most
letters.
If the Plain-Text letters are in same COLUMN replace with beneath letters (Down)
If the Plain-Text Letters are in different ROW&COLUMN change them in Diagonal
Position
Play-fair Cipher
Suppose We have Key NETWORK and THE Plain-Text is HELLO what will be the
Cipher-Text ?
N E T W O
R K A B C
D F G H I/J
L M P Q S
U V X Y Z
Transposition Technique
In Transposition Technique we will just re-arrange the order of bits to provide the
security.
H I H O W
A R E Y O
U X Y Z B
If we want to access any device through Telnet , SSH , HTTP , HTTPS so we should have IP
connectivity and configured any of above protocols properly on that particular device before
accessing.
If you are using Laptop so we need Serial Converter which name is Rs232.
5th Setup-Mode
6th Rommon-Mode
Securing Console port-Accessing
Router> enable
Router(config-line)# login
Router(config-line)# exit
Router(config-line)# exit
Router> enable
Router# Configure terminal
Router(Config)# Interface X
Router(Config-if) ip address [Link] [Link]
Router(Config-if) no shutdown
Telnet-Practical-Lab Cont.……………..
Switch> enable
Switch # Configure terminal
Switch(Config)# Interface vlan 1
Switch(Config-if) ip address [Link] [Link]
Switch(Config-if) no shutdown
Telnet-Practical-Lab Cont.……………..
Second We should Set enable or enable Secret Password in router or switch
Setting Enable or Enable Secret-Password.
Router> enable
Router# Configure terminal
Router(Config)# enable password nothing
Router(Config)# enable secret everything
Switch> enable
Switch# Configure terminal
Switch(Config)# enable password nothing
Switch(Config)# enable secret everything
Telnet-Practical-Lab Cont.……………..
3rd We should enable Telnet in Router and switch.
How to enable telnet
Router> enable
Router# Configure terminal
Router(Config)# line vty 0 4
Router(Config-line)# password saidalam
Router(Config-line)# login
Switch> enable
Switch# Configure terminal
Switch(Config)# line vty 0 4
Switch(Config-line)# password saidalam
Switch(Config-line)# login
What is SSH ?
SSH, also known as Secure Shell or Secure Socket Shell, is a
network protocol that gives users, particularly system
administrators, a secure way to access a node over an unsecured
network. SSH also refers to the suite of utilities that implement
the SSH protocol. Secure Shell provides
strong authentication and encrypted data communications
between two nodes connecting over an open network such as the
internet. SSH is widely used by network administrators for
managing systems and applications remotely, allowing them to
log into another node over a network, execute commands and
move files from one node to another.
Show privilege: This command displays the current privilege. Here's an example:
Router# Show privilege
Current privilege level is 3
Enable: Administrators typically use this command to go to privileged EXEC
mode. However, it can also take you to any privileged mode. Here's an example:
Router# enable 1
Router>Show privilege
Current privilege level is 1
Privilege Levels Cont.…………………
Router>
User: While this command configures users, it can also tell the IOS which privilege
level the user will have when logging in. Here's an example:
Router(config)# username test password test privilege 3
Privilege: This command configures certain commands to be available only at certain
levels. Here's an example:
Router(config)# enable secret level 5 level5pass
Enable secret: By default, this command creates the password to get to privilege
mode 15. However, you can also use it to create passwords to get into other privilege
modes that you create.
Creating Custom Privilege Level
Router> enable
Router# Configure terminal
Router(Config)# enable secret cisco
Router(Config)# enable secret level 2 khan
Router(Config)# enable secret level 3 jan
Router(Config)# privilege exec level 2 clock set
Router(Config)# privilege exec level 2 show run
Router(Config)# privilege exec level 2 configure terminal
Router(Config)# privilege configure level 2 interface
Router(Config)# privilege configure level 2 hostname
Router(Config)# privilege configure level 2 router rip
Creating Custom Privilege Level Cont.……
Router(Config)# privilege interface level 2 ip address
Router(Config)# privilege interface level 2 no shutdown
Router(Config)# privilege router level 2 network
Router(Config)# privilege router level 2 no-autosummary
Cisco IOS CLI Parser Views provide much more granular Access Control features than Privilege
Levels. Network administrators can now implement Role-Based CLI Access (simply called as
RBAC, Role-Based Access Control). By Implementing RBAC, using Parser Views, administrators can
limit what commands a user can see or run on the Cisco Routers and Switches.
Network Administrators can create CLI Parser Views add the Role Based commands to the CLI
Parser View. A CLI Parser View can be tied to a user and when the user logs in using this view, he
will get only the commands which are configured for his view.
1 Root View
2 Cli View
3 Super View
Root View is the view which can configure all commands mean it has full authority on
the box.
CLI View is the view which can run limited commands which is assigned by Root View and
for all users we create CLI View.
Suppose We have Two users. User1 and User2 as we know that if User1 login so it can not
see the User2 Commands and User2 Can not See User1 Commands.
Super-View is the view which can run all CLI view commands but can not run Root View
commands
Following are the pre-requisites for Creating
Parser Views
AAA must be enabled on the router using Cisco IOS "aaa new-model" command
Configuring CLI View
Step 01 - Enable AAA globally on Cisco Router/Switch using "aaa new-model" and configure
password for privilege EXEC mode from the Global Configuration Mode.
R1>enable
R1#configure terminal
R1(config)#aaa new-model
R1(config)#aaa authentication login default local
R1(config)#aaa authorization exec default local
Username: admin
Password:
R1>enable view
Password:
R1#configure terminal
R1(config)#username user1 password user123
R1(config)#username user1 privilege 15 view User1 secret user1
R1(config)#parser view User1
R1(config-view)#secret user123
R1(config-view)#commands exec include configure terminal
R1(config-view)#commands exec include ping
R1(config-view)#commands exec include traceroute
R1(config-view)#commands exec include exit
R1(config-view)#commands configure include interface Fastethernet 0/0
R1(config-view)#commands configure include exit
R1(config-view)#commands interface include ip address
R1(config-view)#commands interface include no ip address
R1(config-view)#commands interface include shutdown
R1(config-view)#commands interface include no shutdown
R1(config-view)#commands interface include exit
R1(config-view)#exit
R1(config)#username user2 password user123
R1(config)#username user2 privilege 15 view User2 secret user2
R1(config)#parser view User2
R1(config-view)#secret user123
R1(config-view)#commands exec include configure terminal
R1(config-view)#commands exec include ping
R1(config-view)#commands exec include traceroute
R1(config-view)#commands exec include exit
R1(config-view)#commands configure include interface Fastethernet 0/0
R1(config-view)#commands configure include exit
R1(config-view)#commands interface include shutdown
R1(config-view)#commands interface include no shutdown
R1(config-view)#commands interface include exit
R1(config-view)#exit
Configuring Super View
First Login From Root-View To create Super View
RADIUS uses UDP Port 1812 and 1813 / 1645 and 1646 TACACS+ uses TCP port 49
RADIUS combines authentication and Authorization TACACS+ treats Authentication, Authorization, and Accountabilitydifferently
RADIUS is an open protocol supported by multiple vendors TACACS+ is Cisco proprietary protocol
RADIUS is a light-weight protocol consuming less resources TACACS+ is a heavy-weight protocol consuming more resources
Mainly used for Network Access Mainly used for Device Administration
AAA Cont.……
Why every network admin should care about AAA
Besides passing certification tests like the Cisco CCNA Security, AAA is a critical
piece of network infrastructure. AAA is what keeps your network secure by
making sure only the right users are authenticated, that those users have access
only to the right network resources, and that those users are logged as they go
about their business.
How do you configure AAA in the Cisco IOS?
Here are the steps to configuring AAA:
Enable AAA
Configure authentication, using RADIUS or TACACS+
Define the method lists for authentication
Apply the method lists per line/ per interface
AAA Particle Lab in Packet-Tracer
2 enable AAA
(aaa new-model)
(aaa authentication login default local)
3 Implement
(line consol 0)
(login authentication default)
(line vty 0 4)
(login authentication default)
AAA Particle Lab in Packet-Tracer Cont.
…
(Tacacs-Server)
1 first configure tacacs server
2 configure the router
(tacacs-server key cisco)
(tacacs-server host [Link])
(aaa new-model)
(aaa authentication login default group tacacs+local)
3 Implement
(line consol 0)
(login authentication default)
(line vty 0 4)
(login authentication default)
AAA Particle Lab in Packet-Tracer Cont.
… (Radius-Server)
1 first configure tacacs server
2 configure the router
(Radius-server key cisco)
(Radius-server host [Link])
(aaa new-model)
(aaa authentication login default group Radius+local)
3 Implement
(line consol 0)
(login authentication default)
(line vty 0 4)
(login authentication default)
Mac-Address Over-Flow Attack
MAC address flooding attack (CAM table flooding attack) is a type of network
attack where an attacker connected to a switch port floods the switch
interface with very large number of Ethernet frames with different fake
source MAC address.
This type of attack is also known as CAM table overflow attack. Within a very
short time, the switch's MAC Address table is full with fake MAC address/port
mappings. Switch's MAC address table has only a limited amount of memory.
The switch can not save any more MAC address in its MAC Address table.
Once the switch's MAC address table is full and it can not save any more MAC
address, its enters into a fail-open mode and start behaving like a
network Hub. Frames are flooded to all ports, similar to broadcast type of
communicaton.
Now, what is the benefit of the attacker? The attacker's machine will be
delivered with all the frames between the victim and another machines. The
attacker will be able to capture sensitive data from network.
macof –i eth0
How to Prevent Mac-over-Flow-Attack
Cisco switches are packed with in-built security feature against MAC flooding
attacks, called as Port Security. Port Security is a feature of Cisco Switches,
which give protection against MAC flooding attacks.
What is Port security ?
By default, all interfaces on a Cisco switch are turned on. That
means that an attacker could connect to your network through
a wall socket and potentially threaten your network. If you
know which devices will be connected to which ports, you can
use the Cisco security feature called port security. By using
port security, a network administrator can associate specific
MAC addresses with the interface, which can prevent an
attacker to connect his device. This way you can restrict
access to an interface so that only the authorized devices can
use it. If an unauthorized device is connected, you can decide
what action the switch will take, for example discarding the
traffic and shutting down the port.
Configuring Port-Security
To configure port security, three steps are required:
3. Define which MAC addresses are allowed to send frames through this interface by
using the (switchport port-security mac-address MAC_ADDRESS) interface
subcommand or using the (swichport port-security mac-address sticky) interface
subcommand to dynamically learn the MAC address of the currently connected host.
Configuring Port-Security Cont.…………….
Two steps are optional:
1. Define what action the switch will take when receiving a frame from an
Unauthorized device by using the (port security violation {protect |
restrict | shutdown) interface subcommand. All three options discards the
traffic from the unauthorized device. The restrict and shutdown options send
a log Messages when a violation occurs. Shut down mode also shuts down the
port.
2. Define the maximum number of MAC addresses that can be used on the
port by using the (switchport port-security maximum NUMBER) interface
Sub mode command
The following example shows the configuration of port security on a Cisco
switch:
Default Violation is Shutdown.
Default Maximum allowed mac-address is just one
Port-Security-Practical-Lab
Suppose we have the below Topology. Now I Want that from port number fa0/1 just PC1
Mac Address should be allowed. If PC2 Plug-in to Fa0/1 PC2 should be not allowed to join
Port-Security-Practical-Lab Cont.……………
Switch> Enable
Switch# Configure terminal
Switch(config)# Interface Fast Ethernet 0/1
Switch(config-if)#switchport mode access Compulsory
Switch(config-if)#switchport access vlan X Optional if not provided default will
be in vlan 1.
Switch(config-if)#switchport portsecurity Compulsory other wise the security
will be not enabled on the port.
Switch(config-if)#switchport portsecurity maximum 5Optional if not provided default
will be allowed just one mac address.
Switch(config-if)#switchport portsecurity violation shutdown Optional if not provided
the default will be shutdown
Switch(config-if)#switchport portsecurity mac-address [Link].1111 Optional if
not provided the first mac address will be allowed.
Port-Security-Practical-Lab Cont.……………
Switch(config-if)#switchport portsecurity mac-address sticky Optional if you
provided the first this command the switch will automatedly learn mac
address and put them in allowed list.
If a switch port goes in error-Disable state the port will no longer send and receive
data from that particular port.
1 Manually 2 Automatic
Error-Disable-Recovery Cont.………………….
1 Manually
Switch> Enable
Switch(config-if)#shutdown
Switch(config-if)#no shutdown
Error-Disable-Recovery Cont.………………….
2 Automictically
Switch> Enable
It is Layer 3 security which Control The flow of traffic from one router to
Another.
The Access-List Number Range is 1-99. The Access-List Number Range is 100-199.
Can block a network ,host ,subnet. We can allow or deny A network, host,
Subnet, and services.
All services are blocked. Select services can be blocked.
Note= The Above ACL rules should not affect the other communication.
Ensure that the router you are implementing ACL must be transit router.
Think your router as destination (incoming as source )
Wild Card Mask
Tells the router which portion of bits to match or ignore.
0=must match 1=ignore