lecture11-web security

Download Report

Transcript lecture11-web security

Web security
1
Applications
– Email
– electronic commerce
– electronic voting
– homework submission
– E-bank
– Paper submission
2
Security Requirments
 Authentication:
identifying someone (or
something) reliably. Proving you are who you
say you are.
 Authorization: permission to access a
resource.
 Integrity: data has not changed by someone
else.
 Confidentiality: data is only received by the
target
3
Terminology
 Encryption:
Scramble data so that only
someone with a secret can make sense of the
data.
 Decryption: Descrambling encrypted data.
 DES: Data Encryption Standard: secret key
cryptographic function standardized by NBS
(NIST).
 AES: Advanced Encryption Standard: recent
standard for symmetric cryptography
4
Terminology (cont.)
 Secret
Key Cryptography: a
cryptographic scheme where the same
key is used to encrypt and decrypt data.
Also called symmetric encryption.
 Public Key Cryptography: a
cryptographic scheme where different
keys are used for encryption and
decryption (asymmetric).
5
Terminology (more!)
 Firewall:
a network component that
separates two networks and (typically)
operates in the upper layers of the OSI
reference model (Application layer).
 Screening
Router: a discriminating
router that filters packets based on
network layer (and sometimes transport
layer) protocols and addresses.
6
Attack types
 DoS
(denial of service): attempting to
disrupt or deny a useful service.
 Eavesdropping: interception of a thirdparty (malicious) host
 Modification: changing data
 Fabrication: producing data on behalf of
another person.
7
Historical Ciphers
 Caesar
cipher
8
Data Encryption Standard
(DES)
 Designed
at IBM in 1975
– Changes suggested by the NSA

Standardized by NIST in 1977
– Official cipher for civilian cryptography
– Reviewed by the NSA
– Used by CIA

Combines substitutions and permutations
– Operates on bits
9
Feistel Network
 Iterative
structure
 Efficient hardware
implementation
 Non-linear element F
provides security
 Multiple rounds
provide mixing
(diffusion) between
the two halves
10
The AES Cipher - Rijndael
 designed
 has
 an
by Rijmen-Daemen in Belgium
128/192/256 bit keys, 128 bit data
iterative cipher
– treats data in 4 groups of 4 bytes
– expands 128-bit key to 4 groups of 4 bytes
(larger keys are expanded to more groups)
– operates an entire block in every round
– round number dependent on key size
 designed
to be:
– resistant against known attacks
– speed and code compactness on many CPUs
– design simplicity
11
RSA
by
Rivest, Shamir & Adleman of MIT in 1977
best
known & widely used public-key scheme
based
on exponentiation in a finite field over
integers modulo a prime
– exponentiation takes O((log n)3) operations (easy)
uses
large integers (eg. 1024 bits)
security
due to cost of factoring large numbers
12
RSA Key Setup
Generation of a public/private key pair:
• select two large primes at random: p, q
• compute the system modulus n = p·q
• select at random the encryption key e
–
(n)=(p-1)(q-1)
–
where 1<e<(n), gcd(e,(n))=1
• solve following equation to find decryption key d :
e·d=1 mod (n) and 0≤d≤n
• public encryption key: KU={e,n}
• private decryption key: KR={d,n}
13
RSA Example
1.
Select primes: p=17 & q=11
2.
Compute n = pq =17×11=187
3.
Compute (n)=(p–1)(q-1)=16×10=160
4.
Select e : gcd(e,160)=1; choose e=7
5.
Determine d: de=1 mod 160 and d < 160
Value is d=23 since 23×7=161= 10×160+1
6.
Public key KU={7,187}
7.
Private key KR={23,187}
14
RSA Use
to encrypt a message M the sender:
– obtains public key of recipient KU={e,n}
– computes: C=Me mod n, where 0≤M<n
to decrypt the ciphertext C
– uses the private key KR={d,n}
– computes: M=Cd mod n
the owner:
note
that the message M must be smaller
than the modulus n
15
RSA Example cont’d
 sample
 given
RSA encryption/decryption is:
message M = 88 (88<187)
 encryption:
C = 887 mod 187 = 11
 decryption:
M = 1123 mod 187 = 88
16
Public Key Cryptography
(a.k.a. asymmetric cryptography)
• Each entity has 2 keys:
– private key (a secret)
– public key (well known).
17
Using Keys
• Private keys are used for decrypting.
• Public keys are used for encrypting.
plaintext
encryption
ciphertext
public key
ciphertext
decryption
plaintext
private key
18
Digital Signature
• Public key cryptography is also used to
provide digital signatures.
plaintext
signing
signed message
private key
signed message
verification
plaintext
public key
19
Transmitting over an insecure
channel.
Alice wants to send Bob a private message.
Apublic is Alice’s public key.
Aprivate is Alice’s private key.
Bpublic is Bob’s public key.
Bprivate is Bob’s private key.
20
Hello Bob,
Wanna get together?
Alice
Bob
encrypt using Bpublic
decrypt using Bprivate
21
OK Alice,
Your place or mine?
Alice
Bob
decrypt using Aprivate
encrypt using Apublic
22
Bob’s Dilemma
• Nobody can read the message from
•
Alice, but anyone could produce it.
How does Bob know that the message
was really sent from Alice?
• Bob may be comforted to know that only
Alice can read his reply.
23
Alice can sign her message!
• Alice can create a digital signature and
•
prove she sent the message (or
someone with knowledge of her private
key).
The signature can be a message digest
encrypted with Aprivate.
24
Revised Scheme
Alice
Sign with Aprivate
encrypt using Bpublic
Bob
check signature using Apublic
decrypt using Bprivate
25
Another possible problem
•
Suppose Bill receives a message from Alice
including a digital signature.
“meet me at the library tonight”
•
Bill sends the same message to Joe so that it
looks like the message came from Alice.
Bill includes the digital signature from the
message Alice sent to him.
Joe is convinced Alice sent the message!
•
•
26
Solution?
• Always start your messages with:
– Dear Bill,
• Create a digest from the encrypted
message and sign that digest.
• There are many other schemes as well.
27
Authentication
28
Authentication
29
Secure Protocols
• Many application protocols include the
use of cryptography as part of the
application level protocol.
– The cryptographic scheme employed is
part of the protocol.
– If stronger cryptographic tools become
available we need to change the protocol.
30
SSL and TLS
• Secure Sockets Layer (SSL) is a
different approach - a new layer is
added that provides a secure channel
over a TCP only link.
• TLS is Transport Layer Security (IETF
standard based on SSL).
31
SSL layer
Application
SSL
TCP
IP
Application
SSL
TCP
IP
32
Advantages of SSL/TLS
• Independent of application layer
• Includes support for negotiated
encryption techniques.
– easy to add new techniques.
• Possible to switch encryption algorithms
in the middle of a session.
33
HTTPS Usage
• HTTPS is HTTP running over SSL.
– used for most secure web transactions.
– HTTPS server usually runs on port 443.
– Include notion of verification of server via a
certificate.
– Central trusted source of certificates.
34