4 Ip
4 Ip
Course 2022-2023
1. IP and ICMP:
v IPv4
v ICMP
v IPv6
v Attacks against IP and ICMP
2. Dynamic Host Configuration Protocol (DHCP):
v DHCP operation
v Attacks against DHCP
3. Address Resolution Protocol (ARP):
v ARP operation
v Attacks against ARP
4. Border Gateway Protocol (BGP):
v BGP operation
v RPKI
v BGPSec
2
IP and ICMP
The Internet network layer
Physical layer
4
IPv4 datagram format
5
IPv4 fragmentation and reassembly
…
different MTUs. in: 1 large datagram
out: 3 smaller datagrams
§ 1500 for Ethernet
v Larger IPv4 datagrams
divided (“fragmented”)
within network (routers): Reassembly
§ A datagram becomes
several ones
§ “Reassembled” only …
at final destination
§ IP header bits used
to identify and order
related fragments.
6
IPv4 fragmentation and reassembly example
Length ID MF Offset
=1040 =x =0 =370
Notice that transport header (i.e. TCP/UDP ports) is only carried in first fragment
and that payload may be arbitrarily segmented (e.g. to evade IDS signatures).
7
Internet Control Message Protocol (ICMP)
3 probes 3 probes
3 probes
9
IPv6: Motivation
10
IPv6 datagram format
Payload
32 bits
11
Other changes from IPv4
12
Internet Control Message Protocol (ICMPv6)
Control & L2
Error discover Autoconfig Multicast
IPv6
Ping SLAAC MLD
MAC
Traceroute
Node Info
MTU
13
StateLess Address Auto Configuration (SLAAC)
14
Transition from IPv4 to IPv6
IPv6 datagram
IPv4 datagram
15
Tunneling
A B IPv4 tunnel E F
connecting IPv6 routers
Logical view:
IPv6 IPv6 IPv6 IPv6
A B C D E F
Physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
IPv4 IPv4
16
Tunneling
A B IPv4 tunnel E F
connecting IPv6 routers
Logical view:
IPv6 IPv6 IPv6 IPv6
A B C D E F
Physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
Data Data
A-to-B: E-to-F:
IPv6 B-to-C: D-to-E: IPv6
IPv6 inside IPv6 inside
IPv4 IPv4 17
Security Flaws & Attacks in IP
IP-based authentication
19
IP address spoofing
Attacker 36.220.9.59
Amplifier
SA: 212.68.212.7
DA: 36.220.9.59
[DoS victim]
20
Problems with some IP options
21
IP Source Routing
67.34.30.6 138.6.25.40
67.14.10.22
138.6.22.26
200.14.7.14
140.10.6.3
140.10.5.4
200.14.7.9
67.0.0.0/24 140.10.0.0/16 200.14.7.0/24 138.6.0.0/16
Network Network Network Network
22
Source-Route MitM Attack
1. Eve generates packets with fake source route to Bob (destination), that claim to
come from Alice.
2. Source route includes Eve’s IP (Eve looks like a router between A and B).
3. Routers between Eve and Bob read source route and deliver packets to Bob via Eve
(in case of loose-source route, otherwise the delivery is straightforward)
4. Bob responds by sending packets to Alice through Eve (reverse order).
5. Eve could even not to forward packets to Alice (DoS is not required).
Comment Eve Packet with
This attack doesn’t work across Internet Route
Most routers block Source Routed packets. 1. Alice
2. Eve
Yet, not blocked on internal networks.
3. Bob
Alice
Packet with Bob
Route
1. Bob
2. Eve
3. Alice
23
IP defenses
DoS
Router DoS
Source victim
Amplifiers
28
ICMP Redirect Attack
192.168.1.2
Default
Forged Gateway
packet
Attacker 192.168.1.4
u Limit which ICMP types and codes you allow into your
network:
v Destination unreachable errors.
v Echo request/reply (for Ping)
v TTL Exceeded (for Traceroute).
31
Dynamic Host Configuration Protocol
(DHCP)
DHCP objectives
u DHCP [RFC2131] allows a host to obtain an IP address from a defined
(pool) range of IP addresses on a DHCP server.
v DHCP runs on top of UDP (UDP/67 Server, UDP/68 Client).
v DHCP and DNS are the key protocols for IP Address Management (IPAM)
u When a host comes online, it contacts DHCP server and requests an
IP address and other key network configuration parameters:
33
DHCP operation (I)
34
DHCP operation (II)
1. DHCPDISCOVER:
ü Client broadcasts a DHCPDISCOVER message to find all
DHCP server(s) on the network.
ü Client source IP address: 0.0.0.0
35
DHCP operation (III)
2. DHCPOFFER:
ü DHCP server(s) responds with a DHCPOFFER.
ü DHCPOFFER message is sent in unicast and contains an
available IP address to lease.
ØIt also contains other parameters such as Subnet mask, DNS
server, Default gateway and duration of the lease.
36
DHCP operation (IV)
3. DHCPREQUEST:
ü Client responds with a broadcast DHCPREQUEST message.
It identifies the explicit server and lease offer that the client is
accepting.
ü It serves as an acceptance notice to the selected DHCP
server and as an implicit decline to any other servers.
ü Also used for lease renewal and verification.
37
DHCP operation (V)
4. DHCPACK:
ü The server verifies the lease information and responds with a
unicast DHCPACK message:
ØAssuming the IP address requested by the client is still valid.
ØIf no longer valid -due to timeout or another client accepting the
lease- then, selected DHCP server responds with a DHCP NAK
message, and the selection process must begin again.
ü The client stores the information and sends an ARP request to its
new IP address to verify that it is really unused.
38
DHCP Operation (VI)
Source: http://what-when-how.com/ipv6-advanced-protocols-implementation/overview-of-the-dhcpv6-protocol-dhcpv6ipv6-part-4/ 41
Attacks and countermeasures in
DHCP
DHCP Denial of Service attack
45
Countermeasure: DHCP Snooping (I)
47
Preventing IP spoofing attacks
IP Spoofing and IP Source Guard (IPSG)
50
Address Resolution Protocol
(ARP)
Address Resolution Protocol (ARP)
• ARP [RFC826] enables a host to find the MAC address of another host, in
the same subnet, that is associated with a given IPv4 address.
• An ARP cache stores known IP-MAC bindings to increase performance:
52
ARP operation
• All devices on the network receive the ARP Request message, but only one
device (should) responds with an ARP Reply:
INFORMATION
53
Neighbor Discovery
54
Vulnerabilities of ARP
1. Since ARP does not authenticate requests or replies, ARP Requests and
Replies can be forged:
2. ARP is stateless: ARP Replies can be sent without a corresponding ARP
Request:
Gratuitous ARP Requests: A host sends an ARP request for its own IP
address. Useful for detecting if an IP address has already been assigned.
3. A node receiving an ARP packet (Request or Reply) must update its local
ARP cache with the information in the source fields, if the receiving node
already has an entry for the IP address of the source in its ARP cache.
(This applies for both ARP Request and Reply messages).
55
ARP Cache Poisoning
ARP Reply
58
Internet Routing Protocols
Routing protocols outline
u Intra-domain routing:
v Routing Information Protocol (RIP):
ü Distance Vector protocol.
ü Plain-text authentication option.
ü RIPng (IPv6) delegate to IPSec.
v Open Shortest Path First (OSPF):
ü Link State protocol.
ü Plain-text or digest authentication option (MD5)
ü OSPFv3 (IPv6) delegate to IPSec.
u Inter-domain routing:
v Border Gateway Protocol (BGP):
ü Path Vector protocol.
ü TCP Authentication Option.
ü Resource Public Key Infrastructure (RPKI).
ü BGPsec.
60
Border Gateway Protocol (BGP)
AS 3
130.10.0.0/16 AS 5
AS 2 110.10.0.0/16
120.10.0.0/16: AS 2 à AS 3 à AS 4
AS 1 130.10.0.0/16: AS 2 à AS 3
110.10.0.0/16: AS 2 à AS 5 62 62
BGP operations (simplified)
Establish session
on TCP port
179
AS-1
Exchange active
routes
on
ssi
Se
AS-2
Exchange
P
BG
incremental
updates
63
Shortest AS Path != Shortest Path
4 hops 9 hops
Source
4 ASs 2 ASs
?
?
Destination
64
Four types of BGP messages
65
BGP connections
[1] Dan Goodin. “Russian-controlled telecom hijacks financial services’ Internet traffic”. Ars Technica. 27 April 2017
[2] BGP leaks and cryptocurrencies
[2] dashboards focus in BGP attacks https://bgpstream.com/, https://observatory.manrs.org 67
Security issues of BGP
u Path Authentication:
v Is the AS path correct?
u Origin Authentication:
v Does the route prefix correspond to the AS that
actually owns that prefix?
69
Session Authentication: TCP AO
70
Session Authentication: TTL Hack
Attacker
AS 200 TTL 255 AS 100
R1 R2
TTL 254 TTL 255
71
Traffic Attraction & Interception Attacks
Verizon
China Wireless
Telecom 22394
66.174.161.0/24
Level 3
Verizon
China Wireless
Telecom
74
But RPKI alone is not enough!
Resource Public Key Infrastructure (RPKI): Certified
mapping from ASes to public keys and IP prefixes.
Level 3
Verizon
China Wireless
Telecom
75
To stop this attack, we need BGPsec
(path authentication)
BGPsec: RPKI + Cannot announce a path that was not
announced to you. VZW: (22394, Prefix)
ISP 1
Level 3
Verizon
China Wireless
VZW: (22394, Prefix)
Telecom
Level3: (VZW, 22394, Prefix)
22394
VZW: (22394, Prefix)
Public Key Signature: Anyone with 22394’s public key can validate
that the message was sent by 22394. 76
To stop this attack, we need BGPsec
(path authentication)
BGPsec: RPKI + Cannot announce a path that was not
announced to you. VZW: (22394, Prefix)
ISP 1
Level 3
Verizon
China Wireless
Telecom
78
BGPsec design Overview
79
Secure BGP Problems