Network Defense Tools: Perimeter and Internal Defenses This Lecture
Total Page:16
File Type:pdf, Size:1020Kb
CS 155 Spring 2006 Perimeter and Internal Defenses Network Defense Tools: Commonly deployed defenses Firewalls, Traffic shapers, and Perimeter defenses – Firewall, IDS Protect local area network and hosts Intrusion Detection Keep external threats from internal network Internal defenses – Virus scanning Protect hosts from threats that get through the perimeter defenses John Mitchell Extend the “perimeter” –VPN Common practices, but could be improved Internal threats are significant Unhappy employees Compromised hosts 2 This lecture Basic Firewall Concept Standard perimeter defense mechanisms Separate local area net from internet Firewall Packet filter (stateless, stateful) Application layer proxies Firewall Traffic shaping Intrusion detection Local network Internet Anomaly and misuse detection Methods applicable to network or host Router Future lectures Virus and malware Worm propagation and detection All packets between LAN and internet routed through firewall 3 4 Firewall goals Two Separable Topics Prevent malicious attacks on hosts Arrangement of firewall and routers Port sweeps, ICMP echo to broadcast addr, syn flooding, … Several different network configurations Worm propagation Separate internal LAN from external Internet Exploit buffer overflow in program listening on network Wall off subnetwork within an organization Prevent general disruption of internal network Intermediate zone for web server, etc. External SMNP packets Personal firewall on end-user machine Provide defense in depth How the firewall processes data Programs contain bugs and are vulnerable to attack Network protocols may contain; Packet filtering router Design weaknesses (SSH CRC) Application-level gateway Implementation flaws (SSL, NTP, FTP, SMTP...) Proxy for protocols such as ftp, smtp, http, etc. Control traffic between “zones of trusts” Personal firewall Can control traffic between separate local networks, etc E.g., disallow telnet connection from email client 5 6 1 Review: TCP Protocol Stack Review: Data Formats TCP Header Application protocol Application message - data Application Application Application message TCP, UDP protocol Transport Transport Transport (TCP, UDP) segment TCP data TCP data TCP data IP protocol IP protocol Network Network packet IP Network (IP) IP TCP data Network Link Data Data Link Access Link Layer frame Link Link ETH IP TCP data ETF IP Header Link (Ethernet) Link (Ethernet) Header Trailer Transport layer provides ports, logical channels identified by number 7 8 Screening router for packet filtering Packet Filtering Uses transport-layer information only IP Source Address, Destination Address Protocol (TCP, UDP, ICMP, etc) TCP or UDP source & destination ports TCP Flags (SYN, ACK, FIN, RST, PSH, etc) ICMP message type Examples DNS uses port 53 Block incoming port 53 packets except known trusted servers Issues Stateful filtering Encapsulation: address translation, other complications Fragmentation Illustrations: Simon Cooper 9 10 Packet filtering examples Source/Destination Address Forgery Compare: Tiny Personal Firewall, ZoneAlarm 11 12 2 More about networking: port numbering Filtering Example: Inbound SMTP TCP connection Server port uses number less than 1024 Client port uses number between 1024 and 16383 Permanent assignment Ports <1024 assigned permanently 20,21 for FTP 23 for Telnet 25 for server SMTP 80 for HTTP Variable use Ports >1024 must be available for client to make connection Limitation for stateless packet filtering If client wants port 2048, firewall must allow incoming traffic Better: stateful filtering knows outgoing requests Only allow incoming traffic on high port to a machine that has initiated an outgoing request on low port Can block external request to internal server based on port number 13 14 Filtering Example: Outbound SMTP Stateful or Dynamic Packet Filtering Known low port out, arbitrary high port in If firewall blocks incoming port 1357 traffic then connection fails 15 16 Telnet FTP FTP Server FTP Client Telnet Server Telnet Client 20 21 Data Command 5150 5151 23 1234 X Client opens command channel to X Client opens channel to server; tells server 151” X server; tells server its port X second port number PORT 5 1234” “ number. The ACK bit is “PORT not set while establishing Y Server the connection but will be Y acknowledges Y set on the remaining Z “OK” “ACK packets ” Z Server opens data channel to client’s DATA CHAN second port NEL Y Server acknowledges [ Client [ acknowledges TCP ACK Stateful filtering can use this pattern to identify legitimate sessions 17 18 3 NAT: Network Address Translation Advantages of NAT rest of local network Motivations for NAT Internet (e.g., home network) Limited address space 10.0.0/24 10.0.0.1 Prevent unsolicited inbound requests Port numbering: host behind NAT not reachable as server 10.0.0.4 10.0.0.2 Avoid renumbering if provider changes 138.76.29.7 Small/mid-sized LANs inherit address space from ISP Addresses hidden by NAT 10.0.0.3 Normal routing Outgoing msg from 171.64.78.90 contains sending address All datagrams leaving local Datagrams with source or Recipient or observer can access 171.64.78.90 network have same single source NAT destination in this network IP address: 138.76.29.7, have 10.0.0/24 address for Addressing with NAT different source port numbers source, destination (as usual) NAT rewrites outgoing packet so recipient sees public addr only An outside computer cannot see 171.64.78.90 Illustration: Kurose and Ross 19 20 Complication for firewalls Normal IP Fragmentation Abnormal Fragmentation Low offset allows second packet to overwrite TCP header at receiving host Flags and offset inside IP header indicate packet fragmentation 21 22 Beyond packet filtering Packet Fragmentation Attack Proxying Firewall Firewall configuration Several network locations – see next slides TCP port 23 is blocked but SMTP port 25 is allowed First packet Two kinds of proxies Fragmentation Offset = 0. Circuit-level proxies DF bit = 0 : "May Fragment" Works at session layer (which I omitted from OSI diagram) MF bit = 1 : "More Fragments" Destination Port = 25. TCP port 25 is allowed, so firewall allows packet Application-level proxies Second packet Tailored to http, ftp, smtp, etc. Fragmentation Offset = 1: second packet overwrites all but first 8 bits of Some protocols easier to proxy than others the first packet DF bit = 0 : "May Fragment" Policy embedded in proxy programs MF bit = 0 : "Last Fragment." Proxies filter incoming, outgoing packets Destination Port = 23. Normally be blocked, but sneaks by! What happens Reconstruct application-layer messages Firewall ignores second packet “TCP header” because it is fragment of first Can filter specific application-layer commands, etc. At host, packet reassembled and received at port 23 Example: only allow specific ftp commands Other examples: ? 23 24 4 Screened Host Architecture Screened Subnet Using Two Routers 25 26 Dual Homed Host Architecture Firewall with application proxies FTP Telnet proxy SMTP proxy proxy Telnet FTP SMTP daemon daemon daemon Network Connection Daemon spawns proxy when communication detected … 27 28 Application-level proxies Configuration issues Enforce policy for specific protocols E.g., Virus scanning for SMTP Need to understand MIME, encoding, Zip archives Flexible approach, but may introduce network delays “Batch” protocols are natural to proxy SMTP (E-Mail) NNTP (Net news) DNS (Domain Name System) NTP (Network Time Protocol Must protect host running protocol stack Disable all non-required services; keep it simple Install/modify services you want Run security audit to establish baseline Be prepared for the system to be compromised 29 30 5 Solsoft Securify 31 32 Problems with Firewalls References Performance Firewalls may interfere with network use Limitations They don't solve deeper problems Buggy software Bad protocols Generally cannot prevent Denial of Service Ineffective against insider attacks Administration Many commercial firewalls permit very complex configurations Elizabeth D. Zwicky William R Cheswick Simon Cooper Steven M Bellovin D. Brent Chapman Aviel D Rubin 33 34 Traffic Shaping Stanford computer use Traditional firewall Allow traffic or not Traffic shaping Limit certain kinds of traffic Can differentiate by host addr, protocol, etc Multi-Protocol Label Switching (MPLS) Label traffic flows at the edge of the network and let core routers identify the required class of service The real issue here on Campus: P2P file sharing takes a lot of bandwidth 1/3 of network bandwidth consumed by BitTorrent Students: what are BitTorrent, Gnutella, Kazaa, … used for? 35 36 6 Sample traffic distribution Traffic shaping functions Classify and analyze traffic Classify by IP address and port number Use application-specific information (layer 7) Control traffic Selectively slow certain classes of traffic Monitor network performance Collect performance data, used to improve policies Network resilience Active traffic management can provide resilience to DoS attacks, at least within the enterprise network Packeteer white paper example; not Stanford data 37 38 PacketShaper Classification PacketShaper Controls A partition: 7 Application Classify 400+ Apps at OSI Layers 2-7 Creates a virtual pipe within a link for each traffic class Peer-to-Peer Apps: 6 Presentation Some Other Apps: Provides a min, max bandwidth •Aimster • H.323 Enables efficient bandwidth use 5 Session • AudioGalaxy