hacking cisco networks and countermeasures

59
Hacking Cisco Networks and Countermeasures

Upload: dkaya

Post on 08-Jun-2015

1.606 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: Hacking Cisco Networks and Countermeasures

Hacking Cisco Networks and Countermeasures

Page 2: Hacking Cisco Networks and Countermeasures

Overview

• Reconnaissance Attacks– Passive Sniffing– Ping Sweeps– Port Scans (tcp&udp)

• Active Attacks– Password attacks– Trust exploitation– Port redirection

• External Attacks– IP Spoofing– DoS, DDoS Attacks

• Internal Attacks– DHCP and ARP Attacks

Page 3: Hacking Cisco Networks and Countermeasures

Reconnaissance Attacks

• Reconnaissance refers to the overall act of learning information about a target network by using readily available information and applications.

• Reconnaissance attacks include these attacks:– Packet sniffers– Port scans– Ping sweeps– Internet information queries

Page 4: Hacking Cisco Networks and Countermeasures

Packet Sniffers

• A packet sniffer is a software application that uses a network adapter card in promiscuous mode to capture all network packets. There are packet sniffer features:– Packet sniffers exploit information passed in clear text. Protocols

that pass information in clear text are Telnet, FTP, SNMP, Post Office Protocol (POP), and HTTP.

– Packet sniffers must be on the same collision domain as the machine that they are targeting.

– Packet sniffers can be used legitimately or can be designed specifically for attack.

Host A Host BRouter A Router B

Page 5: Hacking Cisco Networks and Countermeasures

Passive Sniffing

Page 6: Hacking Cisco Networks and Countermeasures

Packet Sniffer Attack Mitigation

• Here are some packet sniffer mitigation techniques and tools:– Authentication– Switched infrastructure– Antisniffer tools – Cryptography

Host A Host BRouter A Router B

Page 7: Hacking Cisco Networks and Countermeasures

Port Scans and Ping Sweeps

• Port scan and ping sweep attacks:– Identify all services on the network– Identify all hosts and devices on the network– Identify the operating systems on the network– Identify vulnerabilities on the network

Page 8: Hacking Cisco Networks and Countermeasures

Ping Sweep with NMAP

Page 9: Hacking Cisco Networks and Countermeasures

Ping Sweep (cont.)

Page 10: Hacking Cisco Networks and Countermeasures

Blocking Ping Sweeps

access-list 102 deny icmp any any echoaccess-list 102 permit ip any any

interface FastEthernet0/0ip address 10.1.1.254 255.255.255.0ip access-group 102 in

Page 11: Hacking Cisco Networks and Countermeasures

Seems like it worked but ???

Page 12: Hacking Cisco Networks and Countermeasures

We give out too much information…

Page 13: Hacking Cisco Networks and Countermeasures

To block messages originating from the blocking router…

access-list 103 permit icmp any any unreachable

class-map match-all STOPSHARING match access-group 103!

policy-map STOPSHARING class STOPSHARING drop class class-default

control-plane service-policy output STOPSHARING

Page 14: Hacking Cisco Networks and Countermeasures

Same result…

Page 15: Hacking Cisco Networks and Countermeasures

But this time we don’t share info…

Page 16: Hacking Cisco Networks and Countermeasures

Simple UDP Port Scan

Page 17: Hacking Cisco Networks and Countermeasures

Destination Unreachable (Port)

Page 18: Hacking Cisco Networks and Countermeasures

How to block…

access-list 101 deny icmp any any unreachableaccess-list 101 permit ip any any

interface FastEthernet0/0 ip address 10.1.1.254 255.255.255.0 ip access-group 101 out

Page 19: Hacking Cisco Networks and Countermeasures

We don’t send any unreachable messages…

Page 20: Hacking Cisco Networks and Countermeasures

After Blocking everything seems open, some obscurity for scanner…

Page 21: Hacking Cisco Networks and Countermeasures

• Port scans and ping sweeps cannot be prevented without compromising network capabilities.

Port Scan and Ping Sweep Attack Mitigation

However, damage can be mitigated using IPS at the network and host levels.

Workstation with HIPS

Laptop with HIPS

Scan Port Shared Connection

IDS and IPS

Erica Fritch
Removed "HIPS" from sentence, as host-level IPS is HIPS. OK?
Page 22: Hacking Cisco Networks and Countermeasures

Internet Information Queries

• Sample IP address query

Attackers can use Internet tools such as whois as a

weapon.

Page 23: Hacking Cisco Networks and Countermeasures

Access Attacks

• Intruders use access attacks on networks or systems for the these reasons:– Retrieve data– Gain access– Escalate their access privileges

• Access attacks include:– Password attacks– Trust exploitation– Port redirection

Page 24: Hacking Cisco Networks and Countermeasures

Password Attacks

• Hackers implement password attacks using:– Brute-force attacks– Trojan horse programs– IP spoofing– Packet sniffers

Page 25: Hacking Cisco Networks and Countermeasures

Password Attack Example

– The bgp_md5crack tool is used for cracking a secret used for RFC2385 based packet signing and authentication. It is designed for offline cracking, means to work on a sniffed, correct signed packet. This packet can either be directly sniffed of the wire or be provided in a pcap file.

Page 26: Hacking Cisco Networks and Countermeasures

For Routing Protocols…

Page 27: Hacking Cisco Networks and Countermeasures

Simple Cracking with Cain…

Page 28: Hacking Cisco Networks and Countermeasures

Trust Exploitation

– A hacker leverages existing trust relationships.

– Several trust models exist:

• Microsoft Windows:– Domains

– Active directory

• Linux and UNIX:– NIS

– NIS+

System AUser = psmith; Pat Smith

System B is compromised by a hacker.

User = psmith; Pat Smith

HackerUser = psmith; Pat Smithson

A hackergains

access to System A .

Trust relationships:

• System A trusts System B.

• System B trusts everyone.

• System A trusts everyone.

Page 29: Hacking Cisco Networks and Countermeasures

Port Redirection

Host B

Attacker

Source: ADestination: BPort: 23

CompromisedHost A

Source: AttackerDestination: APort: 22

Source: AttackerDestination: BPort: 23

Page 30: Hacking Cisco Networks and Countermeasures

Port Redirection Configuration

On HOSTA we create a named pipe using the mkfifo commands:

#pipe will be the name of our named pipemkfifo pipe

We then create our two way tunnel using Netcat on HOSTA:

nc -lvp 25 <pipe | nc -t 10.1.2.253 23 >pipe

Then telnet from Attacker machine telnet 10.1.2.1 80

Page 31: Hacking Cisco Networks and Countermeasures

Here we are connected to the internal switch…

Page 32: Hacking Cisco Networks and Countermeasures

IP Spoofing

– IP spoofing occurs when a hacker inside or outside a network impersonates a trusted source.

– IP spoofing uses trusted internal IP addresses or trusted external IP addresses.

– Attackers use IP spoofing for many reasons:• To gain root access• To inject malicious data or commands into an existing data

stream • To divert network packets to the hacker who can then

reply as a trusted user by changing the routing tables• To crash servers by overloading memory (DoS)• As a step in a larger attack

Page 33: Hacking Cisco Networks and Countermeasures

IP Spoofing—Types of Attack

•IP spoofing attacks are either:– Nonblind spoofing

• The attacker sniffs sequence numbers (i.e., from inside the subnet of the victim).

– Blind spoofing • The attacker calculates sequence numbers.

•IP spoofing can lead to these types of attacks:– Man-in-the-middle attack– DoS attack– Distributed DoS (DDoS) attack

Page 34: Hacking Cisco Networks and Countermeasures

Let’s see in action

Page 35: Hacking Cisco Networks and Countermeasures

Here we drive router to reply to the other host..

Page 36: Hacking Cisco Networks and Countermeasures

Man-in-the-Middle Attacks

– A man-in-the-middle attack requires that the hacker has access to network packets that come across a network.

– A man-in-the-middle attack is implemented using the following:

• Network packet sniffers (nonblind attack)• Routing and transport protocols (blind attack)

Host A Host B

Router A Router B

Data in Clear Text

Page 37: Hacking Cisco Networks and Countermeasures

IP Spoofing Attack Mitigation

• The threat of IP spoofing can be reduced, but not eliminated, using these measures:– Strong access control at the router

• ACLs on outbound interface• ACLs on inbound interface

– Data encryption– Additional authentication requirements

Host A Host B

Router A ISP Router B

IPSec tunnel

Page 38: Hacking Cisco Networks and Countermeasures

DoS Attacks

• A DoS attack damages or corrupts your computer system or denies you and others access to your networks, systems, or services.

• DoS attack techniques almost always use IP spoofing.

Page 39: Hacking Cisco Networks and Countermeasures

TCP SYN Flooding DoS Attack

AttackerTCP

Client

-------------Client Ports1024–65535

Victim TCP Server

-------------Service Ports

1–1024

80

1SYN

2 SYN and ACK

?

SYN Packet with Spoofed

Source Address

TCP Client

-------------Client Ports1024–65535

TCP Server

-------------Service Ports

1–102480

1SYN

3ACK

2 SYN and ACK

TCP Three-Way

Handshake

Page 40: Hacking Cisco Networks and Countermeasures

DDoS Attacks

• DoS and DDoS attacks have these characteristics: – They are not generally targeted to gain access.– They aim at making a service unavailable. – They require very little effort to execute.– They are difficult to eliminate.

• DoS Attack • DDoS Attack

Attacker Victim

Attack Control Mechanism

Zombie Zombie Zombie

Victim

Page 41: Hacking Cisco Networks and Countermeasures

DDoS Example

HandlerSystems

Client System

4. The client issues commands to handlers that control agents in a mass attack.

1. The cracker looks for targets.

2. The cracker installs software to scan, compromise, and infect agents with zombies.

3. Agents are loaded with remote control attack software.

AgentSystems

Page 42: Hacking Cisco Networks and Countermeasures

SYN Flooding Attack

Page 43: Hacking Cisco Networks and Countermeasures

Let’s be more creative…

Page 44: Hacking Cisco Networks and Countermeasures

We put almost 1 million packets in one minute period on the wire, not so bad….

Page 45: Hacking Cisco Networks and Countermeasures

CPU Consumption..

Page 46: Hacking Cisco Networks and Countermeasures

DoS and DDoS Attack Mitigation

• Reduce DoS and DDoS attacks by:– Protecting yourself against IP spoofing with ingress- and

egress-filtering ACLs– Using antivirus software to find zombie agents– Using anti-DoS features on routers and firewalls

• ip verify unicast reverse-path interface command • ACLs to filter all private Internet address space (RFC

1918) – Using traffic rate limiting at the ISP level

• Use class-based traffic policing on ICMP packets• Use SYN rate limiting

Page 47: Hacking Cisco Networks and Countermeasures

Rate Limiting

What rate limiting does:• Allows network managers to set bandwidth thresholds for users and by traffic type

Benefits:• Prevents the deliberate or accidental flooding of the network

• Keeps traffic flowing smoothly

Rate Limiting for Different Classes of UsersNetwork

Manager

Teachers

Students

2 Mbps

10 Mbps

50 Mbps

Otherwise, there can be a deliberate or accidental slowdown or freezing of the network.

Page 48: Hacking Cisco Networks and Countermeasures

Example: ICMP rate limiting

access-list 170 permit icmp any any

Interface f0/0rate-limit input access-group 170 128000 16000 24000 conform-action transmit exceed-action drop

Page 49: Hacking Cisco Networks and Countermeasures

Spoofing the DHCP Server

1. An attacker activates a DHCP server on a network segment.

2. The client broadcasts a request for DHCP configuration information.

3. The rogue DHCP server responds before the legitimate DHCP server can respond, assigning attacker-defined IP configuration information.

4. Host packets are redirected to the attacker address as it emulates a default gateway for the erroneous DHCP address provided to the client.

ClientRogue DHCP Attacker

Legitimate DHCP Server

Page 50: Hacking Cisco Networks and Countermeasures

Everything starts with starvation…

Page 51: Hacking Cisco Networks and Countermeasures

Storm Control can be in help…

Interface fastethernet 0/1storm-control broadcast level 10.00 8.00

Page 52: Hacking Cisco Networks and Countermeasures

DHCP Snooping

– DHCP snooping allows the configuration of ports as trusted or untrusted.

• Trusted ports can send DHCP requests and acknowledgements.

• Untrusted ports can forward only DHCP requests.

– DHCP snooping enables the switch to build a DHCP binding table that maps a client MAC address, IP address, VLAN, and port ID.

– Use the ip dhcp snooping command.

ClientRogue DHCP

Attacker

Legitimate DHCP Server

Page 53: Hacking Cisco Networks and Countermeasures

DHCP Snooping Configuration

ip dhcp snoopingip dhcp snooping vlan 20interface FastEthernet0/13

switchport access vlan 20ip dhcp snooping trust

Switch#sh ip dhcp snooping binndingMacAddress IpAddress Lease(sec) Type VLAN Interface------------------ --------------- ---------- ------------- ---- --------------------00:14:A8:96:2C:40 10.1.2.12 86371 dhcp-snooping 20 FastEthernet0/2400:14:6A:1D:B8:00 10.1.2.13 86371 dhcp-snooping 20 FastEthernet0/23Total number of bindings: 2

Page 54: Hacking Cisco Networks and Countermeasures

ARP Spoofing: Man-in-the-Middle Attacks

•10.1.1.1 = MAC C.C.C.C

ARP Table in Host A

IP 10.1.1.2MAC A.A.A.A

A

B

•10.1.1.2 = MAC C.C.C.C

ARP Table in Host B

•10.1.1.1 = MAC B.B.B.B•10.1.1.2 = MAC A.A.A.A

ARP Table in Host C

CIP 10.1.1.3MAC C.C.C.C

1. IP 10.1.1.2 ? MAC for 10.1.1.1

2. Legitimate ARP reply 10.1.1.1 = MAC B.B.B.B

3. Subsequent gratuitous ARP replies overwrite legitimate replies

•10.1.1.1 bound to C.C.C.C•10.1.1.2 bound to C.C.C.C

Attacker

IP 10.1.1.1MAC B.B.B.B

A BC

A = host A

B = host B

C = host C

Page 55: Hacking Cisco Networks and Countermeasures

10.1.1.1

Mitigating Man-in-the-Middle Attacks with DAI

• MAC or IP Tracking Built on DHCP Snooping

10.1.1.2DHCP Server

DHCP Discovery (BCAST)

DHCP Offer (UCAST)

DAI provides protection against attacks such as ARP poisoning using spoofing tools such as ettercap, dsniff, and arpspoof.

DAI Function:

Track DiscoveryTrack DHCP Offer MAC or IPTrack Subsequent ARPs for MAC or IP

Page 56: Hacking Cisco Networks and Countermeasures

DAI in Action

•A binding table containing IP-address and MAC-address associations is dynamically populated using DHCP snooping.

10.1.1.110.1.1.210.1.1.2

GARP is sent to attempt to change the IP address to MAC bindings.

Gateway is

10.1.1.1

Attacker is not gateway according to this binding table

I am your gateway: 10.1.1.1

Page 57: Hacking Cisco Networks and Countermeasures

DAI Configuration…

ip arp inspection vlan 20ip arp inspection vlan 20 logging dhcp-bindings allip arp inspection validate src-mac

Page 58: Hacking Cisco Networks and Countermeasures

Questions & Discussion

? ???

?

?

??

??

?

?

?

?

Page 59: Hacking Cisco Networks and Countermeasures

Thank you…