84
CSc 466/566 Computer Security 19 : Network Security Version: 2013/04/10 14:41:18 Department of Computer Science University of Arizona [email protected] Copyright c 2013 Christian Collberg Christian Collberg 1/43

CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

CSc 466/566

Computer Security

19 : Network SecurityVersion: 2013/04/10 14:41:18

Department of Computer ScienceUniversity of Arizona

[email protected]

Copyright c© 2013 Christian Collberg

Christian Collberg

1/43

Page 2: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Outline

1 TunnelingSSHIPsecVPN

2 Intrusion DetectionPort Scanning

3 Summary

Tunneling 2/43

Page 3: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Tunneling

TCP packets are sent in cleartext.

In a tunneling protocol, packets are automatically encrypted.

How to evade school firewall, secure traffic tunneling & more:http://www.wonderhowto.com/how-to-evade-school-firewall-secure-traffic-tunneling-more-285775

Quick and Dirty SSH Tunneling: http://www.youtube.com/watch?v=EkPzt4_S3cc

Tunneling 3/43

Page 4: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

Tunneling 4/43

Page 5: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

Tunneling 4/43

Page 6: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

Tunneling 4/43

Page 7: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

Tunneling 4/43

Page 8: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

1 Password:

Tunneling 4/43

Page 9: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

1 Password:

The Client sends the Server their password.

Tunneling 4/43

Page 10: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

1 Password:

The Client sends the Server their password.

2 Public-key:

Tunneling 4/43

Page 11: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

1 Password:

The Client sends the Server their password.

2 Public-key:

1 The Client sends the Server their public key Pclient.

Tunneling 4/43

Page 12: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

1 Password:

The Client sends the Server their password.

2 Public-key:

1 The Client sends the Server their public key Pclient.

2 The Server checks if Pclient is in its database.

Tunneling 4/43

Page 13: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

1 Password:

The Client sends the Server their password.

2 Public-key:

1 The Client sends the Server their public key Pclient.

2 The Server checks if Pclient is in its database.

3 The Server generates a challenge challenge.

Tunneling 4/43

Page 14: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

1 Password:

The Client sends the Server their password.

2 Public-key:

1 The Client sends the Server their public key Pclient.

2 The Server checks if Pclient is in its database.

3 The Server generates a challenge challenge.

4 The Server sends EPclient(challenge) to the Client.

Tunneling 4/43

Page 15: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

1 Password:

The Client sends the Server their password.

2 Public-key:

1 The Client sends the Server their public key Pclient.

2 The Server checks if Pclient is in its database.

3 The Server generates a challenge challenge.

4 The Server sends EPclient(challenge) to the Client.

5 The Client decrypts: DSclient(EPclient

(challenge))

Tunneling 4/43

Page 16: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

1 Password:

The Client sends the Server their password.

2 Public-key:

1 The Client sends the Server their public key Pclient.

2 The Server checks if Pclient is in its database.

3 The Server generates a challenge challenge.

4 The Server sends EPclient(challenge) to the Client.

5 The Client decrypts: DSclient(EPclient

(challenge))

6 The Client sends challenge to the Server.

Tunneling 4/43

Page 17: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

1 Client connects to Server over TCP.

2 Client and Server exchange available cryptographic primitives.

3 Client and Server decide on a shared session key.

4 The Server sends the Client a list of acceptable forms ofauthentication:

1 Password:

The Client sends the Server their password.

2 Public-key:

1 The Client sends the Server their public key Pclient.

2 The Server checks if Pclient is in its database.

3 The Server generates a challenge challenge.

4 The Server sends EPclient(challenge) to the Client.

5 The Client decrypts: DSclient(EPclient

(challenge))

6 The Client sends challenge to the Server.

5 The Server gives the Client a command prompt.

Tunneling 4/43

Page 18: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice

Page 19: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice Start TCP session

Page 20: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice I support AES,SHA-1,...

Page 21: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice I support 3DES,SHA-256,...

Page 22: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice Exchange session key

Page 23: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice Authentication methods: pw-auth, pub-key-auth

Page 24: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice pw-auth: "love4bob"

Page 25: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice pub-key-auth: PAlice

Page 26: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice

user Puser

Alice PAlice

Bob PBob

PAlice

Page 27: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice

user Puser

Alice PAlice

Bob PBob

OK

Page 28: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice

user Puser

Alice PAlice

Bob PBob

pub-key-auth: EPAlice(challenge)

Page 29: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice

user Puser

Alice PAlice

Bob PBob

pub-key-auth: challenge

Page 30: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Protocol

Alice

user Puser

Alice PAlice

Bob PBob

Command prompt: "ssh> "!

Tunneling 5/43

Page 31: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Setting up SSH Tunneling

Configure an SSH client to forward a local port to a port on aremote machine:✞ ☎

s sh −N −L 8888 : 1 9 2 . 1 6 8 . 1 1 1 . 2 2 2 : 8 0 bob@serve rbob@serve r ’ s password : . . . . . . . .

✝ ✆

8888 is the local port.

192.168.111.222:80 is the IP address and the port on theremote machine.

-N means not to execute any commands on the remote host.

Start a browser, go to http://localhost:8888, this will redirect to192.168.111.222:80.

Tunneling 6/43

Page 32: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SSH Tunneling. . .

-D [bind address:]port: Specifies a local “dynamic” application-levelport forwarding. This works by allocating a socket tolisten to port on the local side, optionally bound to thespecified bind address. Whenever a connection is made tothis port, the connection is forwarded over the securechannel, and the application protocol is then used todetermine where to connect to from the remote machine.

-L [bind address:]port:host:hostport: Specifies that the givenport on the local (client) host is to be forwarded to thegiven host and port on the remote side. This works byallocating a socket to listen to port on the local side,optionally bound to the specified bind address. Whenevera connection is made to this port, the connection isforwarded over the secure channel, and a connection ismade to host port hostport from the remote machine.

Tunneling 7/43

Page 33: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Internet Protocol Security (IPsec)

Operates at the Internet (Network) Layer.

Transparent to applications.

Requires a modified IP stack.

Network applications don’t need to change.

Tunneling 8/43

Page 34: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IPv4 Packet Format

Version (4 bits)

Header length (4 bits)

Service type (8 bits)

Total length (16 bits)

Identification (16 bits)

Flags (3 bits)

Fragment offset (13 bits)

Time-to-Live (8 bits)

Protocol (8 bits)

Header Checksum (16 bits)

Source Address (32 bits)

Destination Address (32 bits)

Payload

Tunneling 9/43

Page 35: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

TCP Packet Format

Source Port (16 bits)

Destination Port (16 bits)

Sequence Number (32 bits)

Acknowledgement Number (32 bits)

Offset (4 bits)

Reserved (4 bits)

Flags (8 bits)

Window size (16 bits)

Checksum (16 bits)

Urgent Pointer (16 bits)

Payload

Tunneling 10/43

Page 36: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Layer

NetworkLayer

Transport

LinkLayer

ApplicationLayer

Data

FrameFooter

ApplicationData

ApplicationData

TCP DataTCPHeader

IPHeader TCP

Header

IP Data

TCP Data

ApplicationData

FrameHeader

IPHeader

Frame Data

IP Data

TCPHeader

TCP Data

Application

Page 37: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

TPC Packet Encapsulated Within IPv4

Version (4 bits)

IP Header

Header length (4 bits)Service type (8 bits)Total length (16 bits)Identification (16 bits)

Flags (3 bits)Fragment offset (13 bits)Time-to-Live (8 bits)Protocol (8 bits)

Header Checksum (16 bits)Source Address (32 bits)

Destination Address (32 bits)

Source Port (16 bits)

TCP Header

Destination Port (16 bits)Sequence Number (32 bits)

Acknowledgement Number (32 bits)Offset (4 bits)

Reserved (4 bits)Flags (8 bits)

Window size (16 bits)Checksum (16 bits)

Urgent Pointer (16 bits)

TCP Payload

Tunneling 12/43

Page 38: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IPsec Authentication Header (AH)

Next Header (8 bits)

Payload Length (8 bits)

Reserved (16 bits)

Security Parameters Index (SPI) (32 bits)

Sequence Number (32 bits)

Authentication Data (MD5/SHA-1)

The IPsec AH is used to authenticate the sender and ensurepacket integrity.

Tunneling 13/43

Page 39: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IPsec Authentication Header (AH)

Next Header (8 bits)

Payload Length (8 bits)

Reserved (16 bits)

Security Parameters Index (SPI) (32 bits)

Sequence Number (32 bits)

Authentication Data (MD5/SHA-1)

The IPsec AH is used to authenticate the sender and ensurepacket integrity.

Security Parameters Index describes which cryptographicalgorithms and keys to use.

Tunneling 13/43

Page 40: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IPsec Authentication Header (AH)

Next Header (8 bits)

Payload Length (8 bits)

Reserved (16 bits)

Security Parameters Index (SPI) (32 bits)

Sequence Number (32 bits)

Authentication Data (MD5/SHA-1)

The IPsec AH is used to authenticate the sender and ensurepacket integrity.

Security Parameters Index describes which cryptographicalgorithms and keys to use.

Randomly initialized Sequence Number is used to protectagainst replay attacks.

Tunneling 13/43

Page 41: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IPsec Authentication Header (AH)

Next Header (8 bits)

Payload Length (8 bits)

Reserved (16 bits)

Security Parameters Index (SPI) (32 bits)

Sequence Number (32 bits)

Authentication Data (MD5/SHA-1)

The IPsec AH is used to authenticate the sender and ensurepacket integrity.

Security Parameters Index describes which cryptographicalgorithms and keys to use.

Randomly initialized Sequence Number is used to protectagainst replay attacks.

Authentication Data contains an Integrity Check Value(ICV) to protect the integrity of the packet.

Tunneling 13/43

Page 42: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Transport Mode

In Transport Mode we protect an end-to-end conversationbetween two hosts.

We can authenticate and/or encrypt.

We insert the AH header between the IP header and the TCPpayload.

Only the payload is encrypted and authenticated.

Tunneling 14/43

Page 43: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IPsec Packet in Transport Mode

Version (4 bits)

IP Header

Header length (4 bits)Service type (8 bits)Total length (16 bits)Identification (16 bits)

Flags (3 bits) & Fragment offset (13 bits)Time-to-Live (8 bits)Protocol (8 bits)

Header Checksum (16 bits)Source Address (32 bits)

Destination Address (32 bits)

Next Header (8 bits)

AH

Payload Length (8 bits)Reserved (16 bits)

Security Parameters Index (SPI) (32 bits)Sequence Number (32 bits)

Authentication Data (MD5/SHA-1)

Source Port (16 bits)

TCP Header

Destination Port (16 bits)Sequence Number (32 bits)

Acknowledgement Number (32 bits)Offset (4 bits)

Reserved (4 bits)Flags (8 bits)

Window size (16 bits)Checksum (16 bits)

Urgent Pointer (16 bits)

TCP Payload

Tunneling 15/43

Page 44: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Tunnel Mode

In Tunnel Mode the entire IP packet is encapsulated insideanother packet.

Both original headers and payload are encrypted andauthenticated.

The source and destination addresses of the new packet canbe different from those of the original packet. This allow us toform a tunnel.

Tunneling 16/43

Page 45: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IPsec Packet in Tunnel Mode

Version (4 bits)

New IP Header. . .

Source Address (32 bits)Destination Address (32 bits)

Next Header (8 bits)

AH

Payload Length (8 bits)Reserved (16 bits)

Security Parameters Index (SPI) (32 bits)Sequence Number (32 bits)

Authentication Data (MD5/SHA-1)

Version (4 bits)

Original IP Header

Header length (4 bits)Service type (8 bits)Total length (16 bits)Identification (16 bits)

Flags (3 bits) & Fragment offset (13 bits)Time-to-Live (8 bits)Protocol (8 bits)

Header Checksum (16 bits)Source Address (32 bits)

Destination Address (32 bits)

Source Port (16 bits)

TCP Header

Destination Port (16 bits)Sequence Number (32 bits)

Acknowledgement Number (32 bits). . .

Urgent Pointer (16 bits)

TCP Payload

Tunneling 17/43

Page 46: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Security Associations (SAs)

A set of Security Associations (SAs) tells, for a particularpacket, which cryptographic keys and algorithms we shoulduse to encrypt/decrypt/authenticate it.

Each IPsec header has a Security Parameter Index (SPI), thatindexes into a Security Association Database (SADB) andgives us the SAs.

Tunneling 18/43

Page 47: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Security Associations (SAs). . .

An SA defines the following parameters:1 Source and destination IP address2 IPsec protocol (AH or ESP)3 Cipher algorithm4 Secret key5 Security Parameter Index (SPI).

Tunneling 19/43

Page 48: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Security Association Datavase (SADB)

SPI src dest protocol cipher key

1 176.11.1.2 192.10.2.3 AH AES 0x4A5. . .

2 192.10.2.3 176.11.1.2 AH 3DES 0x56B. . .

Note that you need one entry for each direction.

Every packet includes the SPI so that the relevant keys andalgorithms can be found.

Tunneling 20/43

Page 49: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Internet Key Exchange (IKE)

Before two processes can start to communicate, they mustnegotiate SAs.

This is done using the Internet Key Exchange (IKE) protocol.

IKE runs in two phases:1 Set up an inital SA to encrypt subsequent communication:

use DiffieHellman key exchange to generate a shared secretkey K ;authenticate using pre-shared keys, signatures, or public-keyencryption;

2 Exchange SAs for the IPsec traffic (encrypt with K ).

Tunneling 21/43

Page 50: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Internet Key Exchange (IKE). . .

Alice

SPI src dst proto cipher key SPI src dst proto cipher key

Page 51: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Internet Key Exchange (IKE). . .

Alice

SPI src dst proto cipher key SPI src dst proto cipher key

Diffie-Hellman: Share K

Page 52: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Internet Key Exchange (IKE). . .

Alice

SPI src dst proto cipher key SPI src dst proto cipher key

Authenticate (pre-shared keys, ...)

Page 53: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Internet Key Exchange (IKE). . .

Alice

SPI . . . protocol . . .

1 . . . AES . . .2 . . . 3DES . . .

SPI . . . protocol . . .

1 . . . 3DES . . .2 . . . AES . . .

Cipher:3DES,Hash:SHA-1

Tunneling 22/43

Page 54: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Internet Key Exchange (IKE). . .

Alice

SPI . . . protocol . . .

1 . . . AES . . .2 . . . 3DES . . .

SPI . . . protocol . . .

1 . . . 3DES . . .2 . . . AES . . .

Cipher:AES,Hash:MD5

Tunneling 22/43

Page 55: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Integrity Check Value (ICV)

The ICV is a hash over the entire packet, including IPsecheader.

A HMAC is used, incorporating a shared secret key:1 The hash provides tamper-detection.2 The key provides authentication.

Tunneling 23/43

Page 56: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IPsec Encapsulating Security Payload Header (ESP)

Security Parameters Index (SPI) (32 bits)

Sequence Number (32 bits)

Encrypted Payload

Padding, Pad Length, Next Header

Authentication Data (MD5/SHA-1)

IPsec defines two modes, AH and ESP .

Tunneling 24/43

Page 57: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IPsec Encapsulating Security Payload Header (ESP)

Security Parameters Index (SPI) (32 bits)

Sequence Number (32 bits)

Encrypted Payload

Padding, Pad Length, Next Header

Authentication Data (MD5/SHA-1)

IPsec defines two modes, AH and ESP .

The AH mode only protects packet integrity, notconfidentiality.

Tunneling 24/43

Page 58: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IPsec Encapsulating Security Payload Header (ESP)

Security Parameters Index (SPI) (32 bits)

Sequence Number (32 bits)

Encrypted Payload

Padding, Pad Length, Next Header

Authentication Data (MD5/SHA-1)

IPsec defines two modes, AH and ESP .

The AH mode only protects packet integrity, notconfidentiality.

The Encapsulating Security Payload (ESP) mode alsoencrypts the payload.

Tunneling 24/43

Page 59: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Virtual Private Network (VPN)

Extend a private network (such as arizona.edu) over long physicaldistances.

Olden days: lease a private line.

Now-a-days: create a tunnel over the open Internet.

To a VPN user, accessing a remote network isindistinguishable from being connected directly to the network.

Two kinds:1 Remote Access VPN for roaming users2 Site-to-Site VPN for fixed networks.

Tunneling 25/43

Page 60: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Remote Access VPNs

AliceNAS

head-office.comIPsec tunnel

A Remote Access VPN connects a roaming user with a localnetwork.

The Network Access Server (NAS) is a VPN endpoint.

Tunneling 26/43

Page 61: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Site-to-Site VPNs

regional-office-A.comNAS

NAS head-office.com

regional-office-B.comNAS

IPsectunnel

IPsectunnel

A Site-to-Site VPN bridges two physically distant networks.Example: Connect the LANs at a company’s head andregional offices.Tunneling 27/43

Page 62: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Virtual Private Network — Problems

Tunnels allow you to circumvent firewall policies:1 Exfiltration : a malicious insider can leak information from the

company.2 Employees can surf unacceptable sites.

Tunneling 28/43

Page 63: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Outline

1 TunnelingSSHIPsecVPN

2 Intrusion DetectionPort Scanning

3 Summary

Intrusion Detection 29/43

Page 64: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Intrusion Detection

An Intrusion Detection System detects malicious activity on anetwork.

Two components:1 IDS sensors : collect real-time data about the network,2 IDS manager : compiles reports from sensors.

SNORT: http://www.youtube.com/watch?v=baxPhu1pA2M

Research projekt ReMIND: http://www.youtube.com/watch?v=onHg5glDg_0

Intrusion Detection 30/43

Page 65: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Sensor

Manager

Sensor

Page 66: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Sensor

Manager

Sensor

Page 67: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IDS Managers

The manager1 compiles reports from sensors,2 decides if an intrusion has occurred,3 raises an alarm

Intrusion Detection 32/43

Page 68: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IDS Sensors

The sensors1 collect information from routers, servers, . . . ,2 writes records to an audit log.

Audit log records:

[Subject,Object,Action,Error,Resource-Usage,Time-Stamp]

Examples:1 [Alice,/etc/passwd,read,no-error,5ms,05:30]2

[128.72.100.99,196.200.11.2,HTTP,error-404,1ms,15:23]

Intrusion Detection 33/43

Page 69: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IDS Techniques — NIDS

Network Intrusion Detection System (NIDS):

Where: edge of network;Examines: traffic patterns, packet content;Detects: malicious network behavior.

Performs deep packet inspection in incoming and outgoingtraffic.

Rule based : compare traffic with a database of attacksignatures.

Statistical : caompare traffic against baseline networkbehavior.

Intrusion Detection 34/43

Page 70: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IDS Techniques — PIDS

Protocol-Based Intrusion Detection System (PIDS):

Where: network host;Examines: specific protocol traffic;Detects: malicius content.

Examples:1 Web server runs a PID to detect and drop malicious HTTP

requests.2 PIDS detects malformed SQL queries between web server and

database server.

Intrusion Detection 35/43

Page 71: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

IDS Techniques — HIDS

Host-Based Intrusion Detection System (HIDS):

Where: single machine;Examines: system calls, resource usage, interprocesscommunication, system logs;Detects: malicius users.

A masquerader gains access using legitimate user’s identity.

Detect unusual behavior using heuristic rules or statisticalanalysis.

Amisfeasor is a legitimate user behaving badly.

Detect violations of rules describing (un)authorized actions.

A clandestine user deletes logs/audit files to cover up hisactions.

Monitor (and log!) changes to log/audit files.

Intrusion Detection 36/43

Page 72: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Attacks on IDSs

DOS: deliberately trigger many intrusion alerts!

Slow attacks!

Learn and mimic normal behavior!

Intrusion Detection 37/43

Page 73: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Port Scanning

Port Scanning looks for open ports on a server.

Information collected:

Open/Closed/Blocked connection?Server operating system?What service is running on a port?

Can be used by

good guys (is my network secure?)bad guys (what vulnerable services can I exploit?)

Intrusion Detection 38/43

Page 74: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Port Scanning — nmap

Nmap (”Network Mapper”) is an open source tool fornetwork exploration and security auditing. It wasdesigned to rapidly scan large networks, although it worksfine against single hosts. Nmap uses raw IP packets innovel ways to determine what hosts are available on thenetwork, what services (application name and version)those hosts are offering, what operating systems (and OSversions) they are running, what type of packetfilters/firewalls are in use, and dozens of othercharacteristics. While Nmap is commonly used forsecurity audits, many systems and network administratorsfind it useful for routine tasks such as network inventory,managing service upgrade schedules, and monitoring hostor service uptime.

Intrusion Detection 39/43

Page 75: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Port Scanning — nmapldots

nmap -A -T4 scanme.nmap.org

Intrusion Detection 40/43

Page 76: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SYN Scans

1 Send a TCP SYN packet to each port on the target.

2 Receive a SYN-ACK packet in return (the port is open!), closewith RET.

3 Otherwise, try next port.

Page 77: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SYN Scans

port 10: SYN

1 Send a TCP SYN packet to each port on the target.

2 Receive a SYN-ACK packet in return (the port is open!), closewith RET.

3 Otherwise, try next port.

Page 78: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SYN Scans

port 10: SYN

SYN-ACK ⇒ port open!

1 Send a TCP SYN packet to each port on the target.

2 Receive a SYN-ACK packet in return (the port is open!), closewith RET.

3 Otherwise, try next port.

Page 79: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SYN Scans

port 10: SYN

SYN-ACK ⇒ port open!

RET

1 Send a TCP SYN packet to each port on the target.

2 Receive a SYN-ACK packet in return (the port is open!), closewith RET.

3 Otherwise, try next port.

Page 80: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SYN Scans

port 11: SYN

1 Send a TCP SYN packet to each port on the target.

2 Receive a SYN-ACK packet in return (the port is open!), closewith RET.

3 Otherwise, try next port.

Page 81: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SYN Scans

port 11: SYN

NOTHING ⇒ port closed!

1 Send a TCP SYN packet to each port on the target.

2 Receive a SYN-ACK packet in return (the port is open!), closewith RET.

3 Otherwise, try next port.

Intrusion Detection 41/43

Page 82: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

SYN Scans

port 11: SYN

NOTHING ⇒ port closed!

1 Send a TCP SYN packet to each port on the target.

2 Receive a SYN-ACK packet in return (the port is open!), closewith RET.

3 Otherwise, try next port.

Intrusion Detection 41/43

Page 83: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Outline

1 TunnelingSSHIPsecVPN

2 Intrusion DetectionPort Scanning

3 Summary

Summary 42/43

Page 84: CSc466/566 ComputerSecurity 19: NetworkSecuritycollberg/Teaching/466-566/... · 2013. 4. 10. · 2 Client and Server exchange available cryptographic primitives. 3 Client and Server

Readings and References

Chapter 6 in Introduction to Computer Security, by Goodrichand Tamassia.

Summary 43/43