Lehrstuhl für Netzarchitekturen und Netzdienste
Institut für Informatik Technische Universität München
ilab Lab 7 Basics of Cryptography / Security I Testate 2 nd Half - - PowerPoint PPT Presentation
Lehrstuhl fr Netzarchitekturen und Netzdienste Institut fr Informatik Technische Universitt Mnchen ilab Lab 7 Basics of Cryptography / Security I Testate 2 nd Half of Term This lecture is divided into two halves: Basics of
Lehrstuhl für Netzarchitekturen und Netzdienste
Institut für Informatik Technische Universität München
Internetpraktikum 2
This lecture is divided into two halves:
Basics of Cryptography
Security I
The understanding of “Basics of Cryptography” is mandatory for
all oral exams in this half of the term.
You can either:
Do an oral exam exclusively about this lecture. Do another oral exam. Here we do not ask questions about “BoC” but assume that you have the good understanding of cryptography.
Lehrstuhl für Netzarchitekturen und Netzdienste
Institut für Informatik Technische Universität München
The following slides are relevant for all second oral exams about Labs 6 – 10.
Internetpraktikum 4
Confidentiality (“Vertraulichkeit”)
It should be impossible, that an attacker is able to eavesdrop (and understand) data sent
Integrity (“Integrität”)
It should be impossible that modifications to data remain undetected
Authenticity (“Authentizität”)
… of data: It should be possible to identify the sender of the data … of the communication partner: It should be possible to identify the communication partner
Non-repudiation (“Nicht Abstreitbarkeit”)
It should be impossible, that the sender of a message repudiates that she has sent the message
Internetpraktikum 5
Passive Attacks Passive Attacks Active Attacks Active Attacks
Eavesdropping of data sent/ user accounts Faked identities Traffic Analysis Replay/delay of messages Insertion/deletion of messages Denial of service Modification of messages
Passive (Eavesdropping) Active (Modification) Alice Bob
Internetpraktikum 6
Symmetric Cryptograpy
All communication instances
share the same symmetric key
Pros:
Cons:
second channel)
the same key)
Asymmetric (public key) Cryptography
Everybody has a key pair
(public/private key)
Pros:
made public
Cons:
Lehrstuhl für Netzarchitekturen und Netzdienste
Institut für Informatik Technische Universität München
Internetpraktikum 8
Alice and Bob exchanged a shared symmetric key k over a secure
channel
Alice encrypts the message using k and some algorithm and sends the
ciphertext to Bob.
Bob decrypts the ciphertext using k and the same algorithm Alice Bob
Message
Encryption
Ciphertext
Alice
Message
Decryption
Ciphertext
Bob
Internetpraktikum 9
Data Encryption Standard (DES)
Developed in the seventies by IBM and NSA. Was official US encryption standard. Block length 64 Bit Key length 56 Bit No working attacks known except brute force
Slow
3DES – Triple DES
DES is applied three times with different keys. Usually:
Still safe Triple slow
Internetpraktikum 10
DES is not safe anymore, 3DES is too slow, so a successor is needed NIST started a tendering procedure, lot‘s of candidates After 5 years the Rijndael-Cipher was chosen to be the AES Properties of AES (Rijndael):
Block cipher, Block size 128, 192 or 256 Bit Key length 128, 192 or 256 Bit Very efficient Safe
future
Internetpraktikum 11
1
XOR
1 2
XOR
2 3
XOR
3 1 IV CBC-Modus:
IV: Initialization vector Plaintext block Cyphertext block
Many symmetric crypto algorithms work on blocks of e.g. 128 bit length Electronic Codebook (ECB)
Blockwise encryption “Same input, same output” (critical with padding) As blocks do not depend on each
exchange/delete/repeat blocks
Cipher Block Chaining (CBC)
Blocks depend on each other
Other modes:
Output feedback mode, Cipher feedback mode, …
Internetpraktikum 12
Stream ciphers XORs
a data stream with a generated key stream
The major problem is the generation of a non predictable (and
endless) keystream with a short key as seed
If the key stream is predictable, the cipher is weak Stream ciphers are based on pseudo random number generators
Stream ciphers often are used close to hardware, e.g. inside mobile
phones or WLAN (RC4)
Lehrstuhl für Netzarchitekturen und Netzdienste
Institut für Informatik Technische Universität München
Internetpraktikum 14
Alice Bob
Message
Encryption
Ciphertext
Alice
Message
Decryption
Ciphertext
Bob
Internetpraktikum 15
ciphertext
signature
Message
Encryption
„Signed“ Message
Bob
Message
Decryption
„Signed“ Message
Alice
Internetpraktikum 16
Developed 1977 by Ronald Rivest, Adi Shamir and Leonard Adleman.
Public Key: N, e
Private Key: N, d
Security of RSA is closely related to the prime factorization problem:
N (and e) is publicly known. N can not be factorized to p and q efficiently (=quickly). If one had p and q, he could easily can compute d the valued
Internetpraktikum 17
Asymmetric Encryption algorithms are some magnitudes slower than
symmetric algorithms
The currently smallest key length still regarded as safe is 1024 bit Used in real life: hybrid encryption systems
Step one: User authentication and exchange of a symmetric session key using public key cryptography Step two: Encryption of data using the symmetric session key
09.11.2005: RSA-640 broken A workgroup at the BSI has solved the “RSA-640 Challenge” using the “General Number Field Sieve (GNFS) method. The researchers used for the factorization of both 320 bit long prime factors of a 193 digit long number about 5 months of computational time on a 80 dual-core 2,2ghz Opteron cluster. Source: http://www.heise.de/newsticker/meldung/65957
Lehrstuhl für Netzarchitekturen und Netzdienste
Institut für Informatik Technische Universität München
Internetpraktikum 19
Hash Functions map an input of arbitrary length to a value inside a
hash space
Size of this hash space: e.g. 160bit
This value is referred to as Hash Value (“fingerprint”)
Message (arbitrary length)
Hash function 00 00 … FF FF … 8f 7d 35 ..
Internetpraktikum 20
A cryptographic hash function needs to be collision resistant It must be practically infeasible to generate a collision:
m1, m2 with H(m1) = H(m2) with m1 != m2
Note: As hash functions map a long string to a short one it is not
possible to avoid collisions
Message 1 (arbitrary length) Same Hash Value Message 2 (arbitrary length)
Internetpraktikum 21
MD5
Must be considered broken
SHA-1 (160 bit)
Currently often used as “default hash function” Not broken yet, but significant advancements in cryptoanalysis of SHA-1 In future, SHA-1 needs to be replaced, NIST recommends to use SHA-1 with more output bits, e.g. SHA-256
Currently NIST started a tendering procedure for finding a SHA-1
successor
Internetpraktikum 22
CRC32 is not a cryptographic hash function
Internetpraktikum 23
Digital signatures combine cryptographic hash functions with
asymmetric cryptography (e.g. RSA).
Message Hash
Hash funct. Private Key
Signature
Message + Signature gets send
Message Hash
Hash funct. Public Key
Signature Hash
Check if equal
Internetpraktikum 24
signature “attached”
messages, too
Internetpraktikum 25
(also referred to as “Message Authentication Code” ( MAC)) Goal: Provide integrity and authenticity of messages without expensive
asymmetric cryptography
Idea: The hash value also depends on a shared symmetric key Pro:
fast (no asymmetric crypto used)
Con:
both communication partners need to share the same key
Internetpraktikum 26
Sender: Message + Hash will be sent Receiver: An attacker is able to modify the message but he cannot compute the
correspondent hash value because he does not know the key used.
Message (abitrary length)
MAC
160 Bit MAC Message (arbitrary length)
MAC
160 Bit MAC
Received 160 Bit MAC
Check if equal
Lehrstuhl für Netzarchitekturen und Netzdienste
Institut für Informatik Technische Universität München
Internetpraktikum 28
Public-key cryptography makes only sense, if we can make sure that a
certain public key really belongs to a certain entity.
Approaches:
“Do-it-yourself”
Use a Certificate Authority (CA)
certain entity
Use a Web-of-Trust
Internetpraktikum 29
Need to be trusted by all communication partners (“Trusted Third
Party”)
The CA also owns a private and public key
The public key is publicly well known, e.g. they are often included in web browsers, mail clients, etc. The private key is used for signing the Certificate.
CA issues Certificates that can be used to verify the communication
partner’s identity
CA
Internetpraktikum 30
Information signed by a CA that maps a public key to some entity
name (e.g. a person or a web server)
Contains at least
Public Key Name of the entity Duration of validity Information about the CA that signed the certificate Signature
Internetpraktikum 31
Bob owns an asymmetric key pair He sends his public key to the CA over a secure channel Additionally he needs to send some proof of identity, e.g. his ID card
This first step is not technical… This first step is essential for the quality and credibility of the certificate
I am Bob. Really!
Internetpraktikum 32
The CA creates the certificate: Finally the CA signs the Certificate with its private key. Finally, the certificate is sent to Bob Certificate Owner: Bob Example, Example Street 123, 12345 Exampletown Owner‘s Public Key: AEF75309CC9643AC896437FF Issuer: Example CA Valid till: 31.12.2011 Revocationlist URL: http://exampleca.com/revocationlist Certificate Owner: Bob Example, Example Street 123, 12345 Exampletown Owner‘s Public Key: AEF75309CC9643AC896437FF Issuer: Example CA Valid till: 31.12.2011 Revocationlist URL: http://exampleca.com/revocationlist Signature of Example CA
Internetpraktikum 33
Situations exist, when certificates need to be made invalid:
If Bob‘s private key is stolen („compromised“). If somebody managed to receive a certificate for an identity she doesn‘t have (a valid certificate for a fake identity).
This process is called revocation For this purpose, the CA publishes a list of revoked certificates,
Internetpraktikum 34
Alice wants to send a message to Bob. For making sure that she really
talks to Bob, she requests Bob‘s certificate
Bob Alice Bobs Certificate
Internetpraktikum 35
Alice now checks the following
Name of the CA and if the CA is „trustworthy“ The „owner field“ matches with the name of the person she wants to talk to The validity of the certificate Validity of the signature for this step, Alice needs the public key of the CA
Alice checks the revocation list and tests, if the certificate is revoked (marked as invalid)
If all steps are ok, the certificate is valid!
Internetpraktikum 36
Bobs Certificate
After verification, Alice takes Bob‘s public key out of the certificate,
and uses the public key to encrypt the message for Bob
Only Bob has the corresponding key for decrypting the message
Message
Encryption Encrypted Message
Message
Decryption
Encrypted Message
Alice Bob
Internetpraktikum 37
Major problem: user‘s do not understand what certificates are. A study of Carnegie Mellon University from 2009 showed that users
are more likely to ignore „technical“ error messages related to well known and „trustworthy“ pages than for sites they do not know this is a big mistake!
Source: Peter Gutmann
Internetpraktikum 38
Who decides which CA is „trustworthy“? Who decides which CA certificate is part of the webbrowser or mail
client?
Who controls the behavior of CAs and removes them from the list of
trusted CAs?
Conclusion:
CA’s are a good thing. But never forget: CA’s are not inerrable!
Alternative:
Web-of-Trust
Internetpraktikum 39
Instead of having one notary, multiple people vouch for the legitimacy
I.e. they sign the public key using their private key. Public key and signatures are made public on keyservers
Example:
Alice signs Bob‘s public key Trudy signs Bob‘s public key Tom already has Alice‘s and Trudy‘s public key Tom trusts Alice and Trudy Tom can use Alice‘s and Trudy‘s public key to validate the signatures for Bob‘s key Tom can be confident to trust into Bob‘s key
Internetpraktikum 40
Internetpraktikum 41
Lehrstuhl für Netzarchitekturen und Netzdienste
Institut für Informatik Technische Universität München
Internetpraktikum 43
Access control
Authenticate a user and determine if she is allowed to use a service
Firewalls
Filter traffic between two networks due to a certain policy
(Intrusion detection)
Monitor traffic and try to find anomalies that are caused by an attacker
…
Internetpraktikum 44
Can be done on different layers: On Network Layer (e.g. WLAN Access Control)
802.1x (“port-based Network Access Control)
the network or not
On Network/Transport layer
Firewalls, e.g. only grant access to the server from a specific IP
On Application Level: Access Rules
Access control lists, e.g. Linux/NT file system, AFS, etc. Policy sets / Policy languages for more complex scenarios
Internetpraktikum 45
Firewalls never are only „hardware and software“ but always a whole
security concept
Packet filters filter messages according to source/destination address + Ports (TCP/UDP) Ingress/egress filtering Application Layer Gateways (Access Control, Logging) Often network address translation (NAT) used Outer Perimeter Inner Perimeter
Internet
Servers
Intranet „Demilitarized Zone“
Internetpraktikum 46
Strategies:
Default-Deny
Default-Permit
Internetpraktikum 47
Firewalls operate on different layers of the ISO/OSI model Layer 2
Filter MAC addresses E.g. only MAC addresses may send packets, that are „known“
Layer 3
Filter IP addresses E.g. only allows traffic from a certain address space
Layer 4
Filter ports E.g. only allows traffic from a certain application
Application Layer Proxy
„Understands“ payload in packets They scan for viruses, check on content (text, pictures), www addresses, etc.
Internetpraktikum 48
Analysis of incoming/outgoing packets (Packet Filtering)
– incoming deny *.*.*.*, 23 blocks port 23 (telnet) – outgoing permit 129.13.*.*, 80 allows http only for IP=129.13.x.y
Network Address Translation (NAT)
Proxy Services
Internetpraktikum 49
Consists of a machine that filters packets E.g.:
A standard computer (e.g. Linux PC) routing and filtering software A dedicated router with filtering software
Filters according to protocol, IP/Ports, TCP flags
Firewall
Internet
Packet Filtering Router
The Simple Packet Filter Architecture
Denied Traffic Permitted Traffic
Internetpraktikum 50
Dual-Homed-Host offers:
Proxy-Services Packet Filtering
Bastion Host = publically reachable within the internet Cons
All traffic flows through the Bastion Host. The Bastion Host can be a bottle neck
The Dual-Homed Host Architecture Firewall
Internet
Dual-Homed Bastion Host
Internetpraktikum 51
(Internet, Intranet)
e.g. Webserver
The Screened Subnet Architecture Firewall
Internet
Bastion Host Demilitarized Zone (DMZ)
Both packet filters can be realized within
does not need to flow through the DMZ. Also known as Triple-Homed FW.
Internet
DMZ