PGP and SSL
Compiled by
Dr. Avita Katal
Assistant Professor(SG)
Cloud Software Operations Cluster
School of Computer Science
UPES, Dehradun
Roadmap
1.1 Securing e-mail
1.2 Securing TCP connections: SSL
1.3 Network layer security: IPsec
1.4 Securing wireless LANs
1.5 Operational security: firewalls and IDS
8: Network Security 8-2
Secure e-mail
Alice wants to send confidential e-mail, m, to Bob.
KS
m K ( .)
S
KS(m
)
KS(m
) KS( ) . m
+ Internet - KS
KS
+
KB( ). + +
-
KB( ) .
KB(KS ) KB(KS )
K+
B KB-
Alice:
generates random symmetric private key, KS.
encrypts message with KS (for efficiency)
also encrypts KS with Bob’s public key.
sends both KS(m) and KB(KS) to Bob.
Secure e-mail
Alice wants to send confidential e-mail, m, to Bob.
KS
m K ( .)
S
KS(m
)
KS(m
) KS( ) . m
+ Internet - KS
KS
+
KB( ). + +
-
KB( ) .
KB(KS ) KB(KS )
K+
B KB-
Bob:
uses his private key to decrypt and
recover KS
uses KS to decrypt KS(m) to recover m
8: Network Security 8-4
Secure e-mail (continued)
• Alice wants to provide sender authentication and message
integrity.
KA- K+
A
m H( ) . -
KA( ) . -
KA(H(m))
-
KA(H(m)) +
KA( ). H(m )
+ Internet - compare
m H( ). H(m )
m
• Alice digitally signs message.
•sends both message (in the clear) and digital signature.
8: Network Security 8-5
Secure e-mail (continued)
• Alice wants to provide secrecy, sender authentication,
message integrity.
KA-
-
m .
H( )
-
KA( ). KA(H(m))
KS
+ KS( ).
m + Internet
KS
+
KB( ). +
KB(KS )
K+
B
Alice uses three keys: her private key, Bob’s public key, newly
created symmetric key
8: Network Security 8-6
Pretty good privacy (PGP)
A PGP signed message:
• Internet e-mail encryption scheme, de-facto
standard. ---BEGIN PGP SIGNED MESSAGE---
Hash: SHA1
• uses symmetric key cryptography, public key
cryptography, hash function, and digital Bob:My husband is out of town
[Link] yours,
signature as described. Alice
• provides secrecy, sender authentication, ---BEGIN PGP SIGNATURE---
integrity. Version: PGP 5.0
Charset: noconv
• inventor, Phil Zimmerman, was target of 3-year yhHJRHhGJGhgg/
federal investigation. 12EpJ+lo8gE4vB3mqJhFEvZP9t6n7G6
m5Gw2
---END PGP SIGNATURE---
8: Network Security 8-7
roadmap
1.1 Securing e-mail
1.2 Securing TCP connections: SSL
1.3 Network layer security: IPsec
1.4 Securing wireless LANs
1.5 Operational security: firewalls and IDS
8: Network Security 8-8
Secure sockets layer (SSL)
• provides transport layer security to any TCP-based application using SSL
services.
• e.g., between Web browsers, servers for e-commerce (shttp)
• security services:
• server authentication, data encryption, client authentication (optional)
Application
Application
SSL sublayer SSL
TCP TCP TCP socket
socket
IP IP
TCP API TCP enhanced with SSL
8: Network Security 8-9
SSL: three phases
TCP SYN
1. Handshake:
• Bob establishes TCP P SY NACK
TC
connection to Alice.
TCP ACK
• authenticates Alice via CA
signed certificate SSL hello
• creates, encrypts (using c ate
ce r tifi
Alice’s public key), sends
master secret key to Alice
• nonce exchange not shown create
Master
Secret KA +(MS)
(MS) decrypt
using KA-
to get MS
8: Network Security 8-10
SSL: three phases
2. Key Derivation:
• Alice, Bob use shared secret (MS) to generate 4 keys:
• EB: Bob->Alice data encryption key
• EA: Alice->Bob data encryption key
• MB: Bob->Alice MAC key
• MA: Alice->Bob MAC key
• encryption and MAC algorithms negotiable between Bob,
Alice.
8: Network Security 8-11
SSL: three phases
3. Data transfer
TCP byte stream b1b2b3 … bn
block n bytes together d MB
.
H( )
compute
MAC
d H(d)
EB
.
H( ) SSL
encrypt d,
MAC, SSL
seq. #
seq. #
d H(d)
SSL record
format Type Ver Len d H(d)
unencryptedencrypted using EB
8: Network Security 8-12
roadmap
1.1 Securing e-mail
1.2 Securing TCP connections: SSL
1.3 Network layer security: IPsec
1.4 Securing wireless LANs
1.5 Operational security: firewalls and IDS
8: Network Security 8-13
IPsec: Network Layer Security
• network-layer secrecy: • for both AH and ESP, source, destination handshake:
• create network-layer logical channel called a security association (SA)
• sending host encrypts the data
in IP datagram • each SA unidirectional.
• TCP and UDP segments; ICMP • uniquely determined by:
• security protocol (AH or ESP)
and SNMP messages.
• source IP address
• network-layer authentication • 32-bit connection ID
• destination host can • A 32-bit identifier for the SA, called the Security Parameter Index (SPI)
authenticate source IP address • The origin interface of the SA and the destination interface of the SA
• two principal protocols: • The type of encryption to be used (for example, 3DES with CBC)
• authentication header (AH) • The encryption key
protocol • The type of integrity check (for example, HMAC with MD5)
• encapsulation security • The authentication key
payload (ESP) protocol • An IPsec entity stores the state information for all of its SAs in its
Security
• Association Database (SAD), which is a data structure in the entity’s OS
kernel.
8: Network Security 8-14
Authentication Header (AH)
Protocol
• provides source AH header includes:
authentication, data • connection identifier
integrity, no confidentiality
• authentication data: source-
• AH header inserted between signed message digest
IP header, data field. calculated over original IP
• protocol field: 51 datagram.
• intermediate routers process • next header field: specifies
datagrams as usual. type of data (e.g., TCP, UDP,
ICMP)
IP header AH header data (e.g., TCP, UDP segment)
8: Network Security 8-15
ESP Protocol
• provides secrecy, host • ESP authentication field is
authentication, data integrity. similar to AH
• data, ESP trailer encrypted. authentication field.
• next header field is in ESP • Protocol = 50.
trailer.
authenticated
encrypted
ESP ESP ESP
IP header TCP/UDP segment
header trailer authent
.
8: Network Security 8-16
roadmap
1.1 Securing e-mail
1.2 Securing TCP connections: SSL
1.3 Network layer security: IPsec
1.4 Operational security: firewalls and IDS
8: Network Security 8-17
Firewalls
firewall
isolates organization’s internal net from larger Internet,
allowing some packets to pass, blocking others.
administered public
network Internet
firewall
8: Network Security 8-18
Firewalls: Why
prevent denial of service attacks:
SYN flooding: attacker establishes many bogus
TCP connections, no resources left for “real”
connections
prevent illegal modification/access of internal data.
e.g., attacker replaces CIA’s homepage with
something else
allow only authorized access to inside network (set of
authenticated users/hosts)
three types of firewalls:
stateless packet filters
stateful packet filters
application gateways
8: Network Security 8-19
Stateless packet filtering
Should arriving
packet be allowed
in? Departing
packet let out?
• internal network connected to Internet via router firewall
• router filters packet-by-packet, decision to forward/drop
packet based on:
• source IP address, destination IP address
• TCP/UDP source and destination port numbers
• ICMP message type
• TCP SYN and ACK bits
8: Network Security 8-20
Stateless packet filtering: example
• example 1: block incoming and outgoing datagrams with
IP protocol field = 17 and with either source or dest port
= 23.
• all incoming, outgoing UDP flows and telnet
connections are blocked.
• example 2: Block inbound TCP segments with ACK=0.
• prevents external clients from making TCP
connections with internal clients, but allows internal
clients to connect to outside.
8: Network Security 8-21
Stateless packet filtering: more
examples
Policy Firewall Setting
No outside Web access. Drop all outgoing packets to any IP
address, port 80
No incoming TCP connections, Drop all incoming TCP SYN packets
except those for institution’s to any IP except [Link],
public Web server only. port 80
Prevent Web-radios from eating Drop all incoming UDP packets -
up the available bandwidth. except DNS and router broadcasts.
Prevent your network from Drop all ICMP packets going to a
being used for a smurf DoS “broadcast” address (eg
attack. [Link]).
Prevent your network from Drop all outgoing ICMP TTL expired
being tracerouted traffic
8: Network Security 8-22
Access Control Lists
ACL: table of rules, applied top to bottom to
incoming packets: (action, condition) pairs
source dest source dest flag
action protocol
address address port port bit
222.22/1 outside of any
allow TCP > 1023 80
6 222.22/16
outside
allow of 222.22/16
TCP 80 > 1023 ACK
222.22/1
6
222.22/1 outside of
allow UDP > 1023 53 ---
6 222.22/16
outside
allow of 222.22/16
UDP 53 > 1023 ----
222.22/1
6
deny all all all all all
8: Network Security
all 8-23
Stateful packet filtering
• stateless packet filter: heavy handed tool
• admits packets that “make no sense,” e.g., dest port = 80, ACK
bit set, even though no TCP connection established:
source dest source dest flag
action protocol
address address port port bit
allow outside of 222.22/16
TCP 80 > 1023 ACK
222.22/16
stateful packet filter: track status of every TCP
connection
track connection setup (SYN), teardown (FIN): can
determine whether incoming, outgoing packets “makes
sense”
timeout inactive connections at firewall: no longer admit
packets 8: Network Security 8-24
Stateful packet filtering
ACL augmented to indicate need to check
connection state table before admitting
packet
source dest source dest flag check
action proto
address address port port bit conxion
outside of any
allow 222.22/16 TCP > 1023 80
222.22/16
allow outside of 222.22/16
TCP 80 > 1023 ACK x
222.22/16
outside of
allow 222.22/16 UDP > 1023 53 ---
222.22/16
allow outside of 222.22/16 x
UDP 53 > 1023 ----
222.22/16
deny all all all all all all
8-25
8: Network Security
gateway-to-remote
Application gateways host telnet session
host-to-gateway
telnet session
• filters packets on application
data as well as on IP/TCP/UDP application router and filter
gateway
fields.
• example: allow select internal
users to telnet outside.
1. require all telnet users to telnet through gateway.
2. for authorized users, gateway sets up telnet connection
to dest host. Gateway relays data between 2
connections
3. router filter blocks all telnet connections not originating
from gateway.
8: Network Security 8-26
Limitations of firewalls and gateways
• IP spoofing: router can’t • filters often use all or
know if data “really” comes nothing policy for UDP.
from claimed source • tradeoff: degree of
• if multiple app’s. need communication with
special treatment, each has outside world, level of
own app. gateway. security
• client software must know • many highly protected
how to contact gateway. sites still suffer from
• e.g., must set IP address of attacks.
proxy in Web browser
8: Network Security 8-27
Intrusion detection systems
• packet filtering:
• operates on TCP/IP headers only
• no correlation check among sessions
• IDS: intrusion detection system
• deep packet inspection: look at packet contents (e.g.,
check character strings in packet against database of
known virus, attack strings)
• examine correlation among multiple packets
• port scanning
• network mapping
• DoS attack
8: Network Security 8-28
Intrusion detection systems
• multiple IDSs: different types of checking at
different locations
application firewall
gateway
Internet
internal
network Web
IDS server DNS
sensors server
FTP
server demilitarized
zone
8: Network Security 8-29
Network Security (summary)
Basic techniques…...
• cryptography (symmetric and public)
• message integrity
• end-point authentication
…. used in many different security scenarios
• secure email
• secure transport (SSL)
• IP sec
• 802.11
Operational Security: firewalls and IDS
8: Network Security 8-30