15-440 Distributed Systems
Fall 2016
L-23 Security
1
Today's Lecture
Internet security weaknesses
Establishing secure channels (Crypto 101)
Key distribution
2
What is “Internet Security” ?
Denial-of-Service
Password
Traffic Cracking
Worms & Viruses modification
Trojan Horse
DNS Poisoning
Phishing
Spyware
IP Spoofing
End-host Route Hijacks Traffic
impersonation Eavesdropping
Spam
Internet Security: Prevent bad things from happening on the internet!
Internet Design Decisions:
(ie: how did we get here? )
Originas a small and cooperative network
( largely trusted infrastructure)
Global Addressing (every
sociopath is your next-door neighbor)
Connection-less datagram service
(can’t verify source, hard to protect
bandwidth)
Internet Design Decisions:
(ie: how did we get here? )
Anyone can connect
( ANYONE can connect)
Millionsof hosts run nearly identical
software
( single exploit can create epidemic)
Most Internet users know about as much as
Senator Stevens aka “the tubes guy”
( God help us all…)
Our “Narrow” Focus
Yes:
1) Creating a “secure channel” for
communication
Some:
2) Protecting resources and limiting
connectivity
No:
1) Preventing software vulnerabilities &
malware, or “social engineering”.
Secure Communication with an Untrusted
Infrastructure
Bob
ISP
ISPD
D
ISP
ISPBB
ISP
ISPCC
ISP
ISPA
A
Alice
What do we need for a secure
communication channel?
Authentication (Who am I talking to?)
Confidentiality (Is my data hidden?)
Integrity (Has my data been modified?)
Availability (Can I reach the destination?)
Example: Eavesdropping - Message
Interception (Attack on Confidentiality)
Mallory
Bob
ISP
ISPD
D
ISP
ISPBB
ISP
ISPCC
ISP
ISPA
A
Alice
Eavesdropping Attack: Example
tcpdump with promiscuous network
interface
On a switched network, what can you see?
What might the following traffic types reveal
about communications?
Full IP packets with unencrypted data
Full IP packets with encrypted payloads
Just DNS lookups (and replies)
slide derived from original by Nick Feamster
Authenticity Attack - Fabrication
ISP
ISPD
D
ISP
ISPBB
ISP
ISPCC
ISP
ISPA
A
Alice
Hello, I’m
“Bob”
Integrity Attack - Tampering
Stop the flow of the message
Delay and optionally modify the message
Release the message again
Alice Bob
Perpetrator
slide derived from original by Nick Feamster
Attack on Availability
Destroy hardware (cutting fiber) or software
Modify software in a subtle way
Corrupt packets in transit
Alice Bob
Blatant denial of service (DoS):
Crashing the server
Overwhelm the server (use up its resource)
slide derived from original by Nick Feamster
Example: Web access
Alice wants to connect to her bank to
transfer some money...
Alice wants to know ...
that she’s really connected to her bank. Authentication
That nobody can observe her financial data Confidentiality
That nobody can modify her request Integrity
That nobody can steal her money! (A mix)
The bank wants to know ...
That Alice is really Alice (or is authorized to act for
Alice)
The same privacy things that Alice wants so they
don’t get sued or fined by the government.
16
Today's Lecture
Internet security weaknesses
Crypto 101
Key distribution
17
Cryptography As a Tool
Using cryptography securely is not simple
Designing cryptographic schemes correctly
is near impossible.
Today we want to give you an idea of what
can be done with cryptography.
Take a security course if you think you may
use it in the future (e.g. 18-487)
Well...
What tools do we have at hand?
Hashing
e.g., SHA-1
Secret-key cryptography, aka symmetric
key.
e.g., AES
Public-key cryptography
e.g., RSA
19
Secret Key Cryptography
Given a key k and a message m
Two functions: Encryption (E), decryption (D)
ciphertext c = E(k, m)
plaintext m = D(k, c)
Both use the same key k.
Hello,Bob
“secure” channel
Alice Bob.com
knows K knows K
But... how does that help with authentication?
They both have to know a pre-shared key K before they start!
20
Symmetric Key: Confidentiality
Motivating Example:
You and a friend share a key K of L random
bits, and a message M also L bits long.
Scheme:
You send her the xor(M,K) and then they
“decrypt” using xor(M,K) again.
1) Do you get the right message to your friend?
2) Can an adversary recover the message M?
Symmetric Key: Confidentiality
One-time Pad (OTP) is secure but usually
impractical
Key is as long at the message
Keys cannot be reused (why?)
In practice, two types of ciphers are
used that require only constant key
length:
Stream Block Ciphers:
Ciphers: Ex: DES, AES,
Ex: RC4, A5 Blowfish
Symmetric Key: Confidentiality
Stream Ciphers (ex: RC4)
Alice: PRNG Pseudo-Random stream of L bits
K XOR
A-B
Message of Length L bits
=
Encrypted Ciphertext
Bob uses KA-B as PRNG seed, and XORs encrypted
text to get the message back (just like OTP).
Symmetric Key: Confidentiality
Block Ciphers (ex: AES)
Block 1 Block 2 Block 3 Block 4 (fixed block size,
e.g. 128 bits)
Round Round Round
#1 #2 #n
Alice:
K A-B
Block 1 Block 2 Block 3 Block 4
Bob breaks the ciphertext into blocks, feeds it
through decryption engine using KA-B to recover
the message.
Symmetric Key: Integrity
Background: Hash Function Properties
Consistent hash(X) always yields same result
One-way given X, can’t find Y s.t. hash(Y) = X
Collision resistant given hash(W) = Z, can’t find X such
that hash(X) = Z
Hash Fn Fixed Size
Message of arbitrary length Hash
Symmetric Key: Integrity
Hash Message Authentication Code (HMAC)
Hash Fn
Step #1:
Message
Alice creates MAC
MAC
K A-B
Alice Transmits Message &
Step Step #3
MAC
#2 Bob computes MAC with
message and KA-B to
MAC Message
verify.
Why is this secure from a message
integrity perspective? How do
properties of a hash function help us?
Symmetric Key: Authentication
You already know how to do this!
(hint: think about how we showed
integrity)
Hash Fn
I am Bob
A43FF234
K A-B
Wrong!
Alice receives the hash, computes a hash with KA-B ,
and she knows the sender is Bob
Symmetric Key: Authentication
What if Mallory overhears the hash sent by
Bob, and then “replays” it later?
ISP
ISPD
D
ISP
ISPBB
ISP
ISPCC
ISP
ISPA
A Hello, I’m
Bob. Here’s
A43FF234
the hash to
“prove” it
Symmetric Key: Authentication
A “Nonce”
A random bitstring used only once. Alice sends nonce to
Bob as a “challenge”. Bob Replies with “fresh” MAC result.
Nonce
Alice Bob
Hash
Nonce
B4FE64
B4FE64 K A-B
Performs same
hash with KA-B
and compares
results
Symmetric Key: Authentication
A “Nonce”
A random bitstring used only once. Alice sends nonce to
Bob as a “challenge”. Bob Replies with “fresh” MAC result.
Nonce ?!?!
Alice
Mallory
If Alice sends Mallory a nonce,
she cannot compute the
corresponding MAC without K A-B
Symmetric Key Crypto Review
Confidentiality: Stream & Block Ciphers
Integrity: HMAC
Authentication: HMAC and Nonce
Questions??
Are we done? Not Really:
1)Number of keys scales as O(n2)
2)How to securely share keys in the first
place?
Asymmetric Key Crypto:
Instead of shared keys, each person has a
“key pair”
KB Bob’s public key
Bob’s private
K B
-1
key
The keys are inverses, so: KB-1 (KB (m)) = m
Asymmetric/Public Key Crypto:
Given a key k and a message m
Two functions: Encryption (E), decryption (D)
ciphertext c = E(KB, m)
plaintext m = D(KB-1 , c)
Encryption and decryption use different keys!
Hello,Bob
“secure” channel
Alice Bob.com
Knows KB Knows KB, KB-1
But how does Alice know that KB means “Bob”?
33
Asymmetric Key Crypto:
It is believed to be computationally
unfeasible to derive KB-1 from KB or to
find any way to get M from KB(M) other
than using KB-1 .
KB can safely be made public.
Note: We will not detail the computation that KB(m) entails,
but rather treat these functions as black boxes with the
desired properties. (more details in the book).
Asymmetric Key: Confidentiality
KB Bob’s public key
KB-1 Bob’s private key
encryption ciphertext decryption plaintext message
algorithm algorithm
KB (m) m = KB-1 (KB (m))
Asymmetric Key: Sign & Verify
If we are given a message M, and a
value S such that KB(S) = M, what can
we conclude?
The message must be from Bob, because it
must be the case that S = KB-1(M), and only
Bob has KB-1 !
This gives us two primitives:
Sign (M) = KB-1(M) = Signature S
Verify (S, M) = test( KB(S) == M )
Asymmetric Key: Integrity &
Authentication
We can use Sign() and Verify() in a similar
manner as our HMAC in symmetric schemes.
S = Sign(M) Message M
Integrity:
Receiver must only check Verify(M, S)
Nonce
Authentication:
S = Sign(Nonce)
Verify(Nonce, S)
Asymmetric Key Review:
Confidentiality: Encrypt with Public Key of
Receiver
Integrity: Sign message with private key of
the sender
Authentication: Entity being authenticated
signs a nonce with private key, signature is
then verified with the public key
But, these operations are computationally
expensive*
The Great Divide
Symmetric Crypto: Asymmetric
(Private key) Crypto:
Example: AES (Public key)
Example: RSA
Requires a pre-
shared secret Yes No
between
communicating
parties?
Overall speed of
cryptographic
operations
Fast Slow
Today's Lecture
Internet security weaknesses
Crypto 101
Key distribution (cover on Thursday)
40