Network Security [Compatibility Mode]
Network Security [Compatibility Mode]
goals:
1. What is network security?
understand principles of network security:
2. Principles of cryptography
cryptography and its many uses beyond “confidentiality”
authentication 3. Authentication
message integrity 4. Integrity
key distribution 5. Key Distribution and certification
security in practice: 6. Access control: firewalls
firewalls
7. Attacks and counter measures
security in application, transport, network, link layers
8. Security in many layers
1 2
Who might Bob, Alice be? There are bad guys (and girls) out there!
Q: What can a “bad guy” do?
In real-life Bob and Alice may be two A: a lot!
persons who need secrecy in commn. eavesdrop: intercept messages
Web browser/server for electronic actively insert messages into connection
transactions (e.g., on-line purchases) impersonation: can fake (spoof) source
on-line banking client/server address in packet (or any field in packet)
DNS servers hijacking: “take over” ongoing connection
routers exchanging routing table updates
by removing sender or receiver, inserting
himself in place
other examples? (ARP requestor and
denial of service: prevent service from
responder, Network Managements etc….) being used by others (e.g., by
overloading resources)
5 6
1
The language of cryptography
Alice’s Bob’s
K encryption
Principles of cryptography A
key
K decryption
B key
11 12
2
Objectives
❏ To review a short history of DES The Data Encryption Standard (DES) is a symmetric-
symmetric-
key block cipher published by the National Institute of
❏ To define the basic structure of DES Standards and Technology (NIST).
(NIST).
In 1973, NIST published a request for proposals for a DES is a block cipher, as shown in Figure 6.1.
national symmetric-key cryptosystem. A proposal from
IBM, a modification of a project called Lucifer, was Figure 6.1 Encryption and decryption with DES
accepted as DES. DES was published in the Federal
Register in March 1975 as a draft of the Federal
Information Processing Standard (FIPS).
3
6.2.1 Initial and Final Permutations 6.2.1 Continue
Solution Solution
Only bit 25 and bit 63 are 1s; the other bits are 0s. In the final The input has only two 1s; the output must also have only two 1s.
permutation, bit 25 becomes bit 64 and bit 63 becomes bit 15 15.. Using Table 6.1, we can find the output related to these two bits
bits..
The result is Bit 15 in the input becomes bit 63 in the output.
output. Bit 64 in the
input becomes bit 25 in the output.
output. So the output has only two 1s,
bit 25 and bit 63
63.. The result in hexadecimal is
Note
The initial and final permutations are straight P-boxes that are
inverses
of each other.
Figure 6.4
They have no cryptography significance in DES. A round in DES
(encryption site)
4
6.2.2 Continued 6.2.2 Continue
DES Function
Expansion P-box
The heart of DES is the DES function. The DES function
applies a 48-bit key to the rightmost 32 bits to produce a Since RI−1 is a 32-bit input and KI is a 48-bit key, we first
32-bit output. need to expand RI−1 to 48 bits.
Although the relationship between the input and output can Whitener (XOR)
be defined mathematically, DES uses Table 6.2 to define After the expansion permutation, DES uses the XOR
this P-box. operation on the expanded right section and the round key.
Note that both the right section and the key are 48-bits in
Table 6.6 Expansion P-box table
length. Also note that the round key is used only in this
operation.
5
6.2.2 Continue 6.2.2 Continued
Example 6.3
Table 6.3 shows the permutation for S-box 1. For the rest of
the boxes see the textbook. The input to S-box 1 is 10001
00011
1. What is the output?
Solution
If we write the first and the sixth bits together, we get 00 in
binary, which is 0 in decimal
decimal.. The remaining bits are 0000 in
binary, which is 0 in decimal
decimal.. We look for the value in row 0,
column 0, in Table 6.10 (S(S--box 8). The result is 13 in decimal,
which is 1101 in binary.
binary. So the input 000000 yields the output
1101..
1101
First Approach
To achieve this goal, one approach is to make the last
round (round 16) different from the others; it has only a
mixer and no swapper.
Note
6
6.2.3 Continued 6.2.3 Continued
Algorithm 6.1 Pseudocode for DES cipher (Continued) Algorithm 6.1 Pseudocode for DES cipher (Continued)
Alternative Approach
We can make all 16 rounds the same by including one
swapper to the 16th round and add an extra swapper after
that (two swappers cancel the effect of each other).
Figure 6.10
Key Generation Key generation
7
6.2.3 Continued 6.2.3 Continued
8
6.2.4 Continued
6-3 DES ANALYSIS
Example 6.6
Let us see how Bob, at the destination, can decipher the Critics have used a strong magnifier to analyze DES
DES..
ciphertext received from Alice using the same key
key.. Table 6.16
Tests have been done to measure the strength of some
shows some interesting points
points..
desired properties in a block cipher
cipher..
To check the avalanche effect in DES, let us encrypt two plaintext Table 6.17 Number of bit differences for Example 6.7
blocks (with the same key) that differ only in one bit and observe
the differences in the number of bits in each round
round..
S-Boxe
Completeness effect The design provides confusion and diffusion of bits from
Completeness effect means that each bit of the ciphertext each round to the next.
needs to depend on many bits on the plaintext.
P-Boxes
They provide diffusion of bits.
Number of Rounds
DES uses sixteen rounds of Feistel ciphers. the ciphertext is
thoroughly a random function of plaintext and ciphertext.
9
6.3.3 DES Weaknesses 6.3.3 Continued
Example 6.8
During the last few years critics have found some Let us try the first weak key in Table 6.18 to encrypt a block two
weaknesses in DES. times.. After two encryptions
times
Weaknesses in Cipher Design with the same key the original plaintext block is created
created.. Note
1. Weaknesses in S-boxes that we have used the encryption algorithm two times, not one
encryption followed by another decryption.
decryption.
2. Weaknesses in P-boxes
3. Weaknesses in Key
10
6.3.3 Continued 6.3.3 Continued
Example 6.9
DES has a key domain of 256. The total number of the above keys
are 64 (4 + 12 + 48)
48). The probability of choosing one of these
keys is 8.8 × 10−16, almost impossible
impossible..
6.3.3 Continued
6-4 Multiple DES
Example 6.10
A substitution that maps every possible input to every The first approach is to use double DES (2DES).
possible output is a group
group..
Meet-in-the-Middle Attack
Figure 6.13 Composition of mapping However, using a known-plaintext attack called meet-in-
the-middle attack proves that double DES improves this
vulnerability slightly (to 257 tests), but not tremendously (to
2112).
11
6.4.1 Continued 6.4.1 Continued
12
6.5.2 Differential Cryptanalysis 6.5.3 Linear Cryptanalysis
It has been revealed that the designers of DES already Linear cryptanalysis is newer than differential
knew about this type of attack and designed S-boxes and cryptanalysis. DES is more vulnerable to linear
chose 16 as the number of rounds to make DES specifically cryptanalysis than to differential cryptanalysis. S-boxes are
resistant to this type of attack. not very resistant to linear cryptanalysis. It has been shown
that DES can be broken using 243 pairs of known plaintexts.
However, from the practical point of view, finding so many
Note pairs is very unlikely.
We show an example of DES differential cryptanalysis in
Appendix N. Note
We show an example of DES linear cryptanalysis in Appendix
N.
But users in commerce and finance are not This should have thwarted brute-force
ready to give up on DES. attacks?
Wrong!
Solution: to use multiple DES with multiple keys
75 76
Meet-in-the-Middle Attack on
Triple DES with Two Keys
2DES
2-DES: C = EK2(EK1(P)) A straightforward implementation would be:
So, X = EK1(P) = DK2(C) C = EK1(EK2(EK1(P)))
Given a known pair (P, C), attack as follows: In practice: C = EK1(DK2(EK1(P)))
Encrypt P with all 256 possible keys for K1. Also referred to as EDE encryption
Decrypt C with all 256 possible keys for K2. Reason: if K1=K2, then 3DES = 1DES. Thus, a 3DES
If EK1’(P) = DK2’(C), try the keys on another (P’, C’). software can be used as a single-DES.
If works, (K1’, K2’) = (K1, K2) with high probability. Standardized in ANSI X9.17 & ISO8732
Takes O(256) steps; not much more than attacking 1- No current known practical attacks
DES.
What about the meet-in-the-middle attack?
77 78
13
Meet-in-the-Middle Attack on 3DES
Triple DES with Three Keys
K1 K2 K1
Encryption: C = EK3(DK2(EK1(P))).
A B
P E D E C If K1 = K3, we have 3DES with 2 keys.
Given known (Plaintext, Ciphertext) pairs i.e. (P, C), (P’, C’) etc.
If K1 = K2 = K3, we have the regular DES.
1. For each possible key for K1, encrypt P to produce a possible
value for A.
So, 3DES w/ 3keys is backward compatible
2. Using this A, and C, attack the 2-DES to obtain a pair of keys with 3DES w/ 2 keys and with the regular DES
(K2, K1’).
3. If K1’ = K1, try the key pair (K1, K2) on another (C’,P’). Some internet applications have adopted 3DES
4. If it works, (K1, K2) is the key pair with high probability.
with three keys.
E.g. PGP and S/MIME.
5. It takes O(255 x 256) = O(2111) steps on average.
79 80
14
Public key cryptography Public key encryption algorithms
K
+ Bob’s public
B key
Requirements:
-
K Bob’s private
B key
+ . .
1 need KB( ) and K - ( ) such that
B
- +
K (K (m)) = m
B B
plaintext encryption ciphertext decryption plaintext +
message, m algorithm + algorithm message 2 given public key KB , it should be
K (m)
B - +
m = K B(K (m)) impossible to compute
B -
private key KB
Bob chooses p=5, q=7. Then n=35, z=24. Useful number theory result: If p,q prime and
e=5 (so e, z relatively prime). n = pq, then: y y mod (p-1)(q-1)
d=29 (so ed-1 exactly divisible by z. x mod n = x mod n
e
(m mod n) d mod n = m edmod n
letter m me c = me mod n
encrypt: ed mod (p-1)(q-1)
l 12 1524832 17 = m mod n
(using number theory result above)
d 1
decrypt:
c c m = cd mod n letter = m mod n
17 481968572106750915091411825223071697 12 l (since we chose ed to be divisible by
(p-1)(q-1) with remainder 1 )
= m
89 90
15
RSA: another important property
The following property will be very useful later:
- +
K (K (m)) = m = K (K (m))
+ - Authentication
B B B B
91 92
Authentication Authentication
Goal: Bob wants Alice to “prove” her identity Goal: Bob wants Alice to “prove” her identity
to him to him
Protocol 1.0: Alice says “I am Alice” Protocol 1.0: Alice says “I am Alice”
“I am Alice” in a network,
Failure scenario?? Bob can not “see”
Alice, so Trudy simply
“I am Alice” declares
herself to be Alice
93 94
Alice’s
IP address
“I am Alice”
95 96
16
Authentication: another try Authentication: another try
Protocol 3.0: Alice says “I am Alice” and sends her Protocol 3.0: Alice says “I am Alice” and sends her
secret password to “prove” it. secret password to “prove” it.
Alice’s Alice’s
“I’m Alice”
IP addr password
97 98
Alice’s encrypted
“I’m Alice”
IP addr password
99 100
17
Protocol 5.0: security hole Protocol5.0: security hole
Man (woman) in the middle attack: Trudy poses as Man (woman) in the middle attack: Trudy poses as
Alice (to Bob) and as Bob (to Alice) Alice (to Bob) and as Bob (to Alice)
I am Alice I am Alice
R -
K (R)
T
R - Send me your public key
K (R) + Difficult to detect:
A K
Send me your public key
T Bob receives everything that Alice sends, and vice
+
K versa. (e.g., so Bob, Alice can meet one week later and
A +
K (m) recall conversation)
Trudy gets T
- + problem is that Trudy receives all messages as well!
+ m = K (K (m))
K (m)
A sends T T Alice
m to
- + encrypted with
m = K (K (m))
A A Alice’s public key
103 104
Digital Signatures
Cryptographic technique similar to
Message integrity hand-written signatures.
sender (Bob) digitally signs document,
establishing he is document
owner/creator.
verifiable, nonforgeable: recipient
(Alice) can prove to someone that
Bob, and no one else (including Alice),
must have signed document
105 106
18
Message Digests Internet checksum: poor crypto hash
large
message
H: Hash
Function
function
m
Computationally expensive Internet checksum has some properties of hash function:
to public-key-encrypt produces fixed length digest (16-bit sum) of message
H(m)
long messages is many-to-one
Goal: fixed-length, easy- Hash function properties:
to-compute digital many-to-1
But given message with given hash value, it is easy to find
“fingerprint” another message with same hash value:
produces fixed-size msg
apply hash function H digest (fingerprint) message ASCII format message ASCII format
to m, get fixed size given message digest x, IOU1 49 4F 55 31 IOU9 49 4F 55 39
message digest, H(m). computationally impossible 00.9 30 30 2E 39 00.1 30 30 2E 31
to find m, such that x = 9BOB 39 42 D2 42 9BOB 39 42 D2 42
H(m) B2 C1 D2 AC
B2 C1 D2 AC different messages
Given m, no one can find m’ but identical checksums!
such that H(m’)=H(m) 109 110
equal
?
111 112
Trusted Intermediaries
Symmetric key problem: Public key problem:
Key distribution and certification How do two entities When Alice obtains
establish shared secret Bob’s public key (from
key over network? web site, e-mail,
Solution: diskette), how does she
know it is Bob’s public
trusted key distribution
key, not Trudy’s?
center (KDC) acting as
intermediary between Solution:
entities trusted certification
authority (CA)
113 114
19
Key Distribution Center (KDC) Key Distribution Center (KDC)
Alice, Bob need shared symmetric key. Q: How does KDC allow Bob, Alice to determine shared
KDC: server shares different secret key with each
symmetric secret key to communicate with each other?
registered user (many users)
KDC
Alice, Bob know own symmetric keys, KA-KDC KB-KDC , for generates
KA-KDC(A,B)
communicating with KDC. R1
KZ-KDC
Alice and Bob communicate: using R1 as
KA-KDC KB-KDC
session key for shared symmetric encryption
115 116
A certificate contains:
Serial number (unique to issuer)
info about certificate owner, including algorithm
and key value itself (not shown)
info about Access control: firewalls
certificate
issuer
valid dates
digital
signature by
issuer
119 120
20
Firewalls Firewalls: Why
firewall prevent denial of service attacks:
isolates organization’s internal net from larger SYN flooding: attacker establishes many false
Internet, allowing some packets to pass, TCP connections, no resources left for “real”
blocking others. connections.
prevent illegal modification/access of internal data.
e.g., attacker replaces CIA’s (Central Intelligent
Agency) homepage with something else
allow only authorized access to inside network (set of
authenticated users/hosts)
administered public
network Internet two types of firewalls:
application-level
firewall
packet-filtering
121 122
Should arriving
Packet Filtering packet be allowed Packet Filtering
in? Departing packet
let out? Example 1: block incoming and outgoing
datagrams with IP protocol field = 17 and with
either source or dest port = 23.
All incoming and outgoing UDP flows and telnet
connections are blocked.
Example 2: Block inbound TCP segments with
internal network connected to Internet via ACK=0.
router firewall
Prevents external clients from making TCP
router filters packet-by-packet, decision to
forward/drop packet based on: connections with internal clients, but allows
source IP address, destination IP address internal clients to connect to outside.
TCP/UDP source and destination port numbers
ICMP message type
TCP SYN and ACK bits
123 124
Example 3: Designing a
packet filtering rules set
Packet Filtering for a network with IP Application gateways gateway-to-remote
address 222.22/16. host telnet session
host-to-gateway
Allow 111.11/16 address to
telnet session
access the subnet
Rule Source Destn Action 222.22.22/24 Filters packets on
Disallow 111.11.11/24
address to access the application data as well application
gateway
router and filter
R1 111.11/16 222.22.22/24 Permit network. as on IP/TCP/UDP fields.
For all other addresses
R2 111.11.11/24 222.22/16 Deny disallow access. Example: allow selected
What will be the actions internal users to telnet
for the following incoming
R3 0.0.0.0/0 0.0.0.0/0 Deny
pkts? outside.
S:111.11.11.1, D: 222.22.6.6
S:111.11.11.1, D:222.22.22.2 1. Require all telnet users to telnet through gateway.
S:111.11.6.6, D:222.22.22.2
S:111.11.6.6, D:222.22.6.6 2. For authorized users, gateway sets up telnet connection to
The packets will be processed dest host. Gateway relays data between 2 connections
by matching the rules one 3. Router filter blocks all telnet connections not originating
after another, and the first from gateway.
matched rule will be fired.
125 126
21
Limitations of firewalls and gateways
Countermeasures?
129 130
A C A C
22
Internet security threats Internet security threats
IP Spoofing: IP Spoofing: ingress filtering
can generate “raw” IP packets directly from routers should not forward outgoing packets
application, putting any value into IP source with invalid source addresses (e.g., datagram
address field source address not in router’s network)
receiver can’t tell if source is spoofed great, but ingress filtering can not be mandated
e.g.: C pretends to be B for all networks
A C A C
B B
Countermeasures?
133 134
A C A C
SYN SYN
SYN SYN
SYN SYN SYN SYN SYN SYN
B B
SYN SYN
Countermeasures?
SYN SYN
135 136
Secure e-mail
Alice wants to send confidential e-mail, m, to Bob.
Security in many layers
KS
Secure email
m KS( ) . KS(m ) KS(m )
KS( ) . m
Secure sockets
+ -
IPsec Internet KS
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.
137 138
23
Secure e-mail Secure e-mail (continued)
Alice wants to send confidential e-mail, m, to Bob. • Alice wants to provide sender authentication
KS message integrity.
KS
+
KB( ). + +
-
KB( ) . + Internet
- compare
KB(KS ) KB(KS )
H(.)
+ K
-
KB B m H(m )
m
Bob:
uses his private key to decrypt and recover KS • Alice digitally signs message.
uses KS to decrypt KS(m) to recover m
• sends both message (in the clear) and digital signature.
139 140
24
IPsec: Network Layer Security Authentication Header (AH) Protocol
Network-layer secrecy:
provides source AH header includes:
sending host encrypts the
For both AH and ESP, source, authentication, data connection identifier
destination handshake: integrity, no
data in IP datagram authentication data:
create network-layer confidentiality
TCP and UDP segments; source- signed message
logical channel called a
ICMP and SNMP AH header inserted digest calculated over
security association (SA)
messages. between IP header,
Each SA unidirectional. original IP datagram.
Network-layer authentication
Uniquely determined by: data field. next header field:
destination host can
authenticate source IP security protocol (AH or protocol field: 51 specifies type of data
address ESP) intermediate routers (e.g., TCP, UDP, ICMP)
source IP address
Two principle protocols: process datagrams as
32-bit connection ID
authentication header usual
(AH) protocol
encapsulation security IP header AH header data (e.g., TCP, UDP segment)
payload (ESP) protocol
145 146
147 148
149 150
25
802.11 WEP encryption Breaking 802.11 WEP encryption
IV
Security hole:
(per frame) 24-bit IV, one IV per frame, -> IV’s eventually reused
key sequence generator
IV transmitted in plaintext -> IV reuse detected
KS: 40-bit
secret ( for given KS, IV)
Attack:
symmetric
k1IV k2IV k3IV … kNIV kN+1IV… kN+1IV 802.11 WEP-encrypted data
key IV
header plus CRC
Trudy causes Alice to encrypt known plaintext d1 d2
plaintext
frame data d1 d2 d3 … dN CRC1 … CRC4
plus CRC d3 d4 …
IV
Trudy sees: ci = di XOR ki
c1 c2 c3 … cN cN+1 … cN+4
151 152
153
26