Lecture 5: Network Attacks I. Course Admin



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

Port Scanning. Objectives. Introduction: Port Scanning. 1. Introduce the techniques of port scanning. 2. Use port scanning audit tools such as Nmap.

Internet structure: network of networks

Domain Name System (DNS)

CIT 380: Securing Computer Systems

The Application Layer: DNS

Domain Name System (or Service) (DNS) Computer Networks Term B10

Domain Name System Richard T. B. Ma

Chapter 2 Application Layer

DATA COMMUNICATOIN NETWORKING

HW/Lab 2: Network Mapping and Attacks. CS 336/536: Computer Network Security DUE at 10/19/2015 (11am)

DNS: Domain Name System

Delay, loss, layered architectures. packets queue in router buffers. packets queueing (delay)

An Introduction to Nmap with a Focus on Information Gathering. Ionuț Ambrosie

Chapter 8 Security Pt 2

NETWORK SECURITY WITH OPENSOURCE FIREWALL

3. The Domain Name Service

Network and Services Discovery

Chapter 6 Phase 2: Scanning

Host Fingerprinting and Firewalking With hping

Network Mapper and Vulnerability Scanning

Denial Of Service. Types of attacks

CS 43: Computer Networks Naming and DNS. Kevin Webb Swarthmore College September 17, 2015

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

Tools for penetration tests 1. Carlo U. Nicola, HT FHNW With extracts from documents of : Google; Wireshark; nmap; Nessus.

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

Attacks and Defense. Phase 1: Reconnaissance

How do I get to

Scanning Tools. Scan Types. Network sweeping - Basic technique used to determine which of a range of IP addresses map to live hosts.

CSCE 465 Computer & Network Security

CMPE 80N: Introduction to Networking and the Internet

Lecture 6: Network Attacks II. Course Admin

Domain Name System (DNS) RFC 1034 RFC

Linux Network Security

Network Security CS 192

How To Map Between Ip Address And Name On A Domain Name System (Dns)

Part I - Gathering WHOIS Information

CS 355. Computer Networking. Wei Lu, Ph.D., P.Eng.

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

Network Security. Network Scanning

Stop that Big Hack Attack Protecting Your Network from Hackers.

Introduction to Network Security Lab 2 - NMap

DNS: Domain Name System

DNS. Spring 2016 CS 438 Staff 1

TCP/IP Security Problems. History that still teaches

NET0183 Networks and Communications

Chapter 1 Computer Networks and the Internet

Host Discovery with nmap

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

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

internet technologies and standards

Looking for Trouble: ICMP and IP Statistics to Watch

CYBER ATTACKS EXPLAINED: PACKET CRAFTING

Networks: IP and TCP. Internet Protocol

Penetration Testing. NTS330 Unit 1 Penetration V1.0. February 20, Juan Ortega. Juan Ortega, juaorteg@uat.edu. 1 Juan Ortega, juaorteg@uat.

Ch 6: Networking Services: NAT, DHCP, DNS, Multicasting

Computer forensics

Chapter 8 Network Security

CS5008: Internet Computing

A S B

Firewall Firewall August, 2003

DNS and P2P File Sharing

Solution of Exercise Sheet 5

Attack Lab: Attacks on TCP/IP Protocols

Technical Support Information Belkin internal use only

Divide and Conquer Real World Distributed Port Scanning

Network Scanning. What is a Network scanner? Why are scanners needed? How do scanners do? Which scanner does the market provide?

Ch 6: Networking Services: NAT, DHCP, DNS, Multicasting, NTP

Firewall Testing. Cameron Kerr Telecommunications Programme University of Otago. May 16, 2005

Introduction. Nmap from an Ethical Hacker's View Part 1. By Kirby Tucker

Network layer: Overview. Network layer functions IP Routing and forwarding

What is a DoS attack?

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

General Network Security

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

Layer Four Traceroute (and related tools) A modern, flexible path-discovery solution with advanced features for network (reverse) engineers

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

Attack and Defense Techniques

2.5 DNS The Internet s Directory Service

Presented By: Holes in the Fence. Agenda. IPCCTV Attack. DDos Attack. Why Network Security is Important

A Very Incomplete Diagram of Network Attacks

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

Computer Networks & Security 2014/2015

CS2107 Introduction to Information and System Security (Slid. (Slide set 8)

Security: Attack and Defense

Troubleshooting Tools

HONEYD (OPEN SOURCE HONEYPOT SOFTWARE)

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

Firewall Implementation

Algorithms and Techniques Used for Auto-discovery of Network Topology, Assets and Services

Network Security Fundamentals


Transcription:

Lecture 5: Network Attacks I CS 336/536: Computer Network Security Fall 2013 Nitesh Saxena Adopted from previous lectures by Keith Ross Course Admin HW/Lab 1 Due Coming Monday 11am Lab sessions are active this Friday Please only attend the sessions you registered for Questions? Break? How about we finish at 7:20pm? 2 1

Outline Key Distribution From last lecture Different forms of Network Attacks Network Reconnaissance Network Mapping 3 Attacks & Hacker Tools Let us look at the network from attacker s perspective Reconnaissance Network mapping Port scanning Sniffing IP address spoofing Session hijacking DoS DDoS 4 2

Reconnaissance casing the joint Let s take a close look at: Reconnaissance with whois Reconnaissance with DNS A few words about a Registrar: Organization where you register a domain name Verifies uniqueness of name Enters domain name into various databases: whois & DNS 5 List of registrars from internic.net: 6 3

Whois databases Input: domain name or company name Output: registrar, whois server, dns server Some useful whois sites: www.internic.net For com, net and org top-level domains www.allwhois.com For country-code top-level domains, e.g., jp, fr 7 Internic Whois: Target google 8 4

Reconnaissance: IP Ranges ARIN: American Registry for Internet Numbers Maintains whois database that includes IP address ranges in US RIPE: Europe APNIC: Asia 9 Query at ARIN 10 5

Why whois databases needs to be publicly available If you re under attack, can analyze source address of packets. Can use whois database to obtain info about the domain from where the attack is coming. Can inform admin that their systems are source of an attack 11 Reconnaissance: DNS database Let s quickly review DNS: distributed database implemented in hierarchy of many DNS servers Authoritative name server: for a given domain (e.g., uab.edu), provides server name to IP address mappings for servers (Web, email, ftp, etc) in domain Primary and secondary name server for reliability 12 6

Root DNS Servers com DNS servers org DNS servers edu DNS servers yahoo.com DNS servers amazon.com DNS servers pbs.org DNS servers uab.edu umass.edu DNS servers DNS servers Figure 2.18 Portion of the hierarchy of DNS servers 13 DNS: queries root DNS server 2 3 4 TLD DNS server 5 local DNS server dns.uab.edu 1 8 7 6 requesting host cis.uab.edu authoritative DNS server dns.cs.umass.edu gaia.cs.umass.edu 14 7

DNS records DNS: distributed db storing resource records (RR) RR format: (name, value, type, ttl) Type=A (address) name is hostname value is IP address Type=NS name is domain (e.g. foo.com) value is IP address of authoritative name server for this domain Type=MX value is name of mailserver associated with name 15 DNS protocol, messages Name, type fields for a query RRs in reponse to query records for authoritative servers additional helpful info that may be used Query and reply messages sent Over UDP on port 53 16 8

DNS: caching and updating records once (any) DNS server learns mapping, it caches mapping cache entries timeout (disappear) after some time Improves efficiency of lookups of name/address mapping 17 Interrogating DNS servers Attacker first gets primary or secondary authoritative server for target organization using whois. Attacker can then query the DNS by sending DNS query messages. Tools (often available in Unix and Windows machines; also available at web sites): nslookup host dig 18 9

nslookup Avaiable in most unix & Windows machines Get yahoo DNS server name using whois set type=any get all 19 Reconnaissance summary Obtaining information from public databases: whois databases Tool: web sites DNS database Tool: nslookup Defense Keep to a minimum what you put in the public database: only what is necessary 20 10

Attacks & Hacker Tools Before talking about defenses, need to look at network from attacker s perspective Reconnaissance Network mapping Port scanning Sniffing IP address spoofing Session hijacking DoS DDoS 21 Network mapping Goal: Learn about a remote network attacker 121.27.2.1 121.27.2.4 Internet firewall? firewall? Internal network 121.27.2.16 22 11

Network mapping Attacker uses ping sweeps to determine live hosts Attacker uses port scans to determine live services Attacker often uses traceroute to determine path to each host discovered during ping sweep. Overlay results from traceroute to create an approximate network diagram 23 Traceroute traceroute: gaia.cs.umass.edu to www.eurecom.fr Three delay measements from gaia.cs.umass.edu to cs-gw.cs.umass.edu 1 cs-gw (128.119.240.254) 1 ms 1 ms 2 ms 2 border1-rt-fa5-1-0.gw.umass.edu (128.119.3.145) 1 ms 1 ms 2 ms 3 cht-vbns.gw.umass.edu (128.119.3.130) 6 ms 5 ms 5 ms 4 jn1-at1-0-0-19.wor.vbns.net (204.147.132.129) 16 ms 11 ms 13 ms 5 jn1-so7-0-0-0.wae.vbns.net (204.147.136.136) 21 ms 18 ms 18 ms 6 abilene-vbns.abilene.ucaid.edu (198.32.11.9) 22 ms 18 ms 22 ms 7 nycm-wash.abilene.ucaid.edu (198.32.8.46) 22 ms 22 ms 22 ms 8 62.40.103.253 (62.40.103.253) 104 ms 109 ms 106 ms 9 de2-1.de1.de.geant.net (62.40.96.129) 109 ms 102 ms 104 ms 10 de.fr1.fr.geant.net (62.40.96.50) 113 ms 121 ms 114 ms 11 renater-gw.fr1.fr.geant.net (62.40.103.54) 112 ms 114 ms 112 ms 12 nio-n2.cssi.renater.fr (193.51.206.13) 111 ms 114 ms 116 ms 13 nice.cssi.renater.fr (195.220.98.102) 123 ms 125 ms 124 ms 14 r3t2-nice.cssi.renater.fr (195.220.98.110) 126 ms 126 ms 124 ms 15 eurecom-valbonne.r3t2.ft.net (193.48.50.54) 135 ms 128 ms 133 ms 16 194.214.211.25 (194.214.211.25) 126 ms 128 ms 126 ms 17 * * * 18 * * * 19 fantasia.eurecom.fr (193.55.113.142) 132 ms 128 ms 136 ms trans-oceanic link * means no reponse (probe lost, router not replying) 24 12

Traceroute: How it works Source sends UDP packets to target Each to an unlikely port 3 packets with the same TTL, then increments TTL When router decrements TTL to 0, sends back to source ICMP packet type 11, code 0, TTL expired When target receives packet, sends back to source ICMP packet type 3, code 0, destination port unreachable 25 Ping Sweep Ping Recall ICMP messages are directly encapsulated in IP datagrams (protocol 1) To ping a host: send ICMP Echo Request (ICMP type 8) Host responds with ICMP Echo Reply (type 0) So let s ping the entire IP address range Use automated tool for this ping sweep If firewall blocks ping packets: Try sweeping with TCP SYN packets to port 80 Or try sending UDP packets to possible ports 26 13

Port scanning Now that we have a map with some hosts, let s find out what ports are open on a target host 65,535 TCP ports; 65,535 UDP ports Web server: TCP port 80 DNS server: UDP port 53 Mail server: TCP port 25 Port scanning tools can scan: List of ports Range of ports All possible TCP and UDP ports Attacker may scan a limited set of ports, to avoid detection 27 Interlude TCP segment structure 32 bits ACK: ACK # valid RST, SYN, FIN: connection estab (setup, teardown commands) source port # dest port # head len sequence number acknowledgement number not used UAP RSF checksum Receive window Urg data pnter Options (variable length) application data (variable length) counting by bytes of data (not segments!) 28 14

Interlude: TCP seq. # s and ACKs Seq. # s: byte stream number of first byte in segment s data ACKs: seq # of next byte expected from other side User types C host ACKs receipt of echoed C Host A Host B host ACKs receipt of C, echoes back C simple telnet scenario time 29 Interlude: TCP Connection Establishment Three way handshake: Step 1: client host sends TCP SYN segment to server SYN=1, ACK=0 specifies initial seq # no data Step 2: server host receives SYN, replies with SYN-ACK segment SYN=1, ACK=1 server host allocates buffers specifies server initial seq. # Step 3: client receives SYN-ACK, replies with ACK segment, which may contain data SYN=0, ACK=1 30 15

TCP: Reset packet If machine receives a TCP packet it is not expecting, it responds with TCP packet with RST bit set. For example when no process is listening on destination port For UDP, machine returns ICMP port unreachable instead 31 Nmap (1) Extremely popular usually run over linux rich feature set, exploiting raw sockets need root to use all features Ping sweeping over any range of IP addresses with ICMP, SYN, ACK OS determination Port scanning Over any range of ports Almost any type of TCP, UDP packet Source IP address spoofing Decoy scanning Packet fragmentation Timing Options Excellent reference: Nmap man page 32 16

Nmap (2) Input: nmap [Scan Type] [Options] <target hosts> Default for port scanning: ports 1-1024 plus ports listed in nmap service file Output: open ports: syn/ack returned; port is open unfiltered (closed) ports: RST returned: port is closed but not blocked by firewall filtered ports: nothing returned; port is blocked by firewall 33 Nmap (3): ping sweep Nmap sp v 116.27.38/24 Sends ICMP echo request (ping) to 256 addresses Can change options so that pings with SYNs, ACKs -sp = ping -v = verbose 34 17

Nmap (4): polite port scan nmap st -v target.com Attempts to complete 3-way handshake with each target port Sends SYN, waits for SYNACK, sends ACK, then sends FIN to close connection If target port is closed, no SYNACK returned Instead RST packet is typically returned TCP connect scans are easy to detect Target (e.g. Web server) may log completed connections Gives away attacker s IP address 35 Nmap (5) : TCP SYN port scan nmap ss -v target.com Stealthier than polite scan Send SYN, receive SYNACK, send RST Send RST segment to avoid an accidental DoS attack Stealthier: hosts do not record connection But routers with logging enabled will record the SYN packet Faster: don t need to send FIN packet 36 18

Nmap (6): TCP ACK scans Example: nmap -PA v target Many filters (in firewalls and routers) only let internal systems hosts initiate TCP connections Drop packets for which ACK=0 (ie SYN packet): no sessions initiated externally To learn what ports are open through firewall, try an ACK scan (segments with ACK=1) ACK dest port 2031 ACK dest port 2032 firewall RST I learned port 2032 is open through the firewall Internal Network 37 Nmap (7): UDP port scans UDP doesn t have SYN, ACK, RST packets nmap simply sends UDP packet to target port (example: nmap PU target; may require root access) ICMP Port Unreachable: interpret port closed Nothing comes back: interpret port open False positives common 38 19

Nmap (8): Obscure source Attacker can enter list of decoy source IP addresses into Nmap For each packet it sends, Nmap also sends packets from decoy source IP addresses For 4 decoy sources, send five packets Attacker s actual address must appear in at least one packet, to get a result If there are 30 decoys, victim network will have to investigate 31 different sources! Example: nmap n DIP1,IP2, 39 Nmap (9): TCP stack fingerprinting In addition to determining open ports, attacker wants to know OS on targeted machine: exploit machine s known vulnerabilities sophisticated hacker may set up lab environment similar to target network TCP implementations in different OSes respond differently to illegal combinations of TCP flag bits. Example: nmap O target 40 20

Nmap (10): Fingerprinting Nmap sends SYN to open port NULL to open port (no flag bits set) SYN/FIN/URG/PSH to open port SYN to closed port ACK to closed port FIN/PSH/URG to closed port UDP to closed port Nmap includes a database of OS fingerprints for hundreds of platforms 41 Nmap (11): more examples nmap -v target.com Scans all TCP default ports on target.com; verbose mode nmap -ss -O target.com/24 First pings addresses in target network to find hosts that are up. Then scans default ports at these hosts; stealth mode (doesn t complete the connections); tries to determine OS running on each scanned host nmap -sx -p 22,53,110,143 198.116.*.1-127 Sends an Xmas tree scan to the first half of each of the 255 possible subnets in the 198.116/16. Testing whether the systems run ssh, DNS, pop3, or imap nmap -v -p 80 *.*.2.3-5 finds all web servers on machines with IP addresses ending in.2.3,.2.4, or.2.5 42 21

Notes and Warnings when using nmap GUI versions available: zenmap: http://nmap.org/zenmap/ USE CAREFULLY Do not scan entire network Scanning a host for testing/learning purposes is fine Please keep in mind the ethics of security education Lab will be the safest platform to try it 43 Defenses against network mapping Filter using firewalls and packet-filtering capabilities of routers Block incoming ICMP packets, except to the hosts that you want to be pingable Filter Time Exceeded ICMP messages leaving your network Close all unused ports Scan your own systems to verify that unneeded ports are closed Intrusion Detection Systems e.g., Snort 44 22