26
CS 356 Systems Security Spring 2015 http://www.cs.colostate.edu/~cs356 Dr. Indrajit Ray http://www.cs.colostate.edu /~indrajit

CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Embed Size (px)

Citation preview

Page 1: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

CS 356 Systems SecuritySpring 2015

http://www.cs.colostate.edu/~cs356

Dr. Indrajit Rayhttp://www.cs.colostate.edu/~indrajit

Page 2: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

A Very Brief Introduction toNetworking

Page 3: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Simplest Network

Page 4: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Local Area Network (LAN)

Page 5: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Network of LANs

neon.tcpip-lab.edu"Neon"

128.143.71.21

argon.tcpip-lab.edu"Argon"128.143.137.144

router137.tcpip-lab.edu"Router137"

128.143.137.1

router71.tcpip-lab.edu"Router71"128.143.71.1

Ethernet NetworkEthernet Network

Router

Page 6: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Internetworking

• Internetwork = Collection of networks connected via routers

Page 7: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Internet = Virtual Network

Page 8: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

neon.tcpip-lab.edu"Neon"

128.143.71.21

argon.tcpip-lab.edu"Argon"128.143.137.144

router137.tcpip-lab.edu"Router137"

128.143.137.1

router71.tcpip-lab.edu"Router71"128.143.71.1

Ethernet NetworkEthernet Network

Router

Sending a packet from Argon to Neon

Page 9: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Sending a packet from Argon to NeonDNS: The IP address of “neon.tcpip-lab.edu” is 128.143.71.21

ARP: What is the MAC address of 128.143.137.1?

neon.tcpip-lab.edu"Neon"

128.143.71.21

argon.tcpip-lab.edu"Argon"128.143.137.144

router137.tcpip-lab.edu"Router137"

128.143.137.1

router71.tcpip-lab.edu"Router71"128.143.71.1

Ethernet NetworkEthernet Network

Router

DNS: What is the IP address

of “neon.tcpip-lab.edu”?ARP: The MAC address of 128.143.137.1 is 00:e0:f9:23:a8:20

128.143.71.21 is not on my local network.Therefore, I need to send the packet to my

default gateway with address 128.143.137.1

frame

128.143.71.21 is on my local network.Therefore, I can send the packet directly.

ARP: The MAC address of 128.143.137.1 is 00:20:af:03:98:28

ARP: What is the MAC address of 128.143.71.21?

frame

Page 10: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Communications Architecture

• The complexity of the communication task is reduced by using multiple protocol layers:

• Each protocol is implemented independently• Each protocol is responsible for a specific subtask• Protocols are grouped in a hierarchy

• A structured set of protocols is called a communications architecture or protocol suite

Page 11: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

TCP/IP Protocol Suite

• The TCP/IP protocol suite is the protocol architecture of the Internet

• The TCP/IP suite has four layers: Application, Transport, Network, and Data Link Layer

• End systems (hosts) implement all four layers. Gateways (Routers) only have the bottom two layers.

Application

Transport

Network Operating system

User-level programs

Data Link

Data Link

Media AccessControl (MAC)

Sublayer inLocal AreaNetworks

Page 12: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

OSI and TCP/IP Protocol StackOSI Model TCP/IP Hierarchy Protocols

7th

Application Layer

6th

Presentation Layer

5th

Session Layer

4th

Transport Layer

3rd

Network Layer

2nd

Link Layer

1st

Physical Layer

Application Layer

Transport Layer

Network Layer

Link Layer

Page 13: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Functions of the Layers• Data Link Layer:

– Service: Reliable transfer of frames over a linkMedia Access Control on a LAN

– Functions: Framing, media access control, error checking• Network Layer:

– Service: Move packets from source host to destination host

– Functions: Routing, addressing• Transport Layer:

– Service: Delivery of data between hosts– Functions: Connection establishment/termination, error

control, flow control• Application Layer:

– Service: Application specific (delivery of email, retrieval of HTML documents, reliable transfer of file)

– Functions: Application specific

Page 14: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Assignment of Protocols to Layers

NetworkLayer

Routing Protocols

PIM

OSPF

RIP

ApplicationLayer

Data LinkLayer

IP

ARP Ethernet

NetworkInterface

TransportLayer

TCP UDP

SNMPFTP DNSHTTP

ICMP

IGMP

pingapplication Telnet

DHCP

Page 15: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Layered Communications

• An entity of a particular layer can only communicate with:

1. a peer layer entity using a common protocol (Peer Protocol)2. adjacent layers to provide services and to receive services

N+1 LayerEntity

N+1 LayerEntity

N+1 Layer ProtocolN+1 Layer

N-1 LayerEntity

N-1 LayerEntity

N-1 Layer ProtocolN-1 Layer

N LayerEntity

N LayerEntity

N Layer ProtocolN Layer

layer N+1/Ninterface

layer N/N-1interface

Page 16: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Exchange of Data• The unit of data sent between peer entities is called a Protocol Data Unit

(PDU)• For now, let us think of a PDU as a single packet

• Scenario: Layer-N at A sends a layer-N PDU to layer-N at B• What actually happens:

– A’s layer-N passes the PDU to the SAPs at layer-N-1– Layer-N-1 entity at A constructs its own (layer-N-1) PDU which it sends to the

layer-N-1 entity at B– PDU at layer-N-1 = layer-N-1 Header + layer –N PDU

N LayerEntity

PDU(at layer N)

N LayerEntity

A B

Page 17: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Layers in the ExampleHTTP

TCP

IP

argon.tcpip-lab.edu

128.143.137.144

Ethernet Ethernet Ethernet

IP

HTTP

TCP

IP

neon.tcpip-lab.edu128.143.71.21

Ethernet

router71.tcpip-lab.edu

128.143.137.100:e0:f9:23:a8:20

router137.tcpip-lab.edu

128.143.71.1

HTTP protocol

TCP protocol

IP protocol

Ethernet

IP protocol

Ethernet

Page 18: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Layers in the Example

HTTP

TCP

IP

argon.tcpip-lab.edu

128.143.137.144

Ethernet Ethernet Ethernet

IP

HTTP

TCP

IP

neon.tcpip-lab.edu128.143.71.21

Ethernet

router71.tcpip-lab.edu

128.143.137.100:e0:f9:23:a8:20

router137.tcpip-lab.edu128.143.71.1

Send HTTP Request to neon

Establish a connection to 128.143.71.21 at port 80Open TCP connection to

128.143.71.21 port 80

Send a datagram (which contains a connection request) to 128.143.71.21Send IP datagram to

128.143.71.21

Send the datagram to 128.143.137.1

Send Ethernet frame to 00:e0:f9:23:a8:20

Send Ethernet frame to 00:20:af:03:98:28

Send IP data-gram to 128.143.71.21

Send the datagram to 128.143.7.21

Frame is an IP datagram

Frame is an IP datagram

IP datagram is a TCP segment for port 80

Page 19: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Encapsulation• As data is moving down the protocol stack, each

protocol is adding layer-specific control information

HTTP

TCP

IP

Ethernet

User data

User dataHTTP Header

TCP Header

TCP HeaderIP Header

TCP HeaderIP HeaderEthernetHeader

EthernetTrailer

IP datagram

TCP segment

Ethernet frame

User dataHTTP Header

User dataHTTP Header

User dataHTTP Header

Page 20: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

Ethernet

• Computer <-> Computer communication on same network

• Each device has unique MAC address (48-bit)example: 00-C0-4F-48-47-93

Ethernet Packet:Dest.

addressData CRCSource

addressType

MAC: Media Access Control

6bytes 6bytes 2bytes

Preamble

8bytes 64 - 1500bytes 4bytes

Page 21: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

IP: Internet Protocol• Unreliable … connectionless datagram delivery service• Responsible for routing of data through intermediate networks and

computers

IP header:

1 :ICMP6 :TCP17 :UDP

118901

11112345

11116789

22220123

22224567

223389010123 4567

Page 22: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

ICMP : Internet Control Message Protocol• Used to report problems with delivery of IP Datagrams within an

IP network• Used by Ping, Traceroute commands

Types and Codes• Echo Request (type=8, code=0)• Echo Reply(type=0, code=0)• Destination Unreachable(type=3, code=0)• Time Exceeded(type=11, code=0) : Time-to-Live =0

ICMP Message

ICMP Data

ICMP Header

IP Header

4bytes20bytes

Type Code Checksum

1byte 1byte 2bytes

Page 23: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

TCP : Transmission Control Protocol• Connection-Oriented, Reliable, Byte Stream ServiceProtocol1. Set up connection2. Transfer data3. Close connection

0 1 2 3 4 5 6 7 8 9 10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

Source Port Destination Port

Sequence Number

Acknowledgement Number

DataOffset

- - - -

        

        

        

        

        

        

        

        

Window

Checksum Urgent Pointer

Options (0 to 10 Words of 32 Bits)

TCP Payload

 

TCP Header Format

Page 24: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

ARP : Address Resolution Protocol

• ARP provides mapping32bit IP address <-> 48bit MAC address128.97.89.153 <-> 00-C0-4F-48-47-93

• ARP cache maintains the recent mappings from IP addresses to MAC addresses

Protocol1. ARP request broadcast on Ethernet2. Destination host ARP layer responds

Page 25: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

DNS: Domain Name System

• DNS provides mapping– www.cs.colostate.edu <-> 129.82.45.114– and many other mappings

• mail servers, IPv6, reverse mapping

• Data is organized as a tree

Page 26: CS 356 Systems Security Spring 2015 cs356 cs356 Dr. Indrajit Ray indrajit

DNS Protocol

.Root DNS Server

.edu DNS Server

.colostate.edu DNS Server

caching DNSserver

what iswww.colostate.edu

what is

www.colostate.edu

.edu is ….

what is www.colostate.edu

.colostate.edu is …

what iswww.colostate.eduwww.colostate.edu is …

129.82.103.106