Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network...

27
Security Possibilities at Layer 2 Security Possibilities at Layer 2 Allan Alton, BSc, CISA, CISSP Allan Alton, BSc, CISA, CISSP http://www3.telus.net/alton http://www3.telus.net/alton UBC UBC September 29, 2005 September 29, 2005

Transcript of Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network...

Page 1: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

Security Possibilities at Layer 2Security Possibilities at Layer 2

Allan Alton, BSc, CISA, CISSPAllan Alton, BSc, CISA, CISSPhttp://www3.telus.net/altonhttp://www3.telus.net/alton

UBCUBCSeptember 29, 2005September 29, 2005

Page 2: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

Caveats and AssumptionsCaveats and AssumptionsOpinions expressed are my own and do notOpinions expressed are my own and do notrepresent the views of UBC, my employer,represent the views of UBC, my employer,any vendor, or any organization to which Iany vendor, or any organization to which Iam associatedam associatedInternet Protocol (IP) implementation in aInternet Protocol (IP) implementation in aswitched environment is assumedswitched environment is assumedFamiliarity with basic networking assumedFamiliarity with basic networking assumedControl of user traffic, not management ofControl of user traffic, not management ofthe network devicethe network device–– Secure management of the switch is assumedSecure management of the switch is assumed

Page 3: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

Caveats and AssumptionsCaveats and AssumptionsConcepts are from a context of CiscoConcepts are from a context of CiscoSystems equipment, but sufficiently generalSystems equipment, but sufficiently generalto apply to other network hardware vendorsto apply to other network hardware vendorsSwitch features are not available on allSwitch features are not available on allproduct lines product lines –– check with your vendor check with your vendorRemediations presented are possibilitiesRemediations presented are possibilitiesnot recommended best practicenot recommended best practiceTest before implementation as bugs may beTest before implementation as bugs may bepresentpresent

Page 4: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

AssertionAssertion

Intelligence built into the newIntelligence built into the newgeneration of switches willgeneration of switches willpermit greater control of datapermit greater control of dataas it enters your networkas it enters your network

Page 5: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

Traditional Network SecurityTraditional Network Security

OSI Layers 3 and 4 where most networkOSI Layers 3 and 4 where most networkcontrols are implementedcontrols are implemented–– e.g.,192.168.1.2 can only be contacted one.g.,192.168.1.2 can only be contacted on

TCP port 80 from subnets beginning withTCP port 80 from subnets beginning with172.16.172.16.

Firewall rules and router access listsFirewall rules and router access lists

Page 6: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

Traditional Network SecurityTraditional Network Security

Ethernet

Server

Server

Ethernet

PC

PC

PC

Firewall

192.168.1.2 on TCP port 80

192.168.1.2 on TCP port 99

Full Access Fu

ll Ac

cess

Full Access

Full Access

Not Involved

Page 7: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

VulnerabilityVulnerabilityAttack within subnetAttack within subnet

Compromised machines can accessCompromised machines can accessothers on the same VLAN by defaultothers on the same VLAN by default

Ethernet

Server

Compromised

Server

Firewall

Server

Limited Access

Full Access

Full Access

Page 8: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediationPrivate VLANsPrivate VLANs

PromiscuousPromiscuous:: talks to any porttalks to any portIsolatedIsolated:: talks only to promiscuoustalks only to promiscuousCommunityCommunity:: talks only to same community or talks only to same community or

promiscuouspromiscuous

YesYesNoNoNoNoYesYescommunity Bcommunity B

NoNoYesYesNoNoYesYescommunity Acommunity A

NoNoNoNoNoNoYesYesisolatedisolated

YesYesYesYesYesYesYesYespromiscuouspromiscuouscommunity Bcommunity Bcommunity Acommunity Aisolatedisolatedpromiscuouspromiscuous

Page 9: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediationProtected PortsProtected Ports

Simpler form of a Private VLANSimpler form of a Private VLAN–– Protected:Protected: similar to Isolatedsimilar to Isolated–– Not protected:Not protected: similar to Promiscuoussimilar to Promiscuous

Only applicable to the local switch howeverOnly applicable to the local switch however

YesYesYesYesnot protectednot protected

YesYesNoNoprotectedprotected

not protectednot protectedprotectedprotected

Page 10: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediation Private VLANs or Protected PortsPrivate VLANs or Protected Ports

Ethernet

Server

Compromised

Server

Firewall

Server

promiscuousor not protected

isolated orprotected

Limited Access

No Access

No Access

Page 11: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

VulnerabilityVulnerabilityBroadcast StormBroadcast Storm

All devices in VLAN / subnet must handleAll devices in VLAN / subnet must handlebroadcasts, consuming resources.broadcasts, consuming resources.OS or application bugs may produce constantOS or application bugs may produce constantbroadcasts. May also be malicious.broadcasts. May also be malicious.

Ethernet

PC A

PC C

PC B

Router

broadcast storm

broadcastbusy handling

broadcasts

Page 12: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediationStorm ControlStorm Control

Can apply to broadcasts, multicasts, orCan apply to broadcasts, multicasts, orunicastsunicasts

Set threshold as percentage of bandwidthSet threshold as percentage of bandwidthover a 1 second periodover a 1 second period

If threshold is exceeded, drop this type ofIf threshold is exceeded, drop this type ofpacket for next 1 second periodpacket for next 1 second period

Page 13: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

VulnerabilityVulnerabilityFlooding for Data Capture or Performance HitFlooding for Data Capture or Performance Hit

Switches flood to all ports when MAC unknownSwitches flood to all ports when MAC unknownSwitches learn MAC addresses at each portSwitches learn MAC addresses at each portTable of addresses is a finite sizeTable of addresses is a finite size

Ethernet

PC

PC

PC

Normal

starts macof or dsniff

address table full flood floodflood

newsourceMAC

Page 14: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

VulnerabilityVulnerabilityDHCP Denial of ServiceDHCP Denial of Service

Attacker requests new addresses for bogus MACsAttacker requests new addresses for bogus MACsFinite number of DHCP addresses in a subnetFinite number of DHCP addresses in a subnetPCs coming on the network can not get addressPCs coming on the network can not get address

Ethernet

DHCP Server

Ethernet

PC

PC

PC

startsDHCP Gobbler

no moreaddresses

PC

no address

requestoffer

Page 15: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediationPort SecurityPort Security

Limits the source MAC addresses on a portLimits the source MAC addresses on a portCan specify static addresses or maximum numberCan specify static addresses or maximum numberViolations on ports canViolations on ports can–– disable portdisable port–– send trap and syslogsend trap and syslog–– continue forwarding; drop frames with new MACscontinue forwarding; drop frames with new MACs–– continue forwarding; age out MAC entries from inactivitycontinue forwarding; age out MAC entries from inactivity

Page 16: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

Ethernet

DHCP Server

Ethernet

PC

PC

PC

VulnerabilityVulnerabilityDHCP Rogue ServerDHCP Rogue Server

Attacker uses rogue DHCP server to provide falseAttacker uses rogue DHCP server to provide falsesettings (e.g., DNS, default gateway, etc.)settings (e.g., DNS, default gateway, etc.)

starts rogueDHCP server

providestrue DHCP

PC

bad DHCPinformation

badoffer

goodoffer

request

Page 17: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediationDHCP SnoopingDHCP Snooping

Define trusted ports for DHCP responsesDefine trusted ports for DHCP responses

Ethernet

DHCP Server

Ethernet

PC

PC

PC

Trusted DHCPUntrusted DHCP

starts rogueDHCP server

badoffer

PC

request

goodoffer gets good

DHCPinformation

Page 18: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediationDHCP Snooping DHCP Snooping –– other vulnerabilities covered other vulnerabilities covered

Comparison of MAC address in layers 2 and 7Comparison of MAC address in layers 2 and 7–– hardware address must match hardware address must match ““chaddrchaddr”” (client (client

hardware address) field in DHCP packet from untrustedhardware address) field in DHCP packet from untrustedportsports

–– recall DHCP Gobbler attack and Port Securityrecall DHCP Gobbler attack and Port Security

Switch keeps track of the DHCP bindings toSwitch keeps track of the DHCP bindings toprevent DoS release attacksprevent DoS release attacks–– DHCP releases or declines must have the hardwareDHCP releases or declines must have the hardware

address match the original bound addressaddress match the original bound address

Page 19: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

VulnerabilityVulnerabilitySpanning Tree Root HijackSpanning Tree Root Hijack

for Data Capture or Performance Hitfor Data Capture or Performance HitSpanning Tree Protocol resolves loopsSpanning Tree Protocol resolves loopsBridge Protocol Data Units sent from switchesBridge Protocol Data Units sent from switchesLoops broken based on root selectionLoops broken based on root selection

Ethernet

PC

Ethernet

sends BPDU root frames

becomes root bridge

STP block

connects to both switches

BPDU BPDU

Page 20: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediationBPDU GuardBPDU Guard

BPDUs should not be received on an access portBPDUs should not be received on an access port

BPDU receipt may indicate unauthorized switch orBPDU receipt may indicate unauthorized switch orhub, or an attackhub, or an attack

BPDU receipt puts port into error disabled modeBPDU receipt puts port into error disabled mode

Page 21: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

VulnerabilityVulnerabilityARP Table PoisoningARP Table Poisoning

ARPs (Address Resolution Protocol) associateARPs (Address Resolution Protocol) associatelayer 3 addresses to layer 2 (IP to MAC)layer 3 addresses to layer 2 (IP to MAC)Requests are broadcastRequests are broadcastResponses unauthenticated and can be sentResponses unauthenticated and can be sentwithout a request (gratuitous)without a request (gratuitous)

Ethernet

PC A

PC C

PC B

Router

Normal

starts ettercap

hijack

hijack

I am alsoRouterI amPC A

ARP tables poisoned

Page 22: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediationDynamic ARP InspectionDynamic ARP Inspection

Validates against DHCP Snooping binding tableValidates against DHCP Snooping binding table(if DHCP Snooping used)(if DHCP Snooping used)

Can build access lists of MAC and IP pairs forCan build access lists of MAC and IP pairs fornon-DHCP environments or set port to be trustednon-DHCP environments or set port to be trusted

Can limit the rate of ARPs to prevent DoS attacksCan limit the rate of ARPs to prevent DoS attacks

Page 23: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

VulnerabilityVulnerabilityIP Address SpoofingIP Address Spoofing

Attacker sends packet with spoofed source IPAttacker sends packet with spoofed source IPaddressaddressVictimVictim’’s response packet dies or goes to wrongs response packet dies or goes to wrongsource (another victim)source (another victim)

Ethernet

Victim

Ethernet

PC

207.206.205.204

15.14.13.12

Firewall

source192.168.1.

1

dest. 192.168.1.1

PC

15.14.13.99

PC

207.206.205.99

Page 24: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediationIngress Access ListIngress Access List

RFC 2827 normally done by router can be doneRFC 2827 normally done by router can be doneat layer 2 device closer to end deviceat layer 2 device closer to end device

Helps protect other devices on subnetHelps protect other devices on subnet

Source IP address should always be 0.0.0.0 forSource IP address should always be 0.0.0.0 forDHCP request or within subnet (DHCP request or within subnet (e.g., 207.206.205.xe.g., 207.206.205.x))

–– Vulnerability: Attacker could still use another IPVulnerability: Attacker could still use another IPaddress within that subnetaddress within that subnet

Page 25: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

RemediationRemediationIP Source GuardIP Source Guard

Based on DHCP Snooping Based on DHCP Snooping —— source IP address source IP addressmust be must be the onethe one listed in DHCP Snooping table. listed in DHCP Snooping table.Can add static mappings for non-DHCP devicesCan add static mappings for non-DHCP devicesCan also check MAC address sourceCan also check MAC address source

Ethernet

207.206.205.204

Router source192.168.1.1

Page 26: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

ConclusionConclusion

Attack within subnetAttack within subnet

Broadcast stormBroadcast storm

MAC FloodingMAC Flooding

DHCP DoSDHCP DoS

DHCP rogueDHCP rogue

Spanning Tree hijackSpanning Tree hijack

ARP table poisoningARP table poisoning

IP address spoofingIP address spoofing

Private VLANsPrivate VLANs

Protected PortsProtected Ports

Storm ControlStorm Control

Port SecurityPort Security

DHCP SnoopingDHCP Snooping

BPDU GuardBPDU Guard

Dynamic ARP InspectionDynamic ARP Inspection

Anti-spoofing access listsAnti-spoofing access lists

IP Source GuardIP Source Guard

Page 27: Security Possibilities at Layer 2 - Electrical and Compu · 2008-09-03 · Traditional Network Security Ethernet Server Server Ethernet PC PC PC Firewall 1 9 2. 1 6 8. 1. 2 o n T

Further ReadingFurther ReadingSAFE Layer 2 Security In-depth Version 2SAFE Layer 2 Security In-depth Version 2http://www.cisco.com/warp/public/cc/so/cuso/epso/sqfr/sfblu_wp.pdfhttp://www.cisco.com/warp/public/cc/so/cuso/epso/sqfr/sfblu_wp.pdf