Programming Project #2. Network Security (TCP/IP and DNS) Overview. Overview. Man in the Middle. Proxy Server. Tadayoshi Kohno



Similar documents
Network Security (TCP/IP and DNS)

CS255 Programming Project 2

Protocol Rollback and Network Security

Attacks on TCP/IP, BGP, DNS Denial of Service

Outline. Network Protocols and Vulnerabilities. Internet Infrastructure. TCP Protocol Stack

Lecture 6: Network Attacks II. Course Admin

CS5008: Internet Computing

Outline. CSc 466/566. Computer Security. 18 : Network Security Introduction. Network Topology. Network Topology. Christian Collberg

Chapter 8 Security Pt 2

A S B

Session Hijacking Exploiting TCP, UDP and HTTP Sessions

Network Security Fundamentals

APNIC elearning: Network Security Fundamentals. 20 March :30 pm Brisbane Time (GMT+10)

CSCE 465 Computer & Network Security

Client Server Registration Protocol

Security vulnerabilities in the Internet and possible solutions

SY system so that an unauthorized individual can take over an authorized session, or to disrupt service to authorized users.

Content Distribution Networks (CDN)

Networks: IP and TCP. Internet Protocol

Internet Firewall CSIS Packet Filtering. Internet Firewall. Examples. Spring 2011 CSIS net15 1. Routers can implement packet filtering

TCP/IP Security Problems. History that still teaches

TCP/IP Fundamentals. OSI Seven Layer Model & Seminar Outline

Guide to Network Defense and Countermeasures Third Edition. Chapter 2 TCP/IP

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

Overview of Network Security The need for network security Desirable security properties Common vulnerabilities Security policy designs

Network Security in Practice

Botnets. Botnets and Spam. Joining the IRC Channel. Command and Control. Tadayoshi Kohno

20-CS X Network Security Spring, An Introduction To. Network Security. Week 1. January 7

Unix System Administration

CS 665: Computer System Security. Network Security. Usage environment. Sources of vulnerabilities. Information Assurance Module

Linux Network Security

Attack Lab: Attacks on TCP/IP Protocols

Project #4: MITM Attacks and Authentication

Denial of Service. Tom Chen SMU

Network Security. Abusayeed Saifullah. CS 5600 Computer Networks. These slides are adapted from Kurose and Ross 8-1

Security Technology White Paper

1 hours, 30 minutes, 38 seconds Heavy scan. All scanned network resources. Copyright 2001, FTP access obtained

Chapter 8 Network Security

Computer Networks: DNS a2acks CS 1951e - Computer Systems Security: Principles and Prac>ce. Domain Name System

A Very Incomplete Diagram of Network Attacks

Denial Of Service. Types of attacks

CS 640 Introduction to Computer Networks. Network security (continued) Key Distribution a first step. Lecture24

1. Firewall Configuration

How do I get to

Internet Firewall CSIS Internet Firewall. Spring 2012 CSIS net13 1. Firewalls. Stateless Packet Filtering

A43. Modern Hacking Techniques and IP Security. By Shawn Mullen. Las Vegas, NV IBM TRAINING. IBM Corporation 2006

Network Security. Chapter 3. Cornelius Diekmann. Version: October 21, Lehrstuhl für Netzarchitekturen und Netzdienste Institut für Informatik

Final exam review, Fall 2005 FSU (CIS-5357) Network Security

Firewalls. Firewalls. Idea: separate local network from the Internet 2/24/15. Intranet DMZ. Trusted hosts and networks. Firewall.

Security of IPv6 and DNSSEC for penetration testers

7 Network Security. 7.1 Introduction 7.2 Improving the Security 7.3 Internet Security Framework. 7.5 Absolute Security?

FIREWALLS. Firewall: isolates organization s internal net from larger Internet, allowing some packets to pass, blocking others

Guide to DDoS Attacks December 2014 Authored by: Lee Myers, SOC Analyst

Port Scanning and Vulnerability Assessment. ECE4893 Internetwork Security Georgia Institute of Technology

Network Concepts. IT 4823 Information Security Concepts and Administration. The Network Environment. Resilience. Network Topology. Transmission Media

Cisco Configuring Commonly Used IP ACLs

General Network Security

What is a DoS attack?

Dos & DDoS Attack Signatures (note supplied by Steve Tonkovich of CAPTUS NETWORKS)

CSE331: Introduction to Networks and Security. Lecture 12 Fall 2006

Firewalls, Tunnels, and Network Intrusion Detection

Own your LAN with Arp Poison Routing

Chapter 4 Firewall Protection and Content Filtering

CSE 127: Computer Security. Network Security. Kirill Levchenko

Firewalls, Tunnels, and Network Intrusion Detection. Firewalls

Chapter 8 Phase3: Gaining Access Using Network Attacks

Security. Contents. S Wireless Personal, Local, Metropolitan, and Wide Area Networks 1

A Brief Overview of VoIP Security. By John McCarron. Voice of Internet Protocol is the next generation telecommunications method.

What is a Firewall? A choke point of control and monitoring Interconnects networks with differing trust Imposes restrictions on network services

Abstract. Introduction. Section I. What is Denial of Service Attack?

Internet Protocol: IP packet headers. vendredi 18 octobre 13

- Basic Router Security -

Distributed Systems. Firewalls: Defending the Network. Paul Krzyzanowski

Internet Security [1] VU Engin Kirda

Security: Attack and Defense

Internet Control Protocols Reading: Chapter 3

VLAN und MPLS, Firewall und NAT,

Transport and Network Layer

Guideline for setting up a functional VPN

CYBER ATTACKS EXPLAINED: THE MAN IN THE MIDDLE

Linux MDS Firewall Supplement

Network Security. Marcus Bendtsen Institutionen för Datavetenskap (IDA) Avdelningen för Databas- och Informationsteknik (ADIT)

Solution of Exercise Sheet 5

CS 356 Lecture 16 Denial of Service. Spring 2013

Firewalls. Chapter 3

Federal Computer Incident Response Center (FedCIRC) Defense Tactics for Distributed Denial of Service Attacks

co Characterizing and Tracing Packet Floods Using Cisco R

Understanding TCP/IP. Introduction. What is an Architectural Model? APPENDIX

CMPT 471 Networking II

Firewalls and System Protection

Seminar Computer Security

Denial of Service Attacks. Notes derived from Michael R. Grimaila s originals

CS 3251: Computer Networking 1 Security Protocols I

Post-Class Quiz: Telecommunication & Network Security Domain

EXPLORER. TFT Filter CONFIGURATION

Packet Sniffers Submitted in partial fulfillment of the requirement for the award of degree Of MCA

Transcription:

CSE 490K Lecture 13 Network Security (TCP/IP and DNS) Tadayoshi Kohno Some slides based on Dan Boneh s and Vitaly Shmatikov s Programming Project #2! Out today, Tuesday, May 8! Due Thursday, May 24, 11:59pm Submit via Catalyst system! Teams of up to three people New teams OK (old teams also OK)! Basic idea: Implement a Man-in-the-Middle attack against SSL! Recall Security and Privacy Code of Ethics form! Based on Dan Boneh s CS255 project (Stanford) Slides: http://crypto.stanford.edu/~dabo/cs255/ proj2_pres.pdf Overview! MITM attack against SSL Not at network layer (not re-writing packets, etc) At SSL Proxy Layer, in Java Networking SSL Certificates! Password-based authentication for MITM server Hashed, salted passwords Password file encrypted with an authenticated encryption scheme. Overview! Normal SSL SSL encrypted data routed like normal TCP/IP over Internet Client Internet SSL webserver Proxy Server! Browser connects to proxy! Proxy connects to web server and forwards between the two Client Internet Man in the Middle! Instead of forwarding encrypted data between the two hosts, the proxy will set up two different SSL connections Proxy <--> Remote Server Normal SSL client connection to remote site Proxy <--> Browser SSL server connection to the browser, using its own certificate, with some data cloned from the remote hosts certificate If browser accepts this fake certificate, the proxy has access to the data in the clear! Proxy

What we provided Basic Admin Server/Client! Basic Proxy Server setup Parses CONNECT request and sets up a connection between client and remote server! Basic Admin Server/Client Server listens for connections on plain socket and parses out username/password/command that client sends! Goal: Experience in adding security features to an application Secure connection between admin client and proxy server using SSL Password based authentication for client Secure storage of password file (authenticated encryption) Passwords stored, hashed, using public and private salt Extra credit: Challenge / Response authentication In addition to password authentication, not instead of. Proxy Server Signing Certificate! Already listens for browser CONNECT requests and sets up the needed SSL connections! You should Understand the connections being made Obtain the remote server certificate from the remote SSL connection Copy the relevant fields and sign a forged certificate using your CA cert (from your keystore); use IAIK Modify the code creating the client SSL connection to use the newly forged certificate! Build a self-signed certificate for the proxy server (the proxy server s CA certificate) keytool -genkey -keyalg RSA Store this in a JKS keystore for use by your proxy server Use it for signing your programmatically generated certs Your proxy pretends to be the CA! Submit a keystore with your project Generating Certs On the Fly iaik.x509.x509certificate! Not easy to generate certificates programmatically using standard Java libraries! Instead, use the IAIK-JCE library iaik.x509.x509certificate (class)! To convert from a java certificate: new X509Certificate(javaCert.getEncoded());! Signing cert.sign(algorithmid.sha256withrsaencryption, issuerpk);! See iaik.asn1.structures.name For extracting info (e.g., common name) from the certificate s distinguished name (cert.getsubjectdn())

Managing Certs and SSL Sockets! Use the KeyStore class for Loading certificates from file (e.g., your CA certificate) Storing programmatically generated certificates! Use SSLContext class for setting up certificates to be used with SSLServerSocket Create a certificate Load into new KeyStore Init a KeyManagerFactory with new KeyStore Init SSLContext with new KeyManagerFactory and provided TrustEveryone TrustManager! Use SSLContext for creating SSLSocketFactories! See MITMSSLSocketFactory.java Admin Server! Already listens for client connections and parses the data sent using plain sockets! You should Modify code to use SSL sockets (see the proxy server code for examples) Implement authentication for the transmitted username and password Implement required admin commands Shutdown Stats Password file! Need to store a file containing usernames, salts, and hashed passwords Both public and secret salts (aka pepper)! Should be stored encrypted with an authenticated encryption scheme I recommend Encrypt-then-MAC Maybe AES in CTR mode to Encrypt, and HMAC-SHA1 to MAC But be careful about security!! Password File Utility! You should add a utility for creating these password files! Simple method: Make a class to take a file and a list of usernames and passwords, and covert it to a password file. Username Salt Hashed password Alice S H(Pwd S P) Bob...... Configuring Firefox (under OS X, similar for Linux)

When going to https://www.cs.washington.edu When going to https://www.cs.washington.edu When going to https://www.cs.washington.edu Sample code causes this second warning Identical in sample code (uses same cert for all websites) Your job - new certificates, avoid second warning Possible Problems! You should be able to start up the proxy and connect to it out of the box After you create your keystore with keytool! If you are having problems Is someone else trying to use your machine and that port? (Default 8001.) Try a different port on the command line Firewall problems Try to telnet to the needed ports (8001/8002/...) Try running your browser on the same machine, and setting the proxy as localhost! Course mailing list: Great place to share knowledge

Internet Infrastructure Attacks on TCP/IP and DNS backbone local network local network Internet service provider (ISP) ISP! TCP/IP for packet routing and connections! Border Gateway Protocol (BGP) for route discovery! Domain Name System (DNS) for IP address discovery OSI Protocol Stack Data Formats application presentation email, Web, NFS application layer Application data message session transport network RPC TCP IP transport layer network layer TCP header data TCP header IP TCP header header data data TCP header data segment packet data link physical Ethernet data link layer Ethernet header IP TCP header header data Ethernet trailer frame TCP (Transmission Control Protocol) IP (Internet Protocol)! Sender: break data into packets Sequence number is attached to every packet! Receiver: reassemble packets in correct order Acknowledge receipt; lost packets are re-sent! Connection state maintained on both sides book mail each page remember received pages and reassemble! Connectionless Unreliable, best-effort protocol! Uses numeric addresses for routing Typically several hops in the route Alice s computer 128.83.130.239 Alice s ISP Packet Source 128.83.130.239 Dest Seq 171.64.66.201 3 Bob s ISP Bob s computer 171.64.66.201

IP Routing! Routing of IP packets is based on IP addresses! Routers use a forwarding table Entry = destination, next hop, network interface, metric For each packet, a table look-up is performed to determine how to route it! Routing information exchange allows update of old routes and creation of new ones RIP (Routing Information Protocol) OSPF (Open Shortest Path First Protocol) BGP (Border Gateway Protocol) Routing Attacks! Source routing Source of the packet specifies a particular route For example, because the automatic route is dead Attacker can spoof source IP address and use source routing to direct response through a compromised host Solution: reject packets with source routing! More heavy-duty: allow source route only via trusted gateways! Routing Information Protocol (RIP) Use bogus routing updates to intercept traffic RIP implicitly assumes that routers are trusted Black hole attacks and many others BGP Misconfiguration! Domain advertises good routes to addresses it does not known how to reach Result: packets go into a network black hole! April 25, 1997: The day the Internet died AS7007 (Florida Internet Exchange) de-aggregated the BGP route table and re-advertised all prefixes as if it originated paths to them In effect, AS7007 was advertising that it has the best route to every host on the Internet Huge network instability as incorrect routing data propagated and routers crashed under traffic ICMP (Control Message Protocol)! Provides feedback about network operation Out-of-band messages carried in IP packets Error reporting, congestion control, reachability, etc.! Example messages: Destination unreachable Time exceeded Parameter problem Redirect to better gateway Reachability test (echo / echo reply) Message transit delay (timestamp request / reply) Security Issues in TCP/IP! Network packets pass by untrusted hosts Eavesdropping (packet sniffing)! IP addresses are public Smurf attacks! TCP connection requires state SYN flooding! TCP state is easy to guess TCP spoofing and connection hijacking Packet Sniffing! Many applications send data unencrypted ftp, telnet send passwords in the clear! Network interface card (NIC) in promiscuous mode reads all passing data network Solution: encryption (e.g., IPSec), improved routing

Smurf Attack Ping of Death 1 ICMP Echo Req Src: victim s address Dest: broadcast address Looks like a legitimate Are you alive? ping request from the victim Stream of ping replies overwhelms victim! If an old Windows machine received an ICMP packet with a payload longer than 64K, machine would crash or reboot Every host on the network generates a ping (ICMP Echo Reply) to victim gateway victi m Programming error in older versions of Windows Packets of this length are illegal, so programmers of Windows code did not account for them Solution: reject external packets to broadcast addresses! Recall security theme of this course - every line of code might be the target of an adversary Solution: patch OS, filter out ICMP packets TCP Handshake SYN Flooding Attack C S S SYN C Listening SYN C1 Listening SYN S, ACK C Store data (connection state, etc.) SYN C2 SYN C3 Spawn a new thread, store connection data and more Wait SYN C4 SYN C5 and more and more ACK S and more and more Connected SYN Flooding Explained Preventing Denial of Service! Attacker sends many connection requests with spoofed source addresses! Victim allocates resources for each request Connection state maintained until timeout Fixed bound on half-open connections! Once resources exhausted, requests from legitimate clients are denied! This is a classic denial of service (DoS) attack Common pattern: it costs nothing to TCP initiator to send a connection request, but TCP responder must allocate state for each request (asymmetry!)! DoS is caused by asymmetric state allocation If responder opens a state for each connection attempt, attacker can initiate thousands of connections from bogus or forged IP addresses! Cookies ensure that the responder is stateless until initiator produced at least 2 messages Responder s state (IP addresses and ports of the connection) is stored in a cookie and sent to initiator After initiator responds, cookie is regenerated and compared with the cookie returned by the initiator

SYN Cookies C Compatible with standard TCP; simply a weird sequence number scheme SYN C SYN S, ACK C sequence # = cookie F=Rijndael or crypto hash ACK S (cookie) More info: http://cr.yp.to/syncookies.html S F(source addr, source port, dest addr, dest port, coarse time, server secret) [Bernstein and Schenk] Listening Does not store state Cookie must be unforgeable and tamper-proof (why?) Client should not be able to invert a cookie (why?) Recompute cookie, compare with with the one received, only establish connection if they match Anti-Spoofing Cookies: Basic Pattern! Client sends request (message #1) to server! Typical protocol: Server sets up connection, responds with message #2 Client may complete session or not (potential DoS)! Cookie version: Server responds with hashed connection data instead of message #2 Client confirms by returning hashed data If source IP address is bogus, attacker can t confirm Need an extra step to send postponed message #2, except in TCP (SYN-ACK already there) Another Defense: Random Deletion SYN C half-open connections 121.17.182.45 231.202.1.16 121.100.20.14 5.17.95.155! If SYN queue is full, delete random entry Legitimate connections have a chance to complete Fake addresses will be eventually deleted! Easy to implement TCP Connection Spoofing! Each TCP connection has an associated state Sequence number, port number! TCP state is easy to guess Port numbers are standard, sequence numbers are often predictable Can inject packets into existing connections! If attacker knows initial sequence number and amount of traffic, can guess likely current number Send a flood of packets with likely sequence numbers Blind IP Spoofing Attack DoS by Connection Reset Alice # Open connection to Alice to get initial sequence number Trusted connection between Alice and Bob uses predictable sequence numbers " Send packets to Alice that resemble Bob s packets! SYN-flood Bob s queue Bob! Can t receive packets sent to Bob, but maybe can penetrate Alice s computer if Alice uses IP address-based authentication For example, rlogin and many other remote access programs uses address-based authentication! If attacker can guess current sequence number for an existing connection, can send Reset packet to close it With 32-bit sequence numbers, probability of guessing correctly is 1/2 32 (not practical) Most systems accept large windows of sequence numbers! much higher probability of success Need large windows to handle massive packet losses

User Datagram Protocol (UDP)! UDP is a connectionless protocol Simply send datagram to application process at the specified port of the IP address Source port number provides return address Applications: media streaming, broadcast! No acknowledgement, no flow control, no message continuation! Denial of service by UDP data flood Countermeasures! Above transport layer: Kerberos Provides authentication, protects against spoofing Does not protect against connection hijacking! Above network layer: SSL/TLS and SSH Protects against connection hijacking and injected data Does not protect against DoS by spoofed packets! Network (IP) layer: IPSec Protects against hijacking, injection, DoS using connection resets, IP address spoofing DNS: Domain Name Service DNS Caching DNS maps symbolic names to numeric IP addresses (for example, www.cs.washington.edu " 128.208.3.88) www.cs.washington.edu Client Local DNS recursive resolver www.cs.washington.edu NS washington.edu NS cs.washington.edu www=ipaddr root & edu DNS server washington.edu DNS server cs.washington.edu DNS server! DNS responses are cached Quick response for repeated translations Other queries may reuse some parts of lookup NS records for domains! DNS negative queries are cached Don t have to repeat past mistakes For example, misspellings! Cached data periodically times out Lifetime (TTL) of data controlled by owner of data TTL passed with every record DNS Vulnerabilities! DNS host-address mappings are not authenticated! DNS implementations have vulnerabilities Reverse query buffer overrun in old releases of BIND Gain root access, abort DNS service MS DNS for NT 4.0 crashes on chargen stream telnet ntbox 19 telnet ntbox 53! Denial of service is a risk Oct 02: ICMP flood took out 9 root servers for 1 hour Reverse DNS Spoofing! Trusted access is often based on host names E.g., permit all hosts in.rhosts to run remote shell! Network requests such as rsh or rlogin arrive from numeric source addresses System performs reverse DNS lookup to determine requester s host name and checks if it s in.rhosts! If attacker can spoof the answer to reverse DNS query, he can fool target machine into thinking that request comes from an authorized host No authentication for DNS responses and typically no double-checking (numeric # symbolic # numeric)

Other DNS Risks! DNS cache poisoning False IP with a high time-to-live will stay in the cache of the DNS server for a long time Basis of pharming! Spoofed ICANN registration and domain hijacking Authentication of domain transfers based on email addr Aug 04: teenager hijacks ebay s German site Jan 05: hijacking of panix.com (oldest ISP in NYC) "The ownership of panix.com was moved to a company in Australia, the actual DNS records were moved to a company in the United Kingdom, and Panix.com's mail has been redirected to yet another company in Canada."! Misconfiguration and human error IP: 10.0.0.7, inaccessible outside good.net network IP: 10.0.0.7, inaccessible outside good.net network Hosts sensitive CGI applications IP: 10.0.0.7, inaccessible outside good.net network Hosts sensitive CGI applications! Attacker at evil.org gets good.net user to browse www.evil.org

IP: 10.0.0.7, inaccessible outside good.net network Hosts sensitive CGI applications! Attacker at evil.org gets good.net user to browse www.evil.org! Places Javascript on www.evil.org that accesses sensitive application on intra.good.net IP: 10.0.0.7, inaccessible outside good.net network Hosts sensitive CGI applications! Attacker at evil.org gets good.net user to browse www.evil.org! Places Javascript on www.evil.org that accesses sensitive application on intra.good.net This doesn t work because Javascript is subject to same-origin policy JavaScript/DNS Intranet attack (II) IP: 10.0.0.7, inaccessible outside good.net network Hosts sensitive CGI applications! Attacker at evil.org gets good.net user to browse www.evil.org! Places Javascript on www.evil.org that accesses sensitive application on intra.good.net This doesn t work because Javascript is subject to same-origin policy but the attacker controls evil.org DNS good.net Lookup www.evil.org browser 222.33.44.55 short ttl GET /, host www.evil.org Response Lookup www.evil.org 10.0.0.7 POST /cgi/app, host www.evil.org Response compromise! Evil.org DNS Evil.org Web Evil.org DNS Web Intra.good.net 10.0.0.7 Drive-by pharming Drive-by pharming Assumes router has default password Reference: http://www.cs.indiana.edu/pub/techreports/tr641.pdf Reference: http://www.cs.indiana.edu/pub/techreports/tr641.pdf

Reference: http://www.cs.indiana.edu/pub/techreports/tr641.pdf Reference: http://www.cs.indiana.edu/pub/techreports/tr641.pdf DNSSEC! Goals: authentication and integrity of DNS requests and responses! PK-DNSSEC (public key) DNS server signs its data (can be done in advance)! SK-DNSSEC (symmetric key) Encryption and MAC: E k (m, MAC(m)) Each message contains a nonce to avoid replay Each DNS node shares a symmetric key with its parent Zone root server has a public key (hybrid approach)