Ipv4 Overview: Cyber Security Spring 2006
Ipv4 Overview: Cyber Security Spring 2006
Ipv4 Overview: Cyber Security Spring 2006
Outline
Review Layered Network Architecture Network Layer protocols Transport Layer Protocols Application Layer Protocols
Reading Material
Many texts on IP networking
Computer Networks, Andrew Tannenbaum Data and Computer Communications, William Stallings Internetworking with TCP/IP Vol 1, Douglas Comer
Plus all the originals from the Internet Engineering Task Force (IETF)
http://ietf.org/
Ether Hdr
IP Hdr
TCP Hdr
HTTP Hdr
Data
IPv4
32 bit Addressing scheme
Host address, e.g., 192.168.1.1 Network address, e.g., 192.168.1.0/24 or 192.168.1.0 255.255.255.0 Host address is the first address in subnetwork, e.g. 192.168.1.0 Broadcast address is the last address in the subnetwork, e.g., 192.168.1.255
Version
IHL
Type of service DF MF Protocol Source address Destination Address 0 or more words of options
Address spoofing
Sender can put any source address in packets he sends:
Can be used to send unwelcome return traffic to the spoofed address Can be used to bypass filters to get unwelcome traffic to the destination
Reverse Path verification can be used by routers to broadly catch some spoofers
Fragmentation
May need to fragment an IP packet if one data link along the way cannot handle the packet size
Perhaps path is a mix of different HW Perhaps unexpected encapsulation makes the packet larger than the source expected Hosts try to understand Maximum Transmission Unit (MTU) to avoid the need for fragmentation (which causes a performance hit)
Fragmentation Flaws
Split packet to fool simple firewall and IDS
Intermediate content observers must do reassembly
Overlapping fragments
Can be used to trick IDS by hiding, e.g. a get /etc/password request Different clients reassemble overlapping fragments differently Just drop overlapping fragments
Solutions
Encrypt all traffic Monitoring programs like arpwatch to detect mapping changes
Which might be valid due to DHCP
May have routing table per incoming interface To route a packet, take the destination address and find the best match network in the table. In case of a tie look at the metric
Use the corresponding next hop address and interface to send the packet on. The next hop address is on the same link as this device, so you use the next hops data-link address, e.g. ethernet MAC address
Decrement time to live field in IP header at each hop. Drop packet when it reaches 0
Attempt to avoid routing loops As internet got bigger, TTL fields got set bigger. 225 maximum
Routing example
Receive a packet destined to 192.168.3.56 on inside interface Local routing table for inside interface
1. 2. 3. 4. 5. 192.168.2.0/30, 127.0.0.1, 1, outside 192.168.5.0/29, 127.0.0.1, 1, dmz 192.168.3.0/24, 192.168.5.6, 1, dmz 192.168.3.0/24, 192.168.1.2, 3, outside 0.0.0.0/0, 192.168.1.2, 1, outside
Entries 3 and 4 tie. But metric for 3 is better Entries 1 and 2 are for directly connected networks
IP Options in General
Originally envisioned as a means to add more features to IP later Most routers drop packets with IP options set
Stance of not passing traffic you dont understand Therefore, IP Option mechanisms never really took off
Dynamic Routing
Injecting unexpected routes a security concern.
BGP supports peer authentication BGP blackholing is in fact used as a mechanism to isolate bad hosts Filter out route traffic from unexpected (external) points OSPF has MD5 authentication, and can statically configure neighbor routers, rather than discover them.
Smurf Attack
An amplification DoS attack
A relatively small amount of information sent is expanded to a large amount of data
Send ICMP echo request to IP broadcast addresses. Spoof the victim's address as the source The echo request receivers dutifully send echo replies to the victim overwhelming it Fraggle is a UDP variant of the same attack
Transport layer
UDP and TCP Transport flows are defined by source and destination ports
A pair of devices can have numerous flows operating simultaneously by communicating between different pairs of ports
Scanners probe for listening ports to understand the services running on various machines
Datagram Transport
User Datagram Protocol (UDP)
A best-effort delivery, no guarantee, no ACK Lower overhead than TCP Good for best-effort traffic like periodic updates No long lived connection overhead on the endpoints
Some folks implement their own reliable protocol over UDP to get better performance or less overhead than TCP
Such efforts dont generally pan out
TFTP and DNS protocols use UDP Data channels of some multimedia protocols, e.g., H.323 also use UDP
UDP Header
Reliable Streams
Transmission Control Protocol (TCP)
Guarantees reliable, ordered stream of traffic Such guarantees impose overhead A fair amount of state is required on both ends
Most Internet protocols use TCP, e.g., HTTP, FTP, SSH, H.323 control channels
TCP Header
Source Port Sequence Number Acknowledgement number HDR Len U A P R S F R C S S Y I G K H T N N Window Size Urgent Pointer Options (0 or more words) Destination Port
Checksum
Syn flood
A resource DoS attack focused on the TCP three-way handshake Say A wants to set up a TCP connection to B
1. 2. A sends SYN with its sequence number X B replies with its own SYN and sequence number Y and an ACK of As sequence number X A sends data with its sequence number X and ACKs Bs sequence number Y
3.
Send many of the first message to B. Never respond to the second message.
This leaves B with a bunch of half open (or embryonic) connections that are filling up memory Firewalls adapted by setting limits on the number of such half open connections.
Application Protocols
Single connection protocols
Use a single connection, e.g. HTTP, SMTP
Spoofing Applications
Often times ridiculously easy Fake Client
Telnet to an SMTP server and enter mail from whoever you want Authenticating email servers
Require a password Require a mail download before server takes send requests
Fake server
Phishing: misdirect user to bogus server
DHCP
Built on older BOOTP protocol (which was built on even older RARP protocol)
Used by diskless Suns
Enables dynamic allocation of IP address and related information Runs over UDP No security considered in the design, obvious problems
Bogus DHCP servers handing out addresses of attackers choice Bogus clients grabbing addresses
IETF attempted to add DHCP authentication but rather late in the game to do this. Other solutions
Physically secure networks Use IPSec
Can have primary and secondary DNS servers per zone. Use TCP based zone transfer to keep up to date Like DHCP, no security designed in
But at least the DNS server is not automatically discovered Although this information can be dynamically set via DHCP
DNSSEC
Seeks to solve the trust issues of DNS Uses a key hierarchy for verification Has been under development for a decade and still not really deployed Provides authentication, not confidentiality DNS Threat Analysis in RFC 3833.
Summary
IPv4 not designed with security in mind Complexity can be exploited
Poor implementations Edge cases in standards