CSN11111 - LAN Security
CSN11111 - LAN Security
Network Security
LAN Security
Learning Objectives
10.2.0.0/
16
10.2.0.0/
16
10.3.0.0/
16
10.3.0.0/
16
VLAN# 10 and VLAN# 30 have been extended onto a second switch. This enables Host
A and Host C to exist in the same VLAN, despite being connected to different physical
switches located in potentially different areas.
The primary benefit of extending a VLAN to different physical switches is that the Layer
2 topology no longer has to be tied to the Physical Topology. A single VLAN can span
across multiple rooms, floors, or office buildings.
Each connected switch port is a member of only a single VLAN. This is referred to as
an Access port. An Access port is a switch port that is a member of only
one VLAN.
In order to extend a VLAN to the second switch, a connection is made
between one Access port on both switches for each VLAN. While functional, this
strategy does not scale. Imagine if our topology was using ten VLANs, on a 24 port
switch nearly half of the ports would be taken up by the inter-switch links.
Instead, there is a mechanism which allows a single switch port to carry traffic from
multiple VLANs. This is referred to as a Trunk port. A Trunk port is a switch port that
carries traffic for multiple VLANs.
Layer 2 Technology
VLANs across switches
Two switches can exchange traffic from one or more VLANs
Inter-switch links are configured as trunks, carrying
frames from all or a subset of a switch’s VLANs
Each frame carries a tag that identifies which VLAN it
belongs to
No VLAN Tagging
VLAN Tagging
Layer 2 Technology
Tagged Ports and Untagged Ports
Whenever a Switch is sending frames out a Trunk port, it adds to
each frame a tag to indicate to the other end what VLAN that frame
belongs to. This allows the receiving switch to read the VLAN tag in order
to determine what VLAN the incoming traffic should be associated to.
An Access port, by comparison, can only ever carry or receive traffic for a
single VLAN. Therefore, there is no need to add a VLAN Tag to traffic
leaving an Access port.
When an Ethernet frame is exiting a Trunk port, the switch will insert a
VLAN Tag between the Source MAC address and the Type fields.
This allows the receiving switch to associate the frame with the
appropriate VLAN.
Layer 2 Technology
VLANs across switches
Tagged Frames
802.1Q Trunk
Trunk Port
Swtich C
Switch A Switch B
Node1 sends a
Swtich C broadcast frame
(e.g. an ARP request)
Node 1
Layer 2 Technology
Switching Loop
Switches A, B
and C broadcast
Switch A Switch B
node 1’s frame
out every port
Swtich C
Node 1
Layer 2 Technology
Switching Loop
Every non-root bridge must select one root port.
The root port of a bridge is the port that is closest to the root
bridge.
The root path cost is the cumulative cost of all links to the root
bridge.
Each segment in a bridged network has one designated port
Functions as the single bridge port that both sends and receives
traffic to and from that segment and the root bridge.
The bridge containing the designated port for a given segment is referred to
as the designated bridge for that segment.
Note: Every active port on the root bridge becomes a designated port.
Layer 2 Technology
How STP works?
How does STP decides in which state the port will be placed? A couple of
criteria exist:
1. all switches in a network elect a root switch. All working interfaces on the
root switch are placed in forwarding state.
2. all other switches, called nonroot switches, determine the best path to
get to the root switch. The port used to reach the root switch (root port) is
placed in forwarding state.
3. on the shared Ethernet segments, the switch with the best path to reach
the root switch is placed in forwarding state. That switch is called the
designated switch and its port is known as the designated port.
4. all other interfaces are placed in blocking state and will not forward
frames.
Layer 2 Technology
CAM Table
CAM table stands for Content Addressable Memory
The CAM table stores information such as MAC
addresses available on physical ports with their
associated VLAN parameters
CAM tables have a fixed size
Normal CAM Behavior 1/3
MAC Port
A 1
Port 2
rB
C 3
fo
MAC B
P
R
A
ARP for B
Port 1
MAC A Port 3
A
R
P
fo
B Is Unknown—
rB
Flood the
Frame
MAC C
Normal CAM Behavior 2/3
MAC Port
A. 1
B. 2
B
C
Port 2
A
C. 3
M
MAC B
m
IA
I Am MAC B
Port 1
MAC A Port 3
A Is on Port 1
Learn:
B Is on Port 2
MAC
29
C
Normal CAM Behavior 3/3
MAC Port
A. 1
B. 2
B
Port 2
➔
C. 3
MAC B
A
fic
af
Tr
Traffic A ➔ B
Port 1
MAC A Port 3
B Is on Port 2
MAC Port
Assume CAM Table Now Full
Y 3
Z
B
3 Port 2
➔
Y Is on Port 3
A
MAC B
fic
C 3
af
Tr
Traffic A ➔B
Port 1
MAC A Port 3
Z Is on Port 3
MAC C
I See Traffic to B!
Attacks and Counter Measures
CAM Table Full
Once the CAM table is full, traffic without a CAM entry is flooded
out every port on that VLAN, but NOT traffic with an existing
CAM entry
This will turn a VLAN on a switch basically into a
hub, which makes it easy for anyone off any port to
collect all traffic exchanged in the port’s VLAN,
This attack will also fill the CAM tables of adjacent switches
As a result, the attacker can see all of the frames sent from
one host to another.
Traffic is flooded only within the local VLAN, so the intruder
sees only traffic within the local VLAN to which the intruder is
connected.
Attacks and Counter Measures
Countermeasures for MAC Attacks
00:0e:00:aa:aa:aa Only One MAC
00:0e:00:bb:bb:bb Addresses
Allowed on the
Port: Shutdown
132,000
Bogus MACs
34
Solution:
Both MAC spoofing and MAC address table overflow attacks can be
mitigated by configuring port security on the switch.
With port security, the administrator can either statically specify the
MAC addresses on a particular switch port or allow the switch to
dynamically learn a fixed number of MAC addresses for a switch
port.
Attacks and Counter Measures
CAM Table Full
Scenario
Use macof to send thousands of frames into a switch to make its CAM table
full of bogus mac addresses so that valid PCs are not able to create CAM
entries on a switch.
After overwhelming the switch’s CAM table, let’s see FTP conversation
between 2 workstations.
Here is my lab environment:
Attacks and Counter Measures
CAM Table Full
Steps
First off, let’s take a look at what a clean CAM table looks like.
Currently there are only 2 MAC addresses learned and 8043 space are available.
To overwhelm the switch’s CAM table, I am going to use “macof”. It will make up
tens of thousands of bogus MAC addresses while sending frames to the switch.
On the attackers PC, open terminal and type macof -i eth0.
Attacks and Counter Measures
CAM Table Full
As a result of the previous command, tons of frames with bogus MAC addresses
will be sent to the switch.
Here is what a CAM table looks like after CAM table overflow attack. As you can
see the switch has learned so many MAC addresses which are all bogus! At this
point the switch can no longer learn a new MAC address and will send all traffic
from a device which its MAC address is not in the CAM table to all ports.
Attacks and Counter Measures
CAM Table Full
If 2 newly connected PCs start conversation, all conversation between the 2 will
be also sent to the attacker’s PC as the switch does not know and cannot
remember the newly connected PC’s MAC addresses. If attacker is running
Wireshark or other Network analyzer, he will be able to capture the
conversations. On the attacker’s PC, run Wireshark and take a look at
conversation between the 2 PCs. As FTP sends everything in plain text, Attacker
successfully captures the username and password.
Attacks and Counter Measures
ARP Spoofing Attack
I Am
10.1.1.4
MAC A
Who Is
10.1.1.4?
SEC-206
Attacks and Counter Measures
ARP Function Review
According to the ARP RFC, a client is allowed to send an
unsolicited ARP reply; this is called a gratuitous ARP; other
hosts on the same subnet can store this information in their
ARP tables
A Gratuitous ARP is an ARP Response that was not prompted by an ARP Request. The Gratuitous ARP is sent as a
broadcast, as a way for a node to announce or update its IP to MAC mapping to the entire network.
when a host had a new MAC address because its Ethernet
adapter was replaced, it should have sent an unsolicited ARP
reply to force an update on all ARP tables in the other hosts.
Anyone can claim to be the owner of any IP/MAC address
they like
ARP attacks use this to redirect traffic
10.1.1.2 Is Now
■Attacker 10.1.1.1 MAC C
ARP tables
ARP 10.1.1.2
ARP 10.1.1.1 Saying
Saying 10.1.1.1 is MAC C
10.1.1.2 is MAC C
10.1.1.3
MAC C 10.1.1.2
MAC B
10.1.1.1 Is Now
MAC C
42
Attacks and Counter Measures
ARP Attack in Action
10.1.1.3
MAC C 10.1.1.2
MAC B
10.1.1.1 Is Now
MAC C
43
Attacks and Counter Measures
Dynamic ARP Inspection
■ Uses the DHCP
10.1.1.1 Snooping Binding table
MAC A information
■ Dynamic ARP Inspection
ARP 10.1.1.1 IsNTohnies Is theARP
IP/MAC Binding table
All packets must match
Saying MyBcNhin
Mat DHCP Snooping entries
10.1.1.2 is MAC C Enabled Dynamic If the entries do not match,
inOdgin!g ARP Inspection throw them in the bit bucket
Enabled
ARP’sTianbtel h
?e Bit
Bucket
10.1.1.3
MAC C 10.1.1.2
ARP 10.1.1.2 MAC B
Saying
10.1.1.1 is MAC C
Client
DHCP Discover (Broadcast)
IP Address: 10.10.10.101
DHCP Offer (Unicast) Default Routers: 10.10.10.1
DNS Servers: 192.168.10.4,
192.168.10.5
DHCP Request (Broadcast)
Gobbler/DHCPx looks at the entire DHCP scope and tries to lease all of the
DHCP addresses available in the DHCP scope
The DHCP Server leases a new IP address for each new MAC address
Attackers could continue to request IP addresses from a DHCP server by
changing their source MAC addresses in much the same way as is done in a
CAM table flooding attack.
The goal is to try to lease all of the DHCP addresses available in the DHCP
scope. 46
This is a Denial of Service DoS attack using DHCP leases
Attacks and Counter Measures
Rogue DHCP Server Attack
Client
Vlan 5
Vlan 165
Vlan 5
DHCP Server
Rogue Server
DHCP Discovery (Broadcast)
switch(config)#
ip dhcp snooping
switch(config-if)#
switch(config)#
switch(config-if)#
switchport port-security
switch(config-if)#
switch(config-if)#
switch(config-if)#
switchport port-security violation shutdown [protect |
restrict | shutdown]
The switch creates a trunk link with the host enabling the
attacker to gain access to all the VLANs on the trunk port, and
the attacker can now send and receive traffic on all the VLANs.
Attacks and Counter Measures
Double-Tagging VLAN Attack
spanning-tree portfast
Attacks and Counter Measures
BPDU(A bridge protocol data unit)
Switch(config)#
spanning-tree portfast bpduguard default
Switch(config-if)#
spanning-tree guard root
Thank You
Any Questions